Commit edf6be24 authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBIFS: rename dumping functions

This commit re-names all functions which dump something from "dbg_dump_*()" to
"ubifs_dump_*()". This is done for consistency with UBI and because this way it
will be more logical once we remove the debugging sompilation option.
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
parent 7c46d0ae
......@@ -715,13 +715,13 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot)
out_dump:
dbg_err("dumping index node (iip=%d)", i->iip);
dbg_dump_node(c, idx);
ubifs_dump_node(c, idx);
list_del(&i->list);
kfree(i);
if (!list_empty(&list)) {
i = list_entry(list.prev, struct idx_node, list);
dbg_err("dumping parent index node");
dbg_dump_node(c, &i->idx);
ubifs_dump_node(c, &i->idx);
}
out_free:
while (!list_empty(&list)) {
......
This diff is collapsed.
......@@ -255,27 +255,27 @@ const char *dbg_get_key_dump(const struct ubifs_info *c,
const union ubifs_key *key);
const char *dbg_snprintf_key(const struct ubifs_info *c,
const union ubifs_key *key, char *buffer, int len);
void dbg_dump_inode(struct ubifs_info *c, const struct inode *inode);
void dbg_dump_node(const struct ubifs_info *c, const void *node);
void dbg_dump_lpt_node(const struct ubifs_info *c, void *node, int lnum,
int offs);
void dbg_dump_budget_req(const struct ubifs_budget_req *req);
void dbg_dump_lstats(const struct ubifs_lp_stats *lst);
void dbg_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi);
void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp);
void dbg_dump_lprops(struct ubifs_info *c);
void dbg_dump_lpt_info(struct ubifs_info *c);
void dbg_dump_leb(const struct ubifs_info *c, int lnum);
void dbg_dump_sleb(const struct ubifs_info *c,
const struct ubifs_scan_leb *sleb, int offs);
void dbg_dump_znode(const struct ubifs_info *c,
const struct ubifs_znode *znode);
void dbg_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat);
void dbg_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
struct ubifs_nnode *parent, int iip);
void dbg_dump_tnc(struct ubifs_info *c);
void dbg_dump_index(struct ubifs_info *c);
void dbg_dump_lpt_lebs(const struct ubifs_info *c);
void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode);
void ubifs_dump_node(const struct ubifs_info *c, const void *node);
void ubifs_dump_budget_req(const struct ubifs_budget_req *req);
void ubifs_dump_lstats(const struct ubifs_lp_stats *lst);
void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi);
void ubifs_dump_lprop(const struct ubifs_info *c,
const struct ubifs_lprops *lp);
void ubifs_dump_lprops(struct ubifs_info *c);
void ubifs_dump_lpt_info(struct ubifs_info *c);
void ubifs_dump_leb(const struct ubifs_info *c, int lnum);
void ubifs_dump_sleb(const struct ubifs_info *c,
const struct ubifs_scan_leb *sleb, int offs);
void ubifs_dump_znode(const struct ubifs_info *c,
const struct ubifs_znode *znode);
void ubifs_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap,
int cat);
void ubifs_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
struct ubifs_nnode *parent, int iip);
void ubifs_dump_tnc(struct ubifs_info *c);
void ubifs_dump_index(struct ubifs_info *c);
void ubifs_dump_lpt_lebs(const struct ubifs_info *c);
int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
dbg_znode_callback znode_cb, void *priv);
......@@ -371,42 +371,39 @@ static inline const char *
dbg_snprintf_key(const struct ubifs_info *c,
const union ubifs_key *key, char *buffer,
int len) { return ""; }
static inline void dbg_dump_inode(struct ubifs_info *c,
const struct inode *inode) { return; }
static inline void dbg_dump_node(const struct ubifs_info *c,
const void *node) { return; }
static inline void dbg_dump_lpt_node(const struct ubifs_info *c,
void *node, int lnum,
int offs) { return; }
static inline void ubifs_dump_inode(struct ubifs_info *c,
const struct inode *inode) { return; }
static inline void ubifs_dump_node(const struct ubifs_info *c,
const void *node) { return; }
static inline void
dbg_dump_budget_req(const struct ubifs_budget_req *req) { return; }
ubifs_dump_budget_req(const struct ubifs_budget_req *req) { return; }
static inline void
dbg_dump_lstats(const struct ubifs_lp_stats *lst) { return; }
ubifs_dump_lstats(const struct ubifs_lp_stats *lst) { return; }
static inline void
dbg_dump_budg(struct ubifs_info *c,
ubifs_dump_budg(struct ubifs_info *c,
const struct ubifs_budg_info *bi) { return; }
static inline void dbg_dump_lprop(const struct ubifs_info *c,
const struct ubifs_lprops *lp) { return; }
static inline void dbg_dump_lprops(struct ubifs_info *c) { return; }
static inline void dbg_dump_lpt_info(struct ubifs_info *c) { return; }
static inline void dbg_dump_leb(const struct ubifs_info *c,
int lnum) { return; }
static inline void ubifs_dump_lprop(const struct ubifs_info *c,
const struct ubifs_lprops *lp){ return; }
static inline void ubifs_dump_lprops(struct ubifs_info *c) { return; }
static inline void ubifs_dump_lpt_info(struct ubifs_info *c) { return; }
static inline void ubifs_dump_leb(const struct ubifs_info *c,
int lnum) { return; }
static inline void
dbg_dump_sleb(const struct ubifs_info *c,
const struct ubifs_scan_leb *sleb, int offs) { return; }
ubifs_dump_sleb(const struct ubifs_info *c,
const struct ubifs_scan_leb *sleb, int offs) { return; }
static inline void
dbg_dump_znode(const struct ubifs_info *c,
const struct ubifs_znode *znode) { return; }
static inline void dbg_dump_heap(struct ubifs_info *c,
struct ubifs_lpt_heap *heap,
int cat) { return; }
static inline void dbg_dump_pnode(struct ubifs_info *c,
struct ubifs_pnode *pnode,
struct ubifs_nnode *parent,
int iip) { return; }
static inline void dbg_dump_tnc(struct ubifs_info *c) { return; }
static inline void dbg_dump_index(struct ubifs_info *c) { return; }
static inline void dbg_dump_lpt_lebs(const struct ubifs_info *c) { return; }
ubifs_dump_znode(const struct ubifs_info *c,
const struct ubifs_znode *znode) { return; }
static inline void ubifs_dump_heap(struct ubifs_info *c,
struct ubifs_lpt_heap *heap,
int cat) { return; }
static inline void ubifs_dump_pnode(struct ubifs_info *c,
struct ubifs_pnode *pnode,
struct ubifs_nnode *parent,
int iip) { return; }
static inline void ubifs_dump_tnc(struct ubifs_info *c) { return; }
static inline void ubifs_dump_index(struct ubifs_info *c) { return; }
static inline void ubifs_dump_lpt_lebs(const struct ubifs_info *c){ return; }
static inline int dbg_walk_index(struct ubifs_info *c,
dbg_leaf_callback leaf_cb,
......
......@@ -97,7 +97,7 @@ static int read_block(struct inode *inode, void *addr, unsigned int block,
dump:
ubifs_err("bad data node (block %u, inode %lu)",
block, inode->i_ino);
dbg_dump_node(c, dn);
ubifs_dump_node(c, dn);
return -EINVAL;
}
......
......@@ -294,7 +294,7 @@ int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
out:
if (!quiet) {
ubifs_err("bad node at LEB %d:%d", lnum, offs);
dbg_dump_node(c, buf);
ubifs_dump_node(c, buf);
dump_stack();
}
return err;
......@@ -841,9 +841,9 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
out:
ubifs_err("cannot write %d bytes to LEB %d:%d, error %d",
len, wbuf->lnum, wbuf->offs, err);
dbg_dump_node(c, buf);
ubifs_dump_node(c, buf);
dump_stack();
dbg_dump_leb(c, wbuf->lnum);
ubifs_dump_leb(c, wbuf->lnum);
return err;
}
......@@ -881,7 +881,7 @@ int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum,
ubifs_prepare_node(c, buf, len, 1);
err = ubifs_leb_write(c, lnum, buf, offs, buf_len, dtype);
if (err)
dbg_dump_node(c, buf);
ubifs_dump_node(c, buf);
return err;
}
......@@ -960,7 +960,7 @@ int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len,
out:
ubifs_err("bad node at LEB %d:%d", lnum, offs);
dbg_dump_node(c, buf);
ubifs_dump_node(c, buf);
dump_stack();
return -EINVAL;
}
......@@ -1017,7 +1017,7 @@ int ubifs_read_node(const struct ubifs_info *c, void *buf, int type, int len,
out:
ubifs_err("bad node at LEB %d:%d, LEB mapping status %d", lnum, offs,
ubi_is_mapped(c->ubi, lnum));
dbg_dump_node(c, buf);
ubifs_dump_node(c, buf);
dump_stack();
return -EINVAL;
}
......
......@@ -386,8 +386,8 @@ static int make_reservation(struct ubifs_info *c, int jhead, int len)
/* This are some budgeting problems, print useful information */
down_write(&c->commit_sem);
dump_stack();
dbg_dump_budg(c, &c->bi);
dbg_dump_lprops(c);
ubifs_dump_budg(c, &c->bi);
ubifs_dump_lprops(c);
cmt_retries = dbg_check_lprops(c);
up_write(&c->commit_sem);
}
......
......@@ -1002,7 +1002,7 @@ void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat,
if (err) {
dbg_msg("failed cat %d hpos %d err %d", cat, i, err);
dump_stack();
dbg_dump_heap(c, heap, cat);
ubifs_dump_heap(c, heap, cat);
}
}
......@@ -1109,8 +1109,8 @@ static int scan_check_cb(struct ubifs_info *c,
if (IS_ERR(sleb)) {
ret = PTR_ERR(sleb);
if (ret == -EUCLEAN) {
dbg_dump_lprops(c);
dbg_dump_budg(c, &c->bi);
ubifs_dump_lprops(c);
ubifs_dump_budg(c, &c->bi);
}
goto out;
}
......@@ -1237,7 +1237,7 @@ static int scan_check_cb(struct ubifs_info *c,
ubifs_err("bad accounting of LEB %d: free %d, dirty %d flags %#x, "
"should be free %d, dirty %d",
lnum, lp->free, lp->dirty, lp->flags, free, dirty);
dbg_dump_leb(c, lnum);
ubifs_dump_leb(c, lnum);
out_destroy:
ubifs_scan_destroy(sleb);
ret = -EINVAL;
......
......@@ -1312,7 +1312,7 @@ static int read_pnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
out:
ubifs_err("error %d reading pnode at %d:%d", err, lnum, offs);
dbg_dump_pnode(c, pnode, parent, iip);
ubifs_dump_pnode(c, pnode, parent, iip);
dump_stack();
dbg_msg("calc num: %d", calc_pnode_num_from_parent(c, parent, iip));
kfree(pnode);
......
......@@ -327,8 +327,8 @@ static int layout_cnodes(struct ubifs_info *c)
ubifs_err("LPT out of space");
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);
dbg_dump_lpt_info(c);
dbg_dump_lpt_lebs(c);
ubifs_dump_lpt_info(c);
ubifs_dump_lpt_lebs(c);
dump_stack();
return err;
}
......@@ -555,8 +555,8 @@ static int write_cnodes(struct ubifs_info *c)
ubifs_err("LPT out of space mismatch");
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);
dbg_dump_lpt_info(c);
dbg_dump_lpt_lebs(c);
ubifs_dump_lpt_info(c);
ubifs_dump_lpt_lebs(c);
dump_stack();
return err;
}
......@@ -1769,8 +1769,8 @@ int dbg_chk_lpt_free_spc(struct ubifs_info *c)
if (free < c->lpt_sz) {
dbg_err("LPT space error: free %lld lpt_sz %lld",
free, c->lpt_sz);
dbg_dump_lpt_info(c);
dbg_dump_lpt_lebs(c);
ubifs_dump_lpt_info(c);
ubifs_dump_lpt_lebs(c);
dump_stack();
return -EINVAL;
}
......@@ -1860,8 +1860,8 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len)
err = -EINVAL;
}
if (err) {
dbg_dump_lpt_info(c);
dbg_dump_lpt_lebs(c);
ubifs_dump_lpt_info(c);
ubifs_dump_lpt_lebs(c);
dump_stack();
}
d->chk_lpt_sz2 = d->chk_lpt_sz;
......@@ -1880,7 +1880,7 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len)
}
/**
* dbg_dump_lpt_leb - dump an LPT LEB.
* ubifs_dump_lpt_leb - dump an LPT LEB.
* @c: UBIFS file-system description object
* @lnum: LEB number to dump
*
......@@ -1986,13 +1986,13 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
}
/**
* dbg_dump_lpt_lebs - dump LPT lebs.
* ubifs_dump_lpt_lebs - dump LPT lebs.
* @c: UBIFS file-system description object
*
* This function dumps all LPT LEBs. The caller has to make sure the LPT is
* locked.
*/
void dbg_dump_lpt_lebs(const struct ubifs_info *c)
void ubifs_dump_lpt_lebs(const struct ubifs_info *c)
{
int i;
......
......@@ -241,7 +241,7 @@ static int validate_master(const struct ubifs_info *c)
out:
ubifs_err("bad master node at offset %d error %d", c->mst_offs, err);
dbg_dump_node(c, c->mst_node);
ubifs_dump_node(c, c->mst_node);
return -EINVAL;
}
......@@ -317,7 +317,7 @@ int ubifs_read_master(struct ubifs_info *c)
if (c->leb_cnt < old_leb_cnt ||
c->leb_cnt < UBIFS_MIN_LEB_CNT) {
ubifs_err("bad leb_cnt on master node");
dbg_dump_node(c, c->mst_node);
ubifs_dump_node(c, c->mst_node);
return -EINVAL;
}
......
......@@ -569,7 +569,7 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
if (snod->type != UBIFS_ORPH_NODE) {
ubifs_err("invalid node type %d in orphan area at "
"%d:%d", snod->type, sleb->lnum, snod->offs);
dbg_dump_node(c, snod->node);
ubifs_dump_node(c, snod->node);
return -EINVAL;
}
......@@ -597,7 +597,7 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
ubifs_err("out of order commit number %llu in "
"orphan node at %d:%d",
cmt_no, sleb->lnum, snod->offs);
dbg_dump_node(c, snod->node);
ubifs_dump_node(c, snod->node);
return -EINVAL;
}
dbg_rcvry("out of date LEB %d", sleb->lnum);
......
......@@ -363,11 +363,11 @@ int ubifs_recover_master_node(struct ubifs_info *c)
ubifs_err("failed to recover master node");
if (mst1) {
dbg_err("dumping first master node");
dbg_dump_node(c, mst1);
ubifs_dump_node(c, mst1);
}
if (mst2) {
dbg_err("dumping second master node");
dbg_dump_node(c, mst2);
ubifs_dump_node(c, mst2);
}
vfree(buf2);
vfree(buf1);
......@@ -1139,8 +1139,8 @@ static int grab_empty_leb(struct ubifs_info *c)
lnum = ubifs_find_free_leb_for_idx(c);
if (lnum < 0) {
dbg_err("could not find an empty LEB");
dbg_dump_lprops(c);
dbg_dump_budg(c, &c->bi);
ubifs_dump_lprops(c);
ubifs_dump_budg(c, &c->bi);
return lnum;
}
......
......@@ -686,7 +686,7 @@ static int replay_bud(struct ubifs_info *c, struct bud_entry *b)
out_dump:
ubifs_err("bad node is at LEB %d:%d", lnum, snod->offs);
dbg_dump_node(c, snod->node);
ubifs_dump_node(c, snod->node);
ubifs_scan_destroy(sleb);
return -EINVAL;
}
......@@ -958,7 +958,7 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf)
out_dump:
ubifs_err("log error detected while replaying the log at LEB %d:%d",
lnum, offs + snod->offs);
dbg_dump_node(c, snod->node);
ubifs_dump_node(c, snod->node);
ubifs_scan_destroy(sleb);
return -EINVAL;
}
......
......@@ -475,7 +475,7 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup)
failed:
ubifs_err("bad superblock, error %d", err);
dbg_dump_node(c, sup);
ubifs_dump_node(c, sup);
return -EINVAL;
}
......
......@@ -101,7 +101,7 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum,
if (!quiet) {
ubifs_err("bad pad node at LEB %d:%d",
lnum, offs);
dbg_dump_node(c, pad);
ubifs_dump_node(c, pad);
}
return SCANNED_A_BAD_PAD_NODE;
}
......
......@@ -246,8 +246,8 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
out_invalid:
ubifs_err("inode %lu validation failed, error %d", inode->i_ino, err);
dbg_dump_node(c, ino);
dbg_dump_inode(c, inode);
ubifs_dump_node(c, ino);
ubifs_dump_inode(c, inode);
err = -EINVAL;
out_ino:
kfree(ino);
......@@ -1147,8 +1147,8 @@ static int check_free_space(struct ubifs_info *c)
ubifs_assert(c->dark_wm > 0);
if (c->lst.total_free + c->lst.total_dirty < c->dark_wm) {
ubifs_err("insufficient free space to mount in R/W mode");
dbg_dump_budg(c, &c->bi);
dbg_dump_lprops(c);
ubifs_dump_budg(c, &c->bi);
ubifs_dump_lprops(c);
return -ENOSPC;
}
return 0;
......
......@@ -340,7 +340,7 @@ static int lnc_add(struct ubifs_info *c, struct ubifs_zbranch *zbr,
err = ubifs_validate_entry(c, dent);
if (err) {
dump_stack();
dbg_dump_node(c, dent);
ubifs_dump_node(c, dent);
return err;
}
......@@ -373,7 +373,7 @@ static int lnc_add_directly(struct ubifs_info *c, struct ubifs_zbranch *zbr,
err = ubifs_validate_entry(c, node);
if (err) {
dump_stack();
dbg_dump_node(c, node);
ubifs_dump_node(c, node);
return err;
}
......@@ -1733,7 +1733,7 @@ static int validate_data_node(struct ubifs_info *c, void *buf,
err = -EINVAL;
out:
ubifs_err("bad node at LEB %d:%d", zbr->lnum, zbr->offs);
dbg_dump_node(c, buf);
ubifs_dump_node(c, buf);
dump_stack();
return err;
}
......@@ -2403,7 +2403,7 @@ static int tnc_delete(struct ubifs_info *c, struct ubifs_znode *znode, int n)
err = ubifs_add_dirt(c, zbr->lnum, zbr->len);
if (err) {
dbg_dump_znode(c, znode);
ubifs_dump_znode(c, znode);
return err;
}
......@@ -2649,7 +2649,7 @@ int ubifs_tnc_remove_range(struct ubifs_info *c, union ubifs_key *from_key,
err = ubifs_add_dirt(c, znode->zbranch[i].lnum,
znode->zbranch[i].len);
if (err) {
dbg_dump_znode(c, znode);
ubifs_dump_znode(c, znode);
goto out_unlock;
}
dbg_tnck(key, "removing key ");
......@@ -3335,7 +3335,7 @@ int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode,
(unsigned long)inode->i_ino, size,
((loff_t)block) << UBIFS_BLOCK_SHIFT);
mutex_unlock(&c->tnc_mutex);
dbg_dump_inode(c, inode);
ubifs_dump_inode(c, inode);
dump_stack();
return -EINVAL;
......
......@@ -54,9 +54,9 @@ static int make_idx_node(struct ubifs_info *c, struct ubifs_idx_node *idx,
br->len = cpu_to_le32(zbr->len);
if (!zbr->lnum || !zbr->len) {
ubifs_err("bad ref in znode");
dbg_dump_znode(c, znode);
ubifs_dump_znode(c, znode);
if (zbr->znode)
dbg_dump_znode(c, zbr->znode);
ubifs_dump_znode(c, zbr->znode);
}
}
ubifs_prepare_node(c, idx, len, 0);
......@@ -388,8 +388,8 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt)
* option which forces in-the-gaps is enabled.
*/
ubifs_warn("out of space");
dbg_dump_budg(c, &c->bi);
dbg_dump_lprops(c);
ubifs_dump_budg(c, &c->bi);
ubifs_dump_lprops(c);
}
/* Try to commit anyway */
err = 0;
......@@ -864,9 +864,9 @@ static int write_index(struct ubifs_info *c)
br->len = cpu_to_le32(zbr->len);
if (!zbr->lnum || !zbr->len) {
ubifs_err("bad ref in znode");
dbg_dump_znode(c, znode);
ubifs_dump_znode(c, znode);
if (zbr->znode)
dbg_dump_znode(c, zbr->znode);
ubifs_dump_znode(c, zbr->znode);
}
}
len = ubifs_idx_node_sz(c, znode->child_cnt);
......
......@@ -387,7 +387,7 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len,
out_dump:
ubifs_err("bad indexing node at LEB %d:%d, error %d", lnum, offs, err);
dbg_dump_node(c, idx);
ubifs_dump_node(c, idx);
kfree(idx);
return -EINVAL;
}
......@@ -486,7 +486,7 @@ int ubifs_tnc_read_node(struct ubifs_info *c, struct ubifs_zbranch *zbr,
zbr->lnum, zbr->offs);
dbg_tnck(key, "looked for key ");
dbg_tnck(&key1, "but found node's key ");
dbg_dump_node(c, node);
ubifs_dump_node(c, node);
return -EINVAL;
}
......
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