dm: use bdev_nr_sectors and bdev_nr_bytes instead of open coding them
Use the proper helpers to read the block device size. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Mike Snitzer <snitzer@redhat.com> Link: https://lore.kernel.org/r/20211018101130.1838532-6-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
da7b392467
commit
6dcbb52cdd
@@ -2341,7 +2341,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
|
||||
ti->error = "Cache data device lookup failed";
|
||||
goto bad;
|
||||
}
|
||||
wc->memory_map_size = i_size_read(wc->ssd_dev->bdev->bd_inode);
|
||||
wc->memory_map_size = bdev_nr_bytes(wc->ssd_dev->bdev);
|
||||
|
||||
/*
|
||||
* Parse the cache block size
|
||||
|
||||
Reference in New Issue
Block a user