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. 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 | 11 +++++++++-- include/linux/blkdev.h | 8 ++++++++ 4 files changed, 21 insertions(+), 18 deletions(-) -- 2.11.0