linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chandan Rajendra <chandan@linux.vnet.ibm.com>
To: linux-btrfs@vger.kernel.org,
	Filipe David Borba Manana <fdmanana@gmail.com>
Subject: Re: [PATCH] Btrfs: implement support for fallocate collapse range
Date: Thu, 03 Jul 2014 11:16:18 +0630	[thread overview]
Message-ID: <2201007.I7dgLZVjz9@localhost.localdomain> (raw)
In-Reply-To: <1403519147-19520-1-git-send-email-fdmanana@gmail.com>

On Monday 23 Jun 2014 11:25:47 Filipe David Borba Manana wrote:
> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> index aeab453..8f1a371 100644
> --- a/fs/btrfs/ctree.c
> +++ b/fs/btrfs/ctree.c
> @@ -2825,12 +2825,12 @@ cow_done:
>  		 * It is safe to drop the lock on our parent before we
>  		 * go through the expensive btree search on b.
>  		 *
> -		 * If we're inserting or deleting (ins_len != 0), then we might
> -		 * be changing slot zero, which may require changing the parent.
> -		 * So, we can't drop the lock until after we know which slot
> -		 * we're operating on.
> +		 * If we're inserting, deleting or updating a key (cow != 0),
> +		 * then we might be changing slot zero, which may require
> +		 * changing the parent. So, we can't drop the lock until after
> +		 * we know which slot we're operating on.
>  		 */
> -		if (!ins_len && !p->keep_locks) {
> +		if (!cow && !p->keep_locks) {
>  			int u = level + 1;

For the "key update" case (i.e. (ins_len == 0) and (cow == 1)), maybe
we could optimize by having a variable to hold the return value of
should_cow_block(), i.e. it keeps track of whether the current
metadata block was COWed. If the variable indicates that the block was
*not* COWed, then we could release the lock on the parent block since
the update operation (even on slot 0) isn't going to change the
corresponding entry in the parent block.

Thanks,
chandan


  parent reply	other threads:[~2014-07-03  5:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23 10:25 [PATCH] Btrfs: implement support for fallocate collapse range Filipe David Borba Manana
2014-07-02 15:11 ` Filipe David Manana
2014-07-03  4:46 ` Chandan Rajendra [this message]
2014-07-03 11:28   ` Filipe David Manana

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=2201007.I7dgLZVjz9@localhost.localdomain \
    --to=chandan@linux.vnet.ibm.com \
    --cc=fdmanana@gmail.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).