Skip to content

Commit

Permalink
Btrfs: fix tree mod log rewind of ADD operations
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jan Schmidt committed Jun 27, 2012
1 parent 155725c commit 19956c7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1094,11 +1094,7 @@ __tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq,
tm->generation);
break;
case MOD_LOG_KEY_ADD:
if (tm->slot != n - 1) {
o_dst = btrfs_node_key_ptr_offset(tm->slot);
o_src = btrfs_node_key_ptr_offset(tm->slot + 1);
memmove_extent_buffer(eb, o_dst, o_src, p_size);
}
/* if a move operation is needed it's in the log */
n--;
break;
case MOD_LOG_MOVE_KEYS:
Expand Down

0 comments on commit 19956c7

Please sign in to comment.