diff options
author | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2012-05-31 13:24:36 -0400 |
---|---|---|
committer | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2012-05-31 13:56:19 -0400 |
commit | c31931088fd6cf953bd0868a2647b6c3928e6c96 (patch) | |
tree | 657827f1fd4be55e2f1d52a661c8803b80c08de7 /fs/btrfs | |
parent | f395694c2cd76cb1882fa82dd37e761598367fe9 (diff) |
Btrfs: fix tree mod log rewinded level and rewinding of moved keys
When we rewind REMOVE_WHILE_FREEING operations, there's code that allocates
a fresh buffer instead of cloning the old one. Setting that buffer's level
correctly was missing in this case.
When rewinding a MOVE_KEYS operation, btrfs_node_key_ptr_offset(slot) was
missing for memmove_extent_buffer()'s arguments.
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ctree.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 63147c1315a7..b4534d918e42 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -1076,7 +1076,9 @@ __tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq, | |||
1076 | n--; | 1076 | n--; |
1077 | break; | 1077 | break; |
1078 | case MOD_LOG_MOVE_KEYS: | 1078 | case MOD_LOG_MOVE_KEYS: |
1079 | memmove_extent_buffer(eb, tm->slot, tm->move.dst_slot, | 1079 | o_dst = btrfs_node_key_ptr_offset(tm->slot); |
1080 | o_src = btrfs_node_key_ptr_offset(tm->move.dst_slot); | ||
1081 | memmove_extent_buffer(eb, o_dst, o_src, | ||
1080 | tm->move.nr_items * p_size); | 1082 | tm->move.nr_items * p_size); |
1081 | break; | 1083 | break; |
1082 | case MOD_LOG_ROOT_REPLACE: | 1084 | case MOD_LOG_ROOT_REPLACE: |
@@ -1127,6 +1129,7 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb, | |||
1127 | btrfs_set_header_backref_rev(eb_rewin, | 1129 | btrfs_set_header_backref_rev(eb_rewin, |
1128 | btrfs_header_backref_rev(eb)); | 1130 | btrfs_header_backref_rev(eb)); |
1129 | btrfs_set_header_owner(eb_rewin, btrfs_header_owner(eb)); | 1131 | btrfs_set_header_owner(eb_rewin, btrfs_header_owner(eb)); |
1132 | btrfs_set_header_level(eb_rewin, btrfs_header_level(eb)); | ||
1130 | } else { | 1133 | } else { |
1131 | eb_rewin = btrfs_clone_extent_buffer(eb); | 1134 | eb_rewin = btrfs_clone_extent_buffer(eb); |
1132 | BUG_ON(!eb_rewin); | 1135 | BUG_ON(!eb_rewin); |
@@ -2609,7 +2612,6 @@ int btrfs_search_old_slot(struct btrfs_root *root, struct btrfs_key *key, | |||
2609 | } | 2612 | } |
2610 | 2613 | ||
2611 | again: | 2614 | again: |
2612 | level = 0; | ||
2613 | b = get_old_root(root, time_seq); | 2615 | b = get_old_root(root, time_seq); |
2614 | extent_buffer_get(b); | 2616 | extent_buffer_get(b); |
2615 | level = btrfs_header_level(b); | 2617 | level = btrfs_header_level(b); |