Re: [PATCH v2] block: Fix __blkdev_issue_zeroout loop

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

 




On 7/6/17 02:26, Christoph Hellwig wrote:
> On Tue, Jul 04, 2017 at 05:27:02PM +0900, Damien Le Moal wrote:
>> The BIO issuing loop in __blkdev_issue_zeroout() is allocating BIOs
>> with a maximum number of bvec (pages) equal to
>>
>> min(nr_sects, (sector_t)BIO_MAX_PAGES)
>>
>> This works since the BIO will always be limited to the absolute maximum
>> number of pages but this is ineficient as too many bvec entries may be
>> requested since different units (number of sectors vs number of pages)
>> are used in the min() operation. Fix this by correctly using the same
>> unit (number of pages), making sure that this number is at least 1 for
>> cases where the number of sectors is less that the number of sectors in
>> a page.
>>
>> Also remove a trailing space after the bit shift in the internal loop
>> min() call.
> 
> Can you move the nr sectors calculation into a helper and add some
> comments?

Sure, no problem. I will send a v3 today.

-- 
Damien Le Moal,
Western Digital



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux