aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Schmidt <list.btrfs@jan-o-sch.net>2012-06-22 08:52:13 -0400
committerJan Schmidt <list.btrfs@jan-o-sch.net>2012-06-27 10:34:40 -0400
commit19956c7e94a7a58d6df8c4db5ae62f9109a7c663 (patch)
tree4ff17f3a5f0cc91453298c5c494f8592ccfb3e50 /fs
parent155725c9c051a343be5e555bf943da827e6cf721 (diff)
Btrfs: fix tree mod log rewind of ADD operations
When a MOD_LOG_KEY_ADD operation is rewinded, we remove the key from the tree block. If its not the last key, removal involves a move operation. This move operation was explicitly done before this commit. However, at insertion time, there's a move operation before the actual addition to make room for the new key, which is recorded in the tree mod log as well. This means, we must drop the move operation when rewinding the add operation, because the next operation we'll be rewinding will be the corresponding MOD_LOG_MOVE_KEYS operation. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ctree.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index e005d9b04616..b98f8604f4f6 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1094,11 +1094,7 @@ __tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq,
1094 tm->generation); 1094 tm->generation);
1095 break; 1095 break;
1096 case MOD_LOG_KEY_ADD: 1096 case MOD_LOG_KEY_ADD:
1097 if (tm->slot != n - 1) { 1097 /* if a move operation is needed it's in the log */
1098 o_dst = btrfs_node_key_ptr_offset(tm->slot);
1099 o_src = btrfs_node_key_ptr_offset(tm->slot + 1);
1100 memmove_extent_buffer(eb, o_dst, o_src, p_size);
1101 }
1102 n--; 1098 n--;
1103 break; 1099 break;
1104 case MOD_LOG_MOVE_KEYS: 1100 case MOD_LOG_MOVE_KEYS: