Re: [PATCH v2] block: Fix __blkdev_issue_zeroout loop
From: Damien Le Moal <hidden>
Date: 2017-07-05 23:50:42
On 7/6/17 02:26, Christoph Hellwig wrote:
On Tue, Jul 04, 2017 at 05:27:02PM +0900, Damien Le Moal wrote:quoted
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