diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-06 13:41:48 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-16 03:31:38 -0400 |
commit | 8ca5175b02b77178a70cbb9fd7020c4938e3d3a6 (patch) | |
tree | a29fbf5c89250ce62eb0c6e7099a18a1de5b46ca /fs/ubifs/lprops.c | |
parent | eaeee242c531cd4b0a4a46e8b5dd7ef504380c42 (diff) |
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>
Diffstat (limited to 'fs/ubifs/lprops.c')
-rw-r--r-- | fs/ubifs/lprops.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c index 0ee0847f2421..ce9fe3933d16 100644 --- a/fs/ubifs/lprops.c +++ b/fs/ubifs/lprops.c | |||
@@ -1100,32 +1100,26 @@ static int scan_check_cb(struct ubifs_info *c, | |||
1100 | goto out; | 1100 | goto out; |
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | /* | ||
1104 | * After an unclean unmount, empty and freeable LEBs | ||
1105 | * may contain garbage - do not scan them. | ||
1106 | */ | ||
1107 | if (lp->free == c->leb_size) { | ||
1108 | lst->empty_lebs += 1; | ||
1109 | lst->total_free += c->leb_size; | ||
1110 | lst->total_dark += ubifs_calc_dark(c, c->leb_size); | ||
1111 | return LPT_SCAN_CONTINUE; | ||
1112 | } | ||
1113 | if (lp->free + lp->dirty == c->leb_size && | ||
1114 | !(lp->flags & LPROPS_INDEX)) { | ||
1115 | lst->total_free += lp->free; | ||
1116 | lst->total_dirty += lp->dirty; | ||
1117 | lst->total_dark += ubifs_calc_dark(c, c->leb_size); | ||
1118 | return LPT_SCAN_CONTINUE; | ||
1119 | } | ||
1120 | |||
1103 | sleb = ubifs_scan(c, lnum, 0, buf, 0); | 1121 | sleb = ubifs_scan(c, lnum, 0, buf, 0); |
1104 | if (IS_ERR(sleb)) { | 1122 | if (IS_ERR(sleb)) { |
1105 | /* | ||
1106 | * After an unclean unmount, empty and freeable LEBs | ||
1107 | * may contain garbage. | ||
1108 | */ | ||
1109 | if (lp->free == c->leb_size) { | ||
1110 | ubifs_err("scan errors were in empty LEB " | ||
1111 | "- continuing checking"); | ||
1112 | lst->empty_lebs += 1; | ||
1113 | lst->total_free += c->leb_size; | ||
1114 | lst->total_dark += ubifs_calc_dark(c, c->leb_size); | ||
1115 | ret = LPT_SCAN_CONTINUE; | ||
1116 | goto exit; | ||
1117 | } | ||
1118 | |||
1119 | if (lp->free + lp->dirty == c->leb_size && | ||
1120 | !(lp->flags & LPROPS_INDEX)) { | ||
1121 | ubifs_err("scan errors were in freeable LEB " | ||
1122 | "- continuing checking"); | ||
1123 | lst->total_free += lp->free; | ||
1124 | lst->total_dirty += lp->dirty; | ||
1125 | lst->total_dark += ubifs_calc_dark(c, c->leb_size); | ||
1126 | ret = LPT_SCAN_CONTINUE; | ||
1127 | goto exit; | ||
1128 | } | ||
1129 | data->err = PTR_ERR(sleb); | 1123 | data->err = PTR_ERR(sleb); |
1130 | ret = LPT_SCAN_STOP; | 1124 | ret = LPT_SCAN_STOP; |
1131 | goto exit; | 1125 | goto exit; |