From adbe9eb09681366b46c4962907c209562298ab13 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 28 Sep 2012 11:56:28 -0400 Subject: [PATCH] --- yaml --- r: 332598 b: refs/heads/master c: 18ec90d63f43cf785f6e73e7a7db546bff3fa380 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/btrfs/tree-log.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 5f97a860de0e..adcd9efc48e1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6f1fed775316d58ba356b2ce62de600ad00f003a +refs/heads/master: 18ec90d63f43cf785f6e73e7a7db546bff3fa380 diff --git a/trunk/fs/btrfs/tree-log.c b/trunk/fs/btrfs/tree-log.c index 31b46a9e94cc..179fda964601 100644 --- a/trunk/fs/btrfs/tree-log.c +++ b/trunk/fs/btrfs/tree-log.c @@ -2901,6 +2901,7 @@ static int drop_objectid_items(struct btrfs_trans_handle *trans, int ret; struct btrfs_key key; struct btrfs_key found_key; + int start_slot; key.objectid = objectid; key.type = max_key_type; @@ -2922,8 +2923,18 @@ static int drop_objectid_items(struct btrfs_trans_handle *trans, if (found_key.objectid != objectid) break; - ret = btrfs_del_item(trans, log, path); - if (ret) + found_key.offset = 0; + found_key.type = 0; + ret = btrfs_bin_search(path->nodes[0], &found_key, 0, + &start_slot); + + ret = btrfs_del_items(trans, log, path, start_slot, + path->slots[0] - start_slot + 1); + /* + * If start slot isn't 0 then we don't need to re-search, we've + * found the last guy with the objectid in this tree. + */ + if (ret || start_slot != 0) break; btrfs_release_path(path); }