提交 f395694c 编写于 作者: J Jan Schmidt

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: NJan Schmidt <list.btrfs@jan-o-sch.net>
上级 e9b7fd4d
...@@ -540,9 +540,8 @@ tree_mod_log_insert_move(struct btrfs_fs_info *fs_info, ...@@ -540,9 +540,8 @@ tree_mod_log_insert_move(struct btrfs_fs_info *fs_info,
int ret; int ret;
int i; int i;
ret = tree_mod_alloc(fs_info, flags, &tm); if (tree_mod_dont_log(fs_info, eb))
if (ret <= 0) return 0;
return ret;
for (i = 0; i + dst_slot < src_slot && i < nr_items; i++) { for (i = 0; i + dst_slot < src_slot && i < nr_items; i++) {
ret = tree_mod_log_insert_key(fs_info, eb, i + dst_slot, 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, ...@@ -550,6 +549,10 @@ tree_mod_log_insert_move(struct btrfs_fs_info *fs_info,
BUG_ON(ret < 0); 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->index = eb->start >> PAGE_CACHE_SHIFT;
tm->slot = src_slot; tm->slot = src_slot;
tm->move.dst_slot = dst_slot; tm->move.dst_slot = dst_slot;
...@@ -4548,9 +4551,7 @@ static void del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root, ...@@ -4548,9 +4551,7 @@ static void del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
btrfs_node_key_ptr_offset(slot + 1), btrfs_node_key_ptr_offset(slot + 1),
sizeof(struct btrfs_key_ptr) * sizeof(struct btrfs_key_ptr) *
(nritems - slot - 1)); (nritems - slot - 1));
} } else if (tree_mod_log && level) {
if (tree_mod_log && level) {
ret = tree_mod_log_insert_key(root->fs_info, parent, slot, ret = tree_mod_log_insert_key(root->fs_info, parent, slot,
MOD_LOG_KEY_REMOVE); MOD_LOG_KEY_REMOVE);
BUG_ON(ret < 0); BUG_ON(ret < 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册