From: Jan Schmidt Date: Wed, 27 Jun 2012 13:23:09 +0000 (+0200) Subject: Btrfs: support root level changes in __resolve_indirect_ref X-Git-Tag: upstream/snapshot3+hdmi~7134^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9345457f4a539a40056431aeb6f068750857472f;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git Btrfs: support root level changes in __resolve_indirect_ref With the tree mod log, we can have a tree that's two levels high, but btrfs_search_old_slot may still return a path with the tree root at level one instead. __resolve_indirect_ref must care for this and accept parents in a lower level than expected. Signed-off-by: Jan Schmidt --- diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 7301cdb..cf0df90 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -301,10 +301,14 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info, goto out; eb = path->nodes[level]; - if (!eb) { - WARN_ON(1); - ret = 1; - goto out; + while (!eb) { + if (!level) { + WARN_ON(1); + ret = 1; + goto out; + } + level--; + eb = path->nodes[level]; } ret = add_all_parents(root, path, parents, level, &ref->key_for_search,