bcachefs: Drop redundant btree_path_downgrade()s
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 17 Feb 2024 04:50:05 +0000 (23:50 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 14 Mar 2024 01:22:25 +0000 (21:22 -0400)
If a path doesn't have any active references, we shouldn't downgrade it;
it'll either be reused, possibly with intent refs again, or dropped at
bch2_trans_begin() time.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_locking.c

index 6843974423381029e7a8cf24fd4cd5c6c33627cd..b9b151e693ed60ecc3dc9147cc34902643cfc7aa 100644 (file)
@@ -747,7 +747,8 @@ void bch2_trans_downgrade(struct btree_trans *trans)
                return;
 
        trans_for_each_path(trans, path, i)
-               bch2_btree_path_downgrade(trans, path);
+               if (path->ref)
+                       bch2_btree_path_downgrade(trans, path);
 }
 
 int bch2_trans_relock(struct btree_trans *trans)