Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6aae4dd authored by Artem Bityutskiy's avatar Artem Bityutskiy
Browse files

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
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -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:
+15 −15
Original line number Original line Diff line number Diff line
@@ -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,


	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,
		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);
+0 −4
Original line number Original line Diff line number Diff line
@@ -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__)


+22 −21
Original line number Original line Diff line number Diff line
@@ -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,
		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,
			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,
			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,
			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,
		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,
			/* 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;
			}
			}
+21 −23
Original line number Original line Diff line number Diff line
@@ -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)
	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)
	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)
			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)
		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)
		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)
		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;
		}
		}
Loading