ubifs: Enable journal replay during mount
Enable ubifs_replay_journal during mount_ubifs, which was
disabled before.
This commit fix an issue with unrecoverable ubifs volumes
after power cut.
Therefor the gc.c is imported now from 1860e37 Linux 3.15
hs: added SPDX-License-Identifier for fs/ubifs/gc.c
Signed-off-by: Anton Habegger <anton.habegger@gmail.com>
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 01d449a..10f8fff 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1049,7 +1049,6 @@
c->orph_buf = NULL;
}
-#ifndef __UBOOT__
/**
* free_buds - free per-bud objects.
* @c: UBIFS file-system description object
@@ -1061,7 +1060,6 @@
rbtree_postorder_for_each_entry_safe(bud, n, &c->buds, rb)
kfree(bud);
}
-#endif
/**
* check_volume_empty - check if the UBI volume is empty.
@@ -1242,6 +1240,7 @@
return 0;
}
+#endif
/**
* destroy_journal - destroy journal data structures.
@@ -1272,7 +1271,6 @@
ubifs_tnc_close(c);
free_buds(c);
}
-#endif
/**
* bu_init - initialize bulk-read information.
@@ -1502,11 +1500,9 @@
if (err)
goto out_lpt;
-#ifndef __UBOOT__
err = ubifs_replay_journal(c);
if (err)
goto out_journal;
-#endif
/* Calculate 'min_idx_lebs' after journal replay */
c->bi.min_idx_lebs = ubifs_calc_min_idx_lebs(c);
@@ -1678,10 +1674,8 @@
spin_unlock(&ubifs_infos_lock);
out_orphans:
free_orphans(c);
-#ifndef __UBOOT__
out_journal:
destroy_journal(c);
-#endif
out_lpt:
ubifs_lpt_free(c, 0);
out_master: