summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-06 20:41:48 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-05-16 10:31:38 +0300
commit8ca5175b02b77178a70cbb9fd7020c4938e3d3a6 (patch)
treea29fbf5c89250ce62eb0c6e7099a18a1de5b46ca
parenteaeee242c531cd4b0a4a46e8b5dd7ef504380c42 (diff)
downloadop-kernel-dev-8ca5175b02b77178a70cbb9fd7020c4938e3d3a6.zip
op-kernel-dev-8ca5175b02b77178a70cbb9fd7020c4938e3d3a6.tar.gz
UBIFS: improve debugging lprops scanning a little
When doing the lprops extra check ('dbg_check_lprops()') we scan whole media. We even scan empty and freeable LEBs which may contain garbage, which we handle after scanning. This patch teach the lprops checking function ('scan_check_cb()') to avoid scanning for free and freeable LEBs and save time. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--fs/ubifs/lprops.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c
index 0ee0847..ce9fe39 100644
--- a/fs/ubifs/lprops.c
+++ b/fs/ubifs/lprops.c
@@ -1100,32 +1100,26 @@ static int scan_check_cb(struct ubifs_info *c,
goto out;
}
+ /*
+ * After an unclean unmount, empty and freeable LEBs
+ * may contain garbage - do not scan them.
+ */
+ if (lp->free == c->leb_size) {
+ lst->empty_lebs += 1;
+ lst->total_free += c->leb_size;
+ lst->total_dark += ubifs_calc_dark(c, c->leb_size);
+ return LPT_SCAN_CONTINUE;
+ }
+ if (lp->free + lp->dirty == c->leb_size &&
+ !(lp->flags & LPROPS_INDEX)) {
+ lst->total_free += lp->free;
+ lst->total_dirty += lp->dirty;
+ lst->total_dark += ubifs_calc_dark(c, c->leb_size);
+ return LPT_SCAN_CONTINUE;
+ }
+
sleb = ubifs_scan(c, lnum, 0, buf, 0);
if (IS_ERR(sleb)) {
- /*
- * After an unclean unmount, empty and freeable LEBs
- * may contain garbage.
- */
- if (lp->free == c->leb_size) {
- ubifs_err("scan errors were in empty LEB "
- "- continuing checking");
- lst->empty_lebs += 1;
- lst->total_free += c->leb_size;
- lst->total_dark += ubifs_calc_dark(c, c->leb_size);
- ret = LPT_SCAN_CONTINUE;
- goto exit;
- }
-
- if (lp->free + lp->dirty == c->leb_size &&
- !(lp->flags & LPROPS_INDEX)) {
- ubifs_err("scan errors were in freeable LEB "
- "- continuing checking");
- lst->total_free += lp->free;
- lst->total_dirty += lp->dirty;
- lst->total_dark += ubifs_calc_dark(c, c->leb_size);
- ret = LPT_SCAN_CONTINUE;
- goto exit;
- }
data->err = PTR_ERR(sleb);
ret = LPT_SCAN_STOP;
goto exit;
OpenPOWER on IntegriCloud