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?

Reply via email to