All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Burkov <boris@bur.io>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 5/7] btrfs: free pertrans at end of cleanup_transaction
Date: Tue, 26 Mar 2024 14:39:39 -0700	[thread overview]
Message-ID: <1697680236677896913e26948a76a2dd01dad235.1711488980.git.boris@bur.io> (raw)
In-Reply-To: <cover.1711488980.git.boris@bur.io>

Some of the operations after the free might convert more pertrans
metadata. Do the freeing as late as possible to eliminate a source of
leaked pertrans metadata.

Helps with the pass rate of generic/269 and generic/475.

Signed-off-by: Boris Burkov <boris@bur.io>
---
 fs/btrfs/disk-io.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 3df5477d48a8..4d7893cc0d4e 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -4850,8 +4850,6 @@ void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans,
 				     EXTENT_DIRTY);
 	btrfs_destroy_pinned_extent(fs_info, &cur_trans->pinned_extents);
 
-	btrfs_free_all_qgroup_pertrans(fs_info);
-
 	cur_trans->state =TRANS_STATE_COMPLETED;
 	wake_up(&cur_trans->commit_wait);
 }
@@ -4904,6 +4902,7 @@ static int btrfs_cleanup_transaction(struct btrfs_fs_info *fs_info)
 	btrfs_assert_delayed_root_empty(fs_info);
 	btrfs_destroy_all_delalloc_inodes(fs_info);
 	btrfs_drop_all_logs(fs_info);
+	btrfs_free_all_qgroup_pertrans(fs_info);
 	mutex_unlock(&fs_info->transaction_kthread_mutex);
 
 	return 0;
-- 
2.44.0


  parent reply	other threads:[~2024-03-26 21:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 21:39 [PATCH 0/7] btrfs: various qg meta rsv leak fixes Boris Burkov
2024-03-26 21:39 ` [PATCH 1/7] btrfs: correctly model root qgroup rsv in convert Boris Burkov
2024-03-26 22:00   ` Qu Wenruo
2024-03-27 17:20     ` Boris Burkov
2024-03-27 19:35       ` Qu Wenruo
2024-03-26 21:39 ` [PATCH 2/7] btrfs: fix qgroup prealloc rsv leak in subvolume operations Boris Burkov
2024-03-26 22:07   ` Qu Wenruo
2024-03-26 21:39 ` [PATCH 3/7] btrfs: record delayed inode root in transaction Boris Burkov
2024-03-26 22:08   ` Qu Wenruo
2024-03-27 17:21     ` Boris Burkov
2024-03-26 21:39 ` [PATCH 4/7] btrfs: convert PREALLOC to PERTRANS after record_root_in_trans Boris Burkov
2024-03-26 22:12   ` Qu Wenruo
2024-03-26 21:39 ` Boris Burkov [this message]
2024-03-26 22:16   ` [PATCH 5/7] btrfs: free pertrans at end of cleanup_transaction Qu Wenruo
2024-03-27 17:22     ` Boris Burkov
2024-03-27 19:51       ` Qu Wenruo
2024-03-26 21:39 ` [PATCH 6/7] btrfs: btrfs_clear_delalloc_extent frees rsv Boris Burkov
2024-03-26 22:26   ` Qu Wenruo
2024-03-27 17:26     ` Boris Burkov
2024-03-27 19:39       ` Qu Wenruo
2024-03-26 21:39 ` [PATCH 7/7] btrfs: always clear meta pertrans during commit Boris Burkov
2024-03-26 22:20   ` Qu Wenruo

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=1697680236677896913e26948a76a2dd01dad235.1711488980.git.boris@bur.io \
    --to=boris@bur.io \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.