Linux block layer
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Keith Busch <kbusch@kernel.org>,
	Coly Li <colyli@suse.de>,
	linux-bcache@vger.kernel.org
Subject: Re: [PATCH V2] block: optimize for small BS IO
Date: Tue, 29 Oct 2019 00:27:45 -0700	[thread overview]
Message-ID: <20191029072745.GA4521@infradead.org> (raw)
In-Reply-To: <20191029070621.1307-1-ming.lei@redhat.com>

On Tue, Oct 29, 2019 at 03:06:21PM +0800, Ming Lei wrote:
> __blk_queue_split() may be a bit heavy for small BS(such as 512B, or

Maybe spell out block size.  BS has another much less nice connotation.

> bch_bio_map() should be the only one which doesn't use bio_add_page(),
> so force to mark bio built via bch_bio_map() as MULTI_PAGE.

We really need to fix that up.  I had patches back in the day which
Kent didn't particularly like for non-technical reason, that might serve
as a starting point.

> @@ -789,6 +794,10 @@ void __bio_add_page(struct bio *bio, struct page *page,
>  	bio->bi_iter.bi_size += len;
>  	bio->bi_vcnt++;
>  
> +	if (!bio_flagged(bio, BIO_MULTI_PAGE) && (bio->bi_vcnt >= 2 ||
> +				(bio->bi_vcnt == 1 && len > PAGE_SIZE)))
> +		bio_set_flag(bio, BIO_MULTI_PAGE);

This looks pretty ugly and does more (and more confusing) checks than
actually needed Maybe we need a little bio_is_multi_page helper to clean
this up a bit:

/*
 * Check if the bio contains more than a page and thus needs special
 * treatment in the bio splitting code.
 */
static inline bool bio_is_multi_page(struct bio *bio)
{
	return bio->bi_vcnt > 1 || bio->bi_io_vec[0].bv_len > PAGE_SIZE;
}

and then this becomes:

	if (!bio_flagged(bio, BIO_MULTI_PAGE) && bio_is_multi_page(bio))

Then again these checks are so cheap that we can just use the
bio_is_multi_page helper directly and skip the flag entirely.

  reply	other threads:[~2019-10-29  7:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-29  7:06 [PATCH V2] block: optimize for small BS IO Ming Lei
2019-10-29  7:27 ` Christoph Hellwig [this message]
2019-10-29 10:13   ` Ming Lei

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=20191029072745.GA4521@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=colyli@suse.de \
    --cc=kbusch@kernel.org \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /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