lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230606075627.a7ae6vjy5q2svrud@quack3>
Date:   Tue, 6 Jun 2023 09:56:27 +0200
From:   Jan Kara <jack@...e.cz>
To:     Zhang Yi <yi.zhang@...weicloud.com>
Cc:     linux-ext4@...r.kernel.org, tytso@....edu,
        adilger.kernel@...ger.ca, jack@...e.cz, yi.zhang@...wei.com,
        yukuai3@...wei.com, chengzhihao1@...wei.com
Subject: Re: [PATCH v2 6/6] jbd2: remove __journal_try_to_free_buffer()

On Tue 06-06-23 14:14:47, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@...wei.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@...wei.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.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@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ