null_blk: fix wrong capacity when bs is not 512 bytes

set_capacity() sets device's capacity using 512 bytes sectors.
null_blk calculates the number of sectors by size / bs, which
set_capacity is called with. This led to null_blk exposing the
wrong number of sectors when bs is not 512 bytes.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>

authored by Matias Bjørling and committed by Jens Axboe 5fdb7e1b de65d2d2

+1 -2
+1 -2
drivers/block/null_blk.c
··· 589 blk_queue_physical_block_size(nullb->q, bs); 590 591 size = gb * 1024 * 1024 * 1024ULL; 592 - sector_div(size, bs); 593 - set_capacity(disk, size); 594 595 disk->flags |= GENHD_FL_EXT_DEVT | GENHD_FL_SUPPRESS_PARTITION_INFO; 596 disk->major = null_major;
··· 589 blk_queue_physical_block_size(nullb->q, bs); 590 591 size = gb * 1024 * 1024 * 1024ULL; 592 + set_capacity(disk, size >> 9); 593 594 disk->flags |= GENHD_FL_EXT_DEVT | GENHD_FL_SUPPRESS_PARTITION_INFO; 595 disk->major = null_major;