From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Filipe Manana <fdmanana@suse.com>, Qu Wenruo <wqu@suse.com>,
David Sterba <dsterba@suse.com>, Sasha Levin <sashal@kernel.org>,
clm@fb.com, josef@toxicpanda.com, linux-btrfs@vger.kernel.org
Subject: [PATCH AUTOSEL 6.12 05/19] btrfs: avoid starting new transaction when cleaning qgroup during subvolume drop
Date: Mon, 10 Feb 2025 20:30:33 -0500 [thread overview]
Message-ID: <20250211013047.4096767-5-sashal@kernel.org> (raw)
In-Reply-To: <20250211013047.4096767-1-sashal@kernel.org>
From: Filipe Manana <fdmanana@suse.com>
[ Upstream commit fdef89ce6fada462aef9cb90a140c93c8c209f0f ]
At btrfs_qgroup_cleanup_dropped_subvolume() all we want to commit the
current transaction in order to have all the qgroup rfer/excl numbers up
to date. However we are using btrfs_start_transaction(), which joins the
current transaction if there is one that is not yet committing, but also
starts a new one if there is none or if the current one is already
committing (its state is >= TRANS_STATE_COMMIT_START). This later case
results in unnecessary IO, wasting time and a pointless rotation of the
backup roots in the super block.
So instead of using btrfs_start_transaction() followed by a
btrfs_commit_transaction(), use btrfs_commit_current_transaction() which
achieves our purpose and avoids starting and committing new transactions.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/qgroup.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 4fcd6cd4c1c24..887e34559a1fa 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1899,11 +1899,7 @@ int btrfs_qgroup_cleanup_dropped_subvolume(struct btrfs_fs_info *fs_info, u64 su
* Commit current transaction to make sure all the rfer/excl numbers
* get updated.
*/
- trans = btrfs_start_transaction(fs_info->quota_root, 0);
- if (IS_ERR(trans))
- return PTR_ERR(trans);
-
- ret = btrfs_commit_transaction(trans);
+ ret = btrfs_commit_current_transaction(fs_info->quota_root);
if (ret < 0)
return ret;
--
2.39.5
next prev parent reply other threads:[~2025-02-11 1:30 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 1:30 [PATCH AUTOSEL 6.12 01/19] nvme-fc: go straight to connecting state when initializing Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 02/19] nvme-fc: do not ignore connectivity loss during connecting Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 03/19] hrtimers: Mark is_migration_base() with __always_inline Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 04/19] powercap: call put_device() on an error path in powercap_register_control_type() Sasha Levin
2025-02-11 1:30 ` Sasha Levin [this message]
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 06/19] futex: Pass in task to futex_queue() Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 07/19] iscsi_ibft: Fix UBSAN shift-out-of-bounds warning in ibft_attr_show_nic() Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 08/19] sched/debug: Provide slice length for fair tasks Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 09/19] platform/x86/intel: pmc: fix ltr decode in pmc_core_ltr_show() Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 10/19] drm/amd/display: Fix out-of-bound accesses Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 11/19] scsi: core: Use GFP_NOIO to avoid circular locking dependency Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 12/19] scsi: ufs: core: Fix error return with query response Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 13/19] scsi: qla1280: Fix kernel oops when debug level > 2 Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 14/19] Revert "drm/amd/display: Use HW lock mgr for PSR1" Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 15/19] ACPI: resource: IRQ override for Eluktronics MECH-17 Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 16/19] smb: client: fix noisy when tree connecting to DFS interlink targets Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 17/19] alpha/elf: Fix misc/setarch test of util-linux by removing 32bit support Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 18/19] vboxsf: fix building with GCC 15 Sasha Levin
2025-02-11 1:30 ` [PATCH AUTOSEL 6.12 19/19] selftests: always check mask returned by statmount(2) Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250211013047.4096767-5-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=fdmanana@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=wqu@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox