Skip to content

Commit 22d26f9

Browse files
Ye Bintytso
authored andcommitted
jbd2: remove the 'success' parameter from the jbd2_do_replay() function
Keep 'success' internally to track if any error happened and then return it at the end in do_one_pass(). If jbd2_do_replay() return -ENOMEM then stop replay journal. Signed-off-by: Ye Bin <[email protected]> Reviewed-by: Zhang Yi <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 0f67827 commit 22d26f9

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

fs/jbd2/recovery.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -489,12 +489,11 @@ static __always_inline int jbd2_do_replay(journal_t *journal,
489489
struct recovery_info *info,
490490
struct buffer_head *bh,
491491
unsigned long *next_log_block,
492-
unsigned int next_commit_ID,
493-
int *success)
492+
unsigned int next_commit_ID)
494493
{
495494
char *tagp;
496495
int flags;
497-
int err;
496+
int ret = 0;
498497
int tag_bytes = journal_tag_bytes(journal);
499498
int descr_csum_size = 0;
500499
unsigned long io_block;
@@ -508,6 +507,7 @@ static __always_inline int jbd2_do_replay(journal_t *journal,
508507
tagp = &bh->b_data[sizeof(journal_header_t)];
509508
while (tagp - bh->b_data + tag_bytes <=
510509
journal->j_blocksize - descr_csum_size) {
510+
int err;
511511

512512
memcpy(&tag, tagp, sizeof(tag));
513513
flags = be16_to_cpu(tag.t_flags);
@@ -517,7 +517,7 @@ static __always_inline int jbd2_do_replay(journal_t *journal,
517517
err = jread(&obh, journal, io_block);
518518
if (err) {
519519
/* Recover what we can, but report failure at the end. */
520-
*success = err;
520+
ret = err;
521521
pr_err("JBD2: IO error %d recovering block %lu in log\n",
522522
err, io_block);
523523
} else {
@@ -539,7 +539,7 @@ static __always_inline int jbd2_do_replay(journal_t *journal,
539539
(journal_block_tag3_t *)tagp,
540540
obh->b_data, next_commit_ID)) {
541541
brelse(obh);
542-
*success = -EFSBADCRC;
542+
ret = -EFSBADCRC;
543543
pr_err("JBD2: Invalid checksum recovering data block %llu in journal block %lu\n",
544544
blocknr, io_block);
545545
goto skip_write;
@@ -580,7 +580,7 @@ static __always_inline int jbd2_do_replay(journal_t *journal,
580580
break;
581581
}
582582

583-
return 0;
583+
return ret;
584584
}
585585

586586
static int do_one_pass(journal_t *journal,
@@ -719,9 +719,12 @@ static int do_one_pass(journal_t *journal,
719719
* done here!
720720
*/
721721
err = jbd2_do_replay(journal, info, bh, &next_log_block,
722-
next_commit_ID, &success);
723-
if (err)
724-
goto failed;
722+
next_commit_ID);
723+
if (err) {
724+
if (err == -ENOMEM)
725+
goto failed;
726+
success = err;
727+
}
725728

726729
continue;
727730

0 commit comments

Comments
 (0)