aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/recovery.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index 093a1ecb700f..fe7af9f676b0 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -357,11 +357,7 @@ static int is_last_write(const struct ubifs_info *c, void *buf, int offs)
357 empty_offs = ALIGN(offs + 1, c->min_io_size); 357 empty_offs = ALIGN(offs + 1, c->min_io_size);
358 check_len = c->leb_size - empty_offs; 358 check_len = c->leb_size - empty_offs;
359 p = buf + empty_offs - offs; 359 p = buf + empty_offs - offs;
360 360 return is_empty(p, check_len);
361 for (; check_len > 0; check_len--)
362 if (*p++ != 0xff)
363 return 0;
364 return 1;
365} 361}
366 362
367/** 363/**
@@ -814,7 +810,7 @@ struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum,
814static int recover_head(const struct ubifs_info *c, int lnum, int offs, 810static int recover_head(const struct ubifs_info *c, int lnum, int offs,
815 void *sbuf) 811 void *sbuf)
816{ 812{
817 int len, err, need_clean = 0; 813 int len, err;
818 814
819 if (c->min_io_size > 1) 815 if (c->min_io_size > 1)
820 len = c->min_io_size; 816 len = c->min_io_size;
@@ -828,19 +824,7 @@ static int recover_head(const struct ubifs_info *c, int lnum, int offs,
828 824
829 /* Read at the head location and check it is empty flash */ 825 /* Read at the head location and check it is empty flash */
830 err = ubi_read(c->ubi, lnum, sbuf, offs, len); 826 err = ubi_read(c->ubi, lnum, sbuf, offs, len);
831 if (err) 827 if (err || !is_empty(sbuf, len)) {
832 need_clean = 1;
833 else {
834 uint8_t *p = sbuf;
835
836 while (len--)
837 if (*p++ != 0xff) {
838 need_clean = 1;
839 break;
840 }
841 }
842
843 if (need_clean) {
844 dbg_rcvry("cleaning head at %d:%d", lnum, offs); 828 dbg_rcvry("cleaning head at %d:%d", lnum, offs);
845 if (offs == 0) 829 if (offs == 0)
846 return ubifs_leb_unmap(c, lnum); 830 return ubifs_leb_unmap(c, lnum);