public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Zhang Yi <yi.zhang@huaweicloud.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu,
	adilger.kernel@dilger.ca, jack@suse.cz, yi.zhang@huawei.com,
	yukuai3@huawei.com, chengzhihao1@huawei.com
Subject: Re: [PATCH v2 6/6] jbd2: remove __journal_try_to_free_buffer()
Date: Tue, 6 Jun 2023 09:56:27 +0200	[thread overview]
Message-ID: <20230606075627.a7ae6vjy5q2svrud@quack3> (raw)
In-Reply-To: <20230606061447.1125036-7-yi.zhang@huaweicloud.com>

On Tue 06-06-23 14:14:47, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@huawei.com>
> 
> __journal_try_to_free_buffer() has only one caller and it's logic is
> much simple now, so just remove it and open code in
> jbd2_journal_try_to_free_buffers().
> 
> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/jbd2/transaction.c | 31 +++++++------------------------
>  1 file changed, 7 insertions(+), 24 deletions(-)
> 
> diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
> index 6ef5022949c4..4d1fda1f7143 100644
> --- a/fs/jbd2/transaction.c
> +++ b/fs/jbd2/transaction.c
> @@ -2099,29 +2099,6 @@ void jbd2_journal_unfile_buffer(journal_t *journal, struct journal_head *jh)
>  	__brelse(bh);
>  }
>  
> -/*
> - * Called from jbd2_journal_try_to_free_buffers().
> - *
> - * Called under jh->b_state_lock
> - */
> -static void
> -__journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh)
> -{
> -	struct journal_head *jh;
> -
> -	jh = bh2jh(bh);
> -
> -	if (jh->b_next_transaction != NULL || jh->b_transaction != NULL)
> -		return;
> -
> -	spin_lock(&journal->j_list_lock);
> -	/* Remove written-back checkpointed metadata buffer */
> -	if (jh->b_cp_transaction != NULL)
> -		jbd2_journal_try_remove_checkpoint(jh);
> -	spin_unlock(&journal->j_list_lock);
> -	return;
> -}
> -
>  /**
>   * jbd2_journal_try_to_free_buffers() - try to free page buffers.
>   * @journal: journal for operation
> @@ -2179,7 +2156,13 @@ bool jbd2_journal_try_to_free_buffers(journal_t *journal, struct folio *folio)
>  			continue;
>  
>  		spin_lock(&jh->b_state_lock);
> -		__journal_try_to_free_buffer(journal, bh);
> +		if (!jh->b_transaction && !jh->b_next_transaction) {
> +			spin_lock(&journal->j_list_lock);
> +			/* Remove written-back checkpointed metadata buffer */
> +			if (jh->b_cp_transaction != NULL)
> +				jbd2_journal_try_remove_checkpoint(jh);
> +			spin_unlock(&journal->j_list_lock);
> +		}
>  		spin_unlock(&jh->b_state_lock);
>  		jbd2_journal_put_journal_head(jh);
>  		if (buffer_jbd(bh))
> -- 
> 2.31.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      reply	other threads:[~2023-06-06  7:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06  6:14 [PATCH v2 0/6] jbd2: fix several checkpoint inconsistent issues Zhang Yi
2023-06-06  6:14 ` [PATCH v2 1/6] jbd2: recheck chechpointing non-dirty buffer Zhang Yi
2023-06-06  6:14 ` [PATCH v2 2/6] jbd2: remove t_checkpoint_io_list Zhang Yi
2023-06-06  6:14 ` [PATCH v2 3/6] jbd2: remove journal_clean_one_cp_list() Zhang Yi
2023-06-06  7:46   ` Jan Kara
2023-06-06 13:58     ` Zhang Yi
2023-06-06  6:14 ` [PATCH v2 4/6] jbd2: Fix wrongly judgement for buffer head removing while doing checkpoint Zhang Yi
2023-06-06  8:01   ` Jan Kara
2023-06-06  6:14 ` [PATCH v2 5/6] jbd2: fix a race when checking checkpoint buffer busy Zhang Yi
2023-06-06  7:59   ` Jan Kara
2023-06-06  6:14 ` [PATCH v2 6/6] jbd2: remove __journal_try_to_free_buffer() Zhang Yi
2023-06-06  7:56   ` Jan Kara [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=20230606075627.a7ae6vjy5q2svrud@quack3 \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=chengzhihao1@huawei.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.com \
    --cc=yi.zhang@huaweicloud.com \
    --cc=yukuai3@huawei.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