aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-16 07:21:51 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-16 08:48:48 -0400
commit43e07073865ae540e3b463f437f0f837f17714ba (patch)
tree41d145642dd7e8dc3da4e94c075daee61a71867f /fs/ubifs
parent7c47bfd0dbb20e5d7fa4e37cfd76bb73d39b32b4 (diff)
UBIFS: simplify LEB recovery function further
Further simplify 'ubifs_recover_leb()' by noticing that we have to call 'clean_buf()' in any case, and it is fine to call it if the offset is aligned to 'c->min_io_size'. Thus, we do not have to call it separately from every "if" - just call it once at the end. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/recovery.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index 4d10b6e36ec4..74281f135b04 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -662,19 +662,13 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
662 } 662 }
663 663
664 if (ret == SCANNED_GARBAGE || ret == SCANNED_A_BAD_PAD_NODE) { 664 if (ret == SCANNED_GARBAGE || ret == SCANNED_A_BAD_PAD_NODE) {
665 if (is_last_write(c, buf, offs)) 665 if (!is_last_write(c, buf, offs))
666 clean_buf(c, &buf, lnum, &offs, &len);
667 else
668 goto corrupted_rescan; 666 goto corrupted_rescan;
669 } else if (ret == SCANNED_A_CORRUPT_NODE) { 667 } else if (ret == SCANNED_A_CORRUPT_NODE) {
670 if (no_more_nodes(c, buf, len, lnum, offs)) 668 if (!no_more_nodes(c, buf, len, lnum, offs))
671 clean_buf(c, &buf, lnum, &offs, &len);
672 else
673 goto corrupted_rescan; 669 goto corrupted_rescan;
674 } else if (!is_empty(buf, len)) { 670 } else if (!is_empty(buf, len)) {
675 if (is_last_write(c, buf, offs)) { 671 if (!is_last_write(c, buf, offs)) {
676 clean_buf(c, &buf, lnum, &offs, &len);
677 } else {
678 int corruption = first_non_ff(buf, len); 672 int corruption = first_non_ff(buf, len);
679 673
680 /* 674 /*
@@ -694,12 +688,9 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
694 if (grouped && drop_incomplete_group(sleb, &offs)) { 688 if (grouped && drop_incomplete_group(sleb, &offs)) {
695 buf = sbuf + offs; 689 buf = sbuf + offs;
696 len = c->leb_size - offs; 690 len = c->leb_size - offs;
697 clean_buf(c, &buf, lnum, &offs, &len);
698 } 691 }
699 692
700 if (offs % c->min_io_size) 693 clean_buf(c, &buf, lnum, &offs, &len);
701 clean_buf(c, &buf, lnum, &offs, &len);
702
703 ubifs_end_scan(c, sleb, lnum, offs); 694 ubifs_end_scan(c, sleb, lnum, offs);
704 695
705 err = fix_unclean_leb(c, sleb, start); 696 err = fix_unclean_leb(c, sleb, start);