From: Filipe Manana Date: Mon, 28 Jul 2014 18:37:17 +0000 (+0100) Subject: Btrfs: avoid unnecessary switch of path locks to blocking mode X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=160f4089c8580b32b5805e7fd8ec7b3810f442c1;p=linux-beck.git 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: Filipe Manana Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index bd0ae3ec76ff..783ea3bac7dc 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -2792,8 +2792,6 @@ again: 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 @@ again: goto again; } + btrfs_set_path_blocking(p); err = btrfs_cow_block(trans, root, b, p->nodes[level + 1], p->slots[level + 1], &b);