linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <liubo2009@cn.fujitsu.com>
To: Josef Bacik <josef@redhat.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: fix return code in drop_objectid_items
Date: Wed, 30 May 2012 09:23:41 +0800	[thread overview]
Message-ID: <4FC5769D.7080509@cn.fujitsu.com> (raw)
In-Reply-To: <1338325076-9203-1-git-send-email-josef@redhat.com>

On 05/30/2012 04:57 AM, Josef Bacik wrote:

> So dpkg fsync()'s the file and the directory containing the file whenever it
> writes to a file which is really slow in btrfs.  This is partly because
> fsync()'ing a directory _always_ committed the transaction instead of just
> going to the tree log.  This is because drop_objectid_items() would return 1
> since it does a btrfs_search_slot() which returns 1.  In tree-log jargon
> this means that we have to commit the transaction to be safe.  So just check
> if ret is greater than 0 and set it to 0 if it does.  With this patch we now
> use the tree-log instead of committing the entire transaction, which is
> twice as fast on my box.  Thanks,
> 


Good catch.

Reviewed-by: Liu Bo <liubo2009@cn.fujitsu.com>

> Signed-off-by: Josef Bacik <josef@redhat.com>
> ---
>  fs/btrfs/tree-log.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index 425014b..2017d0f 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -2667,6 +2667,8 @@ static int drop_objectid_items(struct btrfs_trans_handle *trans,
>  		btrfs_release_path(path);
>  	}
>  	btrfs_release_path(path);
> +	if (ret > 0)
> +		ret = 0;
>  	return ret;
>  }
>  



      reply	other threads:[~2012-05-30  1:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-29 20:57 [PATCH] Btrfs: fix return code in drop_objectid_items Josef Bacik
2012-05-30  1:23 ` Liu Bo [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=4FC5769D.7080509@cn.fujitsu.com \
    --to=liubo2009@cn.fujitsu.com \
    --cc=josef@redhat.com \
    --cc=linux-btrfs@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;
as well as URLs for NNTP newsgroup(s).