提交 160f4089 编写于 作者: F Filipe Manana 提交者: Chris Mason

Btrfs: avoid unnecessary switch of path locks to blocking mode

If we need to cow a node, increase the write lock level and retry the
tree search, there's no point of changing the node locks in our path
to blocking mode, as we only waste time and unnecessarily wake up other
tasks waiting on the spinning locks (just to block them again shortly
after) because we release our path before repeating the tree search.
Signed-off-by: NFilipe Manana <fdmanana@suse.com>
Signed-off-by: NChris Mason <clm@fb.com>
上级 24cdc847
......@@ -2792,8 +2792,6 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
if (!should_cow_block(trans, root, b))
goto cow_done;
btrfs_set_path_blocking(p);
/*
* must have write locks on this node and the
* parent
......@@ -2807,6 +2805,7 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
goto again;
}
btrfs_set_path_blocking(p);
err = btrfs_cow_block(trans, root, b,
p->nodes[level + 1],
p->slots[level + 1], &b);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册