]> git.hungrycats.org Git - linux/commitdiff
btrfs: remove TRANS_JOIN_NOLOCK
authorTal Zussman <tz2294@columbia.edu>
Thu, 17 Sep 2026 04:00:13 +0000 (00:00 -0400)
committerDavid Sterba <dsterba@suse.com>
Thu, 17 Sep 2026 17:49:48 +0000 (19:49 +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: Claude:claude-fable-5-1
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/transaction.c
fs/btrfs/transaction.h

index a875008feb8fce4522316e1338ff80fc4fb9bfe3..84f012bfcffca676ad842a2ad5d11e2744352254 100644 (file)
@@ -125,17 +125,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),
 };
 
@@ -310,12 +307,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;
@@ -709,14 +700,8 @@ again:
        }
 
        /*
-        * 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_FREEZABLE)
                sb_start_intwrite(fs_info->sb);
index 70b6c95efe53afe4fc5e46628ef668634048c4f5..68c724e708095a4f832ceb0f80a140daeb1c8a64 100644 (file)
@@ -106,7 +106,6 @@ enum {
        ENUM_BIT(__TRANS_START),
        ENUM_BIT(__TRANS_ATTACH),
        ENUM_BIT(__TRANS_JOIN),
-       ENUM_BIT(__TRANS_JOIN_NOLOCK),
        ENUM_BIT(__TRANS_DUMMY),
        ENUM_BIT(__TRANS_JOIN_NOSTART),
 };
@@ -114,7 +113,6 @@ enum {
 #define TRANS_START            (__TRANS_START | __TRANS_FREEZABLE)
 #define TRANS_ATTACH           (__TRANS_ATTACH)
 #define TRANS_JOIN             (__TRANS_JOIN | __TRANS_FREEZABLE)
-#define TRANS_JOIN_NOLOCK      (__TRANS_JOIN_NOLOCK)
 #define TRANS_JOIN_NOSTART     (__TRANS_JOIN_NOSTART)
 
 #define TRANS_EXTWRITERS       (__TRANS_START | __TRANS_ATTACH)