block size vs bvec length

Michele Sorcinelli michelesr at
Sun Apr 5 14:17:39 EDT 2020

I created a simple block device driver with a logical queue block size of 512 bytes.

$ cat /sys/block/myblock/queue/physical_block_size
$ cat /sys/block/myblock/queue/logical_block_size

I used rq_for_each_segment() to print bvec.bv_len of the segments and it
appears to be 4096.

Why is it 4096 rather than 512?

Also writing a block of 4096 bytes with dd to /dev/myblock will result in a
single write request, while writing a block of 512 bytes will result in a read
request followed by a write request.

Can someone explain this behavior?


More information about the Kernelnewbies mailing list