From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
To: Chandan Rajendra <chandan@linux.vnet.ibm.com>,
<linux-btrfs@vger.kernel.org>
Cc: <aneesh.kumar@linux.vnet.ibm.com>
Subject: Re: [PATCH] Btrfs: fill_holes: Fix slot number passed to hole_mergeable() call.
Date: Wed, 2 Jul 2014 13:30:17 +0800 [thread overview]
Message-ID: <53B398E9.7040003@cn.fujitsu.com> (raw)
In-Reply-To: <1404196468-2007-1-git-send-email-chandan@linux.vnet.ibm.com>
On 07/01/2014 02:34 PM, Chandan Rajendra wrote:
> For a non-existent key, btrfs_search_slot() sets path->slots[0] to the slot
> where the key could have been present, which in this case would be the slot
> containing the extent item which would be the next neighbor of the file range
> being punched. The current code passes an incremented path->slots[0] and we
> skip to the wrong file extent item. This would mean that we would fail to
> merge the "yet to be created" hole with the next neighboring hole (if one
> exists). Fix this.
>
> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
> ---
Nice catch, this looks good to me.
Reviewed-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
> fs/btrfs/file.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index ad7c059..3cd7997 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -2126,10 +2126,9 @@ static int fill_holes(struct btrfs_trans_handle *trans, struct inode *inode,
> goto out;
> }
>
> - if (hole_mergeable(inode, leaf, path->slots[0]+1, offset, end)) {
> + if (hole_mergeable(inode, leaf, path->slots[0], offset, end)) {
> u64 num_bytes;
>
> - path->slots[0]++;
> key.offset = offset;
> btrfs_set_item_key_safe(root, path, &key);
> fi = btrfs_item_ptr(leaf, path->slots[0],
prev parent reply other threads:[~2014-07-02 5:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 6:34 [PATCH] Btrfs: fill_holes: Fix slot number passed to hole_mergeable() call Chandan Rajendra
2014-07-02 5:30 ` Wang Shilong [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=53B398E9.7040003@cn.fujitsu.com \
--to=wangsl.fnst@cn.fujitsu.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=chandan@linux.vnet.ibm.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).