]> git.hungrycats.org Git - linux/commitdiff
btrfs: remove TRANS_JOIN_NOLOCK
authorTal Zussman <tz2294@columbia.edu>
Thu, 15 Oct 2026 14:43:32 +0000 (10:43 -0400)
committerDavid Sterba <dsterba@suse.com>
Fri, 16 Oct 2026 17:06:57 +0000 (19:06 +0200)
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>
fs/btrfs/transaction.c

index 7431a06f168da299b5056da12fc2a0b3aaebdf96..d265fac023e58ebe110c8703b2adcd167c2992fb 100644 (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 @@ loop:
        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 @@ again:
        /*
         * 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);