mirror of
https://github.com/torvalds/linux.git
synced 2024-11-06 20:21:57 +00:00
Btrfs: always put insert_ptr modifications into the tree mod log
Several callers of insert_ptr set the tree_mod_log parameter to 0 to avoid addition to the tree mod log. In fact, we need all of those operations. This commit simply removes the additional parameter and makes addition to the tree mod log unconditional. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
This commit is contained in:
parent
28da9fb446
commit
c3e0696523
@ -2997,7 +2997,7 @@ static noinline int insert_new_root(struct btrfs_trans_handle *trans,
|
|||||||
static void insert_ptr(struct btrfs_trans_handle *trans,
|
static void insert_ptr(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root, struct btrfs_path *path,
|
struct btrfs_root *root, struct btrfs_path *path,
|
||||||
struct btrfs_disk_key *key, u64 bytenr,
|
struct btrfs_disk_key *key, u64 bytenr,
|
||||||
int slot, int level, int tree_mod_log)
|
int slot, int level)
|
||||||
{
|
{
|
||||||
struct extent_buffer *lower;
|
struct extent_buffer *lower;
|
||||||
int nritems;
|
int nritems;
|
||||||
@ -3010,7 +3010,7 @@ static void insert_ptr(struct btrfs_trans_handle *trans,
|
|||||||
BUG_ON(slot > nritems);
|
BUG_ON(slot > nritems);
|
||||||
BUG_ON(nritems == BTRFS_NODEPTRS_PER_BLOCK(root));
|
BUG_ON(nritems == BTRFS_NODEPTRS_PER_BLOCK(root));
|
||||||
if (slot != nritems) {
|
if (slot != nritems) {
|
||||||
if (tree_mod_log && level)
|
if (level)
|
||||||
tree_mod_log_eb_move(root->fs_info, lower, slot + 1,
|
tree_mod_log_eb_move(root->fs_info, lower, slot + 1,
|
||||||
slot, nritems - slot);
|
slot, nritems - slot);
|
||||||
memmove_extent_buffer(lower,
|
memmove_extent_buffer(lower,
|
||||||
@ -3018,7 +3018,7 @@ static void insert_ptr(struct btrfs_trans_handle *trans,
|
|||||||
btrfs_node_key_ptr_offset(slot),
|
btrfs_node_key_ptr_offset(slot),
|
||||||
(nritems - slot) * sizeof(struct btrfs_key_ptr));
|
(nritems - slot) * sizeof(struct btrfs_key_ptr));
|
||||||
}
|
}
|
||||||
if (tree_mod_log && level) {
|
if (level) {
|
||||||
ret = tree_mod_log_insert_key(root->fs_info, lower, slot,
|
ret = tree_mod_log_insert_key(root->fs_info, lower, slot,
|
||||||
MOD_LOG_KEY_ADD);
|
MOD_LOG_KEY_ADD);
|
||||||
BUG_ON(ret < 0);
|
BUG_ON(ret < 0);
|
||||||
@ -3106,7 +3106,7 @@ static noinline int split_node(struct btrfs_trans_handle *trans,
|
|||||||
btrfs_mark_buffer_dirty(split);
|
btrfs_mark_buffer_dirty(split);
|
||||||
|
|
||||||
insert_ptr(trans, root, path, &disk_key, split->start,
|
insert_ptr(trans, root, path, &disk_key, split->start,
|
||||||
path->slots[level + 1] + 1, level + 1, 1);
|
path->slots[level + 1] + 1, level + 1);
|
||||||
|
|
||||||
if (path->slots[level] >= mid) {
|
if (path->slots[level] >= mid) {
|
||||||
path->slots[level] -= mid;
|
path->slots[level] -= mid;
|
||||||
@ -3643,7 +3643,7 @@ static noinline void copy_for_split(struct btrfs_trans_handle *trans,
|
|||||||
btrfs_set_header_nritems(l, mid);
|
btrfs_set_header_nritems(l, mid);
|
||||||
btrfs_item_key(right, &disk_key, 0);
|
btrfs_item_key(right, &disk_key, 0);
|
||||||
insert_ptr(trans, root, path, &disk_key, right->start,
|
insert_ptr(trans, root, path, &disk_key, right->start,
|
||||||
path->slots[1] + 1, 1, 0);
|
path->slots[1] + 1, 1);
|
||||||
|
|
||||||
btrfs_mark_buffer_dirty(right);
|
btrfs_mark_buffer_dirty(right);
|
||||||
btrfs_mark_buffer_dirty(l);
|
btrfs_mark_buffer_dirty(l);
|
||||||
@ -3850,7 +3850,7 @@ again:
|
|||||||
if (mid <= slot) {
|
if (mid <= slot) {
|
||||||
btrfs_set_header_nritems(right, 0);
|
btrfs_set_header_nritems(right, 0);
|
||||||
insert_ptr(trans, root, path, &disk_key, right->start,
|
insert_ptr(trans, root, path, &disk_key, right->start,
|
||||||
path->slots[1] + 1, 1, 0);
|
path->slots[1] + 1, 1);
|
||||||
btrfs_tree_unlock(path->nodes[0]);
|
btrfs_tree_unlock(path->nodes[0]);
|
||||||
free_extent_buffer(path->nodes[0]);
|
free_extent_buffer(path->nodes[0]);
|
||||||
path->nodes[0] = right;
|
path->nodes[0] = right;
|
||||||
@ -3859,7 +3859,7 @@ again:
|
|||||||
} else {
|
} else {
|
||||||
btrfs_set_header_nritems(right, 0);
|
btrfs_set_header_nritems(right, 0);
|
||||||
insert_ptr(trans, root, path, &disk_key, right->start,
|
insert_ptr(trans, root, path, &disk_key, right->start,
|
||||||
path->slots[1], 1, 0);
|
path->slots[1], 1);
|
||||||
btrfs_tree_unlock(path->nodes[0]);
|
btrfs_tree_unlock(path->nodes[0]);
|
||||||
free_extent_buffer(path->nodes[0]);
|
free_extent_buffer(path->nodes[0]);
|
||||||
path->nodes[0] = right;
|
path->nodes[0] = right;
|
||||||
|
Loading…
Reference in New Issue
Block a user