From: Li Zefan <lizf@cn.fujitsu.com>
To: liubo <liubo2009@cn.fujitsu.com>
Cc: Linux Btrfs <linux-btrfs@vger.kernel.org>,
Josef Bacik <josef@redhat.com>, David Sterba <dave@jikos.cz>
Subject: Re: [PATCH v2] btrfs: make inode ref log recovery faster
Date: Wed, 23 Feb 2011 15:20:22 +0800 [thread overview]
Message-ID: <4D64B536.1080805@cn.fujitsu.com> (raw)
In-Reply-To: <4D64B2B2.3020703@cn.fujitsu.com>
> -conflict_again:
> +
> + if (search_done)
> + goto insert;
> +
> ret = btrfs_search_slot(NULL, root, key, path, 0, 0);
> if (ret == 0) {
> char *victim_name;
> @@ -887,36 +890,22 @@ conflict_again:
> inode, victim_name,
> victim_name_len);
> kfree(victim_name);
> - btrfs_release_path(root, path);
> - goto conflict_again;
> }
> - kfree(victim_name);
> + if (victim_name)
> + kfree(victim_name);
This is still wrong..
Just remove the first kfree() and remain the second one.
> ptr = (unsigned long)(victim_ref + 1) + victim_name_len;
> }
> BUG_ON(ret);
> - }
> - btrfs_release_path(root, path);
>
> - /* look for a conflicting sequence number */
> - di = btrfs_lookup_dir_index_item(trans, root, path, dir->i_ino,
> - btrfs_inode_ref_index(eb, ref),
> - name, namelen, 0);
> - if (di && !IS_ERR(di)) {
> - ret = drop_one_dir_item(trans, root, path, dir, di);
> - BUG_ON(ret);
> - }
> - btrfs_release_path(root, path);
> -
> -
> - /* look for a conflicting name */
> - di = btrfs_lookup_dir_item(trans, root, path, dir->i_ino,
> - name, namelen, 0);
> - if (di && !IS_ERR(di)) {
> - ret = drop_one_dir_item(trans, root, path, dir, di);
> - BUG_ON(ret);
> + /*
> + * NOTE: we have searched root tree and checked the
> + * coresponding ref, it does not need to check again.
> + */
> + search_done = 1;
> }
> btrfs_release_path(root, path);
>
> +insert:
> /* insert our name */
> ret = btrfs_add_link(trans, dir, inode, name, namelen, 0,
> btrfs_inode_ref_index(eb, ref));
prev parent reply other threads:[~2011-02-23 7:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 11:42 [PATCH] btrfs: make inode ref log recovery faster liubo
2011-02-22 14:32 ` David Sterba
2011-02-23 1:12 ` liubo
2011-02-23 1:30 ` Josef Bacik
2011-02-23 1:42 ` liubo
2011-02-23 7:09 ` [PATCH v2] " liubo
2011-02-23 7:20 ` Li Zefan [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=4D64B536.1080805@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=dave@jikos.cz \
--cc=josef@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=liubo2009@cn.fujitsu.com \
/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.