All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/2] btrfs: output more debug message for uncommitted transaction
Date: Mon, 3 Jan 2022 20:02:17 +0100	[thread overview]
Message-ID: <20220103190216.GR28560@twin.jikos.cz> (raw)
In-Reply-To: <20211216114736.69757-3-wqu@suse.com>

On Thu, Dec 16, 2021 at 07:47:36PM +0800, Qu Wenruo wrote:
> The extra info like how many dirty bytes this uncommitted transaction
> has can be very helpful.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

This does not depend on the first patch, so I'll apply that now.

> ---
>  fs/btrfs/disk-io.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 42 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 5c598e124c25..25e0248e3c55 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -4491,6 +4491,47 @@ int btrfs_commit_super(struct btrfs_fs_info *fs_info)
>  	return btrfs_commit_transaction(trans);
>  }
>  
> +static void warn_about_uncommitted_trans(struct btrfs_fs_info *fs_info)
> +{
> +	struct btrfs_transaction *trans;
> +	struct btrfs_transaction *tmp;
> +	bool found = false;
> +
> +	if (likely(list_empty(&fs_info->trans_list)))
> +		return;
> +
> +	/*
> +	 * This function is only called at the very end of close_ctree(),
> +	 * thus no other running transaction, no need to take trans_lock.
> +	 */

I've added an assert

	ASSERT(test_bit(BTRFS_FS_CLOSING_DONE, &fs_info->flags));

just in case somebody would use it as a warning function outside of the
close_tree context.

      reply	other threads:[~2022-01-03 19:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16 11:47 [PATCH 0/2] btrfs: bug fix for read-only scrub on read-only mount Qu Wenruo
2021-12-16 11:47 ` [PATCH 1/2] btrfs: don't start transaction for scrub if the fs is mounted read-only Qu Wenruo
2022-01-03 18:52   ` David Sterba
2022-01-03 23:52     ` Qu Wenruo
2022-01-04 18:40       ` David Sterba
2022-01-04 22:13         ` Qu Wenruo
2022-01-06 15:18           ` David Sterba
2021-12-16 11:47 ` [PATCH 2/2] btrfs: output more debug message for uncommitted transaction Qu Wenruo
2022-01-03 19:02   ` David Sterba [this message]

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=20220103190216.GR28560@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --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.