Skip to contentSkip to conversation

fs: reiserfs: Remove unnecessary check of bh in remove_from_transaction()

PATCH In review Jia-Ju Bai 2 participants 2 messages Jul 27, 2019 – Jul 31, 2019

lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

PATCH 1/1 fs: reiserfs: Remove unnecessary check of bh in remove_from_transaction()

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.

---
 fs/reiserfs/journal.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/reiserfs/journal.c +2 -3
index 4517a1394c6f..11155b8513db 100644
@@ -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) {
Signature · 1 line
2.17.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · 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.

Looks good to me. You can add:

Honza

Quoted 23 lines
---
 fs/reiserfs/journal.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/reiserfs/journal.c +2 -3
index 4517a1394c6f..11155b8513db 100644
@@ -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) {
Signature · 1 line
2.17.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR