Message ID | 20190702174236.3332-2-chaitanya.kulkarni@wdc.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | block: use right accessor to read nr_sects | expand |
On 19-07-02 10:42:27, 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(). Without bd_mutex locked, this helper seems useful to have. Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
On 7/2/19 10:42 AM, Chaitanya Kulkarni wrote: > +/* Helper function to read the bdev->bd_part->nr_sects */ > +static inline sector_t bdev_nr_sects(struct block_device *bdev) > +{ > + return part_nr_sects_read(bdev->bd_part); > +} Is the comment above bdev_nr_sects() really useful or should it be left out? Thanks, Bart.
On 7/3/19 8:03 AM, Bart Van Assche wrote: +} Is the comment above bdev_nr_sects() really useful or should it be left out? Thanks, Bart. Sure, let me send V4 without the comment.
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 592669bcc536..be7ee5a0b0dd 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1475,6 +1475,12 @@ static inline void put_dev_sector(Sector p) put_page(p.v); } +/* Helper function to read the bdev->bd_part->nr_sects */ +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);
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(). Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> --- include/linux/blkdev.h | 6 ++++++ 1 file changed, 6 insertions(+)