[PATCH v3 0/4] Add blk_validate_block_size() helper for drivers to validate block size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The block layer can't support the block size larger than
page size yet, so driver needs to validate the block size
before setting it. Now this validation is done in device drivers
with some duplicated codes. This series tries to add a block
layer helper for it and makes loop driver, nbd driver and
virtio-blk driver use it.

We tested both invalid block size and valid block size cases
for loop driver with the example in man page [1] and for
nbd and virtio-blk driver with qemu-nbd and storage-daemon (vduse)
in the qemu repo [2].

[1] https://man7.org/linux/man-pages/man4/loop.4.html
[2] https://github.com/bytedance/qemu/tree/vduse

V2 to V3:
- Fix some commit logs and print message

V1 to V2:
- Return and print error if validation fails in virtio-blk driver

Xie Yongji (4):
  block: Add a helper to validate the block size
  nbd: Use blk_validate_block_size() to validate block size
  loop: Use blk_validate_block_size() to validate block size
  virtio-blk: Use blk_validate_block_size() to validate block size

 drivers/block/loop.c       | 17 ++---------------
 drivers/block/nbd.c        |  3 ++-
 drivers/block/virtio_blk.c | 12 ++++++++++--
 include/linux/blkdev.h     |  8 ++++++++
 4 files changed, 22 insertions(+), 18 deletions(-)

-- 
2.11.0




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux