mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 13:40:54 +07:00
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>
This commit is contained in:
parent
de65d2d26f
commit
5fdb7e1b97
@ -589,8 +589,7 @@ static int null_add_dev(void)
|
|||||||
blk_queue_physical_block_size(nullb->q, bs);
|
blk_queue_physical_block_size(nullb->q, bs);
|
||||||
|
|
||||||
size = gb * 1024 * 1024 * 1024ULL;
|
size = gb * 1024 * 1024 * 1024ULL;
|
||||||
sector_div(size, bs);
|
set_capacity(disk, size >> 9);
|
||||||
set_capacity(disk, size);
|
|
||||||
|
|
||||||
disk->flags |= GENHD_FL_EXT_DEVT | GENHD_FL_SUPPRESS_PARTITION_INFO;
|
disk->flags |= GENHD_FL_EXT_DEVT | GENHD_FL_SUPPRESS_PARTITION_INFO;
|
||||||
disk->major = null_major;
|
disk->major = null_major;
|
||||||
|
Loading…
Reference in New Issue
Block a user