All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Burkov <boris@bur.io>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 5/7] btrfs: free pertrans at end of cleanup_transaction
Date: Wed, 27 Mar 2024 10:22:34 -0700	[thread overview]
Message-ID: <20240327172234.GC2470028@zen.localdomain> (raw)
In-Reply-To: <78f3a17b-4b74-4b8e-b7c9-fa8a5eaecefe@suse.com>

On Wed, Mar 27, 2024 at 08:46:39AM +1030, Qu Wenruo wrote:
> 
> 
> 在 2024/3/27 08:09, Boris Burkov 写道:
> > 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>
> 
> Well, you can also move other fs level cleanup out of the
> btrfs_cleanup_one_transaction() call.
> (e.g. destory_delayed_inodes()).
> 
> For qgroup part, it looks fine to me as a precautious behavior.

Since the call isn't per transaction, do you think it just makes more
sense to call it once per cleanup not once per trans per cleanup?

Or would you rather I refactored it some other way?

> 
> Thanks,
> Qu
> 
> > ---
> >   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;

  reply	other threads:[~2024-03-27 17:20 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 ` [PATCH 5/7] btrfs: free pertrans at end of cleanup_transaction Boris Burkov
2024-03-26 22:16   ` Qu Wenruo
2024-03-27 17:22     ` Boris Burkov [this message]
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=20240327172234.GC2470028@zen.localdomain \
    --to=boris@bur.io \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@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 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.