UBIFS: run debugging checks only if they are enabled

Do not forget to check whether lpt debugging is enabled before
running the check functions. This commit also makes some spelling
fixes.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
Artem Bityutskiy 2008-10-31 11:42:18 +02:00
parent 552ff3179d
commit 45e12d901f
2 changed files with 10 additions and 2 deletions

View File

@ -36,7 +36,7 @@
* can be written into a single eraseblock. In that case, garbage collection * can be written into a single eraseblock. In that case, garbage collection
* consists of just writing the whole table, which therefore makes all other * consists of just writing the whole table, which therefore makes all other
* eraseblocks reusable. In the case of the big model, dirty eraseblocks are * eraseblocks reusable. In the case of the big model, dirty eraseblocks are
* selected for garbage collection, which consists are marking the nodes in * selected for garbage collection, which consists of marking the clean nodes in
* that LEB as dirty, and then only the dirty nodes are written out. Also, in * that LEB as dirty, and then only the dirty nodes are written out. Also, in
* the case of the big model, a table of LEB numbers is saved so that the entire * the case of the big model, a table of LEB numbers is saved so that the entire
* LPT does not to be scanned looking for empty eraseblocks when UBIFS is first * LPT does not to be scanned looking for empty eraseblocks when UBIFS is first
@ -156,7 +156,6 @@ int ubifs_calc_lpt_geom(struct ubifs_info *c)
} }
c->check_lpt_free = c->big_lpt; c->check_lpt_free = c->big_lpt;
return 0; return 0;
} }

View File

@ -1604,6 +1604,9 @@ static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum)
int ret; int ret;
void *buf = c->dbg->buf; void *buf = c->dbg->buf;
if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS))
return 0;
dbg_lp("LEB %d", lnum); dbg_lp("LEB %d", lnum);
err = ubi_read(c->ubi, lnum, buf, 0, c->leb_size); err = ubi_read(c->ubi, lnum, buf, 0, c->leb_size);
if (err) { if (err) {
@ -1704,6 +1707,9 @@ int dbg_chk_lpt_free_spc(struct ubifs_info *c)
long long free = 0; long long free = 0;
int i; int i;
if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS))
return 0;
for (i = 0; i < c->lpt_lebs; i++) { for (i = 0; i < c->lpt_lebs; i++) {
if (c->ltab[i].tgc || c->ltab[i].cmt) if (c->ltab[i].tgc || c->ltab[i].cmt)
continue; continue;
@ -1735,6 +1741,9 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len)
long long chk_lpt_sz, lpt_sz; long long chk_lpt_sz, lpt_sz;
int err = 0; int err = 0;
if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS))
return 0;
switch (action) { switch (action) {
case 0: case 0:
d->chk_lpt_sz = 0; d->chk_lpt_sz = 0;