linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Schmidt <list.btrfs@jan-o-sch.net>
To: chris.mason@fusionio.com, linux-btrfs@vger.kernel.org
Subject: [PATCH 2/6] Btrfs: remove obsolete btrfs_next_leaf call from __resolve_indirect_ref
Date: Thu, 14 Jun 2012 19:16:34 +0200	[thread overview]
Message-ID: <1339694198-13388-3-git-send-email-list.btrfs@jan-o-sch.net> (raw)
In-Reply-To: <1339694198-13388-1-git-send-email-list.btrfs@jan-o-sch.net>

When resolving indirect refs, we used to call btrfs_next_leaf in case we
didn't find an exact match. While we should find exact matches most of the
time, in case we don't, we must continue searching. Treating those matches
differently depending on the level we're searching doesn't make sense.

Even worse, we might end up searching for a key larger than the largest, in
which case there is no next_leaf and subsequent jobs would fail. This commit
drops the bogous lines.

Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
---
 fs/btrfs/backref.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 3f75895..579131d 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -294,16 +294,8 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info,
 		goto out;
 	}
 
-	if (level == 0) {
-		if (ret == 1 && path->slots[0] >= btrfs_header_nritems(eb)) {
-			ret = btrfs_next_leaf(root, path);
-			if (ret)
-				goto out;
-			eb = path->nodes[0];
-		}
-
+	if (level == 0)
 		btrfs_item_key_to_cpu(eb, &key, path->slots[0]);
-	}
 
 	ret = add_all_parents(root, path, parents, level, &key,
 				ref->wanted_disk_byte, extent_item_pos);
-- 
1.7.3.4


  parent reply	other threads:[~2012-06-14 17:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14 17:16 [PATCH 0/6] Btrfs: tree mod log fixes for 3.5-rc3 Jan Schmidt
2012-06-14 17:16 ` [PATCH 1/6] Btrfs: remove call to btrfs_header_nritems with no effect Jan Schmidt
2012-06-14 17:16 ` Jan Schmidt [this message]
2012-06-14 17:16 ` [PATCH 3/6] Btrfs: use btrfs_read_lock_root_node in get_old_root Jan Schmidt
2012-06-14 17:16 ` [PATCH 4/6] Btrfs: fix return value for __tree_mod_log_oldest_root Jan Schmidt
2012-06-14 17:16 ` [PATCH 5/6] Btrfs: add btrfs_next_old_leaf Jan Schmidt
2012-06-14 17:16 ` [PATCH 6/6] Btrfs: fix race in tree mod log addition Jan Schmidt

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=1339694198-13388-3-git-send-email-list.btrfs@jan-o-sch.net \
    --to=list.btrfs@jan-o-sch.net \
    --cc=chris.mason@fusionio.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).