linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: reiserfs: Remove unnecessary check of bh in remove_from_transaction()
@ 2019-07-27  8:40 Jia-Ju Bai
  2019-07-31  9:48 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2019-07-27  8:40 UTC (permalink / raw)
  To: jack, akpm, arnd, hariprasad.kelam, linux.bhar
  Cc: reiserfs-devel, linux-kernel, Jia-Ju Bai

On lines 3430-3434, bh has been assured to be non-null:
    cn = get_journal_hash_dev(sb, journal->j_hash_table, blocknr);
    if (!cn || !cn->bh) {
        return ret;
    }
    bh = cn->bh;

Thus, the check of bh on line 3447 is unnecessary and can be removed.
Thank Andrew Morton for good advice.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 fs/reiserfs/journal.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 4517a1394c6f..11155b8513db 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -3444,9 +3444,8 @@ static int remove_from_transaction(struct super_block *sb,
 	if (cn == journal->j_last) {
 		journal->j_last = cn->prev;
 	}
-	if (bh)
-		remove_journal_hash(sb, journal->j_hash_table, NULL,
-				    bh->b_blocknr, 0);
+	remove_journal_hash(sb, journal->j_hash_table, NULL,
+			    bh->b_blocknr, 0);
 	clear_buffer_journaled(bh);	/* don't log this one */
 
 	if (!already_cleaned) {
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs: reiserfs: Remove unnecessary check of bh in remove_from_transaction()
  2019-07-27  8:40 [PATCH] fs: reiserfs: Remove unnecessary check of bh in remove_from_transaction() Jia-Ju Bai
@ 2019-07-31  9:48 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2019-07-31  9:48 UTC (permalink / raw)
  To: Jia-Ju Bai
  Cc: jack, akpm, arnd, hariprasad.kelam, linux.bhar, reiserfs-devel,
	linux-kernel

On Sat 27-07-19 16:40:19, Jia-Ju Bai wrote:
> On lines 3430-3434, bh has been assured to be non-null:
>     cn = get_journal_hash_dev(sb, journal->j_hash_table, blocknr);
>     if (!cn || !cn->bh) {
>         return ret;
>     }
>     bh = cn->bh;
> 
> Thus, the check of bh on line 3447 is unnecessary and can be removed.
> Thank Andrew Morton for good advice.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>

Looks good to me. You can add:

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

								Honza

> ---
>  fs/reiserfs/journal.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
> index 4517a1394c6f..11155b8513db 100644
> --- a/fs/reiserfs/journal.c
> +++ b/fs/reiserfs/journal.c
> @@ -3444,9 +3444,8 @@ static int remove_from_transaction(struct super_block *sb,
>  	if (cn == journal->j_last) {
>  		journal->j_last = cn->prev;
>  	}
> -	if (bh)
> -		remove_journal_hash(sb, journal->j_hash_table, NULL,
> -				    bh->b_blocknr, 0);
> +	remove_journal_hash(sb, journal->j_hash_table, NULL,
> +			    bh->b_blocknr, 0);
>  	clear_buffer_journaled(bh);	/* don't log this one */
>  
>  	if (!already_cleaned) {
> -- 
> 2.17.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-31  9:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-27  8:40 [PATCH] fs: reiserfs: Remove unnecessary check of bh in remove_from_transaction() Jia-Ju Bai
2019-07-31  9:48 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).