Commit 7c46d0ae authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBIFS: get rid of dbg_dump_stack

In case of errors we almost always need the stack dump - it makes no sense
to compile it out. Remove the 'dbg_dump_stack()' function completely.
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
parent 1bdcc631
...@@ -1160,7 +1160,7 @@ int dbg_check_synced_i_size(const struct ubifs_info *c, struct inode *inode) ...@@ -1160,7 +1160,7 @@ int dbg_check_synced_i_size(const struct ubifs_info *c, struct inode *inode)
"is clean", ui->ui_size, ui->synced_i_size); "is clean", ui->ui_size, ui->synced_i_size);
ubifs_err("i_ino %lu, i_mode %#x, i_size %lld", inode->i_ino, ubifs_err("i_ino %lu, i_mode %#x, i_size %lld", inode->i_ino,
inode->i_mode, i_size_read(inode)); inode->i_mode, i_size_read(inode));
dbg_dump_stack(); dump_stack();
err = -EINVAL; err = -EINVAL;
} }
spin_unlock(&ui->ui_lock); spin_unlock(&ui->ui_lock);
......
...@@ -149,7 +149,7 @@ struct ubifs_global_debug_info { ...@@ -149,7 +149,7 @@ struct ubifs_global_debug_info {
if (unlikely(!(expr))) { \ if (unlikely(!(expr))) { \
printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \
__func__, __LINE__, current->pid); \ __func__, __LINE__, current->pid); \
dbg_dump_stack(); \ dump_stack(); \
} \ } \
} while (0) } while (0)
...@@ -161,8 +161,6 @@ struct ubifs_global_debug_info { ...@@ -161,8 +161,6 @@ struct ubifs_global_debug_info {
} \ } \
} while (0) } while (0)
#define dbg_dump_stack() dump_stack()
#define dbg_err(fmt, ...) do { \ #define dbg_err(fmt, ...) do { \
ubifs_err(fmt, ##__VA_ARGS__); \ ubifs_err(fmt, ##__VA_ARGS__); \
} while (0) } while (0)
...@@ -341,7 +339,6 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c); ...@@ -341,7 +339,6 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c);
printk(KERN_DEBUG fmt "\n", ##__VA_ARGS__); \ printk(KERN_DEBUG fmt "\n", ##__VA_ARGS__); \
} while (0) } while (0)
#define dbg_dump_stack()
#define ubifs_assert_cmt_locked(c) #define ubifs_assert_cmt_locked(c)
#define dbg_msg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) #define dbg_msg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__)
......
...@@ -109,7 +109,7 @@ int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs, ...@@ -109,7 +109,7 @@ int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs,
if (err && (err != -EBADMSG || even_ebadmsg)) { if (err && (err != -EBADMSG || even_ebadmsg)) {
ubifs_err("reading %d bytes from LEB %d:%d failed, error %d", ubifs_err("reading %d bytes from LEB %d:%d failed, error %d",
len, lnum, offs, err); len, lnum, offs, err);
dbg_dump_stack(); dump_stack();
} }
return err; return err;
} }
...@@ -130,7 +130,7 @@ int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, ...@@ -130,7 +130,7 @@ int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs,
ubifs_err("writing %d bytes to LEB %d:%d failed, error %d", ubifs_err("writing %d bytes to LEB %d:%d failed, error %d",
len, lnum, offs, err); len, lnum, offs, err);
ubifs_ro_mode(c, err); ubifs_ro_mode(c, err);
dbg_dump_stack(); dump_stack();
} }
return err; return err;
} }
...@@ -151,7 +151,7 @@ int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len, ...@@ -151,7 +151,7 @@ int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len,
ubifs_err("changing %d bytes in LEB %d failed, error %d", ubifs_err("changing %d bytes in LEB %d failed, error %d",
len, lnum, err); len, lnum, err);
ubifs_ro_mode(c, err); ubifs_ro_mode(c, err);
dbg_dump_stack(); dump_stack();
} }
return err; return err;
} }
...@@ -170,7 +170,7 @@ int ubifs_leb_unmap(struct ubifs_info *c, int lnum) ...@@ -170,7 +170,7 @@ int ubifs_leb_unmap(struct ubifs_info *c, int lnum)
if (err) { if (err) {
ubifs_err("unmap LEB %d failed, error %d", lnum, err); ubifs_err("unmap LEB %d failed, error %d", lnum, err);
ubifs_ro_mode(c, err); ubifs_ro_mode(c, err);
dbg_dump_stack(); dump_stack();
} }
return err; return err;
} }
...@@ -189,7 +189,7 @@ int ubifs_leb_map(struct ubifs_info *c, int lnum, int dtype) ...@@ -189,7 +189,7 @@ int ubifs_leb_map(struct ubifs_info *c, int lnum, int dtype)
if (err) { if (err) {
ubifs_err("mapping LEB %d failed, error %d", lnum, err); ubifs_err("mapping LEB %d failed, error %d", lnum, err);
ubifs_ro_mode(c, err); ubifs_ro_mode(c, err);
dbg_dump_stack(); dump_stack();
} }
return err; return err;
} }
...@@ -202,7 +202,7 @@ int ubifs_is_mapped(const struct ubifs_info *c, int lnum) ...@@ -202,7 +202,7 @@ int ubifs_is_mapped(const struct ubifs_info *c, int lnum)
if (err < 0) { if (err < 0) {
ubifs_err("ubi_is_mapped failed for LEB %d, error %d", ubifs_err("ubi_is_mapped failed for LEB %d, error %d",
lnum, err); lnum, err);
dbg_dump_stack(); dump_stack();
} }
return err; return err;
} }
...@@ -295,7 +295,7 @@ int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, ...@@ -295,7 +295,7 @@ int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
if (!quiet) { if (!quiet) {
ubifs_err("bad node at LEB %d:%d", lnum, offs); ubifs_err("bad node at LEB %d:%d", lnum, offs);
dbg_dump_node(c, buf); dbg_dump_node(c, buf);
dbg_dump_stack(); dump_stack();
} }
return err; return err;
} }
...@@ -842,7 +842,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) ...@@ -842,7 +842,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len)
ubifs_err("cannot write %d bytes to LEB %d:%d, error %d", ubifs_err("cannot write %d bytes to LEB %d:%d, error %d",
len, wbuf->lnum, wbuf->offs, err); len, wbuf->lnum, wbuf->offs, err);
dbg_dump_node(c, buf); dbg_dump_node(c, buf);
dbg_dump_stack(); dump_stack();
dbg_dump_leb(c, wbuf->lnum); dbg_dump_leb(c, wbuf->lnum);
return err; return err;
} }
...@@ -961,7 +961,7 @@ int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len, ...@@ -961,7 +961,7 @@ int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len,
out: out:
ubifs_err("bad node at LEB %d:%d", lnum, offs); ubifs_err("bad node at LEB %d:%d", lnum, offs);
dbg_dump_node(c, buf); dbg_dump_node(c, buf);
dbg_dump_stack(); dump_stack();
return -EINVAL; return -EINVAL;
} }
...@@ -1018,7 +1018,7 @@ int ubifs_read_node(const struct ubifs_info *c, void *buf, int type, int len, ...@@ -1018,7 +1018,7 @@ int ubifs_read_node(const struct ubifs_info *c, void *buf, int type, int len,
ubifs_err("bad node at LEB %d:%d, LEB mapping status %d", lnum, offs, ubifs_err("bad node at LEB %d:%d, LEB mapping status %d", lnum, offs,
ubi_is_mapped(c->ubi, lnum)); ubi_is_mapped(c->ubi, lnum));
dbg_dump_node(c, buf); dbg_dump_node(c, buf);
dbg_dump_stack(); dump_stack();
return -EINVAL; return -EINVAL;
} }
......
...@@ -385,7 +385,7 @@ static int make_reservation(struct ubifs_info *c, int jhead, int len) ...@@ -385,7 +385,7 @@ static int make_reservation(struct ubifs_info *c, int jhead, int len)
if (err == -ENOSPC) { if (err == -ENOSPC) {
/* This are some budgeting problems, print useful information */ /* This are some budgeting problems, print useful information */
down_write(&c->commit_sem); down_write(&c->commit_sem);
dbg_dump_stack(); dump_stack();
dbg_dump_budg(c, &c->bi); dbg_dump_budg(c, &c->bi);
dbg_dump_lprops(c); dbg_dump_lprops(c);
cmt_retries = dbg_check_lprops(c); cmt_retries = dbg_check_lprops(c);
......
...@@ -1001,7 +1001,7 @@ void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, ...@@ -1001,7 +1001,7 @@ void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat,
out: out:
if (err) { if (err) {
dbg_msg("failed cat %d hpos %d err %d", cat, i, err); dbg_msg("failed cat %d hpos %d err %d", cat, i, err);
dbg_dump_stack(); dump_stack();
dbg_dump_heap(c, heap, cat); dbg_dump_heap(c, heap, cat);
} }
} }
......
...@@ -926,7 +926,7 @@ static int check_lpt_crc(void *buf, int len) ...@@ -926,7 +926,7 @@ static int check_lpt_crc(void *buf, int len)
if (crc != calc_crc) { if (crc != calc_crc) {
ubifs_err("invalid crc in LPT node: crc %hx calc %hx", crc, ubifs_err("invalid crc in LPT node: crc %hx calc %hx", crc,
calc_crc); calc_crc);
dbg_dump_stack(); dump_stack();
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -949,7 +949,7 @@ static int check_lpt_type(uint8_t **addr, int *pos, int type) ...@@ -949,7 +949,7 @@ static int check_lpt_type(uint8_t **addr, int *pos, int type)
if (node_type != type) { if (node_type != type) {
ubifs_err("invalid type (%d) in LPT node type %d", node_type, ubifs_err("invalid type (%d) in LPT node type %d", node_type,
type); type);
dbg_dump_stack(); dump_stack();
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -1247,7 +1247,7 @@ int ubifs_read_nnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip) ...@@ -1247,7 +1247,7 @@ int ubifs_read_nnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
out: out:
ubifs_err("error %d reading nnode at %d:%d", err, lnum, offs); ubifs_err("error %d reading nnode at %d:%d", err, lnum, offs);
dbg_dump_stack(); dump_stack();
kfree(nnode); kfree(nnode);
return err; return err;
} }
...@@ -1313,7 +1313,7 @@ static int read_pnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip) ...@@ -1313,7 +1313,7 @@ static int read_pnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
out: out:
ubifs_err("error %d reading pnode at %d:%d", err, lnum, offs); ubifs_err("error %d reading pnode at %d:%d", err, lnum, offs);
dbg_dump_pnode(c, pnode, parent, iip); dbg_dump_pnode(c, pnode, parent, iip);
dbg_dump_stack(); dump_stack();
dbg_msg("calc num: %d", calc_pnode_num_from_parent(c, parent, iip)); dbg_msg("calc num: %d", calc_pnode_num_from_parent(c, parent, iip));
kfree(pnode); kfree(pnode);
return err; return err;
......
...@@ -159,7 +159,7 @@ void ubifs_delete_orphan(struct ubifs_info *c, ino_t inum) ...@@ -159,7 +159,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); dbg_err("missing orphan ino %lu", (unsigned long)inum);
dbg_dump_stack(); dump_stack();
} }
/** /**
......
...@@ -339,7 +339,7 @@ static int lnc_add(struct ubifs_info *c, struct ubifs_zbranch *zbr, ...@@ -339,7 +339,7 @@ static int lnc_add(struct ubifs_info *c, struct ubifs_zbranch *zbr,
err = ubifs_validate_entry(c, dent); err = ubifs_validate_entry(c, dent);
if (err) { if (err) {
dbg_dump_stack(); dump_stack();
dbg_dump_node(c, dent); dbg_dump_node(c, dent);
return err; return err;
} }
...@@ -372,7 +372,7 @@ static int lnc_add_directly(struct ubifs_info *c, struct ubifs_zbranch *zbr, ...@@ -372,7 +372,7 @@ static int lnc_add_directly(struct ubifs_info *c, struct ubifs_zbranch *zbr,
err = ubifs_validate_entry(c, node); err = ubifs_validate_entry(c, node);
if (err) { if (err) {
dbg_dump_stack(); dump_stack();
dbg_dump_node(c, node); dbg_dump_node(c, node);
return err; return err;
} }
...@@ -1734,7 +1734,7 @@ static int validate_data_node(struct ubifs_info *c, void *buf, ...@@ -1734,7 +1734,7 @@ static int validate_data_node(struct ubifs_info *c, void *buf,
out: out:
ubifs_err("bad node at LEB %d:%d", zbr->lnum, zbr->offs); ubifs_err("bad node at LEB %d:%d", zbr->lnum, zbr->offs);
dbg_dump_node(c, buf); dbg_dump_node(c, buf);
dbg_dump_stack(); dump_stack();
return err; return err;
} }
...@@ -1775,7 +1775,7 @@ int ubifs_tnc_bulk_read(struct ubifs_info *c, struct bu_info *bu) ...@@ -1775,7 +1775,7 @@ int ubifs_tnc_bulk_read(struct ubifs_info *c, struct bu_info *bu)
if (err && err != -EBADMSG) { if (err && err != -EBADMSG) {
ubifs_err("failed to read from LEB %d:%d, error %d", ubifs_err("failed to read from LEB %d:%d, error %d",
lnum, offs, err); lnum, offs, err);
dbg_dump_stack(); dump_stack();
dbg_tnck(&bu->key, "key "); dbg_tnck(&bu->key, "key ");
return err; return err;
} }
...@@ -3336,7 +3336,7 @@ int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode, ...@@ -3336,7 +3336,7 @@ int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode,
((loff_t)block) << UBIFS_BLOCK_SHIFT); ((loff_t)block) << UBIFS_BLOCK_SHIFT);
mutex_unlock(&c->tnc_mutex); mutex_unlock(&c->tnc_mutex);
dbg_dump_inode(c, inode); dbg_dump_inode(c, inode);
dbg_dump_stack(); dump_stack();
return -EINVAL; return -EINVAL;
out_unlock: out_unlock:
......
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