Skip to contentSkip to conversation

btrfs: remove redundant refcount check in btrfs_put_transaction()

PATCH In review [email protected] 2 participants 2 messages Oct 15, 2025 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: remove redundant refcount check in btrfs_put_transaction()

From: Xuanqiang Luo <[email protected]>

Eric Dumazet removed the redundant refcount check for sk_refcnt, I noticed a similar issue in btrfs_put_transaction().

refcount_dec_and_test() already checks for a zero refcount and complains, making the preceding WARN_ON redundant.

---
 fs/btrfs/transaction.c | 1 -
 1 file changed, 1 deletion(-)
fs/btrfs/transaction.c +0 -1
index 89ae0c7a610a..485bef0ba419 100644
@@ -138,7 +138,6 @@ static const unsigned int btrfs_blocked_trans_types[TRANS_STATE_MAX] = {
 
 void btrfs_put_transaction(struct btrfs_transaction *transaction)
 {
-	WARN_ON(refcount_read(&transaction->use_count) == 0);
 	if (refcount_dec_and_test(&transaction->use_count)) {
 		BUG_ON(!list_empty(&transaction->list));
 		WARN_ON(!xa_empty(&transaction->delayed_refs.head_refs));
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · On Wed, Oct 15, 2025 at 03:05:21PM +0800, [email protected] wrote:

From: Xuanqiang Luo <[email protected]>

Eric Dumazet removed the redundant refcount check for sk_refcnt, I noticed a similar issue in btrfs_put_transaction().

refcount_dec_and_test() already checks for a zero refcount and complains, making the preceding WARN_ON redundant.