Re: [PATCH 1/8] block: add a helper function to read nr_setcs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/13/2019 08:31 AM, Bart Van Assche wrote:
> On 6/13/19 7:59 AM, 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().
>>
>> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx>
>> ---
>>    include/linux/blkdev.h | 12 ++++++++++++
>>    1 file changed, 12 insertions(+)
>>
>> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
>> index 592669bcc536..1ae65107182a 100644
>> --- a/include/linux/blkdev.h
>> +++ b/include/linux/blkdev.h
>> @@ -1475,6 +1475,18 @@ 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)
>> +{
>> +	sector_t nr_sects;
>> +
>> +	rcu_read_lock();
>> +	nr_sects = part_nr_sects_read(bdev->bd_part);
>> +	rcu_read_unlock();
>> +
>> +	return nr_sects;
>> +}
>> +
>>    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);
>>
>
> Please explain what makes you think that part_nr_sects_read() must be
> protected by an RCU read lock.

Thanks Bart for looking into this, we actually don't need those locking.

I'll fix this in the V2.

Please let me know if you find any other issues with this series.

>
> Thanks,
>
> Bart.
>





[Index of Archives]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux