btrfs: remove TRANS_JOIN_NOLOCK

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@columbia.edu>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Tal Zussman 2026-10-15 10:43:32 -04:00 committed by David Sterba
parent a09f52a06d
commit 293aae0123

View File

@ -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);