[PATCH v4 18/18] btrfs: remove TRANS_JOIN_NOLOCK

From: Tal Zussman

Date: Mon Oct 12 2026 - 12:47:01 EST


btrfs_join_transaction_spacecache() was the only user of
TRANS_JOIN_NOLOCK and is gone, so remove the join type, its entries in
the blocked types table, and the special cases in join_transaction() and
start_transaction().

Assisted-by: LLM
Signed-off-by: Tal Zussman <tz2294@xxxxxxxxxxxx>
---
fs/btrfs/transaction.c | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 7431a06f168d..d265fac023e5 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -42,7 +42,6 @@ enum {
ENUM_BIT(TRANS_START),
ENUM_BIT(TRANS_ATTACH),
ENUM_BIT(TRANS_JOIN),
- ENUM_BIT(TRANS_JOIN_NOLOCK),
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
ENUM_BIT(TRANS_DUMMY),
#endif
@@ -141,17 +140,14 @@ static const unsigned int btrfs_blocked_trans_types[TRANS_STATE_MAX] = {
[TRANS_STATE_UNBLOCKED] = (TRANS_START |
TRANS_ATTACH |
TRANS_JOIN |
- TRANS_JOIN_NOLOCK |
TRANS_JOIN_NOSTART),
[TRANS_STATE_SUPER_COMMITTED] = (TRANS_START |
TRANS_ATTACH |
TRANS_JOIN |
- TRANS_JOIN_NOLOCK |
TRANS_JOIN_NOSTART),
[TRANS_STATE_COMPLETED] = (TRANS_START |
TRANS_ATTACH |
TRANS_JOIN |
- TRANS_JOIN_NOLOCK |
TRANS_JOIN_NOSTART),
};

@@ -342,12 +338,6 @@ static noinline int join_transaction(struct btrfs_fs_info *fs_info,
if (type == TRANS_ATTACH || type == TRANS_JOIN_NOSTART)
return -ENOENT;

- /*
- * JOIN_NOLOCK only happens during the transaction commit, so
- * it is impossible that ->running_transaction is NULL
- */
- BUG_ON(type == TRANS_JOIN_NOLOCK);
-
cur_trans = kmalloc_obj(*cur_trans, GFP_NOFS);
if (!cur_trans)
return -ENOMEM;
@@ -750,14 +740,8 @@ start_transaction(struct btrfs_root *root, unsigned int num_items,
/*
* Only TRANS_START and TRANS_JOIN require sb intwrite lock.
*
- * If we are JOIN_NOLOCK we're already committing a transaction and
- * waiting on this guy, so we don't need to do the sb_start_intwrite
- * because we're already holding a ref. We need this because we could
- * have raced in and did an fsync() on a file which can kick a commit
- * and then we deadlock with somebody doing a freeze.
- *
* If we are ATTACH, it means we just want to catch the current
- * transaction and commit it, so we needn't do sb_start_intwrite().
+ * transaction and commit it, so we needn't do sb_start_intwrite().
*/
if (type & TRANS_SB_INTWRITER_MASK)
sb_start_intwrite(fs_info->sb);

--
2.39.5