public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Damien Le Moal <damien.lemoal@wdc.com>, linux-block@vger.kernel.org
Cc: Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v3] block: Fix __blkdev_issue_zeroout loop
Date: Thu, 6 Jul 2017 09:48:52 -0600	[thread overview]
Message-ID: <f0c6a1ea-8396-b65b-c88f-9785edf57550@kernel.dk> (raw)
In-Reply-To: <20170706112115.616-1-damien.lemoal@wdc.com>

On 07/06/2017 05:21 AM, 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 requested number of bvecs will always be limited
> to the absolute maximum number supported (BIO_MAX_PAGES), but this is
> ineficient as too many bvec entries may be requested due to the
> different units being used in the min() operation (number of sectors vs
> number of pages).
> To fix this, introduce the helper __blkdev_sectors_to_bio_pages() to
> correctly calculate the number of bvecs for zeroout BIOs as the issuing
> loop progresses. The calculation is done using consistent units and
> makes sure that the number of pages return 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.

Thanks, added for 4.13.

-- 
Jens Axboe

      parent reply	other threads:[~2017-07-06 15:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06 11:21 [PATCH v3] block: Fix __blkdev_issue_zeroout loop Damien Le Moal
2017-07-06 15:28 ` Christoph Hellwig
2017-07-06 15:48 ` Jens Axboe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f0c6a1ea-8396-b65b-c88f-9785edf57550@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=damien.lemoal@wdc.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox