block size vs bvec length

Michele Sorcinelli michelesr at
Sun Apr 5 19:53:54 EDT 2020

On 4/6/20 12:35 AM, Valdis Klētnieks wrote:
> What is the actual device backing this block device?

There's no real device behind the driver: it's just writing the data on the
> That's called a read-modify-write (RMW) cycle, and is used when a write request
> isn't exactly one physical block long, and it happens for file devices as well,
> it's just hidden by the file system layer.

I understand this, but I don't understand why it's using 4096 as unit rather
than 512 that is the logical (and physical) block size I set for the queue
using blk_queue_logical_block_size(). What's the relation between actual block
size and the size of a segment (the bv_len field of the bio_vec struct) ?

Is it related somehow to the page size? Does a segment need to be at least long
as the page size? For example I've noticed that blk_queue_max_segment_size()
will set the max segment size to PAGE_SIZE if the given size it's < PAGE_SIZE.

More information about the Kernelnewbies mailing list