UBIFS: add a commentary about log recovery
Add a commentary which elaborates that 'ubifs_recover_log_leb()' recovers only the last log LEB, not any. Also remove some unneeded newlines. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
Родитель
54dd55a406
Коммит
7d08ae3c92
|
@ -772,7 +772,8 @@ out_free:
|
||||||
* @sbuf: LEB-sized buffer to use
|
* @sbuf: LEB-sized buffer to use
|
||||||
*
|
*
|
||||||
* This function does a scan of a LEB, but caters for errors that might have
|
* This function does a scan of a LEB, but caters for errors that might have
|
||||||
* been caused by the unclean unmount from which we are attempting to recover.
|
* been caused by unclean reboots from which we are attempting to recover
|
||||||
|
* (assume that only the last log LEB can be corrupted by an unclean reboot).
|
||||||
*
|
*
|
||||||
* This function returns %0 on success and a negative error code on failure.
|
* This function returns %0 on success and a negative error code on failure.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -839,6 +839,11 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf)
|
||||||
if (IS_ERR(sleb)) {
|
if (IS_ERR(sleb)) {
|
||||||
if (PTR_ERR(sleb) != -EUCLEAN || !c->need_recovery)
|
if (PTR_ERR(sleb) != -EUCLEAN || !c->need_recovery)
|
||||||
return PTR_ERR(sleb);
|
return PTR_ERR(sleb);
|
||||||
|
/*
|
||||||
|
* Note, the below function will recover this log LEB only if
|
||||||
|
* it is the last, because unclean reboots can possibly corrupt
|
||||||
|
* only the tail of the log.
|
||||||
|
*/
|
||||||
sleb = ubifs_recover_log_leb(c, lnum, offs, sbuf);
|
sleb = ubifs_recover_log_leb(c, lnum, offs, sbuf);
|
||||||
if (IS_ERR(sleb))
|
if (IS_ERR(sleb))
|
||||||
return PTR_ERR(sleb);
|
return PTR_ERR(sleb);
|
||||||
|
@ -850,7 +855,6 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
node = sleb->buf;
|
node = sleb->buf;
|
||||||
|
|
||||||
snod = list_entry(sleb->nodes.next, struct ubifs_scan_node, list);
|
snod = list_entry(sleb->nodes.next, struct ubifs_scan_node, list);
|
||||||
if (c->cs_sqnum == 0) {
|
if (c->cs_sqnum == 0) {
|
||||||
/*
|
/*
|
||||||
|
@ -897,7 +901,6 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
list_for_each_entry(snod, &sleb->nodes, list) {
|
list_for_each_entry(snod, &sleb->nodes, list) {
|
||||||
|
|
||||||
cond_resched();
|
cond_resched();
|
||||||
|
|
||||||
if (snod->sqnum >= SQNUM_WATERMARK) {
|
if (snod->sqnum >= SQNUM_WATERMARK) {
|
||||||
|
@ -1030,9 +1033,7 @@ int ubifs_replay_journal(struct ubifs_info *c)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
dbg_mnt("start replaying the journal");
|
dbg_mnt("start replaying the journal");
|
||||||
|
|
||||||
c->replaying = 1;
|
c->replaying = 1;
|
||||||
|
|
||||||
lnum = c->ltail_lnum = c->lhead_lnum;
|
lnum = c->ltail_lnum = c->lhead_lnum;
|
||||||
offs = c->lhead_offs;
|
offs = c->lhead_offs;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче