Message ID | 20190821061423.3408-2-chaitanya.kulkarni@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block: use right accessor to read nr_sects | expand |
On 8/20/19 11:14 PM, Chaitanya Kulkarni wrote: > This patch introduces helper function to read the number of sectors > from struct block_device->bd_part member. For more details Please refer > to the comment in the include/linux/genhd.h for part_nr_sects_read(). > > Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com> > Reviewed-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> ^^^^^^^^^^ This looks weird.
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 4798bb25f1ee..aa5801c8ff73 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1468,6 +1468,11 @@ static inline void put_dev_sector(Sector p) put_page(p.v); } +static inline sector_t bdev_nr_sects(struct block_device *bdev) +{ + return part_nr_sects_read(bdev->bd_part); +} + int kblockd_schedule_work(struct work_struct *work); int kblockd_schedule_work_on(int cpu, struct work_struct *work); int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay);