From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org,
Christoph Hellwig <hch@infradead.org>, Jan Kara <jack@suse.cz>,
Ritesh Harjani <riteshh@linux.ibm.com>,
Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH] iomap: Submit the BIO at the end of each extent
Date: Fri, 20 Mar 2020 08:50:20 -0700 [thread overview]
Message-ID: <20200320155020.GB6812@magnolia> (raw)
In-Reply-To: <20200320144014.3276-1-willy@infradead.org>
On Fri, Mar 20, 2020 at 07:40:14AM -0700, Matthew Wilcox wrote:
> From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
>
> By definition, an extent covers a range of consecutive blocks, so
> it would be quite rare to be able to just add pages to the BIO from
> a previous range. The only case we can think of is a mapped extent
> followed by a hole extent, followed by another mapped extent which has
> been allocated immediately after the first extent. We believe this to
> be an unlikely layout for a filesystem to choose and, since the queue
> is plugged, those two BIOs would be merged by the block layer.
>
> The reason we care is that ext2/ext4 choose to lay out blocks 0-11
> consecutively, followed by the indirect block, and we want to merge those
> two BIOs. If we don't submit the data BIO before asking the filesystem
> for the next extent, then the indirect BIO will be submitted first,
> and waited for, leading to inefficient I/O patterns. Buffer heads solve
> this with the BH_boundary flag, but iomap doesn't need that as long as
> we submit the bio here.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
> fs/iomap/buffered-io.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index f080f542911b..417115bfaf6b 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -420,6 +420,16 @@ iomap_readpages_actor(struct inode *inode, loff_t pos, loff_t length,
> ctx, iomap, srcmap);
> }
>
> + /*
> + * Submitting the bio here leads to better I/O patterns for
> + * filesystems which need to do metadata reads to find the
> + * next extent.
> + */
> + if (ctx->bio) {
> + submit_bio(ctx->bio);
> + ctx->bio = NULL;
> + }
> +
> return done;
> }
>
> @@ -449,8 +459,6 @@ iomap_readpages(struct address_space *mapping, struct list_head *pages,
> }
> ret = 0;
> done:
> - if (ctx.bio)
> - submit_bio(ctx.bio);
> if (ctx.cur_page) {
> if (!ctx.cur_page_in_bio)
> unlock_page(ctx.cur_page);
> --
> 2.25.1
>
next prev parent reply other threads:[~2020-03-20 15:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-20 14:40 [PATCH] iomap: Submit the BIO at the end of each extent Matthew Wilcox
2020-03-20 14:44 ` Christoph Hellwig
2020-03-20 15:50 ` Darrick J. Wong [this message]
2020-03-20 21:46 ` Darrick J. Wong
2020-03-21 14:20 ` Matthew Wilcox
2020-03-23 12:59 ` Christoph Hellwig
2020-05-05 0:37 ` Darrick J. Wong
2020-05-05 2:24 ` Matthew Wilcox
2020-05-05 2:59 ` Darrick J. Wong
2020-05-05 19:08 ` Darrick J. Wong
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=20200320155020.GB6812@magnolia \
--to=darrick.wong@oracle.com \
--cc=dchinner@redhat.com \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=riteshh@linux.ibm.com \
--cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).