Commit a6aae4dd authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBIFS: get rid of dbg_err

This patch removes the 'dbg_err()' macro and we now use 'ubifs_err()' instead.
The idea of 'dbg_err()' was to compile out some error message to make the
binary a bit smaller - but I think it was a bad idea.
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
parent f70b7e52
...@@ -716,13 +716,13 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot) ...@@ -716,13 +716,13 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot)
return 0; return 0;
out_dump: out_dump:
dbg_err("dumping index node (iip=%d)", i->iip); ubifs_err("dumping index node (iip=%d)", i->iip);
ubifs_dump_node(c, idx); ubifs_dump_node(c, idx);
list_del(&i->list); list_del(&i->list);
kfree(i); kfree(i);
if (!list_empty(&list)) { if (!list_empty(&list)) {
i = list_entry(list.prev, struct idx_node, list); i = list_entry(list.prev, struct idx_node, list);
dbg_err("dumping parent index node"); ubifs_err("dumping parent index node");
ubifs_dump_node(c, &i->idx); ubifs_dump_node(c, &i->idx);
} }
out_free: out_free:
......
...@@ -1285,10 +1285,10 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1, ...@@ -1285,10 +1285,10 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1,
err = 1; err = 1;
key_read(c, &dent1->key, &key); key_read(c, &dent1->key, &key);
if (keys_cmp(c, &zbr1->key, &key)) { if (keys_cmp(c, &zbr1->key, &key)) {
dbg_err("1st entry at %d:%d has key %s", zbr1->lnum, ubifs_err("1st entry at %d:%d has key %s", zbr1->lnum,
zbr1->offs, dbg_snprintf_key(c, &key, key_buf, zbr1->offs, dbg_snprintf_key(c, &key, key_buf,
DBG_KEY_BUF_LEN)); DBG_KEY_BUF_LEN));
dbg_err("but it should have key %s according to tnc", ubifs_err("but it should have key %s according to tnc",
dbg_snprintf_key(c, &zbr1->key, key_buf, dbg_snprintf_key(c, &zbr1->key, key_buf,
DBG_KEY_BUF_LEN)); DBG_KEY_BUF_LEN));
ubifs_dump_node(c, dent1); ubifs_dump_node(c, dent1);
...@@ -1297,10 +1297,10 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1, ...@@ -1297,10 +1297,10 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1,
key_read(c, &dent2->key, &key); key_read(c, &dent2->key, &key);
if (keys_cmp(c, &zbr2->key, &key)) { if (keys_cmp(c, &zbr2->key, &key)) {
dbg_err("2nd entry at %d:%d has key %s", zbr1->lnum, ubifs_err("2nd entry at %d:%d has key %s", zbr1->lnum,
zbr1->offs, dbg_snprintf_key(c, &key, key_buf, zbr1->offs, dbg_snprintf_key(c, &key, key_buf,
DBG_KEY_BUF_LEN)); DBG_KEY_BUF_LEN));
dbg_err("but it should have key %s according to tnc", ubifs_err("but it should have key %s according to tnc",
dbg_snprintf_key(c, &zbr2->key, key_buf, dbg_snprintf_key(c, &zbr2->key, key_buf,
DBG_KEY_BUF_LEN)); DBG_KEY_BUF_LEN));
ubifs_dump_node(c, dent2); ubifs_dump_node(c, dent2);
...@@ -1316,9 +1316,9 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1, ...@@ -1316,9 +1316,9 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1,
goto out_free; goto out_free;
} }
if (cmp == 0 && nlen1 == nlen2) if (cmp == 0 && nlen1 == nlen2)
dbg_err("2 xent/dent nodes with the same name"); ubifs_err("2 xent/dent nodes with the same name");
else else
dbg_err("bad order of colliding key %s", ubifs_err("bad order of colliding key %s",
dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN));
ubifs_msg("first node at %d:%d\n", zbr1->lnum, zbr1->offs); ubifs_msg("first node at %d:%d\n", zbr1->lnum, zbr1->offs);
......
...@@ -159,10 +159,6 @@ struct ubifs_global_debug_info { ...@@ -159,10 +159,6 @@ struct ubifs_global_debug_info {
} \ } \
} while (0) } while (0)
#define dbg_err(fmt, ...) do { \
ubifs_err(fmt, ##__VA_ARGS__); \
} while (0)
#define ubifs_dbg_msg(type, fmt, ...) \ #define ubifs_dbg_msg(type, fmt, ...) \
pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__) pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__)
......
...@@ -2094,7 +2094,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, ...@@ -2094,7 +2094,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
int i; int i;
if (pnode->num != col) { if (pnode->num != col) {
dbg_err("pnode num %d expected %d parent num %d iip %d", ubifs_err("pnode num %d expected %d parent num %d iip %d",
pnode->num, col, pnode->parent->num, pnode->iip); pnode->num, col, pnode->parent->num, pnode->iip);
return -EINVAL; return -EINVAL;
} }
...@@ -2109,13 +2109,13 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, ...@@ -2109,13 +2109,13 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
if (lnum >= c->leb_cnt) if (lnum >= c->leb_cnt)
continue; continue;
if (lprops->lnum != lnum) { if (lprops->lnum != lnum) {
dbg_err("bad LEB number %d expected %d", ubifs_err("bad LEB number %d expected %d",
lprops->lnum, lnum); lprops->lnum, lnum);
return -EINVAL; return -EINVAL;
} }
if (lprops->flags & LPROPS_TAKEN) { if (lprops->flags & LPROPS_TAKEN) {
if (cat != LPROPS_UNCAT) { if (cat != LPROPS_UNCAT) {
dbg_err("LEB %d taken but not uncat %d", ubifs_err("LEB %d taken but not uncat %d",
lprops->lnum, cat); lprops->lnum, cat);
return -EINVAL; return -EINVAL;
} }
...@@ -2128,7 +2128,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, ...@@ -2128,7 +2128,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
case LPROPS_FRDI_IDX: case LPROPS_FRDI_IDX:
break; break;
default: default:
dbg_err("LEB %d index but cat %d", ubifs_err("LEB %d index but cat %d",
lprops->lnum, cat); lprops->lnum, cat);
return -EINVAL; return -EINVAL;
} }
...@@ -2141,7 +2141,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, ...@@ -2141,7 +2141,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
case LPROPS_FREEABLE: case LPROPS_FREEABLE:
break; break;
default: default:
dbg_err("LEB %d not index but cat %d", ubifs_err("LEB %d not index but cat %d",
lprops->lnum, cat); lprops->lnum, cat);
return -EINVAL; return -EINVAL;
} }
...@@ -2182,14 +2182,14 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, ...@@ -2182,14 +2182,14 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
break; break;
} }
if (!found) { if (!found) {
dbg_err("LEB %d cat %d not found in cat heap/list", ubifs_err("LEB %d cat %d not found in cat heap/list",
lprops->lnum, cat); lprops->lnum, cat);
return -EINVAL; return -EINVAL;
} }
switch (cat) { switch (cat) {
case LPROPS_EMPTY: case LPROPS_EMPTY:
if (lprops->free != c->leb_size) { if (lprops->free != c->leb_size) {
dbg_err("LEB %d cat %d free %d dirty %d", ubifs_err("LEB %d cat %d free %d dirty %d",
lprops->lnum, cat, lprops->free, lprops->lnum, cat, lprops->free,
lprops->dirty); lprops->dirty);
return -EINVAL; return -EINVAL;
...@@ -2197,7 +2197,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, ...@@ -2197,7 +2197,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
case LPROPS_FREEABLE: case LPROPS_FREEABLE:
case LPROPS_FRDI_IDX: case LPROPS_FRDI_IDX:
if (lprops->free + lprops->dirty != c->leb_size) { if (lprops->free + lprops->dirty != c->leb_size) {
dbg_err("LEB %d cat %d free %d dirty %d", ubifs_err("LEB %d cat %d free %d dirty %d",
lprops->lnum, cat, lprops->free, lprops->lnum, cat, lprops->free,
lprops->dirty); lprops->dirty);
return -EINVAL; return -EINVAL;
...@@ -2233,8 +2233,9 @@ int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode, ...@@ -2233,8 +2233,9 @@ int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode,
/* cnode is a nnode */ /* cnode is a nnode */
num = calc_nnode_num(row, col); num = calc_nnode_num(row, col);
if (cnode->num != num) { if (cnode->num != num) {
dbg_err("nnode num %d expected %d " ubifs_err("nnode num %d expected %d "
"parent num %d iip %d", cnode->num, num, "parent num %d iip %d",
cnode->num, num,
(nnode ? nnode->num : 0), cnode->iip); (nnode ? nnode->num : 0), cnode->iip);
return -EINVAL; return -EINVAL;
} }
......
...@@ -320,8 +320,7 @@ static int layout_cnodes(struct ubifs_info *c) ...@@ -320,8 +320,7 @@ static int layout_cnodes(struct ubifs_info *c)
return 0; return 0;
no_space: no_space:
ubifs_err("LPT out of space"); ubifs_err("LPT out of space at LEB %d:%d needing %d, done_ltab %d, "
dbg_err("LPT out of space at LEB %d:%d needing %d, done_ltab %d, "
"done_lsave %d", lnum, offs, len, done_ltab, done_lsave); "done_lsave %d", lnum, offs, len, done_ltab, done_lsave);
ubifs_dump_lpt_info(c); ubifs_dump_lpt_info(c);
ubifs_dump_lpt_lebs(c); ubifs_dump_lpt_lebs(c);
...@@ -548,8 +547,7 @@ static int write_cnodes(struct ubifs_info *c) ...@@ -548,8 +547,7 @@ static int write_cnodes(struct ubifs_info *c)
return 0; return 0;
no_space: no_space:
ubifs_err("LPT out of space mismatch"); ubifs_err("LPT out of space mismatch at LEB %d:%d needing %d, done_ltab "
dbg_err("LPT out of space mismatch at LEB %d:%d needing %d, done_ltab "
"%d, done_lsave %d", lnum, offs, len, done_ltab, done_lsave); "%d, done_lsave %d", lnum, offs, len, done_ltab, done_lsave);
ubifs_dump_lpt_info(c); ubifs_dump_lpt_info(c);
ubifs_dump_lpt_lebs(c); ubifs_dump_lpt_lebs(c);
...@@ -1733,7 +1731,7 @@ int dbg_check_ltab(struct ubifs_info *c) ...@@ -1733,7 +1731,7 @@ int dbg_check_ltab(struct ubifs_info *c)
for (lnum = c->lpt_first; lnum <= c->lpt_last; lnum++) { for (lnum = c->lpt_first; lnum <= c->lpt_last; lnum++) {
err = dbg_check_ltab_lnum(c, lnum); err = dbg_check_ltab_lnum(c, lnum);
if (err) { if (err) {
dbg_err("failed at LEB %d", lnum); ubifs_err("failed at LEB %d", lnum);
return err; return err;
} }
} }
...@@ -1765,7 +1763,7 @@ int dbg_chk_lpt_free_spc(struct ubifs_info *c) ...@@ -1765,7 +1763,7 @@ int dbg_chk_lpt_free_spc(struct ubifs_info *c)
free += c->leb_size; free += c->leb_size;
} }
if (free < c->lpt_sz) { if (free < c->lpt_sz) {
dbg_err("LPT space error: free %lld lpt_sz %lld", ubifs_err("LPT space error: free %lld lpt_sz %lld",
free, c->lpt_sz); free, c->lpt_sz);
ubifs_dump_lpt_info(c); ubifs_dump_lpt_info(c);
ubifs_dump_lpt_lebs(c); ubifs_dump_lpt_lebs(c);
...@@ -1805,12 +1803,12 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) ...@@ -1805,12 +1803,12 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len)
d->chk_lpt_lebs = 0; d->chk_lpt_lebs = 0;
d->chk_lpt_wastage = 0; d->chk_lpt_wastage = 0;
if (c->dirty_pn_cnt > c->pnode_cnt) { if (c->dirty_pn_cnt > c->pnode_cnt) {
dbg_err("dirty pnodes %d exceed max %d", ubifs_err("dirty pnodes %d exceed max %d",
c->dirty_pn_cnt, c->pnode_cnt); c->dirty_pn_cnt, c->pnode_cnt);
err = -EINVAL; err = -EINVAL;
} }
if (c->dirty_nn_cnt > c->nnode_cnt) { if (c->dirty_nn_cnt > c->nnode_cnt) {
dbg_err("dirty nnodes %d exceed max %d", ubifs_err("dirty nnodes %d exceed max %d",
c->dirty_nn_cnt, c->nnode_cnt); c->dirty_nn_cnt, c->nnode_cnt);
err = -EINVAL; err = -EINVAL;
} }
...@@ -1828,22 +1826,22 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) ...@@ -1828,22 +1826,22 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len)
chk_lpt_sz *= d->chk_lpt_lebs; chk_lpt_sz *= d->chk_lpt_lebs;
chk_lpt_sz += len - c->nhead_offs; chk_lpt_sz += len - c->nhead_offs;
if (d->chk_lpt_sz != chk_lpt_sz) { if (d->chk_lpt_sz != chk_lpt_sz) {
dbg_err("LPT wrote %lld but space used was %lld", ubifs_err("LPT wrote %lld but space used was %lld",
d->chk_lpt_sz, chk_lpt_sz); d->chk_lpt_sz, chk_lpt_sz);
err = -EINVAL; err = -EINVAL;
} }
if (d->chk_lpt_sz > c->lpt_sz) { if (d->chk_lpt_sz > c->lpt_sz) {
dbg_err("LPT wrote %lld but lpt_sz is %lld", ubifs_err("LPT wrote %lld but lpt_sz is %lld",
d->chk_lpt_sz, c->lpt_sz); d->chk_lpt_sz, c->lpt_sz);
err = -EINVAL; err = -EINVAL;
} }
if (d->chk_lpt_sz2 && d->chk_lpt_sz != d->chk_lpt_sz2) { if (d->chk_lpt_sz2 && d->chk_lpt_sz != d->chk_lpt_sz2) {
dbg_err("LPT layout size %lld but wrote %lld", ubifs_err("LPT layout size %lld but wrote %lld",
d->chk_lpt_sz, d->chk_lpt_sz2); d->chk_lpt_sz, d->chk_lpt_sz2);
err = -EINVAL; err = -EINVAL;
} }
if (d->chk_lpt_sz2 && d->new_nhead_offs != len) { if (d->chk_lpt_sz2 && d->new_nhead_offs != len) {
dbg_err("LPT new nhead offs: expected %d was %d", ubifs_err("LPT new nhead offs: expected %d was %d",
d->new_nhead_offs, len); d->new_nhead_offs, len);
err = -EINVAL; err = -EINVAL;
} }
...@@ -1853,7 +1851,7 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) ...@@ -1853,7 +1851,7 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len)
if (c->big_lpt) if (c->big_lpt)
lpt_sz += c->lsave_sz; lpt_sz += c->lsave_sz;
if (d->chk_lpt_sz - d->chk_lpt_wastage > lpt_sz) { if (d->chk_lpt_sz - d->chk_lpt_wastage > lpt_sz) {
dbg_err("LPT chk_lpt_sz %lld + waste %lld exceeds %lld", ubifs_err("LPT chk_lpt_sz %lld + waste %lld exceeds %lld",
d->chk_lpt_sz, d->chk_lpt_wastage, lpt_sz); d->chk_lpt_sz, d->chk_lpt_wastage, lpt_sz);
err = -EINVAL; err = -EINVAL;
} }
......
...@@ -88,7 +88,7 @@ int ubifs_add_orphan(struct ubifs_info *c, ino_t inum) ...@@ -88,7 +88,7 @@ int ubifs_add_orphan(struct ubifs_info *c, ino_t inum)
else if (inum > o->inum) else if (inum > o->inum)
p = &(*p)->rb_right; p = &(*p)->rb_right;
else { else {
dbg_err("orphaned twice"); ubifs_err("orphaned twice");
spin_unlock(&c->orphan_lock); spin_unlock(&c->orphan_lock);
kfree(orphan); kfree(orphan);
return 0; return 0;
...@@ -154,7 +154,7 @@ void ubifs_delete_orphan(struct ubifs_info *c, ino_t inum) ...@@ -154,7 +154,7 @@ void ubifs_delete_orphan(struct ubifs_info *c, ino_t inum)
} }
} }
spin_unlock(&c->orphan_lock); spin_unlock(&c->orphan_lock);
dbg_err("missing orphan ino %lu", (unsigned long)inum); ubifs_err("missing orphan ino %lu", (unsigned long)inum);
dump_stack(); dump_stack();
} }
......
...@@ -362,11 +362,11 @@ int ubifs_recover_master_node(struct ubifs_info *c) ...@@ -362,11 +362,11 @@ int ubifs_recover_master_node(struct ubifs_info *c)
out_free: out_free:
ubifs_err("failed to recover master node"); ubifs_err("failed to recover master node");
if (mst1) { if (mst1) {
dbg_err("dumping first master node"); ubifs_err("dumping first master node");
ubifs_dump_node(c, mst1); ubifs_dump_node(c, mst1);
} }
if (mst2) { if (mst2) {
dbg_err("dumping second master node"); ubifs_err("dumping second master node");
ubifs_dump_node(c, mst2); ubifs_dump_node(c, mst2);
} }
vfree(buf2); vfree(buf2);
...@@ -683,7 +683,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, ...@@ -683,7 +683,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
ret, lnum, offs); ret, lnum, offs);
break; break;
} else { } else {
dbg_err("unexpected return value %d", ret); ubifs_err("unexpected return value %d", ret);
err = -EINVAL; err = -EINVAL;
goto error; goto error;
} }
...@@ -789,7 +789,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, ...@@ -789,7 +789,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
corrupted_rescan: corrupted_rescan:
/* Re-scan the corrupted data with verbose messages */ /* Re-scan the corrupted data with verbose messages */
dbg_err("corruptio %d", ret); ubifs_err("corruptio %d", ret);
ubifs_scan_a_node(c, buf, len, lnum, offs, 1); ubifs_scan_a_node(c, buf, len, lnum, offs, 1);
corrupted: corrupted:
ubifs_scanned_corruption(c, lnum, offs, buf); ubifs_scanned_corruption(c, lnum, offs, buf);
...@@ -827,15 +827,15 @@ static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs, ...@@ -827,15 +827,15 @@ static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs,
goto out_free; goto out_free;
ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0); ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0);
if (ret != SCANNED_A_NODE) { if (ret != SCANNED_A_NODE) {
dbg_err("Not a valid node"); ubifs_err("Not a valid node");
goto out_err; goto out_err;
} }
if (cs_node->ch.node_type != UBIFS_CS_NODE) { if (cs_node->ch.node_type != UBIFS_CS_NODE) {
dbg_err("Node a CS node, type is %d", cs_node->ch.node_type); ubifs_err("Node a CS node, type is %d", cs_node->ch.node_type);
goto out_err; goto out_err;
} }
if (le64_to_cpu(cs_node->cmt_no) != c->cmt_no) { if (le64_to_cpu(cs_node->cmt_no) != c->cmt_no) {
dbg_err("CS node cmt_no %llu != current cmt_no %llu", ubifs_err("CS node cmt_no %llu != current cmt_no %llu",
(unsigned long long)le64_to_cpu(cs_node->cmt_no), (unsigned long long)le64_to_cpu(cs_node->cmt_no),
c->cmt_no); c->cmt_no);
goto out_err; goto out_err;
...@@ -1138,7 +1138,7 @@ static int grab_empty_leb(struct ubifs_info *c) ...@@ -1138,7 +1138,7 @@ static int grab_empty_leb(struct ubifs_info *c)
*/ */
lnum = ubifs_find_free_leb_for_idx(c); lnum = ubifs_find_free_leb_for_idx(c);
if (lnum < 0) { if (lnum < 0) {
dbg_err("could not find an empty LEB"); ubifs_err("could not find an empty LEB");
ubifs_dump_lprops(c); ubifs_dump_lprops(c);
ubifs_dump_budg(c, &c->bi); ubifs_dump_budg(c, &c->bi);
return lnum; return lnum;
...@@ -1218,7 +1218,7 @@ int ubifs_rcvry_gc_commit(struct ubifs_info *c) ...@@ -1218,7 +1218,7 @@ int ubifs_rcvry_gc_commit(struct ubifs_info *c)
} }
mutex_unlock(&wbuf->io_mutex); mutex_unlock(&wbuf->io_mutex);
if (err < 0) { if (err < 0) {
dbg_err("GC failed, error %d", err); ubifs_err("GC failed, error %d", err);
if (err == -EAGAIN) if (err == -EAGAIN)
err = -EINVAL; err = -EINVAL;
return err; return err;
......
...@@ -861,12 +861,12 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) ...@@ -861,12 +861,12 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf)
* numbers. * numbers.
*/ */
if (snod->type != UBIFS_CS_NODE) { if (snod->type != UBIFS_CS_NODE) {
dbg_err("first log node at LEB %d:%d is not CS node", ubifs_err("first log node at LEB %d:%d is not CS node",
lnum, offs); lnum, offs);
goto out_dump; goto out_dump;
} }
if (le64_to_cpu(node->cmt_no) != c->cmt_no) { if (le64_to_cpu(node->cmt_no) != c->cmt_no) {
dbg_err("first CS node at LEB %d:%d has wrong " ubifs_err("first CS node at LEB %d:%d has wrong "
"commit number %llu expected %llu", "commit number %llu expected %llu",
lnum, offs, lnum, offs,
(unsigned long long)le64_to_cpu(node->cmt_no), (unsigned long long)le64_to_cpu(node->cmt_no),
...@@ -892,7 +892,7 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) ...@@ -892,7 +892,7 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf)
/* Make sure the first node sits at offset zero of the LEB */ /* Make sure the first node sits at offset zero of the LEB */
if (snod->offs != 0) { if (snod->offs != 0) {
dbg_err("first node is not at zero offset"); ubifs_err("first node is not at zero offset");
goto out_dump; goto out_dump;
} }
...@@ -905,7 +905,7 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) ...@@ -905,7 +905,7 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf)
} }
if (snod->sqnum < c->cs_sqnum) { if (snod->sqnum < c->cs_sqnum) {
dbg_err("bad sqnum %llu, commit sqnum %llu", ubifs_err("bad sqnum %llu, commit sqnum %llu",
snod->sqnum, c->cs_sqnum); snod->sqnum, c->cs_sqnum);
goto out_dump; goto out_dump;
} }
......
...@@ -109,7 +109,7 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum, ...@@ -109,7 +109,7 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum,
/* Make the node pads to 8-byte boundary */ /* Make the node pads to 8-byte boundary */
if ((node_len + pad_len) & 7) { if ((node_len + pad_len) & 7) {
if (!quiet) if (!quiet)
dbg_err("bad padding length %d - %d", ubifs_err("bad padding length %d - %d",
offs, offs + node_len + pad_len); offs, offs + node_len + pad_len);
return SCANNED_A_BAD_PAD_NODE; return SCANNED_A_BAD_PAD_NODE;
} }
...@@ -245,7 +245,7 @@ void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs, ...@@ -245,7 +245,7 @@ void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs,
len = c->leb_size - offs; len = c->leb_size - offs;
if (len > 8192) if (len > 8192)
len = 8192; len = 8192;
dbg_err("first %d bytes from LEB %d:%d", len, lnum, offs); ubifs_err("first %d bytes from LEB %d:%d", len, lnum, offs);
print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4, buf, len, 1); print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4, buf, len, 1);
} }
...@@ -300,16 +300,16 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum, ...@@ -300,16 +300,16 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum,
switch (ret) { switch (ret) {
case SCANNED_GARBAGE: case SCANNED_GARBAGE:
dbg_err("garbage"); ubifs_err("garbage");
goto corrupted; goto corrupted;
case SCANNED_A_NODE: case SCANNED_A_NODE:
break; break;
case SCANNED_A_CORRUPT_NODE: case SCANNED_A_CORRUPT_NODE:
case SCANNED_A_BAD_PAD_NODE: case SCANNED_A_BAD_PAD_NODE:
dbg_err("bad node"); ubifs_err("bad node");
goto corrupted; goto corrupted;
default: default:
dbg_err("unknown"); ubifs_err("unknown");
err = -EINVAL; err = -EINVAL;
goto error; goto error;
} }
......
...@@ -668,7 +668,7 @@ static int init_constants_sb(struct ubifs_info *c) ...@@ -668,7 +668,7 @@ static int init_constants_sb(struct ubifs_info *c)
tmp = UBIFS_CS_NODE_SZ + UBIFS_REF_NODE_SZ * c->jhead_cnt; tmp = UBIFS_CS_NODE_SZ + UBIFS_REF_NODE_SZ * c->jhead_cnt;
tmp = ALIGN(tmp, c->min_io_size); tmp = ALIGN(tmp, c->min_io_size);
if (tmp > c->leb_size) { if (tmp > c->leb_size) {
dbg_err("too small LEB size %d, at least %d needed", ubifs_err("too small LEB size %d, at least %d needed",
c->leb_size, tmp); c->leb_size, tmp);
return -EINVAL; return -EINVAL;
} }
...@@ -683,7 +683,7 @@ static int init_constants_sb(struct ubifs_info *c) ...@@ -683,7 +683,7 @@ static int init_constants_sb(struct ubifs_info *c)
tmp /= c->leb_size; tmp /= c->leb_size;
tmp += 1; tmp += 1;
if (c->log_lebs < tmp) { if (c->log_lebs < tmp) {
dbg_err("too small log %d LEBs, required min. %d LEBs", ubifs_err("too small log %d LEBs, required min. %d LEBs",
c->log_lebs, tmp); c->log_lebs, tmp);
return -EINVAL; return -EINVAL;
} }
...@@ -863,7 +863,7 @@ static void free_orphans(struct ubifs_info *c) ...@@ -863,7 +863,7 @@ static void free_orphans(struct ubifs_info *c)
orph = list_entry(c->orph_list.next, struct ubifs_orphan, list); orph = list_entry(c->orph_list.next, struct ubifs_orphan, list);
list_del(&orph->list); list_del(&orph->list);
kfree(orph); kfree(orph);
dbg_err("orphan list not empty at unmount"); ubifs_err("orphan list not empty at unmount");
} }
vfree(c->orph_buf); vfree(c->orph_buf);
...@@ -2126,7 +2126,7 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, ...@@ -2126,7 +2126,7 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
*/ */
ubi = open_ubi(name, UBI_READONLY); ubi = open_ubi(name, UBI_READONLY);
if (IS_ERR(ubi)) { if (IS_ERR(ubi)) {
dbg_err("cannot open \"%s\", error %d", ubifs_err("cannot open \"%s\", error %d",
name, (int)PTR_ERR(ubi)); name, (int)PTR_ERR(ubi));
return ERR_CAST(ubi); return ERR_CAST(ubi);
} }
......
...@@ -293,9 +293,9 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, ...@@ -293,9 +293,9 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len,
lnum, offs, znode->level, znode->child_cnt); lnum, offs, znode->level, znode->child_cnt);
if (znode->child_cnt > c->fanout || znode->level > UBIFS_MAX_LEVELS) { if (znode->child_cnt > c->fanout || znode->level > UBIFS_MAX_LEVELS) {
dbg_err("current fanout %d, branch count %d", ubifs_err("current fanout %d, branch count %d",
c->fanout, znode->child_cnt); c->fanout, znode->child_cnt);
dbg_err("max levels %d, znode level %d", ubifs_err("max levels %d, znode level %d",
UBIFS_MAX_LEVELS, znode->level); UBIFS_MAX_LEVELS, znode->level);
err = 1; err = 1;
goto out_dump; goto out_dump;
...@@ -316,7 +316,7 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, ...@@ -316,7 +316,7 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len,
if (zbr->lnum < c->main_first || if (zbr->lnum < c->main_first ||
zbr->lnum >= c->leb_cnt || zbr->offs < 0 || zbr->lnum >= c->leb_cnt || zbr->offs < 0 ||
zbr->offs + zbr->len > c->leb_size || zbr->offs & 7) { zbr->offs + zbr->len > c->leb_size || zbr->offs & 7) {
dbg_err("bad branch %d", i); ubifs_err("bad branch %d", i);
err = 2; err = 2;
goto out_dump; goto out_dump;
} }
...@@ -340,17 +340,17 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, ...@@ -340,17 +340,17 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len,
type = key_type(c, &zbr->key); type = key_type(c, &zbr->key);
if (c->ranges[type].max_len == 0) { if (c->ranges[type].max_len == 0) {
if (zbr->len != c->ranges[type].len) { if (zbr->len != c->ranges[type].len) {
dbg_err("bad target node (type %d) length (%d)", ubifs_err("bad target node (type %d) length (%d)",
type, zbr->len); type, zbr->len);
dbg_err("have to be %d", c->ranges[type].len); ubifs_err("have to be %d", c->ranges[type].len);
err = 4; err = 4;
goto out_dump; goto out_dump;
} }
} else if (zbr->len < c->ranges[type].min_len || } else if (zbr->len < c->ranges[type].min_len ||
zbr->len > c->ranges[type].max_len) { zbr->len > c->ranges[type].max_len) {
dbg_err("bad target node (type %d) length (%d)", ubifs_err("bad target node (type %d) length (%d)",
type, zbr->len); type, zbr->len);
dbg_err("have to be in range of %d-%d", ubifs_err("have to be in range of %d-%d",
c->ranges[type].min_len, c->ranges[type].min_len,
c->ranges[type].max_len); c->ranges[type].max_len);
err = 5; err = 5;
...@@ -370,12 +370,12 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, ...@@ -370,12 +370,12 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len,
cmp = keys_cmp(c, key1, key2); cmp = keys_cmp(c, key1, key2);
if (cmp > 0) { if (cmp > 0) {
dbg_err("bad key order (keys %d and %d)", i, i + 1); ubifs_err("bad key order (keys %d and %d)", i, i + 1);
err = 6; err = 6;
goto out_dump; goto out_dump;
} else if (cmp == 0 && !is_hash_key(c, key1)) { } else if (cmp == 0 && !is_hash_key(c, key1)) {
/* These can only be keys with colliding hash */ /* These can only be keys with colliding hash */
dbg_err("keys %d and %d are not hashed but equivalent", ubifs_err("keys %d and %d are not hashed but equivalent",
i, i + 1); i, i + 1);
err = 7; err = 7;
goto out_dump; goto out_dump;
......
...@@ -399,7 +399,7 @@ ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf, ...@@ -399,7 +399,7 @@ ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf,
if (buf) { if (buf) {
/* If @buf is %NULL we are supposed to return the length */ /* If @buf is %NULL we are supposed to return the length */
if (ui->data_len > size) { if (ui->data_len > size) {
dbg_err("buffer size %zd, xattr len %d", ubifs_err("buffer size %zd, xattr len %d",
size, ui->data_len); size, ui->data_len);
err = -ERANGE; err = -ERANGE;
goto out_iput; goto out_iput;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment