mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
block: add a sb_bdev_nr_blocks helper
Add a helper to return the size of sb->s_bdev in sb->s_blocksize_bits based unites. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Link: https://lore.kernel.org/r/20211018101130.1838532-26-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
2a93ad8fcb
commit
bcc6e2cfaa
1 changed files with 6 additions and 0 deletions
|
@ -251,6 +251,12 @@ static inline sector_t get_capacity(struct gendisk *disk)
|
||||||
return bdev_nr_sectors(disk->part0);
|
return bdev_nr_sectors(disk->part0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline u64 sb_bdev_nr_blocks(struct super_block *sb)
|
||||||
|
{
|
||||||
|
return bdev_nr_sectors(sb->s_bdev) >>
|
||||||
|
(sb->s_blocksize_bits - SECTOR_SHIFT);
|
||||||
|
}
|
||||||
|
|
||||||
int bdev_disk_changed(struct gendisk *disk, bool invalidate);
|
int bdev_disk_changed(struct gendisk *disk, bool invalidate);
|
||||||
void blk_drop_partitions(struct gendisk *disk);
|
void blk_drop_partitions(struct gendisk *disk);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue