[Drbd-dev] don't use ->bd_inode to access the block device size v3
Kari Argillander
kari.argillander at gmail.com
Tue Oct 19 03:04:16 CEST 2021
On Mon, Oct 18, 2021 at 11:53:08AM -0600, Jens Axboe wrote:
snip..
> diff --git a/include/linux/genhd.h b/include/linux/genhd.h
> index 7b0326661a1e..a967b3fb3c71 100644
> --- a/include/linux/genhd.h
> +++ b/include/linux/genhd.h
> @@ -236,14 +236,14 @@ static inline sector_t get_start_sect(struct block_device *bdev)
> return bdev->bd_start_sect;
> }
>
> -static inline loff_t bdev_nr_bytes(struct block_device *bdev)
> +static inline sector_t bdev_nr_sectors(struct block_device *bdev)
> {
> - return i_size_read(bdev->bd_inode);
> + return bdev->bd_nr_sectors;
> }
>
> -static inline sector_t bdev_nr_sectors(struct block_device *bdev)
> +static inline loff_t bdev_nr_bytes(struct block_device *bdev)
> {
> - return bdev_nr_bytes(bdev) >> SECTOR_SHIFT;
> + return bdev_nr_setors(bdev) << SECTOR_SHIFT;
setors -> sectors
> }
>
> static inline sector_t get_capacity(struct gendisk *disk)
>
> --
> Jens Axboe
>
More information about the drbd-dev
mailing list