aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/replay.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ubifs/replay.c')
-rw-r--r--fs/ubifs/replay.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c
index 3a2da7e476e5..eba46d4a7619 100644
--- a/fs/ubifs/replay.c
+++ b/fs/ubifs/replay.c
@@ -1007,7 +1007,7 @@ out:
1007 */ 1007 */
1008int ubifs_replay_journal(struct ubifs_info *c) 1008int ubifs_replay_journal(struct ubifs_info *c)
1009{ 1009{
1010 int err, i, lnum, offs, free; 1010 int err, lnum, free;
1011 1011
1012 BUILD_BUG_ON(UBIFS_TRUN_KEY > 5); 1012 BUILD_BUG_ON(UBIFS_TRUN_KEY > 5);
1013 1013
@@ -1025,25 +1025,17 @@ int ubifs_replay_journal(struct ubifs_info *c)
1025 dbg_mnt("start replaying the journal"); 1025 dbg_mnt("start replaying the journal");
1026 c->replaying = 1; 1026 c->replaying = 1;
1027 lnum = c->ltail_lnum = c->lhead_lnum; 1027 lnum = c->ltail_lnum = c->lhead_lnum;
1028 offs = c->lhead_offs;
1029 1028
1030 for (i = 0; i < c->log_lebs; i++, lnum++) { 1029 lnum = UBIFS_LOG_LNUM;
1031 if (lnum >= UBIFS_LOG_LNUM + c->log_lebs) { 1030 do {
1032 /* 1031 err = replay_log_leb(c, lnum, 0, c->sbuf);
1033 * The log is logically circular, we reached the last
1034 * LEB, switch to the first one.
1035 */
1036 lnum = UBIFS_LOG_LNUM;
1037 offs = 0;
1038 }
1039 err = replay_log_leb(c, lnum, offs, c->sbuf);
1040 if (err == 1) 1032 if (err == 1)
1041 /* We hit the end of the log */ 1033 /* We hit the end of the log */
1042 break; 1034 break;
1043 if (err) 1035 if (err)
1044 goto out; 1036 goto out;
1045 offs = 0; 1037 lnum = ubifs_next_log_lnum(c, lnum);
1046 } 1038 } while (lnum != UBIFS_LOG_LNUM);
1047 1039
1048 err = replay_buds(c); 1040 err = replay_buds(c);
1049 if (err) 1041 if (err)