Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

btrfs: remove redundant refcount check in btrfs_put_transaction()

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. This is a leftover
from the atomic_t times.

Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Xuanqiang Luo and committed by
David Sterba
225e747e a232ff90

-1
-1
fs/btrfs/transaction.c
··· 138 138 139 139 void btrfs_put_transaction(struct btrfs_transaction *transaction) 140 140 { 141 - WARN_ON(refcount_read(&transaction->use_count) == 0); 142 141 if (refcount_dec_and_test(&transaction->use_count)) { 143 142 BUG_ON(!list_empty(&transaction->list)); 144 143 WARN_ON(!xa_empty(&transaction->delayed_refs.head_refs));