All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Damien Le Moal <damien.lemoal@wdc.com>
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v2] block: Fix __blkdev_issue_zeroout loop
Date: Wed, 5 Jul 2017 19:26:16 +0200	[thread overview]
Message-ID: <20170705172616.GA5417@lst.de> (raw)
In-Reply-To: <20170704082702.15727-1-damien.lemoal@wdc.com>

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	other threads:[~2017-07-05 17:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-04  8:27 [PATCH v2] block: Fix __blkdev_issue_zeroout loop Damien Le Moal
2017-07-05 17:26 ` Christoph Hellwig [this message]
2017-07-05 23:50   ` Damien Le Moal

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=20170705172616.GA5417@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@wdc.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.