All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: Namjae Jeon <linkinjeon@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: add block plug for .writepages
Date: Mon, 31 Oct 2011 12:01:45 -0400	[thread overview]
Message-ID: <20111031160145.GD4468@shiny> (raw)
In-Reply-To: <1320075907-4079-1-git-send-email-linkinjeon@gmail.com>

On Tue, Nov 01, 2011 at 12:45:07AM +0900, Namjae Jeon wrote:
> Add block plug for btrfs .writepages. Block plug is helpful to reduce block lock contention.
> 
> Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
> ---
>  fs/btrfs/extent_io.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index d418164..8f2d6bd 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -2388,6 +2388,7 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
>  	pgoff_t end;		/* Inclusive */
>  	int scanned = 0;
>  	int tag;
> +	struct blk_plug plug;
>  
>  	pagevec_init(&pvec, 0);
>  	if (wbc->range_cyclic) {
> @@ -2405,6 +2406,8 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
>  retry:
>  	if (wbc->sync_mode == WB_SYNC_ALL)
>  		tag_pages_for_writeback(mapping, index, end);
> +
> +	blk_start_plug(&plug);
>  	while (!done && !nr_to_write_done && (index <= end) &&
>  	       (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag,
>  			min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) {
> @@ -2468,6 +2471,7 @@ retry:
>  		pagevec_release(&pvec);
>  		cond_resched();
>  	}
> +	blk_finish_plug(&plug);
>  	if (!scanned && !done) {
>  		/*
>  		 * We hit the last page and there is more work to be done: wrap

Thanks for the patch, but we actually do this at a lower level in btrfs.
The actual IO can be done to multiple block devices, so we try to plug
for each device individually.

-chris


  reply	other threads:[~2011-10-31 16:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 15:45 [PATCH] btrfs: add block plug for .writepages Namjae Jeon
2011-10-31 16:01 ` Chris Mason [this message]
2011-11-01  5:31   ` NamJae Jeon
2011-11-01  7:14     ` Shaohua Li
2011-11-01 12:26       ` NamJae Jeon

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=20111031160145.GD4468@shiny \
    --to=chris.mason@oracle.com \
    --cc=linkinjeon@gmail.com \
    --cc=linux-kernel@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.