Skip to content

Commit a6aae4d

Browse files
committed
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: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
1 parent f70b7e5 commit a6aae4d

12 files changed

Lines changed: 114 additions & 119 deletions

File tree

‎fs/ubifs/commit.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,13 +716,13 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot)
716716
return 0;
717717

718718
out_dump:
719-
dbg_err("dumping index node (iip=%d)", i->iip);
719+
ubifs_err("dumping index node (iip=%d)", i->iip);
720720
ubifs_dump_node(c, idx);
721721
list_del(&i->list);
722722
kfree(i);
723723
if (!list_empty(&list)) {
724724
i = list_entry(list.prev, struct idx_node, list);
725-
dbg_err("dumping parent index node");
725+
ubifs_err("dumping parent index node");
726726
ubifs_dump_node(c, &i->idx);
727727
}
728728
out_free:

‎fs/ubifs/debug.c‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,24 +1285,24 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1,
12851285
err = 1;
12861286
key_read(c, &dent1->key, &key);
12871287
if (keys_cmp(c, &zbr1->key, &key)) {
1288-
dbg_err("1st entry at %d:%d has key %s", zbr1->lnum,
1289-
zbr1->offs, dbg_snprintf_key(c, &key, key_buf,
1290-
DBG_KEY_BUF_LEN));
1291-
dbg_err("but it should have key %s according to tnc",
1292-
dbg_snprintf_key(c, &zbr1->key, key_buf,
1293-
DBG_KEY_BUF_LEN));
1288+
ubifs_err("1st entry at %d:%d has key %s", zbr1->lnum,
1289+
zbr1->offs, dbg_snprintf_key(c, &key, key_buf,
1290+
DBG_KEY_BUF_LEN));
1291+
ubifs_err("but it should have key %s according to tnc",
1292+
dbg_snprintf_key(c, &zbr1->key, key_buf,
1293+
DBG_KEY_BUF_LEN));
12941294
ubifs_dump_node(c, dent1);
12951295
goto out_free;
12961296
}
12971297

12981298
key_read(c, &dent2->key, &key);
12991299
if (keys_cmp(c, &zbr2->key, &key)) {
1300-
dbg_err("2nd entry at %d:%d has key %s", zbr1->lnum,
1301-
zbr1->offs, dbg_snprintf_key(c, &key, key_buf,
1302-
DBG_KEY_BUF_LEN));
1303-
dbg_err("but it should have key %s according to tnc",
1304-
dbg_snprintf_key(c, &zbr2->key, key_buf,
1305-
DBG_KEY_BUF_LEN));
1300+
ubifs_err("2nd entry at %d:%d has key %s", zbr1->lnum,
1301+
zbr1->offs, dbg_snprintf_key(c, &key, key_buf,
1302+
DBG_KEY_BUF_LEN));
1303+
ubifs_err("but it should have key %s according to tnc",
1304+
dbg_snprintf_key(c, &zbr2->key, key_buf,
1305+
DBG_KEY_BUF_LEN));
13061306
ubifs_dump_node(c, dent2);
13071307
goto out_free;
13081308
}
@@ -1316,10 +1316,10 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1,
13161316
goto out_free;
13171317
}
13181318
if (cmp == 0 && nlen1 == nlen2)
1319-
dbg_err("2 xent/dent nodes with the same name");
1319+
ubifs_err("2 xent/dent nodes with the same name");
13201320
else
1321-
dbg_err("bad order of colliding key %s",
1322-
dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN));
1321+
ubifs_err("bad order of colliding key %s",
1322+
dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN));
13231323

13241324
ubifs_msg("first node at %d:%d\n", zbr1->lnum, zbr1->offs);
13251325
ubifs_dump_node(c, dent1);

‎fs/ubifs/debug.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ struct ubifs_global_debug_info {
159159
} \
160160
} while (0)
161161

162-
#define dbg_err(fmt, ...) do { \
163-
ubifs_err(fmt, ##__VA_ARGS__); \
164-
} while (0)
165-
166162
#define ubifs_dbg_msg(type, fmt, ...) \
167163
pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__)
168164

‎fs/ubifs/lpt.c‎

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,8 +2094,8 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
20942094
int i;
20952095

20962096
if (pnode->num != col) {
2097-
dbg_err("pnode num %d expected %d parent num %d iip %d",
2098-
pnode->num, col, pnode->parent->num, pnode->iip);
2097+
ubifs_err("pnode num %d expected %d parent num %d iip %d",
2098+
pnode->num, col, pnode->parent->num, pnode->iip);
20992099
return -EINVAL;
21002100
}
21012101
for (i = 0; i < UBIFS_LPT_FANOUT; i++) {
@@ -2109,14 +2109,14 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
21092109
if (lnum >= c->leb_cnt)
21102110
continue;
21112111
if (lprops->lnum != lnum) {
2112-
dbg_err("bad LEB number %d expected %d",
2113-
lprops->lnum, lnum);
2112+
ubifs_err("bad LEB number %d expected %d",
2113+
lprops->lnum, lnum);
21142114
return -EINVAL;
21152115
}
21162116
if (lprops->flags & LPROPS_TAKEN) {
21172117
if (cat != LPROPS_UNCAT) {
2118-
dbg_err("LEB %d taken but not uncat %d",
2119-
lprops->lnum, cat);
2118+
ubifs_err("LEB %d taken but not uncat %d",
2119+
lprops->lnum, cat);
21202120
return -EINVAL;
21212121
}
21222122
continue;
@@ -2128,8 +2128,8 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
21282128
case LPROPS_FRDI_IDX:
21292129
break;
21302130
default:
2131-
dbg_err("LEB %d index but cat %d",
2132-
lprops->lnum, cat);
2131+
ubifs_err("LEB %d index but cat %d",
2132+
lprops->lnum, cat);
21332133
return -EINVAL;
21342134
}
21352135
} else {
@@ -2141,8 +2141,8 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
21412141
case LPROPS_FREEABLE:
21422142
break;
21432143
default:
2144-
dbg_err("LEB %d not index but cat %d",
2145-
lprops->lnum, cat);
2144+
ubifs_err("LEB %d not index but cat %d",
2145+
lprops->lnum, cat);
21462146
return -EINVAL;
21472147
}
21482148
}
@@ -2182,24 +2182,24 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
21822182
break;
21832183
}
21842184
if (!found) {
2185-
dbg_err("LEB %d cat %d not found in cat heap/list",
2186-
lprops->lnum, cat);
2185+
ubifs_err("LEB %d cat %d not found in cat heap/list",
2186+
lprops->lnum, cat);
21872187
return -EINVAL;
21882188
}
21892189
switch (cat) {
21902190
case LPROPS_EMPTY:
21912191
if (lprops->free != c->leb_size) {
2192-
dbg_err("LEB %d cat %d free %d dirty %d",
2193-
lprops->lnum, cat, lprops->free,
2194-
lprops->dirty);
2192+
ubifs_err("LEB %d cat %d free %d dirty %d",
2193+
lprops->lnum, cat, lprops->free,
2194+
lprops->dirty);
21952195
return -EINVAL;
21962196
}
21972197
case LPROPS_FREEABLE:
21982198
case LPROPS_FRDI_IDX:
21992199
if (lprops->free + lprops->dirty != c->leb_size) {
2200-
dbg_err("LEB %d cat %d free %d dirty %d",
2201-
lprops->lnum, cat, lprops->free,
2202-
lprops->dirty);
2200+
ubifs_err("LEB %d cat %d free %d dirty %d",
2201+
lprops->lnum, cat, lprops->free,
2202+
lprops->dirty);
22032203
return -EINVAL;
22042204
}
22052205
}
@@ -2233,9 +2233,10 @@ int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode,
22332233
/* cnode is a nnode */
22342234
num = calc_nnode_num(row, col);
22352235
if (cnode->num != num) {
2236-
dbg_err("nnode num %d expected %d "
2237-
"parent num %d iip %d", cnode->num, num,
2238-
(nnode ? nnode->num : 0), cnode->iip);
2236+
ubifs_err("nnode num %d expected %d "
2237+
"parent num %d iip %d",
2238+
cnode->num, num,
2239+
(nnode ? nnode->num : 0), cnode->iip);
22392240
return -EINVAL;
22402241
}
22412242
nn = (struct ubifs_nnode *)cnode;

‎fs/ubifs/lpt_commit.c‎

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,8 @@ static int layout_cnodes(struct ubifs_info *c)
320320
return 0;
321321

322322
no_space:
323-
ubifs_err("LPT out of space");
324-
dbg_err("LPT out of space at LEB %d:%d needing %d, done_ltab %d, "
325-
"done_lsave %d", lnum, offs, len, done_ltab, done_lsave);
323+
ubifs_err("LPT out of space at LEB %d:%d needing %d, done_ltab %d, "
324+
"done_lsave %d", lnum, offs, len, done_ltab, done_lsave);
326325
ubifs_dump_lpt_info(c);
327326
ubifs_dump_lpt_lebs(c);
328327
dump_stack();
@@ -548,9 +547,8 @@ static int write_cnodes(struct ubifs_info *c)
548547
return 0;
549548

550549
no_space:
551-
ubifs_err("LPT out of space mismatch");
552-
dbg_err("LPT out of space mismatch at LEB %d:%d needing %d, done_ltab "
553-
"%d, done_lsave %d", lnum, offs, len, done_ltab, done_lsave);
550+
ubifs_err("LPT out of space mismatch at LEB %d:%d needing %d, done_ltab "
551+
"%d, done_lsave %d", lnum, offs, len, done_ltab, done_lsave);
554552
ubifs_dump_lpt_info(c);
555553
ubifs_dump_lpt_lebs(c);
556554
dump_stack();
@@ -1733,7 +1731,7 @@ int dbg_check_ltab(struct ubifs_info *c)
17331731
for (lnum = c->lpt_first; lnum <= c->lpt_last; lnum++) {
17341732
err = dbg_check_ltab_lnum(c, lnum);
17351733
if (err) {
1736-
dbg_err("failed at LEB %d", lnum);
1734+
ubifs_err("failed at LEB %d", lnum);
17371735
return err;
17381736
}
17391737
}
@@ -1765,8 +1763,8 @@ int dbg_chk_lpt_free_spc(struct ubifs_info *c)
17651763
free += c->leb_size;
17661764
}
17671765
if (free < c->lpt_sz) {
1768-
dbg_err("LPT space error: free %lld lpt_sz %lld",
1769-
free, c->lpt_sz);
1766+
ubifs_err("LPT space error: free %lld lpt_sz %lld",
1767+
free, c->lpt_sz);
17701768
ubifs_dump_lpt_info(c);
17711769
ubifs_dump_lpt_lebs(c);
17721770
dump_stack();
@@ -1805,13 +1803,13 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len)
18051803
d->chk_lpt_lebs = 0;
18061804
d->chk_lpt_wastage = 0;
18071805
if (c->dirty_pn_cnt > c->pnode_cnt) {
1808-
dbg_err("dirty pnodes %d exceed max %d",
1809-
c->dirty_pn_cnt, c->pnode_cnt);
1806+
ubifs_err("dirty pnodes %d exceed max %d",
1807+
c->dirty_pn_cnt, c->pnode_cnt);
18101808
err = -EINVAL;
18111809
}
18121810
if (c->dirty_nn_cnt > c->nnode_cnt) {
1813-
dbg_err("dirty nnodes %d exceed max %d",
1814-
c->dirty_nn_cnt, c->nnode_cnt);
1811+
ubifs_err("dirty nnodes %d exceed max %d",
1812+
c->dirty_nn_cnt, c->nnode_cnt);
18151813
err = -EINVAL;
18161814
}
18171815
return err;
@@ -1828,23 +1826,23 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len)
18281826
chk_lpt_sz *= d->chk_lpt_lebs;
18291827
chk_lpt_sz += len - c->nhead_offs;
18301828
if (d->chk_lpt_sz != chk_lpt_sz) {
1831-
dbg_err("LPT wrote %lld but space used was %lld",
1832-
d->chk_lpt_sz, chk_lpt_sz);
1829+
ubifs_err("LPT wrote %lld but space used was %lld",
1830+
d->chk_lpt_sz, chk_lpt_sz);
18331831
err = -EINVAL;
18341832
}
18351833
if (d->chk_lpt_sz > c->lpt_sz) {
1836-
dbg_err("LPT wrote %lld but lpt_sz is %lld",
1837-
d->chk_lpt_sz, c->lpt_sz);
1834+
ubifs_err("LPT wrote %lld but lpt_sz is %lld",
1835+
d->chk_lpt_sz, c->lpt_sz);
18381836
err = -EINVAL;
18391837
}
18401838
if (d->chk_lpt_sz2 && d->chk_lpt_sz != d->chk_lpt_sz2) {
1841-
dbg_err("LPT layout size %lld but wrote %lld",
1842-
d->chk_lpt_sz, d->chk_lpt_sz2);
1839+
ubifs_err("LPT layout size %lld but wrote %lld",
1840+
d->chk_lpt_sz, d->chk_lpt_sz2);
18431841
err = -EINVAL;
18441842
}
18451843
if (d->chk_lpt_sz2 && d->new_nhead_offs != len) {
1846-
dbg_err("LPT new nhead offs: expected %d was %d",
1847-
d->new_nhead_offs, len);
1844+
ubifs_err("LPT new nhead offs: expected %d was %d",
1845+
d->new_nhead_offs, len);
18481846
err = -EINVAL;
18491847
}
18501848
lpt_sz = (long long)c->pnode_cnt * c->pnode_sz;
@@ -1853,8 +1851,8 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len)
18531851
if (c->big_lpt)
18541852
lpt_sz += c->lsave_sz;
18551853
if (d->chk_lpt_sz - d->chk_lpt_wastage > lpt_sz) {
1856-
dbg_err("LPT chk_lpt_sz %lld + waste %lld exceeds %lld",
1857-
d->chk_lpt_sz, d->chk_lpt_wastage, lpt_sz);
1854+
ubifs_err("LPT chk_lpt_sz %lld + waste %lld exceeds %lld",
1855+
d->chk_lpt_sz, d->chk_lpt_wastage, lpt_sz);
18581856
err = -EINVAL;
18591857
}
18601858
if (err) {

‎fs/ubifs/orphan.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ int ubifs_add_orphan(struct ubifs_info *c, ino_t inum)
8888
else if (inum > o->inum)
8989
p = &(*p)->rb_right;
9090
else {
91-
dbg_err("orphaned twice");
91+
ubifs_err("orphaned twice");
9292
spin_unlock(&c->orphan_lock);
9393
kfree(orphan);
9494
return 0;
@@ -154,7 +154,7 @@ void ubifs_delete_orphan(struct ubifs_info *c, ino_t inum)
154154
}
155155
}
156156
spin_unlock(&c->orphan_lock);
157-
dbg_err("missing orphan ino %lu", (unsigned long)inum);
157+
ubifs_err("missing orphan ino %lu", (unsigned long)inum);
158158
dump_stack();
159159
}
160160

‎fs/ubifs/recovery.c‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,11 @@ int ubifs_recover_master_node(struct ubifs_info *c)
362362
out_free:
363363
ubifs_err("failed to recover master node");
364364
if (mst1) {
365-
dbg_err("dumping first master node");
365+
ubifs_err("dumping first master node");
366366
ubifs_dump_node(c, mst1);
367367
}
368368
if (mst2) {
369-
dbg_err("dumping second master node");
369+
ubifs_err("dumping second master node");
370370
ubifs_dump_node(c, mst2);
371371
}
372372
vfree(buf2);
@@ -683,7 +683,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
683683
ret, lnum, offs);
684684
break;
685685
} else {
686-
dbg_err("unexpected return value %d", ret);
686+
ubifs_err("unexpected return value %d", ret);
687687
err = -EINVAL;
688688
goto error;
689689
}
@@ -789,7 +789,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
789789

790790
corrupted_rescan:
791791
/* Re-scan the corrupted data with verbose messages */
792-
dbg_err("corruptio %d", ret);
792+
ubifs_err("corruptio %d", ret);
793793
ubifs_scan_a_node(c, buf, len, lnum, offs, 1);
794794
corrupted:
795795
ubifs_scanned_corruption(c, lnum, offs, buf);
@@ -827,17 +827,17 @@ static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs,
827827
goto out_free;
828828
ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0);
829829
if (ret != SCANNED_A_NODE) {
830-
dbg_err("Not a valid node");
830+
ubifs_err("Not a valid node");
831831
goto out_err;
832832
}
833833
if (cs_node->ch.node_type != UBIFS_CS_NODE) {
834-
dbg_err("Node a CS node, type is %d", cs_node->ch.node_type);
834+
ubifs_err("Node a CS node, type is %d", cs_node->ch.node_type);
835835
goto out_err;
836836
}
837837
if (le64_to_cpu(cs_node->cmt_no) != c->cmt_no) {
838-
dbg_err("CS node cmt_no %llu != current cmt_no %llu",
839-
(unsigned long long)le64_to_cpu(cs_node->cmt_no),
840-
c->cmt_no);
838+
ubifs_err("CS node cmt_no %llu != current cmt_no %llu",
839+
(unsigned long long)le64_to_cpu(cs_node->cmt_no),
840+
c->cmt_no);
841841
goto out_err;
842842
}
843843
*cs_sqnum = le64_to_cpu(cs_node->ch.sqnum);
@@ -1138,7 +1138,7 @@ static int grab_empty_leb(struct ubifs_info *c)
11381138
*/
11391139
lnum = ubifs_find_free_leb_for_idx(c);
11401140
if (lnum < 0) {
1141-
dbg_err("could not find an empty LEB");
1141+
ubifs_err("could not find an empty LEB");
11421142
ubifs_dump_lprops(c);
11431143
ubifs_dump_budg(c, &c->bi);
11441144
return lnum;
@@ -1218,7 +1218,7 @@ int ubifs_rcvry_gc_commit(struct ubifs_info *c)
12181218
}
12191219
mutex_unlock(&wbuf->io_mutex);
12201220
if (err < 0) {
1221-
dbg_err("GC failed, error %d", err);
1221+
ubifs_err("GC failed, error %d", err);
12221222
if (err == -EAGAIN)
12231223
err = -EINVAL;
12241224
return err;

0 commit comments

Comments
 (0)