aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJan Schmidt2012-05-31 15:02:32 +0200
committerJan Schmidt2012-05-31 19:56:19 +0200
commitf395694c2cd76cb1882fa82dd37e761598367fe9 (patch)
tree08e0ef4499046d1400d86b86c2f61a2a52a66cf6 /fs
parente9b7fd4d8b7c915cff353ca085b83bd19737396b (diff)
Btrfs: fix tree mod log del_ptr
Logging for del_ptr when we're not deleting the last pointer was wrong. This fixes both, duplicate log entries and log sequence. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ctree.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index c7c48489b963..63147c1315a7 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -540,9 +540,8 @@ tree_mod_log_insert_move(struct btrfs_fs_info *fs_info,
int ret;
int i;
- ret = tree_mod_alloc(fs_info, flags, &tm);
- if (ret <= 0)
- return ret;
+ if (tree_mod_dont_log(fs_info, eb))
+ return 0;
for (i = 0; i + dst_slot < src_slot && i < nr_items; i++) {
ret = tree_mod_log_insert_key(fs_info, eb, i + dst_slot,
@@ -550,6 +549,10 @@ tree_mod_log_insert_move(struct btrfs_fs_info *fs_info,
BUG_ON(ret < 0);
}
+ ret = tree_mod_alloc(fs_info, flags, &tm);
+ if (ret <= 0)
+ return ret;
+
tm->index = eb->start >> PAGE_CACHE_SHIFT;
tm->slot = src_slot;
tm->move.dst_slot = dst_slot;
@@ -4548,9 +4551,7 @@ static void del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
btrfs_node_key_ptr_offset(slot + 1),
sizeof(struct btrfs_key_ptr) *
(nritems - slot - 1));
- }
-
- if (tree_mod_log && level) {
+ } else if (tree_mod_log && level) {
ret = tree_mod_log_insert_key(root->fs_info, parent, slot,
MOD_LOG_KEY_REMOVE);
BUG_ON(ret < 0);