Commit 782c3fb2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'upstream-3.7-rc1' of git://git.infradead.org/linux-ubifs

Pull ubifs changes from Artem Bityutskiy:
 "No big changes for 3.7 in UBIFS:
   - Error reporting and debug printing improvements
   - Power cut emulation fixes
   - Minor cleanups"

Fix trivial conflict in fs/ubifs/debug.c due to the user namespace
changes.

* tag 'upstream-3.7-rc1' of git://git.infradead.org/linux-ubifs:
  UBIFS: print less
  UBIFS: use pr_ helper instead of printk
  UBIFS: comply with coding style
  UBIFS: use __aligned() attribute
  UBIFS: remove __DATE__ and __TIME__
  UBIFS: fix power cut emulation for mtdram
  UBIFS: improve scanning debug output
  UBIFS: always print full error reports
  UBIFS: print PID in debug messages
parents 60c7b4df 3668b70f
...@@ -342,9 +342,8 @@ static int do_budget_space(struct ubifs_info *c) ...@@ -342,9 +342,8 @@ static int do_budget_space(struct ubifs_info *c)
lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt - lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt -
c->lst.taken_empty_lebs; c->lst.taken_empty_lebs;
if (unlikely(rsvd_idx_lebs > lebs)) { if (unlikely(rsvd_idx_lebs > lebs)) {
dbg_budg("out of indexing space: min_idx_lebs %d (old %d), " dbg_budg("out of indexing space: min_idx_lebs %d (old %d), rsvd_idx_lebs %d",
"rsvd_idx_lebs %d", min_idx_lebs, c->bi.min_idx_lebs, min_idx_lebs, c->bi.min_idx_lebs, rsvd_idx_lebs);
rsvd_idx_lebs);
return -ENOSPC; return -ENOSPC;
} }
......
...@@ -293,8 +293,8 @@ int ubifs_bg_thread(void *info) ...@@ -293,8 +293,8 @@ int ubifs_bg_thread(void *info)
int err; int err;
struct ubifs_info *c = info; struct ubifs_info *c = info;
dbg_msg("background thread \"%s\" started, PID %d", ubifs_msg("background thread \"%s\" started, PID %d",
c->bgt_name, current->pid); c->bgt_name, current->pid);
set_freezable(); set_freezable();
while (1) { while (1) {
...@@ -328,7 +328,7 @@ int ubifs_bg_thread(void *info) ...@@ -328,7 +328,7 @@ int ubifs_bg_thread(void *info)
cond_resched(); cond_resched();
} }
dbg_msg("background thread \"%s\" stops", c->bgt_name); ubifs_msg("background thread \"%s\" stops", c->bgt_name);
return 0; return 0;
} }
...@@ -514,7 +514,7 @@ struct idx_node { ...@@ -514,7 +514,7 @@ struct idx_node {
struct list_head list; struct list_head list;
int iip; int iip;
union ubifs_key upper_key; union ubifs_key upper_key;
struct ubifs_idx_node idx __attribute__((aligned(8))); struct ubifs_idx_node idx __aligned(8);
}; };
/** /**
......
...@@ -112,8 +112,7 @@ void ubifs_compress(const void *in_buf, int in_len, void *out_buf, int *out_len, ...@@ -112,8 +112,7 @@ void ubifs_compress(const void *in_buf, int in_len, void *out_buf, int *out_len,
if (compr->comp_mutex) if (compr->comp_mutex)
mutex_unlock(compr->comp_mutex); mutex_unlock(compr->comp_mutex);
if (unlikely(err)) { if (unlikely(err)) {
ubifs_warn("cannot compress %d bytes, compressor %s, " ubifs_warn("cannot compress %d bytes, compressor %s, error %d, leave data uncompressed",
"error %d, leave data uncompressed",
in_len, compr->name, err); in_len, compr->name, err);
goto no_compr; goto no_compr;
} }
...@@ -176,8 +175,8 @@ int ubifs_decompress(const void *in_buf, int in_len, void *out_buf, ...@@ -176,8 +175,8 @@ int ubifs_decompress(const void *in_buf, int in_len, void *out_buf,
if (compr->decomp_mutex) if (compr->decomp_mutex)
mutex_unlock(compr->decomp_mutex); mutex_unlock(compr->decomp_mutex);
if (err) if (err)
ubifs_err("cannot decompress %d bytes, compressor %s, " ubifs_err("cannot decompress %d bytes, compressor %s, error %d",
"error %d", in_len, compr->name, err); in_len, compr->name, err);
return err; return err;
} }
......
...@@ -219,15 +219,15 @@ const char *dbg_jhead(int jhead) ...@@ -219,15 +219,15 @@ const char *dbg_jhead(int jhead)
static void dump_ch(const struct ubifs_ch *ch) static void dump_ch(const struct ubifs_ch *ch)
{ {
printk(KERN_ERR "\tmagic %#x\n", le32_to_cpu(ch->magic)); pr_err("\tmagic %#x\n", le32_to_cpu(ch->magic));
printk(KERN_ERR "\tcrc %#x\n", le32_to_cpu(ch->crc)); pr_err("\tcrc %#x\n", le32_to_cpu(ch->crc));
printk(KERN_ERR "\tnode_type %d (%s)\n", ch->node_type, pr_err("\tnode_type %d (%s)\n", ch->node_type,
dbg_ntype(ch->node_type)); dbg_ntype(ch->node_type));
printk(KERN_ERR "\tgroup_type %d (%s)\n", ch->group_type, pr_err("\tgroup_type %d (%s)\n", ch->group_type,
dbg_gtype(ch->group_type)); dbg_gtype(ch->group_type));
printk(KERN_ERR "\tsqnum %llu\n", pr_err("\tsqnum %llu\n",
(unsigned long long)le64_to_cpu(ch->sqnum)); (unsigned long long)le64_to_cpu(ch->sqnum));
printk(KERN_ERR "\tlen %u\n", le32_to_cpu(ch->len)); pr_err("\tlen %u\n", le32_to_cpu(ch->len));
} }
void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode) void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode)
...@@ -238,43 +238,43 @@ void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode) ...@@ -238,43 +238,43 @@ void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode)
struct ubifs_dent_node *dent, *pdent = NULL; struct ubifs_dent_node *dent, *pdent = NULL;
int count = 2; int count = 2;
printk(KERN_ERR "Dump in-memory inode:"); pr_err("Dump in-memory inode:");
printk(KERN_ERR "\tinode %lu\n", inode->i_ino); pr_err("\tinode %lu\n", inode->i_ino);
printk(KERN_ERR "\tsize %llu\n", pr_err("\tsize %llu\n",
(unsigned long long)i_size_read(inode)); (unsigned long long)i_size_read(inode));
printk(KERN_ERR "\tnlink %u\n", inode->i_nlink); pr_err("\tnlink %u\n", inode->i_nlink);
printk(KERN_ERR "\tuid %u\n", (unsigned int)i_uid_read(inode)); pr_err("\tuid %u\n", (unsigned int)i_uid_read(inode));
printk(KERN_ERR "\tgid %u\n", (unsigned int)i_gid_read(inode)); pr_err("\tgid %u\n", (unsigned int)i_gid_read(inode));
printk(KERN_ERR "\tatime %u.%u\n", pr_err("\tatime %u.%u\n",
(unsigned int)inode->i_atime.tv_sec, (unsigned int)inode->i_atime.tv_sec,
(unsigned int)inode->i_atime.tv_nsec); (unsigned int)inode->i_atime.tv_nsec);
printk(KERN_ERR "\tmtime %u.%u\n", pr_err("\tmtime %u.%u\n",
(unsigned int)inode->i_mtime.tv_sec, (unsigned int)inode->i_mtime.tv_sec,
(unsigned int)inode->i_mtime.tv_nsec); (unsigned int)inode->i_mtime.tv_nsec);
printk(KERN_ERR "\tctime %u.%u\n", pr_err("\tctime %u.%u\n",
(unsigned int)inode->i_ctime.tv_sec, (unsigned int)inode->i_ctime.tv_sec,
(unsigned int)inode->i_ctime.tv_nsec); (unsigned int)inode->i_ctime.tv_nsec);
printk(KERN_ERR "\tcreat_sqnum %llu\n", ui->creat_sqnum); pr_err("\tcreat_sqnum %llu\n", ui->creat_sqnum);
printk(KERN_ERR "\txattr_size %u\n", ui->xattr_size); pr_err("\txattr_size %u\n", ui->xattr_size);
printk(KERN_ERR "\txattr_cnt %u\n", ui->xattr_cnt); pr_err("\txattr_cnt %u\n", ui->xattr_cnt);
printk(KERN_ERR "\txattr_names %u\n", ui->xattr_names); pr_err("\txattr_names %u\n", ui->xattr_names);
printk(KERN_ERR "\tdirty %u\n", ui->dirty); pr_err("\tdirty %u\n", ui->dirty);
printk(KERN_ERR "\txattr %u\n", ui->xattr); pr_err("\txattr %u\n", ui->xattr);
printk(KERN_ERR "\tbulk_read %u\n", ui->xattr); pr_err("\tbulk_read %u\n", ui->xattr);
printk(KERN_ERR "\tsynced_i_size %llu\n", pr_err("\tsynced_i_size %llu\n",
(unsigned long long)ui->synced_i_size); (unsigned long long)ui->synced_i_size);
printk(KERN_ERR "\tui_size %llu\n", pr_err("\tui_size %llu\n",
(unsigned long long)ui->ui_size); (unsigned long long)ui->ui_size);
printk(KERN_ERR "\tflags %d\n", ui->flags); pr_err("\tflags %d\n", ui->flags);
printk(KERN_ERR "\tcompr_type %d\n", ui->compr_type); pr_err("\tcompr_type %d\n", ui->compr_type);
printk(KERN_ERR "\tlast_page_read %lu\n", ui->last_page_read); pr_err("\tlast_page_read %lu\n", ui->last_page_read);
printk(KERN_ERR "\tread_in_a_row %lu\n", ui->read_in_a_row); pr_err("\tread_in_a_row %lu\n", ui->read_in_a_row);
printk(KERN_ERR "\tdata_len %d\n", ui->data_len); pr_err("\tdata_len %d\n", ui->data_len);
if (!S_ISDIR(inode->i_mode)) if (!S_ISDIR(inode->i_mode))
return; return;
printk(KERN_ERR "List of directory entries:\n"); pr_err("List of directory entries:\n");
ubifs_assert(!mutex_is_locked(&c->tnc_mutex)); ubifs_assert(!mutex_is_locked(&c->tnc_mutex));
lowest_dent_key(c, &key, inode->i_ino); lowest_dent_key(c, &key, inode->i_ino);
...@@ -282,11 +282,11 @@ void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode) ...@@ -282,11 +282,11 @@ void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode)
dent = ubifs_tnc_next_ent(c, &key, &nm); dent = ubifs_tnc_next_ent(c, &key, &nm);
if (IS_ERR(dent)) { if (IS_ERR(dent)) {
if (PTR_ERR(dent) != -ENOENT) if (PTR_ERR(dent) != -ENOENT)
printk(KERN_ERR "error %ld\n", PTR_ERR(dent)); pr_err("error %ld\n", PTR_ERR(dent));
break; break;
} }
printk(KERN_ERR "\t%d: %s (%s)\n", pr_err("\t%d: %s (%s)\n",
count++, dent->name, get_dent_type(dent->type)); count++, dent->name, get_dent_type(dent->type));
nm.name = dent->name; nm.name = dent->name;
...@@ -305,12 +305,9 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) ...@@ -305,12 +305,9 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node)
const struct ubifs_ch *ch = node; const struct ubifs_ch *ch = node;
char key_buf[DBG_KEY_BUF_LEN]; char key_buf[DBG_KEY_BUF_LEN];
if (dbg_is_tst_rcvry(c))
return;
/* If the magic is incorrect, just hexdump the first bytes */ /* If the magic is incorrect, just hexdump the first bytes */
if (le32_to_cpu(ch->magic) != UBIFS_NODE_MAGIC) { if (le32_to_cpu(ch->magic) != UBIFS_NODE_MAGIC) {
printk(KERN_ERR "Not a node, first %zu bytes:", UBIFS_CH_SZ); pr_err("Not a node, first %zu bytes:", UBIFS_CH_SZ);
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 32, 1, print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 32, 1,
(void *)node, UBIFS_CH_SZ, 1); (void *)node, UBIFS_CH_SZ, 1);
return; return;
...@@ -324,8 +321,7 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) ...@@ -324,8 +321,7 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node)
{ {
const struct ubifs_pad_node *pad = node; const struct ubifs_pad_node *pad = node;
printk(KERN_ERR "\tpad_len %u\n", pr_err("\tpad_len %u\n", le32_to_cpu(pad->pad_len));
le32_to_cpu(pad->pad_len));
break; break;
} }
case UBIFS_SB_NODE: case UBIFS_SB_NODE:
...@@ -333,112 +329,77 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) ...@@ -333,112 +329,77 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node)
const struct ubifs_sb_node *sup = node; const struct ubifs_sb_node *sup = node;
unsigned int sup_flags = le32_to_cpu(sup->flags); unsigned int sup_flags = le32_to_cpu(sup->flags);
printk(KERN_ERR "\tkey_hash %d (%s)\n", pr_err("\tkey_hash %d (%s)\n",
(int)sup->key_hash, get_key_hash(sup->key_hash)); (int)sup->key_hash, get_key_hash(sup->key_hash));
printk(KERN_ERR "\tkey_fmt %d (%s)\n", pr_err("\tkey_fmt %d (%s)\n",
(int)sup->key_fmt, get_key_fmt(sup->key_fmt)); (int)sup->key_fmt, get_key_fmt(sup->key_fmt));
printk(KERN_ERR "\tflags %#x\n", sup_flags); pr_err("\tflags %#x\n", sup_flags);
printk(KERN_ERR "\t big_lpt %u\n", pr_err("\t big_lpt %u\n",
!!(sup_flags & UBIFS_FLG_BIGLPT)); !!(sup_flags & UBIFS_FLG_BIGLPT));
printk(KERN_ERR "\t space_fixup %u\n", pr_err("\t space_fixup %u\n",
!!(sup_flags & UBIFS_FLG_SPACE_FIXUP)); !!(sup_flags & UBIFS_FLG_SPACE_FIXUP));
printk(KERN_ERR "\tmin_io_size %u\n", pr_err("\tmin_io_size %u\n", le32_to_cpu(sup->min_io_size));
le32_to_cpu(sup->min_io_size)); pr_err("\tleb_size %u\n", le32_to_cpu(sup->leb_size));
printk(KERN_ERR "\tleb_size %u\n", pr_err("\tleb_cnt %u\n", le32_to_cpu(sup->leb_cnt));
le32_to_cpu(sup->leb_size)); pr_err("\tmax_leb_cnt %u\n", le32_to_cpu(sup->max_leb_cnt));
printk(KERN_ERR "\tleb_cnt %u\n", pr_err("\tmax_bud_bytes %llu\n",
le32_to_cpu(sup->leb_cnt));
printk(KERN_ERR "\tmax_leb_cnt %u\n",
le32_to_cpu(sup->max_leb_cnt));
printk(KERN_ERR "\tmax_bud_bytes %llu\n",
(unsigned long long)le64_to_cpu(sup->max_bud_bytes)); (unsigned long long)le64_to_cpu(sup->max_bud_bytes));
printk(KERN_ERR "\tlog_lebs %u\n", pr_err("\tlog_lebs %u\n", le32_to_cpu(sup->log_lebs));
le32_to_cpu(sup->log_lebs)); pr_err("\tlpt_lebs %u\n", le32_to_cpu(sup->lpt_lebs));
printk(KERN_ERR "\tlpt_lebs %u\n", pr_err("\torph_lebs %u\n", le32_to_cpu(sup->orph_lebs));
le32_to_cpu(sup->lpt_lebs)); pr_err("\tjhead_cnt %u\n", le32_to_cpu(sup->jhead_cnt));
printk(KERN_ERR "\torph_lebs %u\n", pr_err("\tfanout %u\n", le32_to_cpu(sup->fanout));
le32_to_cpu(sup->orph_lebs)); pr_err("\tlsave_cnt %u\n", le32_to_cpu(sup->lsave_cnt));
printk(KERN_ERR "\tjhead_cnt %u\n", pr_err("\tdefault_compr %u\n",
le32_to_cpu(sup->jhead_cnt));
printk(KERN_ERR "\tfanout %u\n",
le32_to_cpu(sup->fanout));
printk(KERN_ERR "\tlsave_cnt %u\n",
le32_to_cpu(sup->lsave_cnt));
printk(KERN_ERR "\tdefault_compr %u\n",
(int)le16_to_cpu(sup->default_compr)); (int)le16_to_cpu(sup->default_compr));
printk(KERN_ERR "\trp_size %llu\n", pr_err("\trp_size %llu\n",
(unsigned long long)le64_to_cpu(sup->rp_size)); (unsigned long long)le64_to_cpu(sup->rp_size));
printk(KERN_ERR "\trp_uid %u\n", pr_err("\trp_uid %u\n", le32_to_cpu(sup->rp_uid));
le32_to_cpu(sup->rp_uid)); pr_err("\trp_gid %u\n", le32_to_cpu(sup->rp_gid));
printk(KERN_ERR "\trp_gid %u\n", pr_err("\tfmt_version %u\n", le32_to_cpu(sup->fmt_version));
le32_to_cpu(sup->rp_gid)); pr_err("\ttime_gran %u\n", le32_to_cpu(sup->time_gran));
printk(KERN_ERR "\tfmt_version %u\n", pr_err("\tUUID %pUB\n", sup->uuid);
le32_to_cpu(sup->fmt_version));
printk(KERN_ERR "\ttime_gran %u\n",
le32_to_cpu(sup->time_gran));
printk(KERN_ERR "\tUUID %pUB\n",
sup->uuid);
break; break;
} }
case UBIFS_MST_NODE: case UBIFS_MST_NODE:
{ {
const struct ubifs_mst_node *mst = node; const struct ubifs_mst_node *mst = node;
printk(KERN_ERR "\thighest_inum %llu\n", pr_err("\thighest_inum %llu\n",
(unsigned long long)le64_to_cpu(mst->highest_inum)); (unsigned long long)le64_to_cpu(mst->highest_inum));
printk(KERN_ERR "\tcommit number %llu\n", pr_err("\tcommit number %llu\n",
(unsigned long long)le64_to_cpu(mst->cmt_no)); (unsigned long long)le64_to_cpu(mst->cmt_no));
printk(KERN_ERR "\tflags %#x\n", pr_err("\tflags %#x\n", le32_to_cpu(mst->flags));
le32_to_cpu(mst->flags)); pr_err("\tlog_lnum %u\n", le32_to_cpu(mst->log_lnum));
printk(KERN_ERR "\tlog_lnum %u\n", pr_err("\troot_lnum %u\n", le32_to_cpu(mst->root_lnum));
le32_to_cpu(mst->log_lnum)); pr_err("\troot_offs %u\n", le32_to_cpu(mst->root_offs));
printk(KERN_ERR "\troot_lnum %u\n", pr_err("\troot_len %u\n", le32_to_cpu(mst->root_len));
le32_to_cpu(mst->root_lnum)); pr_err("\tgc_lnum %u\n", le32_to_cpu(mst->gc_lnum));
printk(KERN_ERR "\troot_offs %u\n", pr_err("\tihead_lnum %u\n", le32_to_cpu(mst->ihead_lnum));
le32_to_cpu(mst->root_offs)); pr_err("\tihead_offs %u\n", le32_to_cpu(mst->ihead_offs));
printk(KERN_ERR "\troot_len %u\n", pr_err("\tindex_size %llu\n",
le32_to_cpu(mst->root_len));
printk(KERN_ERR "\tgc_lnum %u\n",
le32_to_cpu(mst->gc_lnum));
printk(KERN_ERR "\tihead_lnum %u\n",
le32_to_cpu(mst->ihead_lnum));
printk(KERN_ERR "\tihead_offs %u\n",
le32_to_cpu(mst->ihead_offs));
printk(KERN_ERR "\tindex_size %llu\n",
(unsigned long long)le64_to_cpu(mst->index_size)); (unsigned long long)le64_to_cpu(mst->index_size));
printk(KERN_ERR "\tlpt_lnum %u\n", pr_err("\tlpt_lnum %u\n", le32_to_cpu(mst->lpt_lnum));
le32_to_cpu(mst->lpt_lnum)); pr_err("\tlpt_offs %u\n", le32_to_cpu(mst->lpt_offs));
printk(KERN_ERR "\tlpt_offs %u\n", pr_err("\tnhead_lnum %u\n", le32_to_cpu(mst->nhead_lnum));
le32_to_cpu(mst->lpt_offs)); pr_err("\tnhead_offs %u\n", le32_to_cpu(mst->nhead_offs));
printk(KERN_ERR "\tnhead_lnum %u\n", pr_err("\tltab_lnum %u\n", le32_to_cpu(mst->ltab_lnum));
le32_to_cpu(mst->nhead_lnum)); pr_err("\tltab_offs %u\n", le32_to_cpu(mst->ltab_offs));
printk(KERN_ERR "\tnhead_offs %u\n", pr_err("\tlsave_lnum %u\n", le32_to_cpu(mst->lsave_lnum));
le32_to_cpu(mst->nhead_offs)); pr_err("\tlsave_offs %u\n", le32_to_cpu(mst->lsave_offs));
printk(KERN_ERR "\tltab_lnum %u\n", pr_err("\tlscan_lnum %u\n", le32_to_cpu(mst->lscan_lnum));
le32_to_cpu(mst->ltab_lnum)); pr_err("\tleb_cnt %u\n", le32_to_cpu(mst->leb_cnt));
printk(KERN_ERR "\tltab_offs %u\n", pr_err("\tempty_lebs %u\n", le32_to_cpu(mst->empty_lebs));
le32_to_cpu(mst->ltab_offs)); pr_err("\tidx_lebs %u\n", le32_to_cpu(mst->idx_lebs));
printk(KERN_ERR "\tlsave_lnum %u\n", pr_err("\ttotal_free %llu\n",
le32_to_cpu(mst->lsave_lnum));
printk(KERN_ERR "\tlsave_offs %u\n",
le32_to_cpu(mst->lsave_offs));
printk(KERN_ERR "\tlscan_lnum %u\n",
le32_to_cpu(mst->lscan_lnum));
printk(KERN_ERR "\tleb_cnt %u\n",
le32_to_cpu(mst->leb_cnt));
printk(KERN_ERR "\tempty_lebs %u\n",
le32_to_cpu(mst->empty_lebs));
printk(KERN_ERR "\tidx_lebs %u\n",
le32_to_cpu(mst->idx_lebs));
printk(KERN_ERR "\ttotal_free %llu\n",
(unsigned long long)le64_to_cpu(mst->total_free)); (unsigned long long)le64_to_cpu(mst->total_free));
printk(KERN_ERR "\ttotal_dirty %llu\n", pr_err("\ttotal_dirty %llu\n",
(unsigned long long)le64_to_cpu(mst->total_dirty)); (unsigned long long)le64_to_cpu(mst->total_dirty));
printk(KERN_ERR "\ttotal_used %llu\n", pr_err("\ttotal_used %llu\n",
(unsigned long long)le64_to_cpu(mst->total_used)); (unsigned long long)le64_to_cpu(mst->total_used));
printk(KERN_ERR "\ttotal_dead %llu\n", pr_err("\ttotal_dead %llu\n",
(unsigned long long)le64_to_cpu(mst->total_dead)); (unsigned long long)le64_to_cpu(mst->total_dead));
printk(KERN_ERR "\ttotal_dark %llu\n", pr_err("\ttotal_dark %llu\n",
(unsigned long long)le64_to_cpu(mst->total_dark)); (unsigned long long)le64_to_cpu(mst->total_dark));
break; break;
} }
...@@ -446,12 +407,9 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) ...@@ -446,12 +407,9 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node)
{ {
const struct ubifs_ref_node *ref = node; const struct ubifs_ref_node *ref = node;
printk(KERN_ERR "\tlnum %u\n", pr_err("\tlnum %u\n", le32_to_cpu(ref->lnum));
le32_to_cpu(ref->lnum)); pr_err("\toffs %u\n", le32_to_cpu(ref->offs));
printk(KERN_ERR "\toffs %u\n", pr_err("\tjhead %u\n", le32_to_cpu(ref->jhead));
le32_to_cpu(ref->offs));
printk(KERN_ERR "\tjhead %u\n",
le32_to_cpu(ref->jhead));
break; break;
} }
case UBIFS_INO_NODE: case UBIFS_INO_NODE:
...@@ -459,41 +417,32 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) ...@@ -459,41 +417,32 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node)
const struct ubifs_ino_node *ino = node; const struct ubifs_ino_node *ino = node;
key_read(c, &ino->key, &key); key_read(c, &ino->key, &key);
printk(KERN_ERR "\tkey %s\n", pr_err("\tkey %s\n",
dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN));
printk(KERN_ERR "\tcreat_sqnum %llu\n", pr_err("\tcreat_sqnum %llu\n",
(unsigned long long)le64_to_cpu(ino->creat_sqnum)); (unsigned long long)le64_to_cpu(ino->creat_sqnum));
printk(KERN_ERR "\tsize %llu\n", pr_err("\tsize %llu\n",
(unsigned long long)le64_to_cpu(ino->size)); (unsigned long long)le64_to_cpu(ino->size));
printk(KERN_ERR "\tnlink %u\n", pr_err("\tnlink %u\n", le32_to_cpu(ino->nlink));
le32_to_cpu(ino->nlink)); pr_err("\tatime %lld.%u\n",
printk(KERN_ERR "\tatime %lld.%u\n",
(long long)le64_to_cpu(ino->atime_sec), (long long)le64_to_cpu(ino->atime_sec),
le32_to_cpu(ino->atime_nsec)); le32_to_cpu(ino->atime_nsec));
printk(KERN_ERR "\tmtime %lld.%u\n", pr_err("\tmtime %lld.%u\n",
(long long)le64_to_cpu(ino->mtime_sec), (long long)le64_to_cpu(ino->mtime_sec),
le32_to_cpu(ino->mtime_nsec)); le32_to_cpu(ino->mtime_nsec));
printk(KERN_ERR "\tctime %lld.%u\n", pr_err("\tctime %lld.%u\n",
(long long)le64_to_cpu(ino->ctime_sec), (long long)le64_to_cpu(ino->ctime_sec),
le32_to_cpu(ino->ctime_nsec)); le32_to_cpu(ino->ctime_nsec));
printk(KERN_ERR "\tuid %u\n", pr_err("\tuid %u\n", le32_to_cpu(ino->uid));
le32_to_cpu(ino->uid)); pr_err("\tgid %u\n", le32_to_cpu(ino->gid));
printk(KERN_ERR "\tgid %u\n", pr_err("\tmode %u\n", le32_to_cpu(ino->mode));
le32_to_cpu(ino->gid)); pr_err("\tflags %#x\n", le32_to_cpu(ino->flags));
printk(KERN_ERR "\tmode %u\n", pr_err("\txattr_cnt %u\n", le32_to_cpu(ino->xattr_cnt));
le32_to_cpu(ino->mode)); pr_err("\txattr_size %u\n", le32_to_cpu(ino->xattr_size));
printk(KERN_ERR "\tflags %#x\n", pr_err("\txattr_names %u\n", le32_to_cpu(ino->xattr_names));
le32_to_cpu(ino->flags)); pr_err("\tcompr_type %#x\n",
printk(KERN_ERR "\txattr_cnt %u\n",
le32_to_cpu(ino->xattr_cnt));
printk(KERN_ERR "\txattr_size %u\n",
le32_to_cpu(ino->xattr_size));
printk(KERN_ERR "\txattr_names %u\n",
le32_to_cpu(ino->xattr_names));
printk(KERN_ERR "\tcompr_type %#x\n",
(int)le16_to_cpu(ino->compr_type)); (int)le16_to_cpu(ino->compr_type));
printk(KERN_ERR "\tdata len %u\n", pr_err("\tdata len %u\n", le32_to_cpu(ino->data_len));
le32_to_cpu(ino->data_len));
break; break;
} }
case UBIFS_DENT_NODE: case UBIFS_DENT_NODE:
...@@ -503,22 +452,21 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) ...@@ -503,22 +452,21 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node)
int nlen = le16_to_cpu(dent->nlen); int nlen = le16_to_cpu(dent->nlen);
key_read(c, &dent->key, &key); key_read(c, &dent->key, &key);
printk(KERN_ERR "\tkey %s\n", pr_err("\tkey %s\n",
dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN));
printk(KERN_ERR "\tinum %llu\n", pr_err("\tinum %llu\n",
(unsigned long long)le64_to_cpu(dent->inum)); (unsigned long long)le64_to_cpu(dent->inum));
printk(KERN_ERR "\ttype %d\n", (int)dent->type); pr_err("\ttype %d\n", (int)dent->type);
printk(KERN_ERR "\tnlen %d\n", nlen); pr_err("\tnlen %d\n", nlen);
printk(KERN_ERR "\tname "); pr_err("\tname ");
if (nlen > UBIFS_MAX_NLEN) if (nlen > UBIFS_MAX_NLEN)
printk(KERN_ERR "(bad name length, not printing, " pr_err("(bad name length, not printing, bad or corrupted node)");
"bad or corrupted node)");
else { else {
for (i = 0; i < nlen && dent->name[i]; i++) for (i = 0; i < nlen && dent->name[i]; i++)
printk(KERN_CONT "%c", dent->name[i]); pr_cont("%c", dent->name[i]);
} }
printk(KERN_CONT "\n"); pr_cont("\n");
break; break;
} }
...@@ -528,15 +476,13 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) ...@@ -528,15 +476,13 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node)
int dlen = le32_to_cpu(ch->len) - UBIFS_DATA_NODE_SZ; int dlen = le32_to_cpu(ch->len) - UBIFS_DATA_NODE_SZ;
key_read(c, &dn->key, &key); key_read(c, &dn->key, &key);
printk(KERN_ERR "\tkey %s\n", pr_err("\tkey %s\n",
dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN));
printk(KERN_ERR "\tsize %u\n", pr_err("\tsize %u\n", le32_to_cpu(dn->size));
le32_to_cpu(dn->size)); pr_err("\tcompr_typ %d\n",
printk(KERN_ERR "\tcompr_typ %d\n",
(int)le16_to_cpu(dn->compr_type)); (int)le16_to_cpu(dn->compr_type));
printk(KERN_ERR "\tdata size %d\n", pr_err("\tdata size %d\n", dlen);
dlen); pr_err("\tdata:\n");
printk(KERN_ERR "\tdata:\n");
print_hex_dump(KERN_ERR, "\t", DUMP_PREFIX_OFFSET, 32, 1, print_hex_dump(KERN_ERR, "\t", DUMP_PREFIX_OFFSET, 32, 1,
(void *)&dn->data, dlen, 0); (void *)&dn->data, dlen, 0);
break; break;
...@@ -545,11 +491,10 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) ...@@ -545,11 +491,10 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node)
{ {
const struct ubifs_trun_node *trun = node; const struct ubifs_trun_node *trun = node;
printk(KERN_ERR "\tinum %u\n", pr_err("\tinum %u\n", le32_to_cpu(trun->inum));
le32_to_cpu(trun->inum)); pr_err("\told_size %llu\n",
printk(KERN_ERR "\told_size %llu\n",
(unsigned long long)le64_to_cpu(trun->old_size)); (unsigned long long)le64_to_cpu(trun->old_size));
printk(KERN_ERR "\tnew_size %llu\n", pr_err("\tnew_size %llu\n",
(unsigned long long)le64_to_cpu(trun->new_size)); (unsigned long long)le64_to_cpu(trun->new_size));
break; break;
} }
...@@ -558,17 +503,16 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) ...@@ -558,17 +503,16 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node)
const struct ubifs_idx_node *idx = node; const struct ubifs_idx_node *idx = node;
n = le16_to_cpu(idx->child_cnt); n = le16_to_cpu(idx->child_cnt);
printk(KERN_ERR "\tchild_cnt %d\n", n); pr_err("\tchild_cnt %d\n", n);
printk(KERN_ERR "\tlevel %d\n", pr_err("\tlevel %d\n", (int)le16_to_cpu(idx->level));
(int)le16_to_cpu(idx->level)); pr_err("\tBranches:\n");
printk(KERN_ERR "\tBranches:\n");
for (i = 0; i < n && i < c->fanout - 1; i++) { for (i = 0; i < n && i < c->fanout - 1; i++) {
const struct ubifs_branch *br; const struct ubifs_branch *br;
br = ubifs_idx_branch(c, idx, i); br = ubifs_idx_branch(c, idx, i);
key_read(c, &br->key, &key); key_read(c, &br->key, &key);
printk(KERN_ERR "\t%d: LEB %d:%d len %d key %s\n", pr_err("\t%d: LEB %d:%d len %d key %s\n",
i, le32_to_cpu(br->lnum), le32_to_cpu(br->offs), i, le32_to_cpu(br->lnum), le32_to_cpu(br->offs),
le32_to_cpu(br->len), le32_to_cpu(br->len),
dbg_snprintf_key(c, &key, key_buf, dbg_snprintf_key(c, &key, key_buf,
...@@ -582,20 +526,20 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) ...@@ -582,20 +526,20 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node)
{ {
const struct ubifs_orph_node *orph = node; const struct ubifs_orph_node *orph = node;
printk(KERN_ERR "\tcommit number %llu\n", pr_err("\tcommit number %llu\n",
(unsigned long long) (unsigned long long)
le64_to_cpu(orph->cmt_no) & LLONG_MAX); le64_to_cpu(orph->cmt_no) & LLONG_MAX);
printk(KERN_ERR "\tlast node flag %llu\n", pr_err("\tlast node flag %llu\n",
(unsigned long long)(le64_to_cpu(orph->cmt_no)) >> 63); (unsigned long long)(le64_to_cpu(orph->cmt_no)) >> 63);
n = (le32_to_cpu(ch->len) - UBIFS_ORPH_NODE_SZ) >> 3; n = (le32_to_cpu(ch->len) - UBIFS_ORPH_NODE_SZ) >> 3;
printk(KERN_ERR "\t%d orphan inode numbers:\n", n); pr_err("\t%d orphan inode numbers:\n", n);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
printk(KERN_ERR "\t ino %llu\n", pr_err("\t ino %llu\n",
(unsigned long long)le64_to_cpu(orph->inos[i])); (unsigned long long)le64_to_cpu(orph->inos[i]));
break; break;
} }
default: default:
printk(KERN_ERR "node type %d was not recognized\n", pr_err("node type %d was not recognized\n",
(int)ch->node_type); (int)ch->node_type);
} }
spin_unlock(&dbg_lock); spin_unlock(&dbg_lock);
...@@ -604,16 +548,16 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) ...@@ -604,16 +548,16 @@ 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_budget_req(const struct ubifs_budget_req *req)
{ {
spin_lock(&dbg_lock); spin_lock(&dbg_lock);
printk(KERN_ERR "Budgeting request: new_ino %d, dirtied_ino %d\n", pr_err("Budgeting request: new_ino %d, dirtied_ino %d\n",
req->new_ino, req->dirtied_ino); req->new_ino, req->dirtied_ino);
printk(KERN_ERR "\tnew_ino_d %d, dirtied_ino_d %d\n", pr_err("\tnew_ino_d %d, dirtied_ino_d %d\n",
req->new_ino_d, req->dirtied_ino_d); req->new_ino_d, req->dirtied_ino_d);
printk(KERN_ERR "\tnew_page %d, dirtied_page %d\n", pr_err("\tnew_page %d, dirtied_page %d\n",
req->new_page, req->dirtied_page); req->new_page, req->dirtied_page);
printk(KERN_ERR "\tnew_dent %d, mod_dent %d\n", pr_err("\tnew_dent %d, mod_dent %d\n",
req->new_dent, req->mod_dent); req->new_dent, req->mod_dent);
printk(KERN_ERR "\tidx_growth %d\n", req->idx_growth); pr_err("\tidx_growth %d\n", req->idx_growth);
printk(KERN_ERR "\tdata_growth %d dd_growth %d\n", pr_err("\tdata_growth %d dd_growth %d\n",
req->data_growth, req->dd_growth); req->data_growth, req->dd_growth);
spin_unlock(&dbg_lock); spin_unlock(&dbg_lock);
} }
...@@ -621,14 +565,12 @@ void ubifs_dump_budget_req(const struct ubifs_budget_req *req) ...@@ -621,14 +565,12 @@ void ubifs_dump_budget_req(const struct ubifs_budget_req *req)
void ubifs_dump_lstats(const struct ubifs_lp_stats *lst) void ubifs_dump_lstats(const struct ubifs_lp_stats *lst)
{ {
spin_lock(&dbg_lock); spin_lock(&dbg_lock);
printk(KERN_ERR "(pid %d) Lprops statistics: empty_lebs %d, " pr_err("(pid %d) Lprops statistics: empty_lebs %d, idx_lebs %d\n",
"idx_lebs %d\n", current->pid, lst->empty_lebs, lst->idx_lebs); current->pid, lst->empty_lebs, lst->idx_lebs);
printk(KERN_ERR "\ttaken_empty_lebs %d, total_free %lld, " pr_err("\ttaken_empty_lebs %d, total_free %lld, total_dirty %lld\n",
"total_dirty %lld\n", lst->taken_empty_lebs, lst->total_free, lst->taken_empty_lebs, lst->total_free, lst->total_dirty);
lst->total_dirty); pr_err("\ttotal_used %lld, total_dark %lld, total_dead %lld\n",
printk(KERN_ERR "\ttotal_used %lld, total_dark %lld, " lst->total_used, lst->total_dark, lst->total_dead);
"total_dead %lld\n", lst->total_used, lst->total_dark,
lst->total_dead);
spin_unlock(&dbg_lock); spin_unlock(&dbg_lock);
} }
...@@ -642,21 +584,17 @@ void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi) ...@@ -642,21 +584,17 @@ void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi)
spin_lock(&c->space_lock); spin_lock(&c->space_lock);
spin_lock(&dbg_lock); spin_lock(&dbg_lock);
printk(KERN_ERR "(pid %d) Budgeting info: data budget sum %lld, " pr_err("(pid %d) Budgeting info: data budget sum %lld, total budget sum %lld\n",
"total budget sum %lld\n", current->pid, current->pid, bi->data_growth + bi->dd_growth,
bi->data_growth + bi->dd_growth,
bi->data_growth + bi->dd_growth + bi->idx_growth); bi->data_growth + bi->dd_growth + bi->idx_growth);
printk(KERN_ERR "\tbudg_data_growth %lld, budg_dd_growth %lld, " pr_err("\tbudg_data_growth %lld, budg_dd_growth %lld, budg_idx_growth %lld\n",
"budg_idx_growth %lld\n", bi->data_growth, bi->dd_growth, bi->data_growth, bi->dd_growth, bi->idx_growth);
bi->idx_growth); pr_err("\tmin_idx_lebs %d, old_idx_sz %llu, uncommitted_idx %lld\n",
printk(KERN_ERR "\tmin_idx_lebs %d, old_idx_sz %llu, " bi->min_idx_lebs, bi->old_idx_sz, bi->uncommitted_idx);
"uncommitted_idx %lld\n", bi->min_idx_lebs, bi->old_idx_sz, pr_err("\tpage_budget %d, inode_budget %d, dent_budget %d\n",
bi->uncommitted_idx);
printk(KERN_ERR "\tpage_budget %d, inode_budget %d, dent_budget %d\n",
bi->page_budget, bi->inode_budget, bi->dent_budget); bi->page_budget, bi->inode_budget, bi->dent_budget);
printk(KERN_ERR "\tnospace %u, nospace_rp %u\n", pr_err("\tnospace %u, nospace_rp %u\n", bi->nospace, bi->nospace_rp);
bi->nospace, bi->nospace_rp); pr_err("\tdark_wm %d, dead_wm %d, max_idx_node_sz %d\n",
printk(KERN_ERR "\tdark_wm %d, dead_wm %d, max_idx_node_sz %d\n",
c->dark_wm, c->dead_wm, c->max_idx_node_sz); c->dark_wm, c->dead_wm, c->max_idx_node_sz);
if (bi != &c->bi) if (bi != &c->bi)
...@@ -667,38 +605,37 @@ void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi) ...@@ -667,38 +605,37 @@ void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi)
*/ */
goto out_unlock; goto out_unlock;
printk(KERN_ERR "\tfreeable_cnt %d, calc_idx_sz %lld, idx_gc_cnt %d\n", pr_err("\tfreeable_cnt %d, calc_idx_sz %lld, idx_gc_cnt %d\n",
c->freeable_cnt, c->calc_idx_sz, c->idx_gc_cnt); c->freeable_cnt, c->calc_idx_sz, c->idx_gc_cnt);
printk(KERN_ERR "\tdirty_pg_cnt %ld, dirty_zn_cnt %ld, " pr_err("\tdirty_pg_cnt %ld, dirty_zn_cnt %ld, clean_zn_cnt %ld\n",
"clean_zn_cnt %ld\n", atomic_long_read(&c->dirty_pg_cnt), atomic_long_read(&c->dirty_pg_cnt),
atomic_long_read(&c->dirty_zn_cnt), atomic_long_read(&c->dirty_zn_cnt),
atomic_long_read(&c->clean_zn_cnt)); atomic_long_read(&c->clean_zn_cnt));
printk(KERN_ERR "\tgc_lnum %d, ihead_lnum %d\n", pr_err("\tgc_lnum %d, ihead_lnum %d\n", c->gc_lnum, c->ihead_lnum);
c->gc_lnum, c->ihead_lnum);
/* If we are in R/O mode, journal heads do not exist */ /* If we are in R/O mode, journal heads do not exist */
if (c->jheads) if (c->jheads)
for (i = 0; i < c->jhead_cnt; i++) for (i = 0; i < c->jhead_cnt; i++)
printk(KERN_ERR "\tjhead %s\t LEB %d\n", pr_err("\tjhead %s\t LEB %d\n",
dbg_jhead(c->jheads[i].wbuf.jhead), dbg_jhead(c->jheads[i].wbuf.jhead),
c->jheads[i].wbuf.lnum); c->jheads[i].wbuf.lnum);
for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) { for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) {
bud = rb_entry(rb, struct ubifs_bud, rb); bud = rb_entry(rb, struct ubifs_bud, rb);
printk(KERN_ERR "\tbud LEB %d\n", bud->lnum); pr_err("\tbud LEB %d\n", bud->lnum);
} }
list_for_each_entry(bud, &c->old_buds, list) list_for_each_entry(bud, &c->old_buds, list)
printk(KERN_ERR "\told bud LEB %d\n", bud->lnum); pr_err("\told bud LEB %d\n", bud->lnum);
list_for_each_entry(idx_gc, &c->idx_gc, list) list_for_each_entry(idx_gc, &c->idx_gc, list)
printk(KERN_ERR "\tGC'ed idx LEB %d unmap %d\n", pr_err("\tGC'ed idx LEB %d unmap %d\n",
idx_gc->lnum, idx_gc->unmap); idx_gc->lnum, idx_gc->unmap);
printk(KERN_ERR "\tcommit state %d\n", c->cmt_state); pr_err("\tcommit state %d\n", c->cmt_state);
/* Print budgeting predictions */ /* Print budgeting predictions */
available = ubifs_calc_available(c, c->bi.min_idx_lebs); available = ubifs_calc_available(c, c->bi.min_idx_lebs);
outstanding = c->bi.data_growth + c->bi.dd_growth; outstanding = c->bi.data_growth + c->bi.dd_growth;
free = ubifs_get_free_space_nolock(c); free = ubifs_get_free_space_nolock(c);
printk(KERN_ERR "Budgeting predictions:\n"); pr_err("Budgeting predictions:\n");
printk(KERN_ERR "\tavailable: %lld, outstanding %lld, free %lld\n", pr_err("\tavailable: %lld, outstanding %lld, free %lld\n",
available, outstanding, free); available, outstanding, free);
out_unlock: out_unlock:
spin_unlock(&dbg_lock); spin_unlock(&dbg_lock);
...@@ -718,21 +655,19 @@ void ubifs_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) ...@@ -718,21 +655,19 @@ void ubifs_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp)
dark = ubifs_calc_dark(c, spc); dark = ubifs_calc_dark(c, spc);
if (lp->flags & LPROPS_INDEX) if (lp->flags & LPROPS_INDEX)
printk(KERN_ERR "LEB %-7d free %-8d dirty %-8d used %-8d " pr_err("LEB %-7d free %-8d dirty %-8d used %-8d free + dirty %-8d flags %#x (",
"free + dirty %-8d flags %#x (", lp->lnum, lp->free, lp->lnum, lp->free, lp->dirty, c->leb_size - spc, spc,
lp->dirty, c->leb_size - spc, spc, lp->flags); lp->flags);
else else
printk(KERN_ERR "LEB %-7d free %-8d dirty %-8d used %-8d " pr_err("LEB %-7d free %-8d dirty %-8d used %-8d free + dirty %-8d dark %-4d dead %-4d nodes fit %-3d flags %#-4x (",
"free + dirty %-8d dark %-4d dead %-4d nodes fit %-3d " lp->lnum, lp->free, lp->dirty, c->leb_size - spc, spc,
"flags %#-4x (", lp->lnum, lp->free, lp->dirty, dark, dead, (int)(spc / UBIFS_MAX_NODE_SZ), lp->flags);
c->leb_size - spc, spc, dark, dead,
(int)(spc / UBIFS_MAX_NODE_SZ), lp->flags);
if (lp->flags & LPROPS_TAKEN) { if (lp->flags & LPROPS_TAKEN) {
if (lp->flags & LPROPS_INDEX) if (lp->flags & LPROPS_INDEX)
printk(KERN_CONT "index, taken"); pr_cont("index, taken");
else else
printk(KERN_CONT "taken"); pr_cont("taken");
} else { } else {
const char *s; const char *s;
...@@ -769,7 +704,7 @@ void ubifs_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) ...@@ -769,7 +704,7 @@ void ubifs_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp)
break; break;
} }
} }
printk(KERN_CONT "%s", s); pr_cont("%s", s);
} }
for (rb = rb_first((struct rb_root *)&c->buds); rb; rb = rb_next(rb)) { for (rb = rb_first((struct rb_root *)&c->buds); rb; rb = rb_next(rb)) {
...@@ -784,19 +719,18 @@ void ubifs_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) ...@@ -784,19 +719,18 @@ void ubifs_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp)
*/ */
if (c->jheads && if (c->jheads &&
lp->lnum == c->jheads[i].wbuf.lnum) { lp->lnum == c->jheads[i].wbuf.lnum) {
printk(KERN_CONT ", jhead %s", pr_cont(", jhead %s", dbg_jhead(i));
dbg_jhead(i));
head = 1; head = 1;
} }
} }
if (!head) if (!head)
printk(KERN_CONT ", bud of jhead %s", pr_cont(", bud of jhead %s",
dbg_jhead(bud->jhead)); dbg_jhead(bud->jhead));
} }
} }
if (lp->lnum == c->gc_lnum) if (lp->lnum == c->gc_lnum)
printk(KERN_CONT ", GC LEB"); pr_cont(", GC LEB");
printk(KERN_CONT ")\n"); pr_cont(")\n");
} }
void ubifs_dump_lprops(struct ubifs_info *c) void ubifs_dump_lprops(struct ubifs_info *c)
...@@ -805,8 +739,7 @@ void ubifs_dump_lprops(struct ubifs_info *c) ...@@ -805,8 +739,7 @@ void ubifs_dump_lprops(struct ubifs_info *c)
struct ubifs_lprops lp; struct ubifs_lprops lp;
struct ubifs_lp_stats lst; struct ubifs_lp_stats lst;
printk(KERN_ERR "(pid %d) start dumping LEB properties\n", pr_err("(pid %d) start dumping LEB properties\n", current->pid);
current->pid);
ubifs_get_lp_stats(c, &lst); ubifs_get_lp_stats(c, &lst);
ubifs_dump_lstats(&lst); ubifs_dump_lstats(&lst);
...@@ -817,8 +750,7 @@ void ubifs_dump_lprops(struct ubifs_info *c) ...@@ -817,8 +750,7 @@ void ubifs_dump_lprops(struct ubifs_info *c)
ubifs_dump_lprop(c, &lp); ubifs_dump_lprop(c, &lp);
} }
printk(KERN_ERR "(pid %d) finish dumping LEB properties\n", pr_err("(pid %d) finish dumping LEB properties\n", current->pid);
current->pid);
} }
void ubifs_dump_lpt_info(struct ubifs_info *c) void ubifs_dump_lpt_info(struct ubifs_info *c)
...@@ -826,37 +758,36 @@ void ubifs_dump_lpt_info(struct ubifs_info *c) ...@@ -826,37 +758,36 @@ void ubifs_dump_lpt_info(struct ubifs_info *c)
int i; int i;
spin_lock(&dbg_lock); spin_lock(&dbg_lock);
printk(KERN_ERR "(pid %d) dumping LPT information\n", current->pid); pr_err("(pid %d) dumping LPT information\n", current->pid);
printk(KERN_ERR "\tlpt_sz: %lld\n", c->lpt_sz); pr_err("\tlpt_sz: %lld\n", c->lpt_sz);
printk(KERN_ERR "\tpnode_sz: %d\n", c->pnode_sz); pr_err("\tpnode_sz: %d\n", c->pnode_sz);
printk(KERN_ERR "\tnnode_sz: %d\n", c->nnode_sz); pr_err("\tnnode_sz: %d\n", c->nnode_sz);
printk(KERN_ERR "\tltab_sz: %d\n", c->ltab_sz); pr_err("\tltab_sz: %d\n", c->ltab_sz);
printk(KERN_ERR "\tlsave_sz: %d\n", c->lsave_sz); pr_err("\tlsave_sz: %d\n", c->lsave_sz);
printk(KERN_ERR "\tbig_lpt: %d\n", c->big_lpt); pr_err("\tbig_lpt: %d\n", c->big_lpt);
printk(KERN_ERR "\tlpt_hght: %d\n", c->lpt_hght); pr_err("\tlpt_hght: %d\n", c->lpt_hght);
printk(KERN_ERR "\tpnode_cnt: %d\n", c->pnode_cnt); pr_err("\tpnode_cnt: %d\n", c->pnode_cnt);
printk(KERN_ERR "\tnnode_cnt: %d\n", c->nnode_cnt); pr_err("\tnnode_cnt: %d\n", c->nnode_cnt);
printk(KERN_ERR "\tdirty_pn_cnt: %d\n", c->dirty_pn_cnt); pr_err("\tdirty_pn_cnt: %d\n", c->dirty_pn_cnt);
printk(KERN_ERR "\tdirty_nn_cnt: %d\n", c->dirty_nn_cnt); pr_err("\tdirty_nn_cnt: %d\n", c->dirty_nn_cnt);
printk(KERN_ERR "\tlsave_cnt: %d\n", c->lsave_cnt); pr_err("\tlsave_cnt: %d\n", c->lsave_cnt);
printk(KERN_ERR "\tspace_bits: %d\n", c->space_bits); pr_err("\tspace_bits: %d\n", c->space_bits);
printk(KERN_ERR "\tlpt_lnum_bits: %d\n", c->lpt_lnum_bits); pr_err("\tlpt_lnum_bits: %d\n", c->lpt_lnum_bits);
printk(KERN_ERR "\tlpt_offs_bits: %d\n", c->lpt_offs_bits); pr_err("\tlpt_offs_bits: %d\n", c->lpt_offs_bits);
printk(KERN_ERR "\tlpt_spc_bits: %d\n", c->lpt_spc_bits); pr_err("\tlpt_spc_bits: %d\n", c->lpt_spc_bits);
printk(KERN_ERR "\tpcnt_bits: %d\n", c->pcnt_bits); pr_err("\tpcnt_bits: %d\n", c->pcnt_bits);
printk(KERN_ERR "\tlnum_bits: %d\n", c->lnum_bits); pr_err("\tlnum_bits: %d\n", c->lnum_bits);
printk(KERN_ERR "\tLPT root is at %d:%d\n", c->lpt_lnum, c->lpt_offs); pr_err("\tLPT root is at %d:%d\n", c->lpt_lnum, c->lpt_offs);
printk(KERN_ERR "\tLPT head is at %d:%d\n", pr_err("\tLPT head is at %d:%d\n",
c->nhead_lnum, c->nhead_offs); c->nhead_lnum, c->nhead_offs);
printk(KERN_ERR "\tLPT ltab is at %d:%d\n", pr_err("\tLPT ltab is at %d:%d\n", c->ltab_lnum, c->ltab_offs);
c->ltab_lnum, c->ltab_offs);
if (c->big_lpt) if (c->big_lpt)
printk(KERN_ERR "\tLPT lsave is at %d:%d\n", pr_err("\tLPT lsave is at %d:%d\n",
c->lsave_lnum, c->lsave_offs); c->lsave_lnum, c->lsave_offs);
for (i = 0; i < c->lpt_lebs; i++) for (i = 0; i < c->lpt_lebs; i++)
printk(KERN_ERR "\tLPT LEB %d free %d dirty %d tgc %d " pr_err("\tLPT LEB %d free %d dirty %d tgc %d cmt %d\n",
"cmt %d\n", i + c->lpt_first, c->ltab[i].free, i + c->lpt_first, c->ltab[i].free, c->ltab[i].dirty,
c->ltab[i].dirty, c->ltab[i].tgc, c->ltab[i].cmt); c->ltab[i].tgc, c->ltab[i].cmt);
spin_unlock(&dbg_lock); spin_unlock(&dbg_lock);
} }
...@@ -865,13 +796,13 @@ void ubifs_dump_sleb(const struct ubifs_info *c, ...@@ -865,13 +796,13 @@ void ubifs_dump_sleb(const struct ubifs_info *c,
{ {
struct ubifs_scan_node *snod; struct ubifs_scan_node *snod;
printk(KERN_ERR "(pid %d) start dumping scanned data from LEB %d:%d\n", pr_err("(pid %d) start dumping scanned data from LEB %d:%d\n",
current->pid, sleb->lnum, offs); current->pid, sleb->lnum, offs);
list_for_each_entry(snod, &sleb->nodes, list) { list_for_each_entry(snod, &sleb->nodes, list) {
cond_resched(); cond_resched();
printk(KERN_ERR "Dumping node at LEB %d:%d len %d\n", sleb->lnum, pr_err("Dumping node at LEB %d:%d len %d\n",
snod->offs, snod->len); sleb->lnum, snod->offs, snod->len);
ubifs_dump_node(c, snod->node); ubifs_dump_node(c, snod->node);
} }
} }
...@@ -882,11 +813,7 @@ void ubifs_dump_leb(const struct ubifs_info *c, int lnum) ...@@ -882,11 +813,7 @@ void ubifs_dump_leb(const struct ubifs_info *c, int lnum)
struct ubifs_scan_node *snod; struct ubifs_scan_node *snod;
void *buf; void *buf;
if (dbg_is_tst_rcvry(c)) pr_err("(pid %d) start dumping LEB %d\n", current->pid, lnum);
return;
printk(KERN_ERR "(pid %d) start dumping LEB %d\n",
current->pid, lnum);
buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL);
if (!buf) { if (!buf) {
...@@ -900,18 +827,17 @@ void ubifs_dump_leb(const struct ubifs_info *c, int lnum) ...@@ -900,18 +827,17 @@ void ubifs_dump_leb(const struct ubifs_info *c, int lnum)
goto out; goto out;
} }
printk(KERN_ERR "LEB %d has %d nodes ending at %d\n", lnum, pr_err("LEB %d has %d nodes ending at %d\n", lnum,
sleb->nodes_cnt, sleb->endpt); sleb->nodes_cnt, sleb->endpt);
list_for_each_entry(snod, &sleb->nodes, list) { list_for_each_entry(snod, &sleb->nodes, list) {
cond_resched(); cond_resched();
printk(KERN_ERR "Dumping node at LEB %d:%d len %d\n", lnum, pr_err("Dumping node at LEB %d:%d len %d\n", lnum,
snod->offs, snod->len); snod->offs, snod->len);
ubifs_dump_node(c, snod->node); ubifs_dump_node(c, snod->node);
} }
printk(KERN_ERR "(pid %d) finish dumping LEB %d\n", pr_err("(pid %d) finish dumping LEB %d\n", current->pid, lnum);
current->pid, lnum);
ubifs_scan_destroy(sleb); ubifs_scan_destroy(sleb);
out: out:
...@@ -932,33 +858,28 @@ void ubifs_dump_znode(const struct ubifs_info *c, ...@@ -932,33 +858,28 @@ void ubifs_dump_znode(const struct ubifs_info *c,
else else
zbr = &c->zroot; zbr = &c->zroot;
printk(KERN_ERR "znode %p, LEB %d:%d len %d parent %p iip %d level %d" pr_err("znode %p, LEB %d:%d len %d parent %p iip %d level %d child_cnt %d flags %lx\n",
" child_cnt %d flags %lx\n", znode, zbr->lnum, zbr->offs, znode, zbr->lnum, zbr->offs, zbr->len, znode->parent, znode->iip,
zbr->len, znode->parent, znode->iip, znode->level, znode->level, znode->child_cnt, znode->flags);
znode->child_cnt, znode->flags);
if (znode->child_cnt <= 0 || znode->child_cnt > c->fanout) { if (znode->child_cnt <= 0 || znode->child_cnt > c->fanout) {
spin_unlock(&dbg_lock); spin_unlock(&dbg_lock);
return; return;
} }
printk(KERN_ERR "zbranches:\n"); pr_err("zbranches:\n");
for (n = 0; n < znode->child_cnt; n++) { for (n = 0; n < znode->child_cnt; n++) {
zbr = &znode->zbranch[n]; zbr = &znode->zbranch[n];
if (znode->level > 0) if (znode->level > 0)
printk(KERN_ERR "\t%d: znode %p LEB %d:%d len %d key " pr_err("\t%d: znode %p LEB %d:%d len %d key %s\n",
"%s\n", n, zbr->znode, zbr->lnum, n, zbr->znode, zbr->lnum, zbr->offs, zbr->len,
zbr->offs, zbr->len, dbg_snprintf_key(c, &zbr->key, key_buf,
dbg_snprintf_key(c, &zbr->key, DBG_KEY_BUF_LEN));
key_buf,
DBG_KEY_BUF_LEN));
else else
printk(KERN_ERR "\t%d: LNC %p LEB %d:%d len %d key " pr_err("\t%d: LNC %p LEB %d:%d len %d key %s\n",
"%s\n", n, zbr->znode, zbr->lnum, n, zbr->znode, zbr->lnum, zbr->offs, zbr->len,
zbr->offs, zbr->len, dbg_snprintf_key(c, &zbr->key, key_buf,
dbg_snprintf_key(c, &zbr->key, DBG_KEY_BUF_LEN));
key_buf,
DBG_KEY_BUF_LEN));
} }
spin_unlock(&dbg_lock); spin_unlock(&dbg_lock);
} }
...@@ -967,16 +888,16 @@ void ubifs_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat) ...@@ -967,16 +888,16 @@ void ubifs_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat)
{ {
int i; int i;
printk(KERN_ERR "(pid %d) start dumping heap cat %d (%d elements)\n", pr_err("(pid %d) start dumping heap cat %d (%d elements)\n",
current->pid, cat, heap->cnt); current->pid, cat, heap->cnt);
for (i = 0; i < heap->cnt; i++) { for (i = 0; i < heap->cnt; i++) {
struct ubifs_lprops *lprops = heap->arr[i]; struct ubifs_lprops *lprops = heap->arr[i];
printk(KERN_ERR "\t%d. LEB %d hpos %d free %d dirty %d " pr_err("\t%d. LEB %d hpos %d free %d dirty %d flags %d\n",
"flags %d\n", i, lprops->lnum, lprops->hpos, i, lprops->lnum, lprops->hpos, lprops->free,
lprops->free, lprops->dirty, lprops->flags); lprops->dirty, lprops->flags);
} }
printk(KERN_ERR "(pid %d) finish dumping heap\n", current->pid); pr_err("(pid %d) finish dumping heap\n", current->pid);
} }
void ubifs_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, void ubifs_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
...@@ -984,15 +905,15 @@ void ubifs_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, ...@@ -984,15 +905,15 @@ void ubifs_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode,
{ {
int i; int i;
printk(KERN_ERR "(pid %d) dumping pnode:\n", current->pid); pr_err("(pid %d) dumping pnode:\n", current->pid);
printk(KERN_ERR "\taddress %zx parent %zx cnext %zx\n", pr_err("\taddress %zx parent %zx cnext %zx\n",
(size_t)pnode, (size_t)parent, (size_t)pnode->cnext); (size_t)pnode, (size_t)parent, (size_t)pnode->cnext);
printk(KERN_ERR "\tflags %lu iip %d level %d num %d\n", pr_err("\tflags %lu iip %d level %d num %d\n",
pnode->flags, iip, pnode->level, pnode->num); pnode->flags, iip, pnode->level, pnode->num);
for (i = 0; i < UBIFS_LPT_FANOUT; i++) { for (i = 0; i < UBIFS_LPT_FANOUT; i++) {
struct ubifs_lprops *lp = &pnode->lprops[i]; struct ubifs_lprops *lp = &pnode->lprops[i];
printk(KERN_ERR "\t%d: free %d dirty %d flags %d lnum %d\n", pr_err("\t%d: free %d dirty %d flags %d lnum %d\n",
i, lp->free, lp->dirty, lp->flags, lp->lnum); i, lp->free, lp->dirty, lp->flags, lp->lnum);
} }
} }
...@@ -1002,20 +923,20 @@ void ubifs_dump_tnc(struct ubifs_info *c) ...@@ -1002,20 +923,20 @@ void ubifs_dump_tnc(struct ubifs_info *c)
struct ubifs_znode *znode; struct ubifs_znode *znode;
int level; int level;
printk(KERN_ERR "\n"); pr_err("\n");
printk(KERN_ERR "(pid %d) start dumping TNC tree\n", current->pid); pr_err("(pid %d) start dumping TNC tree\n", current->pid);
znode = ubifs_tnc_levelorder_next(c->zroot.znode, NULL); znode = ubifs_tnc_levelorder_next(c->zroot.znode, NULL);
level = znode->level; level = znode->level;
printk(KERN_ERR "== Level %d ==\n", level); pr_err("== Level %d ==\n", level);
while (znode) { while (znode) {
if (level != znode->level) { if (level != znode->level) {
level = znode->level; level = znode->level;
printk(KERN_ERR "== Level %d ==\n", level); pr_err("== Level %d ==\n", level);
} }
ubifs_dump_znode(c, znode); ubifs_dump_znode(c, znode);
znode = ubifs_tnc_levelorder_next(c->zroot.znode, znode); znode = ubifs_tnc_levelorder_next(c->zroot.znode, znode);
} }
printk(KERN_ERR "(pid %d) finish dumping TNC tree\n", current->pid); pr_err("(pid %d) finish dumping TNC tree\n", current->pid);
} }
static int dump_znode(struct ubifs_info *c, struct ubifs_znode *znode, static int dump_znode(struct ubifs_info *c, struct ubifs_znode *znode,
...@@ -1154,8 +1075,8 @@ int dbg_check_synced_i_size(const struct ubifs_info *c, struct inode *inode) ...@@ -1154,8 +1075,8 @@ int dbg_check_synced_i_size(const struct ubifs_info *c, struct inode *inode)
mutex_lock(&ui->ui_mutex); mutex_lock(&ui->ui_mutex);
spin_lock(&ui->ui_lock); spin_lock(&ui->ui_lock);
if (ui->ui_size != ui->synced_i_size && !ui->dirty) { if (ui->ui_size != ui->synced_i_size && !ui->dirty) {
ubifs_err("ui_size is %lld, synced_i_size is %lld, but inode " ubifs_err("ui_size is %lld, synced_i_size is %lld, but inode is clean",
"is clean", ui->ui_size, ui->synced_i_size); 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));
dump_stack(); dump_stack();
...@@ -1217,17 +1138,16 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir) ...@@ -1217,17 +1138,16 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir)
kfree(pdent); kfree(pdent);
if (i_size_read(dir) != size) { if (i_size_read(dir) != size) {
ubifs_err("directory inode %lu has size %llu, " ubifs_err("directory inode %lu has size %llu, but calculated size is %llu",
"but calculated size is %llu", dir->i_ino, dir->i_ino, (unsigned long long)i_size_read(dir),
(unsigned long long)i_size_read(dir),
(unsigned long long)size); (unsigned long long)size);
ubifs_dump_inode(c, dir); ubifs_dump_inode(c, dir);
dump_stack(); dump_stack();
return -EINVAL; return -EINVAL;
} }
if (dir->i_nlink != nlink) { if (dir->i_nlink != nlink) {
ubifs_err("directory inode %lu has nlink %u, but calculated " ubifs_err("directory inode %lu has nlink %u, but calculated nlink is %u",
"nlink is %u", dir->i_ino, dir->i_nlink, nlink); dir->i_ino, dir->i_nlink, nlink);
ubifs_dump_inode(c, dir); ubifs_dump_inode(c, dir);
dump_stack(); dump_stack();
return -EINVAL; return -EINVAL;
...@@ -1686,8 +1606,8 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, ...@@ -1686,8 +1606,8 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
if (znode_cb) { if (znode_cb) {
err = znode_cb(c, znode, priv); err = znode_cb(c, znode, priv);
if (err) { if (err) {
ubifs_err("znode checking function returned " ubifs_err("znode checking function returned error %d",
"error %d", err); err);
ubifs_dump_znode(c, znode); ubifs_dump_znode(c, znode);
goto out_dump; goto out_dump;
} }
...@@ -1697,9 +1617,7 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, ...@@ -1697,9 +1617,7 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
zbr = &znode->zbranch[idx]; zbr = &znode->zbranch[idx];
err = leaf_cb(c, zbr, priv); err = leaf_cb(c, zbr, priv);
if (err) { if (err) {
ubifs_err("leaf checking function " ubifs_err("leaf checking function returned error %d, for leaf at LEB %d:%d",
"returned error %d, for leaf "
"at LEB %d:%d",
err, zbr->lnum, zbr->offs); err, zbr->lnum, zbr->offs);
goto out_dump; goto out_dump;
} }
...@@ -1807,8 +1725,8 @@ int dbg_check_idx_size(struct ubifs_info *c, long long idx_size) ...@@ -1807,8 +1725,8 @@ int dbg_check_idx_size(struct ubifs_info *c, long long idx_size)
} }
if (calc != idx_size) { if (calc != idx_size) {
ubifs_err("index size check failed: calculated size is %lld, " ubifs_err("index size check failed: calculated size is %lld, should be %lld",
"should be %lld", calc, idx_size); calc, idx_size);
dump_stack(); dump_stack();
return -EINVAL; return -EINVAL;
} }
...@@ -2120,8 +2038,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, ...@@ -2120,8 +2038,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr,
fscki = read_add_inode(c, priv, inum); fscki = read_add_inode(c, priv, inum);
if (IS_ERR(fscki)) { if (IS_ERR(fscki)) {
err = PTR_ERR(fscki); err = PTR_ERR(fscki);
ubifs_err("error %d while processing data node and " ubifs_err("error %d while processing data node and trying to find inode node %lu",
"trying to find inode node %lu",
err, (unsigned long)inum); err, (unsigned long)inum);
goto out_dump; goto out_dump;
} }
...@@ -2131,9 +2048,8 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, ...@@ -2131,9 +2048,8 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr,
blk_offs <<= UBIFS_BLOCK_SHIFT; blk_offs <<= UBIFS_BLOCK_SHIFT;
blk_offs += le32_to_cpu(dn->size); blk_offs += le32_to_cpu(dn->size);
if (blk_offs > fscki->size) { if (blk_offs > fscki->size) {
ubifs_err("data node at LEB %d:%d is not within inode " ubifs_err("data node at LEB %d:%d is not within inode size %lld",
"size %lld", zbr->lnum, zbr->offs, zbr->lnum, zbr->offs, fscki->size);
fscki->size);
err = -EINVAL; err = -EINVAL;
goto out_dump; goto out_dump;
} }
...@@ -2154,8 +2070,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, ...@@ -2154,8 +2070,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr,
fscki = read_add_inode(c, priv, inum); fscki = read_add_inode(c, priv, inum);
if (IS_ERR(fscki)) { if (IS_ERR(fscki)) {
err = PTR_ERR(fscki); err = PTR_ERR(fscki);
ubifs_err("error %d while processing entry node and " ubifs_err("error %d while processing entry node and trying to find inode node %lu",
"trying to find inode node %lu",
err, (unsigned long)inum); err, (unsigned long)inum);
goto out_dump; goto out_dump;
} }
...@@ -2167,8 +2082,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, ...@@ -2167,8 +2082,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr,
fscki1 = read_add_inode(c, priv, inum); fscki1 = read_add_inode(c, priv, inum);
if (IS_ERR(fscki1)) { if (IS_ERR(fscki1)) {
err = PTR_ERR(fscki1); err = PTR_ERR(fscki1);
ubifs_err("error %d while processing entry node and " ubifs_err("error %d while processing entry node and trying to find parent inode node %lu",
"trying to find parent inode node %lu",
err, (unsigned long)inum); err, (unsigned long)inum);
goto out_dump; goto out_dump;
} }
...@@ -2258,61 +2172,52 @@ static int check_inodes(struct ubifs_info *c, struct fsck_data *fsckd) ...@@ -2258,61 +2172,52 @@ static int check_inodes(struct ubifs_info *c, struct fsck_data *fsckd)
*/ */
if (fscki->inum != UBIFS_ROOT_INO && if (fscki->inum != UBIFS_ROOT_INO &&
fscki->references != 1) { fscki->references != 1) {
ubifs_err("directory inode %lu has %d " ubifs_err("directory inode %lu has %d direntries which refer it, but should be 1",
"direntries which refer it, but "
"should be 1",
(unsigned long)fscki->inum, (unsigned long)fscki->inum,
fscki->references); fscki->references);
goto out_dump; goto out_dump;
} }
if (fscki->inum == UBIFS_ROOT_INO && if (fscki->inum == UBIFS_ROOT_INO &&
fscki->references != 0) { fscki->references != 0) {
ubifs_err("root inode %lu has non-zero (%d) " ubifs_err("root inode %lu has non-zero (%d) direntries which refer it",
"direntries which refer it",
(unsigned long)fscki->inum, (unsigned long)fscki->inum,
fscki->references); fscki->references);
goto out_dump; goto out_dump;
} }
if (fscki->calc_sz != fscki->size) { if (fscki->calc_sz != fscki->size) {
ubifs_err("directory inode %lu size is %lld, " ubifs_err("directory inode %lu size is %lld, but calculated size is %lld",
"but calculated size is %lld",
(unsigned long)fscki->inum, (unsigned long)fscki->inum,
fscki->size, fscki->calc_sz); fscki->size, fscki->calc_sz);
goto out_dump; goto out_dump;
} }
if (fscki->calc_cnt != fscki->nlink) { if (fscki->calc_cnt != fscki->nlink) {
ubifs_err("directory inode %lu nlink is %d, " ubifs_err("directory inode %lu nlink is %d, but calculated nlink is %d",
"but calculated nlink is %d",
(unsigned long)fscki->inum, (unsigned long)fscki->inum,
fscki->nlink, fscki->calc_cnt); fscki->nlink, fscki->calc_cnt);
goto out_dump; goto out_dump;
} }
} else { } else {
if (fscki->references != fscki->nlink) { if (fscki->references != fscki->nlink) {
ubifs_err("inode %lu nlink is %d, but " ubifs_err("inode %lu nlink is %d, but calculated nlink is %d",
"calculated nlink is %d",
(unsigned long)fscki->inum, (unsigned long)fscki->inum,
fscki->nlink, fscki->references); fscki->nlink, fscki->references);
goto out_dump; goto out_dump;
} }
} }
if (fscki->xattr_sz != fscki->calc_xsz) { if (fscki->xattr_sz != fscki->calc_xsz) {
ubifs_err("inode %lu has xattr size %u, but " ubifs_err("inode %lu has xattr size %u, but calculated size is %lld",
"calculated size is %lld",
(unsigned long)fscki->inum, fscki->xattr_sz, (unsigned long)fscki->inum, fscki->xattr_sz,
fscki->calc_xsz); fscki->calc_xsz);
goto out_dump; goto out_dump;
} }
if (fscki->xattr_cnt != fscki->calc_xcnt) { if (fscki->xattr_cnt != fscki->calc_xcnt) {
ubifs_err("inode %lu has %u xattrs, but " ubifs_err("inode %lu has %u xattrs, but calculated count is %lld",
"calculated count is %lld",
(unsigned long)fscki->inum, (unsigned long)fscki->inum,
fscki->xattr_cnt, fscki->calc_xcnt); fscki->xattr_cnt, fscki->calc_xcnt);
goto out_dump; goto out_dump;
} }
if (fscki->xattr_nms != fscki->calc_xnms) { if (fscki->xattr_nms != fscki->calc_xnms) {
ubifs_err("inode %lu has xattr names' size %u, but " ubifs_err("inode %lu has xattr names' size %u, but calculated names' size is %lld",
"calculated names' size is %lld",
(unsigned long)fscki->inum, fscki->xattr_nms, (unsigned long)fscki->inum, fscki->xattr_nms,
fscki->calc_xnms); fscki->calc_xnms);
goto out_dump; goto out_dump;
...@@ -2652,20 +2557,18 @@ static int power_cut_emulated(struct ubifs_info *c, int lnum, int write) ...@@ -2652,20 +2557,18 @@ static int power_cut_emulated(struct ubifs_info *c, int lnum, int write)
return 1; return 1;
} }
static void cut_data(const void *buf, unsigned int len) static int corrupt_data(const struct ubifs_info *c, const void *buf,
unsigned int len)
{ {
unsigned int from, to, i, ffs = chance(1, 2); unsigned int from, to, i, ffs = chance(1, 2);
unsigned char *p = (void *)buf; unsigned char *p = (void *)buf;
from = random32() % (len + 1); from = random32() % (len + 1);
if (chance(1, 2)) /* Corruption may only span one max. write unit */
to = random32() % (len - from + 1); to = min(len, ALIGN(from, c->max_write_size));
else
to = len;
if (from < to) ubifs_warn("filled bytes %u-%u with %s", from, to - 1,
ubifs_warn("filled bytes %u-%u with %s", from, to - 1, ffs ? "0xFFs" : "random data");
ffs ? "0xFFs" : "random data");
if (ffs) if (ffs)
for (i = from; i < to; i++) for (i = from; i < to; i++)
...@@ -2673,6 +2576,8 @@ static void cut_data(const void *buf, unsigned int len) ...@@ -2673,6 +2576,8 @@ static void cut_data(const void *buf, unsigned int len)
else else
for (i = from; i < to; i++) for (i = from; i < to; i++)
p[i] = random32() % 0x100; p[i] = random32() % 0x100;
return to;
} }
int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf,
...@@ -2685,7 +2590,9 @@ int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, ...@@ -2685,7 +2590,9 @@ int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf,
failing = power_cut_emulated(c, lnum, 1); failing = power_cut_emulated(c, lnum, 1);
if (failing) if (failing)
cut_data(buf, len); len = corrupt_data(c, buf, len);
ubifs_warn("actually write %d bytes to LEB %d:%d (the buffer was corrupted)",
len, lnum, offs);
err = ubi_leb_write(c->ubi, lnum, buf, offs, len); err = ubi_leb_write(c->ubi, lnum, buf, offs, len);
if (err) if (err)
return err; return err;
......
...@@ -150,7 +150,7 @@ struct ubifs_global_debug_info { ...@@ -150,7 +150,7 @@ struct ubifs_global_debug_info {
#define ubifs_assert(expr) do { \ #define ubifs_assert(expr) do { \
if (unlikely(!(expr))) { \ if (unlikely(!(expr))) { \
printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ pr_crit("UBIFS assert failed in %s at %u (pid %d)\n", \
__func__, __LINE__, current->pid); \ __func__, __LINE__, current->pid); \
dump_stack(); \ dump_stack(); \
} \ } \
...@@ -159,26 +159,23 @@ struct ubifs_global_debug_info { ...@@ -159,26 +159,23 @@ struct ubifs_global_debug_info {
#define ubifs_assert_cmt_locked(c) do { \ #define ubifs_assert_cmt_locked(c) do { \
if (unlikely(down_write_trylock(&(c)->commit_sem))) { \ if (unlikely(down_write_trylock(&(c)->commit_sem))) { \
up_write(&(c)->commit_sem); \ up_write(&(c)->commit_sem); \
printk(KERN_CRIT "commit lock is not locked!\n"); \ pr_crit("commit lock is not locked!\n"); \
ubifs_assert(0); \ ubifs_assert(0); \
} \ } \
} while (0) } 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 " (pid %d): " fmt "\n", current->pid, \
##__VA_ARGS__)
#define DBG_KEY_BUF_LEN 48 #define DBG_KEY_BUF_LEN 48
#define ubifs_dbg_msg_key(type, key, fmt, ...) do { \ #define ubifs_dbg_msg_key(type, key, fmt, ...) do { \
char __tmp_key_buf[DBG_KEY_BUF_LEN]; \ char __tmp_key_buf[DBG_KEY_BUF_LEN]; \
pr_debug("UBIFS DBG " type ": " fmt "%s\n", ##__VA_ARGS__, \ pr_debug("UBIFS DBG " type " (pid %d): " fmt "%s\n", current->pid, \
##__VA_ARGS__, \
dbg_snprintf_key(c, key, __tmp_key_buf, DBG_KEY_BUF_LEN)); \ dbg_snprintf_key(c, key, __tmp_key_buf, DBG_KEY_BUF_LEN)); \
} while (0) } while (0)
/* Just a debugging messages not related to any specific UBIFS subsystem */
#define dbg_msg(fmt, ...) \
printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n", current->pid, \
__func__, ##__VA_ARGS__)
/* General messages */ /* General messages */
#define dbg_gen(fmt, ...) ubifs_dbg_msg("gen", fmt, ##__VA_ARGS__) #define dbg_gen(fmt, ...) ubifs_dbg_msg("gen", fmt, ##__VA_ARGS__)
/* Additional journal messages */ /* Additional journal messages */
......
...@@ -980,8 +980,8 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -980,8 +980,8 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
* separately. * separately.
*/ */
dbg_gen("dent '%.*s' ino %lu in dir ino %lu to dent '%.*s' in " dbg_gen("dent '%.*s' ino %lu in dir ino %lu to dent '%.*s' in dir ino %lu",
"dir ino %lu", old_dentry->d_name.len, old_dentry->d_name.name, old_dentry->d_name.len, old_dentry->d_name.name,
old_inode->i_ino, old_dir->i_ino, new_dentry->d_name.len, old_inode->i_ino, old_dir->i_ino, new_dentry->d_name.len,
new_dentry->d_name.name, new_dir->i_ino); new_dentry->d_name.name, new_dir->i_ino);
ubifs_assert(mutex_is_locked(&old_dir->i_mutex)); ubifs_assert(mutex_is_locked(&old_dir->i_mutex));
......
...@@ -1486,8 +1486,8 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, ...@@ -1486,8 +1486,8 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma,
err = ubifs_budget_space(c, &req); err = ubifs_budget_space(c, &req);
if (unlikely(err)) { if (unlikely(err)) {
if (err == -ENOSPC) if (err == -ENOSPC)
ubifs_warn("out of space for mmapped file " ubifs_warn("out of space for mmapped file (inode number %lu)",
"(inode number %lu)", inode->i_ino); inode->i_ino);
return VM_FAULT_SIGBUS; return VM_FAULT_SIGBUS;
} }
......
...@@ -714,9 +714,9 @@ int ubifs_garbage_collect(struct ubifs_info *c, int anyway) ...@@ -714,9 +714,9 @@ int ubifs_garbage_collect(struct ubifs_info *c, int anyway)
break; break;
} }
dbg_gc("found LEB %d: free %d, dirty %d, sum %d " dbg_gc("found LEB %d: free %d, dirty %d, sum %d (min. space %d)",
"(min. space %d)", lp.lnum, lp.free, lp.dirty, lp.lnum, lp.free, lp.dirty, lp.free + lp.dirty,
lp.free + lp.dirty, min_space); min_space);
space_before = c->leb_size - wbuf->offs - wbuf->used; space_before = c->leb_size - wbuf->offs - wbuf->used;
if (wbuf->lnum == -1) if (wbuf->lnum == -1)
......
...@@ -315,17 +315,15 @@ static void remove_buds(struct ubifs_info *c) ...@@ -315,17 +315,15 @@ static void remove_buds(struct ubifs_info *c)
* heads (non-closed buds). * heads (non-closed buds).
*/ */
c->cmt_bud_bytes += wbuf->offs - bud->start; c->cmt_bud_bytes += wbuf->offs - bud->start;
dbg_log("preserve %d:%d, jhead %s, bud bytes %d, " dbg_log("preserve %d:%d, jhead %s, bud bytes %d, cmt_bud_bytes %lld",
"cmt_bud_bytes %lld", bud->lnum, bud->start, bud->lnum, bud->start, dbg_jhead(bud->jhead),
dbg_jhead(bud->jhead), wbuf->offs - bud->start, wbuf->offs - bud->start, c->cmt_bud_bytes);
c->cmt_bud_bytes);
bud->start = wbuf->offs; bud->start = wbuf->offs;
} else { } else {
c->cmt_bud_bytes += c->leb_size - bud->start; c->cmt_bud_bytes += c->leb_size - bud->start;
dbg_log("remove %d:%d, jhead %s, bud bytes %d, " dbg_log("remove %d:%d, jhead %s, bud bytes %d, cmt_bud_bytes %lld",
"cmt_bud_bytes %lld", bud->lnum, bud->start, bud->lnum, bud->start, dbg_jhead(bud->jhead),
dbg_jhead(bud->jhead), c->leb_size - bud->start, c->leb_size - bud->start, c->cmt_bud_bytes);
c->cmt_bud_bytes);
rb_erase(p1, &c->buds); rb_erase(p1, &c->buds);
/* /*
* If the commit does not finish, the recovery will need * If the commit does not finish, the recovery will need
......
...@@ -867,15 +867,15 @@ int dbg_check_cats(struct ubifs_info *c) ...@@ -867,15 +867,15 @@ int dbg_check_cats(struct ubifs_info *c)
list_for_each_entry(lprops, &c->empty_list, list) { list_for_each_entry(lprops, &c->empty_list, list) {
if (lprops->free != c->leb_size) { if (lprops->free != c->leb_size) {
ubifs_err("non-empty LEB %d on empty list " ubifs_err("non-empty LEB %d on empty list (free %d dirty %d flags %d)",
"(free %d dirty %d flags %d)", lprops->lnum, lprops->lnum, lprops->free, lprops->dirty,
lprops->free, lprops->dirty, lprops->flags); lprops->flags);
return -EINVAL; return -EINVAL;
} }
if (lprops->flags & LPROPS_TAKEN) { if (lprops->flags & LPROPS_TAKEN) {
ubifs_err("taken LEB %d on empty list " ubifs_err("taken LEB %d on empty list (free %d dirty %d flags %d)",
"(free %d dirty %d flags %d)", lprops->lnum, lprops->lnum, lprops->free, lprops->dirty,
lprops->free, lprops->dirty, lprops->flags); lprops->flags);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -883,15 +883,15 @@ int dbg_check_cats(struct ubifs_info *c) ...@@ -883,15 +883,15 @@ int dbg_check_cats(struct ubifs_info *c)
i = 0; i = 0;
list_for_each_entry(lprops, &c->freeable_list, list) { list_for_each_entry(lprops, &c->freeable_list, list) {
if (lprops->free + lprops->dirty != c->leb_size) { if (lprops->free + lprops->dirty != c->leb_size) {
ubifs_err("non-freeable LEB %d on freeable list " ubifs_err("non-freeable LEB %d on freeable list (free %d dirty %d flags %d)",
"(free %d dirty %d flags %d)", lprops->lnum, lprops->lnum, lprops->free, lprops->dirty,
lprops->free, lprops->dirty, lprops->flags); lprops->flags);
return -EINVAL; return -EINVAL;
} }
if (lprops->flags & LPROPS_TAKEN) { if (lprops->flags & LPROPS_TAKEN) {
ubifs_err("taken LEB %d on freeable list " ubifs_err("taken LEB %d on freeable list (free %d dirty %d flags %d)",
"(free %d dirty %d flags %d)", lprops->lnum, lprops->lnum, lprops->free, lprops->dirty,
lprops->free, lprops->dirty, lprops->flags); lprops->flags);
return -EINVAL; return -EINVAL;
} }
i += 1; i += 1;
...@@ -913,21 +913,21 @@ int dbg_check_cats(struct ubifs_info *c) ...@@ -913,21 +913,21 @@ int dbg_check_cats(struct ubifs_info *c)
list_for_each_entry(lprops, &c->frdi_idx_list, list) { list_for_each_entry(lprops, &c->frdi_idx_list, list) {
if (lprops->free + lprops->dirty != c->leb_size) { if (lprops->free + lprops->dirty != c->leb_size) {
ubifs_err("non-freeable LEB %d on frdi_idx list " ubifs_err("non-freeable LEB %d on frdi_idx list (free %d dirty %d flags %d)",
"(free %d dirty %d flags %d)", lprops->lnum, lprops->lnum, lprops->free, lprops->dirty,
lprops->free, lprops->dirty, lprops->flags); lprops->flags);
return -EINVAL; return -EINVAL;
} }
if (lprops->flags & LPROPS_TAKEN) { if (lprops->flags & LPROPS_TAKEN) {
ubifs_err("taken LEB %d on frdi_idx list " ubifs_err("taken LEB %d on frdi_idx list (free %d dirty %d flags %d)",
"(free %d dirty %d flags %d)", lprops->lnum, lprops->lnum, lprops->free, lprops->dirty,
lprops->free, lprops->dirty, lprops->flags); lprops->flags);
return -EINVAL; return -EINVAL;
} }
if (!(lprops->flags & LPROPS_INDEX)) { if (!(lprops->flags & LPROPS_INDEX)) {
ubifs_err("non-index LEB %d on frdi_idx list " ubifs_err("non-index LEB %d on frdi_idx list (free %d dirty %d flags %d)",
"(free %d dirty %d flags %d)", lprops->lnum, lprops->lnum, lprops->free, lprops->dirty,
lprops->free, lprops->dirty, lprops->flags); lprops->flags);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -982,9 +982,9 @@ void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, ...@@ -982,9 +982,9 @@ void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat,
goto out; goto out;
} }
if (lprops != lp) { if (lprops != lp) {
dbg_msg("lprops %zx lp %zx lprops->lnum %d lp->lnum %d", ubifs_err("lprops %zx lp %zx lprops->lnum %d lp->lnum %d",
(size_t)lprops, (size_t)lp, lprops->lnum, (size_t)lprops, (size_t)lp, lprops->lnum,
lp->lnum); lp->lnum);
err = 4; err = 4;
goto out; goto out;
} }
...@@ -1002,7 +1002,7 @@ void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, ...@@ -1002,7 +1002,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); ubifs_err("failed cat %d hpos %d err %d", cat, i, err);
dump_stack(); dump_stack();
ubifs_dump_heap(c, heap, cat); ubifs_dump_heap(c, heap, cat);
} }
...@@ -1153,8 +1153,8 @@ static int scan_check_cb(struct ubifs_info *c, ...@@ -1153,8 +1153,8 @@ static int scan_check_cb(struct ubifs_info *c,
if (free > c->leb_size || free < 0 || dirty > c->leb_size || if (free > c->leb_size || free < 0 || dirty > c->leb_size ||
dirty < 0) { dirty < 0) {
ubifs_err("bad calculated accounting for LEB %d: " ubifs_err("bad calculated accounting for LEB %d: free %d, dirty %d",
"free %d, dirty %d", lnum, free, dirty); lnum, free, dirty);
goto out_destroy; goto out_destroy;
} }
...@@ -1200,8 +1200,7 @@ static int scan_check_cb(struct ubifs_info *c, ...@@ -1200,8 +1200,7 @@ static int scan_check_cb(struct ubifs_info *c,
/* Free but not unmapped LEB, it's fine */ /* Free but not unmapped LEB, it's fine */
is_idx = 0; is_idx = 0;
else { else {
ubifs_err("indexing node without indexing " ubifs_err("indexing node without indexing flag");
"flag");
goto out_print; goto out_print;
} }
} }
...@@ -1236,8 +1235,7 @@ static int scan_check_cb(struct ubifs_info *c, ...@@ -1236,8 +1235,7 @@ static int scan_check_cb(struct ubifs_info *c,
return LPT_SCAN_CONTINUE; return LPT_SCAN_CONTINUE;
out_print: out_print:
ubifs_err("bad accounting of LEB %d: free %d, dirty %d flags %#x, " ubifs_err("bad accounting of LEB %d: free %d, dirty %d flags %#x, should be free %d, dirty %d",
"should be free %d, dirty %d",
lnum, lp->free, lp->dirty, lp->flags, free, dirty); lnum, lp->free, lp->dirty, lp->flags, free, dirty);
ubifs_dump_leb(c, lnum); ubifs_dump_leb(c, lnum);
out_destroy: out_destroy:
...@@ -1290,12 +1288,10 @@ int dbg_check_lprops(struct ubifs_info *c) ...@@ -1290,12 +1288,10 @@ int dbg_check_lprops(struct ubifs_info *c)
lst.total_dirty != c->lst.total_dirty || lst.total_dirty != c->lst.total_dirty ||
lst.total_used != c->lst.total_used) { lst.total_used != c->lst.total_used) {
ubifs_err("bad overall accounting"); ubifs_err("bad overall accounting");
ubifs_err("calculated: empty_lebs %d, idx_lebs %d, " ubifs_err("calculated: empty_lebs %d, idx_lebs %d, total_free %lld, total_dirty %lld, total_used %lld",
"total_free %lld, total_dirty %lld, total_used %lld",
lst.empty_lebs, lst.idx_lebs, lst.total_free, lst.empty_lebs, lst.idx_lebs, lst.total_free,
lst.total_dirty, lst.total_used); lst.total_dirty, lst.total_used);
ubifs_err("read from lprops: empty_lebs %d, idx_lebs %d, " ubifs_err("read from lprops: empty_lebs %d, idx_lebs %d, total_free %lld, total_dirty %lld, total_used %lld",
"total_free %lld, total_dirty %lld, total_used %lld",
c->lst.empty_lebs, c->lst.idx_lebs, c->lst.total_free, c->lst.empty_lebs, c->lst.idx_lebs, c->lst.total_free,
c->lst.total_dirty, c->lst.total_used); c->lst.total_dirty, c->lst.total_used);
err = -EINVAL; err = -EINVAL;
......
...@@ -1311,7 +1311,7 @@ static int read_pnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip) ...@@ -1311,7 +1311,7 @@ static int read_pnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
ubifs_err("error %d reading pnode at %d:%d", err, lnum, offs); ubifs_err("error %d reading pnode at %d:%d", err, lnum, offs);
ubifs_dump_pnode(c, pnode, parent, iip); ubifs_dump_pnode(c, pnode, parent, iip);
dump_stack(); dump_stack();
dbg_msg("calc num: %d", calc_pnode_num_from_parent(c, parent, iip)); ubifs_err("calc num: %d", calc_pnode_num_from_parent(c, parent, iip));
kfree(pnode); kfree(pnode);
return err; return err;
} }
...@@ -2237,8 +2237,7 @@ int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode, ...@@ -2237,8 +2237,7 @@ 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) {
ubifs_err("nnode num %d expected %d " ubifs_err("nnode num %d expected %d parent num %d iip %d",
"parent num %d iip %d",
cnode->num, num, cnode->num, num,
(nnode ? nnode->num : 0), cnode->iip); (nnode ? nnode->num : 0), cnode->iip);
return -EINVAL; return -EINVAL;
......
...@@ -320,8 +320,8 @@ static int layout_cnodes(struct ubifs_info *c) ...@@ -320,8 +320,8 @@ static int layout_cnodes(struct ubifs_info *c)
return 0; return 0;
no_space: no_space:
ubifs_err("LPT out of space at LEB %d:%d needing %d, done_ltab %d, " ubifs_err("LPT out of space at LEB %d:%d needing %d, done_ltab %d, done_lsave %d",
"done_lsave %d", lnum, offs, len, done_ltab, done_lsave); 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);
dump_stack(); dump_stack();
...@@ -545,8 +545,8 @@ static int write_cnodes(struct ubifs_info *c) ...@@ -545,8 +545,8 @@ static int write_cnodes(struct ubifs_info *c)
return 0; return 0;
no_space: no_space:
ubifs_err("LPT out of space mismatch at LEB %d:%d needing %d, done_ltab " ubifs_err("LPT out of space mismatch at LEB %d:%d needing %d, done_ltab %d, done_lsave %d",
"%d, done_lsave %d", lnum, offs, len, done_ltab, done_lsave); 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);
dump_stack(); dump_stack();
...@@ -1662,21 +1662,19 @@ static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum) ...@@ -1662,21 +1662,19 @@ static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum)
continue; continue;
} }
if (!dbg_is_all_ff(p, len)) { if (!dbg_is_all_ff(p, len)) {
dbg_msg("invalid empty space in LEB %d at %d", ubifs_err("invalid empty space in LEB %d at %d",
lnum, c->leb_size - len); lnum, c->leb_size - len);
err = -EINVAL; err = -EINVAL;
} }
i = lnum - c->lpt_first; i = lnum - c->lpt_first;
if (len != c->ltab[i].free) { if (len != c->ltab[i].free) {
dbg_msg("invalid free space in LEB %d " ubifs_err("invalid free space in LEB %d (free %d, expected %d)",
"(free %d, expected %d)", lnum, len, c->ltab[i].free);
lnum, len, c->ltab[i].free);
err = -EINVAL; err = -EINVAL;
} }
if (dirty != c->ltab[i].dirty) { if (dirty != c->ltab[i].dirty) {
dbg_msg("invalid dirty space in LEB %d " ubifs_err("invalid dirty space in LEB %d (dirty %d, expected %d)",
"(dirty %d, expected %d)", lnum, dirty, c->ltab[i].dirty);
lnum, dirty, c->ltab[i].dirty);
err = -EINVAL; err = -EINVAL;
} }
goto out; goto out;
...@@ -1888,8 +1886,7 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) ...@@ -1888,8 +1886,7 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
int err, len = c->leb_size, node_type, node_num, node_len, offs; int err, len = c->leb_size, node_type, node_num, node_len, offs;
void *buf, *p; void *buf, *p;
printk(KERN_DEBUG "(pid %d) start dumping LEB %d\n", pr_err("(pid %d) start dumping LEB %d\n", current->pid, lnum);
current->pid, lnum);
buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL);
if (!buf) { if (!buf) {
ubifs_err("cannot allocate memory to dump LPT"); ubifs_err("cannot allocate memory to dump LPT");
...@@ -1907,14 +1904,14 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) ...@@ -1907,14 +1904,14 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
pad_len = get_pad_len(c, p, len); pad_len = get_pad_len(c, p, len);
if (pad_len) { if (pad_len) {
printk(KERN_DEBUG "LEB %d:%d, pad %d bytes\n", pr_err("LEB %d:%d, pad %d bytes\n",
lnum, offs, pad_len); lnum, offs, pad_len);
p += pad_len; p += pad_len;
len -= pad_len; len -= pad_len;
continue; continue;
} }
if (len) if (len)
printk(KERN_DEBUG "LEB %d:%d, free %d bytes\n", pr_err("LEB %d:%d, free %d bytes\n",
lnum, offs, len); lnum, offs, len);
break; break;
} }
...@@ -1925,11 +1922,10 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) ...@@ -1925,11 +1922,10 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
{ {
node_len = c->pnode_sz; node_len = c->pnode_sz;
if (c->big_lpt) if (c->big_lpt)
printk(KERN_DEBUG "LEB %d:%d, pnode num %d\n", pr_err("LEB %d:%d, pnode num %d\n",
lnum, offs, node_num); lnum, offs, node_num);
else else
printk(KERN_DEBUG "LEB %d:%d, pnode\n", pr_err("LEB %d:%d, pnode\n", lnum, offs);
lnum, offs);
break; break;
} }
case UBIFS_LPT_NNODE: case UBIFS_LPT_NNODE:
...@@ -1939,29 +1935,28 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) ...@@ -1939,29 +1935,28 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
node_len = c->nnode_sz; node_len = c->nnode_sz;
if (c->big_lpt) if (c->big_lpt)
printk(KERN_DEBUG "LEB %d:%d, nnode num %d, ", pr_err("LEB %d:%d, nnode num %d, ",
lnum, offs, node_num); lnum, offs, node_num);
else else
printk(KERN_DEBUG "LEB %d:%d, nnode, ", pr_err("LEB %d:%d, nnode, ",
lnum, offs); lnum, offs);
err = ubifs_unpack_nnode(c, p, &nnode); err = ubifs_unpack_nnode(c, p, &nnode);
for (i = 0; i < UBIFS_LPT_FANOUT; i++) { for (i = 0; i < UBIFS_LPT_FANOUT; i++) {
printk(KERN_CONT "%d:%d", nnode.nbranch[i].lnum, pr_cont("%d:%d", nnode.nbranch[i].lnum,
nnode.nbranch[i].offs); nnode.nbranch[i].offs);
if (i != UBIFS_LPT_FANOUT - 1) if (i != UBIFS_LPT_FANOUT - 1)
printk(KERN_CONT ", "); pr_cont(", ");
} }
printk(KERN_CONT "\n"); pr_cont("\n");
break; break;
} }
case UBIFS_LPT_LTAB: case UBIFS_LPT_LTAB:
node_len = c->ltab_sz; node_len = c->ltab_sz;
printk(KERN_DEBUG "LEB %d:%d, ltab\n", pr_err("LEB %d:%d, ltab\n", lnum, offs);
lnum, offs);
break; break;
case UBIFS_LPT_LSAVE: case UBIFS_LPT_LSAVE:
node_len = c->lsave_sz; node_len = c->lsave_sz;
printk(KERN_DEBUG "LEB %d:%d, lsave len\n", lnum, offs); pr_err("LEB %d:%d, lsave len\n", lnum, offs);
break; break;
default: default:
ubifs_err("LPT node type %d not recognized", node_type); ubifs_err("LPT node type %d not recognized", node_type);
...@@ -1972,8 +1967,7 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) ...@@ -1972,8 +1967,7 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
len -= node_len; len -= node_len;
} }
printk(KERN_DEBUG "(pid %d) finish dumping LEB %d\n", pr_err("(pid %d) finish dumping LEB %d\n", current->pid, lnum);
current->pid, lnum);
out: out:
vfree(buf); vfree(buf);
return; return;
...@@ -1990,12 +1984,10 @@ void ubifs_dump_lpt_lebs(const struct ubifs_info *c) ...@@ -1990,12 +1984,10 @@ void ubifs_dump_lpt_lebs(const struct ubifs_info *c)
{ {
int i; int i;
printk(KERN_DEBUG "(pid %d) start dumping all LPT LEBs\n", pr_err("(pid %d) start dumping all LPT LEBs\n", current->pid);
current->pid);
for (i = 0; i < c->lpt_lebs; i++) for (i = 0; i < c->lpt_lebs; i++)
dump_lpt_leb(c, i + c->lpt_first); dump_lpt_leb(c, i + c->lpt_first);
printk(KERN_DEBUG "(pid %d) finish dumping all LPT LEBs\n", pr_err("(pid %d) finish dumping all LPT LEBs\n", current->pid);
current->pid);
} }
/** /**
......
...@@ -562,8 +562,8 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, ...@@ -562,8 +562,8 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
list_for_each_entry(snod, &sleb->nodes, list) { list_for_each_entry(snod, &sleb->nodes, list) {
if (snod->type != UBIFS_ORPH_NODE) { if (snod->type != UBIFS_ORPH_NODE) {
ubifs_err("invalid node type %d in orphan area at " ubifs_err("invalid node type %d in orphan area at %d:%d",
"%d:%d", snod->type, sleb->lnum, snod->offs); snod->type, sleb->lnum, snod->offs);
ubifs_dump_node(c, snod->node); ubifs_dump_node(c, snod->node);
return -EINVAL; return -EINVAL;
} }
...@@ -589,8 +589,7 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, ...@@ -589,8 +589,7 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
* number. That makes this orphan node, out of date. * number. That makes this orphan node, out of date.
*/ */
if (!first) { if (!first) {
ubifs_err("out of order commit number %llu in " ubifs_err("out of order commit number %llu in orphan node at %d:%d",
"orphan node at %d:%d",
cmt_no, sleb->lnum, snod->offs); cmt_no, sleb->lnum, snod->offs);
ubifs_dump_node(c, snod->node); ubifs_dump_node(c, snod->node);
return -EINVAL; return -EINVAL;
......
...@@ -609,7 +609,8 @@ static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs) ...@@ -609,7 +609,8 @@ static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs)
snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node, snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node,
list); list);
dbg_rcvry("dropping last node at %d:%d", sleb->lnum, snod->offs); dbg_rcvry("dropping last node at %d:%d",
sleb->lnum, snod->offs);
*offs = snod->offs; *offs = snod->offs;
list_del(&snod->list); list_del(&snod->list);
kfree(snod); kfree(snod);
...@@ -702,8 +703,8 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, ...@@ -702,8 +703,8 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
* See header comment for this file for more * See header comment for this file for more
* explanations about the reasons we have this check. * explanations about the reasons we have this check.
*/ */
ubifs_err("corrupt empty space LEB %d:%d, corruption " ubifs_err("corrupt empty space LEB %d:%d, corruption starts at %d",
"starts at %d", lnum, offs, corruption); lnum, offs, corruption);
/* Make sure we dump interesting non-0xFF data */ /* Make sure we dump interesting non-0xFF data */
offs += corruption; offs += corruption;
buf += corruption; buf += corruption;
...@@ -899,8 +900,8 @@ struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum, ...@@ -899,8 +900,8 @@ struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum,
} }
} }
if (snod->sqnum > cs_sqnum) { if (snod->sqnum > cs_sqnum) {
ubifs_err("unrecoverable log corruption " ubifs_err("unrecoverable log corruption in LEB %d",
"in LEB %d", lnum); lnum);
ubifs_scan_destroy(sleb); ubifs_scan_destroy(sleb);
return ERR_PTR(-EUCLEAN); return ERR_PTR(-EUCLEAN);
} }
......
...@@ -141,9 +141,9 @@ static int set_bud_lprops(struct ubifs_info *c, struct bud_entry *b) ...@@ -141,9 +141,9 @@ static int set_bud_lprops(struct ubifs_info *c, struct bud_entry *b)
* during the replay. * during the replay.
*/ */
if (dirty != 0) if (dirty != 0)
dbg_msg("LEB %d lp: %d free %d dirty " dbg_mnt("LEB %d lp: %d free %d dirty replay: %d free %d dirty",
"replay: %d free %d dirty", b->bud->lnum, b->bud->lnum, lp->free, lp->dirty, b->free,
lp->free, lp->dirty, b->free, b->dirty); b->dirty);
} }
lp = ubifs_change_lp(c, lp, b->free, dirty + b->dirty, lp = ubifs_change_lp(c, lp, b->free, dirty + b->dirty,
lp->flags | LPROPS_TAKEN, 0); lp->flags | LPROPS_TAKEN, 0);
...@@ -677,7 +677,8 @@ static int replay_bud(struct ubifs_info *c, struct bud_entry *b) ...@@ -677,7 +677,8 @@ static int replay_bud(struct ubifs_info *c, struct bud_entry *b)
b->dirty = sleb->endpt - offs - used; b->dirty = sleb->endpt - offs - used;
b->free = c->leb_size - sleb->endpt; b->free = c->leb_size - sleb->endpt;
dbg_mnt("bud LEB %d replied: dirty %d, free %d", lnum, b->dirty, b->free); dbg_mnt("bud LEB %d replied: dirty %d, free %d",
lnum, b->dirty, b->free);
out: out:
ubifs_scan_destroy(sleb); ubifs_scan_destroy(sleb);
...@@ -865,8 +866,7 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) ...@@ -865,8 +866,7 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf)
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) {
ubifs_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),
c->cmt_no); c->cmt_no);
...@@ -1058,8 +1058,8 @@ int ubifs_replay_journal(struct ubifs_info *c) ...@@ -1058,8 +1058,8 @@ int ubifs_replay_journal(struct ubifs_info *c)
c->bi.uncommitted_idx *= c->max_idx_node_sz; c->bi.uncommitted_idx *= c->max_idx_node_sz;
ubifs_assert(c->bud_bytes <= c->max_bud_bytes || c->need_recovery); ubifs_assert(c->bud_bytes <= c->max_bud_bytes || c->need_recovery);
dbg_mnt("finished, log head LEB %d:%d, max_sqnum %llu, " dbg_mnt("finished, log head LEB %d:%d, max_sqnum %llu, highest_inum %lu",
"highest_inum %lu", c->lhead_lnum, c->lhead_offs, c->max_sqnum, c->lhead_lnum, c->lhead_offs, c->max_sqnum,
(unsigned long)c->highest_inum); (unsigned long)c->highest_inum);
out: out:
destroy_replay_list(c); destroy_replay_list(c);
......
...@@ -391,9 +391,8 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) ...@@ -391,9 +391,8 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup)
min_leb_cnt += c->lpt_lebs + c->orph_lebs + c->jhead_cnt + 6; min_leb_cnt += c->lpt_lebs + c->orph_lebs + c->jhead_cnt + 6;
if (c->leb_cnt < min_leb_cnt || c->leb_cnt > c->vi.size) { if (c->leb_cnt < min_leb_cnt || c->leb_cnt > c->vi.size) {
ubifs_err("bad LEB count: %d in superblock, %d on UBI volume, " ubifs_err("bad LEB count: %d in superblock, %d on UBI volume, %d minimum required",
"%d minimum required", c->leb_cnt, c->vi.size, c->leb_cnt, c->vi.size, min_leb_cnt);
min_leb_cnt);
goto failed; goto failed;
} }
...@@ -411,15 +410,14 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) ...@@ -411,15 +410,14 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup)
max_bytes = (long long)c->leb_size * UBIFS_MIN_BUD_LEBS; max_bytes = (long long)c->leb_size * UBIFS_MIN_BUD_LEBS;
if (c->max_bud_bytes < max_bytes) { if (c->max_bud_bytes < max_bytes) {
ubifs_err("too small journal (%lld bytes), must be at least " ubifs_err("too small journal (%lld bytes), must be at least %lld bytes",
"%lld bytes", c->max_bud_bytes, max_bytes); c->max_bud_bytes, max_bytes);
goto failed; goto failed;
} }
max_bytes = (long long)c->leb_size * c->main_lebs; max_bytes = (long long)c->leb_size * c->main_lebs;
if (c->max_bud_bytes > max_bytes) { if (c->max_bud_bytes > max_bytes) {
ubifs_err("too large journal size (%lld bytes), only %lld bytes" ubifs_err("too large journal size (%lld bytes), only %lld bytes available in the main area",
"available in the main area",
c->max_bud_bytes, max_bytes); c->max_bud_bytes, max_bytes);
goto failed; goto failed;
} }
...@@ -549,10 +547,9 @@ int ubifs_read_superblock(struct ubifs_info *c) ...@@ -549,10 +547,9 @@ int ubifs_read_superblock(struct ubifs_info *c)
ubifs_assert(!c->ro_media || c->ro_mount); ubifs_assert(!c->ro_media || c->ro_mount);
if (!c->ro_mount || if (!c->ro_mount ||
c->ro_compat_version > UBIFS_RO_COMPAT_VERSION) { c->ro_compat_version > UBIFS_RO_COMPAT_VERSION) {
ubifs_err("on-flash format version is w%d/r%d, but " ubifs_err("on-flash format version is w%d/r%d, but software only supports up to version w%d/r%d",
"software only supports up to version " c->fmt_version, c->ro_compat_version,
"w%d/r%d", c->fmt_version, UBIFS_FORMAT_VERSION,
c->ro_compat_version, UBIFS_FORMAT_VERSION,
UBIFS_RO_COMPAT_VERSION); UBIFS_RO_COMPAT_VERSION);
if (c->ro_compat_version <= UBIFS_RO_COMPAT_VERSION) { if (c->ro_compat_version <= UBIFS_RO_COMPAT_VERSION) {
ubifs_msg("only R/O mounting is possible"); ubifs_msg("only R/O mounting is possible");
......
...@@ -75,7 +75,7 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum, ...@@ -75,7 +75,7 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum,
magic = le32_to_cpu(ch->magic); magic = le32_to_cpu(ch->magic);
if (magic == 0xFFFFFFFF) { if (magic == 0xFFFFFFFF) {
dbg_scan("hit empty space"); dbg_scan("hit empty space at LEB %d:%d", lnum, offs);
return SCANNED_EMPTY_SPACE; return SCANNED_EMPTY_SPACE;
} }
...@@ -85,7 +85,8 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum, ...@@ -85,7 +85,8 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum,
if (len < UBIFS_CH_SZ) if (len < UBIFS_CH_SZ)
return SCANNED_GARBAGE; return SCANNED_GARBAGE;
dbg_scan("scanning %s", dbg_ntype(ch->node_type)); dbg_scan("scanning %s at LEB %d:%d",
dbg_ntype(ch->node_type), lnum, offs);
if (ubifs_check_node(c, buf, lnum, offs, quiet, 1)) if (ubifs_check_node(c, buf, lnum, offs, quiet, 1))
return SCANNED_A_CORRUPT_NODE; return SCANNED_A_CORRUPT_NODE;
...@@ -114,8 +115,8 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum, ...@@ -114,8 +115,8 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum,
return SCANNED_A_BAD_PAD_NODE; return SCANNED_A_BAD_PAD_NODE;
} }
dbg_scan("%d bytes padded, offset now %d", dbg_scan("%d bytes padded at LEB %d:%d, offset now %d", pad_len,
pad_len, ALIGN(offs + node_len + pad_len, 8)); lnum, offs, ALIGN(offs + node_len + pad_len, 8));
return node_len + pad_len; return node_len + pad_len;
} }
...@@ -150,8 +151,8 @@ struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum, ...@@ -150,8 +151,8 @@ struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum,
err = ubifs_leb_read(c, lnum, sbuf + offs, offs, c->leb_size - offs, 0); err = ubifs_leb_read(c, lnum, sbuf + offs, offs, c->leb_size - offs, 0);
if (err && err != -EBADMSG) { if (err && err != -EBADMSG) {
ubifs_err("cannot read %d bytes from LEB %d:%d," ubifs_err("cannot read %d bytes from LEB %d:%d, error %d",
" error %d", c->leb_size - offs, lnum, offs, err); c->leb_size - offs, lnum, offs, err);
kfree(sleb); kfree(sleb);
return ERR_PTR(err); return ERR_PTR(err);
} }
...@@ -240,8 +241,6 @@ void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs, ...@@ -240,8 +241,6 @@ void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs,
int len; int len;
ubifs_err("corruption at LEB %d:%d", lnum, offs); ubifs_err("corruption at LEB %d:%d", lnum, offs);
if (dbg_is_tst_rcvry(c))
return;
len = c->leb_size - offs; len = c->leb_size - offs;
if (len > 8192) if (len > 8192)
len = 8192; len = 8192;
......
...@@ -89,9 +89,8 @@ static int validate_inode(struct ubifs_info *c, const struct inode *inode) ...@@ -89,9 +89,8 @@ static int validate_inode(struct ubifs_info *c, const struct inode *inode)
return 5; return 5;
if (!ubifs_compr_present(ui->compr_type)) { if (!ubifs_compr_present(ui->compr_type)) {
ubifs_warn("inode %lu uses '%s' compression, but it was not " ubifs_warn("inode %lu uses '%s' compression, but it was not compiled in",
"compiled in", inode->i_ino, inode->i_ino, ubifs_compr_name(ui->compr_type));
ubifs_compr_name(ui->compr_type));
} }
err = dbg_check_dir(c, inode); err = dbg_check_dir(c, inode);
...@@ -1061,8 +1060,8 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options, ...@@ -1061,8 +1060,8 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
flag = parse_standard_option(p); flag = parse_standard_option(p);
if (!flag) { if (!flag) {
ubifs_err("unrecognized mount option \"%s\" " ubifs_err("unrecognized mount option \"%s\" or missing value",
"or missing value", p); p);
return -EINVAL; return -EINVAL;
} }
sb->s_flags |= flag; sb->s_flags |= flag;
...@@ -1124,8 +1123,8 @@ static void bu_init(struct ubifs_info *c) ...@@ -1124,8 +1123,8 @@ static void bu_init(struct ubifs_info *c)
} }
/* Just disable bulk-read */ /* Just disable bulk-read */
ubifs_warn("Cannot allocate %d bytes of memory for bulk-read, " ubifs_warn("cannot allocate %d bytes of memory for bulk-read, disabling it",
"disabling it", c->max_bu_buf_len); c->max_bu_buf_len);
c->mount_opts.bulk_read = 1; c->mount_opts.bulk_read = 1;
c->bulk_read = 0; c->bulk_read = 0;
return; return;
...@@ -1161,7 +1160,7 @@ static int check_free_space(struct ubifs_info *c) ...@@ -1161,7 +1160,7 @@ static int check_free_space(struct ubifs_info *c)
static int mount_ubifs(struct ubifs_info *c) static int mount_ubifs(struct ubifs_info *c)
{ {
int err; int err;
long long x; long long x, y;
size_t sz; size_t sz;
c->ro_mount = !!(c->vfs_sb->s_flags & MS_RDONLY); c->ro_mount = !!(c->vfs_sb->s_flags & MS_RDONLY);
...@@ -1411,75 +1410,69 @@ static int mount_ubifs(struct ubifs_info *c) ...@@ -1411,75 +1410,69 @@ static int mount_ubifs(struct ubifs_info *c)
c->mounting = 0; c->mounting = 0;
ubifs_msg("mounted UBI device %d, volume %d, name \"%s\"", ubifs_msg("mounted UBI device %d, volume %d, name \"%s\"%s",
c->vi.ubi_num, c->vi.vol_id, c->vi.name); c->vi.ubi_num, c->vi.vol_id, c->vi.name,
if (c->ro_mount) c->ro_mount ? ", R/O mode" : NULL);
ubifs_msg("mounted read-only");
x = (long long)c->main_lebs * c->leb_size; x = (long long)c->main_lebs * c->leb_size;
ubifs_msg("file system size: %lld bytes (%lld KiB, %lld MiB, %d " y = (long long)c->log_lebs * c->leb_size + c->max_bud_bytes;
"LEBs)", x, x >> 10, x >> 20, c->main_lebs); ubifs_msg("LEB size: %d bytes (%d KiB), min./max. I/O unit sizes: %d bytes/%d bytes",
x = (long long)c->log_lebs * c->leb_size + c->max_bud_bytes; c->leb_size, c->leb_size >> 10, c->min_io_size,
ubifs_msg("journal size: %lld bytes (%lld KiB, %lld MiB, %d " c->max_write_size);
"LEBs)", x, x >> 10, x >> 20, c->log_lebs + c->max_bud_cnt); ubifs_msg("FS size: %lld bytes (%lld MiB, %d LEBs), journal size %lld bytes (%lld MiB, %d LEBs)",
ubifs_msg("media format: w%d/r%d (latest is w%d/r%d)", x, x >> 20, c->main_lebs,
y, y >> 20, c->log_lebs + c->max_bud_cnt);
ubifs_msg("reserved for root: %llu bytes (%llu KiB)",
c->report_rp_size, c->report_rp_size >> 10);
ubifs_msg("media format: w%d/r%d (latest is w%d/r%d), UUID %pUB%s",
c->fmt_version, c->ro_compat_version, c->fmt_version, c->ro_compat_version,
UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION); UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION, c->uuid,
ubifs_msg("default compressor: %s", ubifs_compr_name(c->default_compr)); c->big_lpt ? ", big LPT model" : ", small LPT model");
ubifs_msg("reserved for root: %llu bytes (%llu KiB)",
c->report_rp_size, c->report_rp_size >> 10); dbg_gen("default compressor: %s", ubifs_compr_name(c->default_compr));
dbg_gen("data journal heads: %d",
dbg_msg("compiled on: " __DATE__ " at " __TIME__);
dbg_msg("min. I/O unit size: %d bytes", c->min_io_size);
dbg_msg("max. write size: %d bytes", c->max_write_size);
dbg_msg("LEB size: %d bytes (%d KiB)",
c->leb_size, c->leb_size >> 10);
dbg_msg("data journal heads: %d",
c->jhead_cnt - NONDATA_JHEADS_CNT); c->jhead_cnt - NONDATA_JHEADS_CNT);
dbg_msg("UUID: %pUB", c->uuid); dbg_gen("log LEBs: %d (%d - %d)",
dbg_msg("big_lpt %d", c->big_lpt);
dbg_msg("log LEBs: %d (%d - %d)",
c->log_lebs, UBIFS_LOG_LNUM, c->log_last); c->log_lebs, UBIFS_LOG_LNUM, c->log_last);
dbg_msg("LPT area LEBs: %d (%d - %d)", dbg_gen("LPT area LEBs: %d (%d - %d)",
c->lpt_lebs, c->lpt_first, c->lpt_last); c->lpt_lebs, c->lpt_first, c->lpt_last);
dbg_msg("orphan area LEBs: %d (%d - %d)", dbg_gen("orphan area LEBs: %d (%d - %d)",
c->orph_lebs, c->orph_first, c->orph_last); c->orph_lebs, c->orph_first, c->orph_last);
dbg_msg("main area LEBs: %d (%d - %d)", dbg_gen("main area LEBs: %d (%d - %d)",
c->main_lebs, c->main_first, c->leb_cnt - 1); c->main_lebs, c->main_first, c->leb_cnt - 1);
dbg_msg("index LEBs: %d", c->lst.idx_lebs); dbg_gen("index LEBs: %d", c->lst.idx_lebs);
dbg_msg("total index bytes: %lld (%lld KiB, %lld MiB)", dbg_gen("total index bytes: %lld (%lld KiB, %lld MiB)",
c->bi.old_idx_sz, c->bi.old_idx_sz >> 10, c->bi.old_idx_sz, c->bi.old_idx_sz >> 10,
c->bi.old_idx_sz >> 20); c->bi.old_idx_sz >> 20);
dbg_msg("key hash type: %d", c->key_hash_type); dbg_gen("key hash type: %d", c->key_hash_type);
dbg_msg("tree fanout: %d", c->fanout); dbg_gen("tree fanout: %d", c->fanout);
dbg_msg("reserved GC LEB: %d", c->gc_lnum); dbg_gen("reserved GC LEB: %d", c->gc_lnum);
dbg_msg("first main LEB: %d", c->main_first); dbg_gen("max. znode size %d", c->max_znode_sz);
dbg_msg("max. znode size %d", c->max_znode_sz); dbg_gen("max. index node size %d", c->max_idx_node_sz);
dbg_msg("max. index node size %d", c->max_idx_node_sz); dbg_gen("node sizes: data %zu, inode %zu, dentry %zu",
dbg_msg("node sizes: data %zu, inode %zu, dentry %zu",
UBIFS_DATA_NODE_SZ, UBIFS_INO_NODE_SZ, UBIFS_DENT_NODE_SZ); UBIFS_DATA_NODE_SZ, UBIFS_INO_NODE_SZ, UBIFS_DENT_NODE_SZ);
dbg_msg("node sizes: trun %zu, sb %zu, master %zu", dbg_gen("node sizes: trun %zu, sb %zu, master %zu",
UBIFS_TRUN_NODE_SZ, UBIFS_SB_NODE_SZ, UBIFS_MST_NODE_SZ); UBIFS_TRUN_NODE_SZ, UBIFS_SB_NODE_SZ, UBIFS_MST_NODE_SZ);
dbg_msg("node sizes: ref %zu, cmt. start %zu, orph %zu", dbg_gen("node sizes: ref %zu, cmt. start %zu, orph %zu",
UBIFS_REF_NODE_SZ, UBIFS_CS_NODE_SZ, UBIFS_ORPH_NODE_SZ); UBIFS_REF_NODE_SZ, UBIFS_CS_NODE_SZ, UBIFS_ORPH_NODE_SZ);
dbg_msg("max. node sizes: data %zu, inode %zu dentry %zu, idx %d", dbg_gen("max. node sizes: data %zu, inode %zu dentry %zu, idx %d",
UBIFS_MAX_DATA_NODE_SZ, UBIFS_MAX_INO_NODE_SZ, UBIFS_MAX_DATA_NODE_SZ, UBIFS_MAX_INO_NODE_SZ,
UBIFS_MAX_DENT_NODE_SZ, ubifs_idx_node_sz(c, c->fanout)); UBIFS_MAX_DENT_NODE_SZ, ubifs_idx_node_sz(c, c->fanout));
dbg_msg("dead watermark: %d", c->dead_wm); dbg_gen("dead watermark: %d", c->dead_wm);
dbg_msg("dark watermark: %d", c->dark_wm); dbg_gen("dark watermark: %d", c->dark_wm);
dbg_msg("LEB overhead: %d", c->leb_overhead); dbg_gen("LEB overhead: %d", c->leb_overhead);
x = (long long)c->main_lebs * c->dark_wm; x = (long long)c->main_lebs * c->dark_wm;
dbg_msg("max. dark space: %lld (%lld KiB, %lld MiB)", dbg_gen("max. dark space: %lld (%lld KiB, %lld MiB)",
x, x >> 10, x >> 20); x, x >> 10, x >> 20);
dbg_msg("maximum bud bytes: %lld (%lld KiB, %lld MiB)", dbg_gen("maximum bud bytes: %lld (%lld KiB, %lld MiB)",
c->max_bud_bytes, c->max_bud_bytes >> 10, c->max_bud_bytes, c->max_bud_bytes >> 10,
c->max_bud_bytes >> 20); c->max_bud_bytes >> 20);
dbg_msg("BG commit bud bytes: %lld (%lld KiB, %lld MiB)", dbg_gen("BG commit bud bytes: %lld (%lld KiB, %lld MiB)",
c->bg_bud_bytes, c->bg_bud_bytes >> 10, c->bg_bud_bytes, c->bg_bud_bytes >> 10,
c->bg_bud_bytes >> 20); c->bg_bud_bytes >> 20);
dbg_msg("current bud bytes %lld (%lld KiB, %lld MiB)", dbg_gen("current bud bytes %lld (%lld KiB, %lld MiB)",
c->bud_bytes, c->bud_bytes >> 10, c->bud_bytes >> 20); c->bud_bytes, c->bud_bytes >> 10, c->bud_bytes >> 20);
dbg_msg("max. seq. number: %llu", c->max_sqnum); dbg_gen("max. seq. number: %llu", c->max_sqnum);
dbg_msg("commit number: %llu", c->cmt_no); dbg_gen("commit number: %llu", c->cmt_no);
return 0; return 0;
...@@ -1564,10 +1557,9 @@ static int ubifs_remount_rw(struct ubifs_info *c) ...@@ -1564,10 +1557,9 @@ static int ubifs_remount_rw(struct ubifs_info *c)
if (c->rw_incompat) { if (c->rw_incompat) {
ubifs_err("the file-system is not R/W-compatible"); ubifs_err("the file-system is not R/W-compatible");
ubifs_msg("on-flash format version is w%d/r%d, but software " ubifs_msg("on-flash format version is w%d/r%d, but software only supports up to version w%d/r%d",
"only supports up to version w%d/r%d", c->fmt_version, c->fmt_version, c->ro_compat_version,
c->ro_compat_version, UBIFS_FORMAT_VERSION, UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION);
UBIFS_RO_COMPAT_VERSION);
return -EROFS; return -EROFS;
} }
...@@ -1828,8 +1820,8 @@ static void ubifs_put_super(struct super_block *sb) ...@@ -1828,8 +1820,8 @@ static void ubifs_put_super(struct super_block *sb)
* next mount, so we just print a message and * next mount, so we just print a message and
* continue to unmount normally. * continue to unmount normally.
*/ */
ubifs_err("failed to write master node, " ubifs_err("failed to write master node, error %d",
"error %d", err); err);
} else { } else {
for (i = 0; i < c->jhead_cnt; i++) for (i = 0; i < c->jhead_cnt; i++)
/* Make sure write-buffer timers are canceled */ /* Make sure write-buffer timers are canceled */
...@@ -2248,8 +2240,7 @@ static int __init ubifs_init(void) ...@@ -2248,8 +2240,7 @@ static int __init ubifs_init(void)
* UBIFS_BLOCK_SIZE. It is assumed that both are powers of 2. * UBIFS_BLOCK_SIZE. It is assumed that both are powers of 2.
*/ */
if (PAGE_CACHE_SIZE < UBIFS_BLOCK_SIZE) { if (PAGE_CACHE_SIZE < UBIFS_BLOCK_SIZE) {
ubifs_err("VFS page cache size is %u bytes, but UBIFS requires" ubifs_err("VFS page cache size is %u bytes, but UBIFS requires at least 4096 bytes",
" at least 4096 bytes",
(unsigned int)PAGE_CACHE_SIZE); (unsigned int)PAGE_CACHE_SIZE);
return -EINVAL; return -EINVAL;
} }
......
...@@ -328,8 +328,8 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, ...@@ -328,8 +328,8 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len,
case UBIFS_XENT_KEY: case UBIFS_XENT_KEY:
break; break;
default: default:
dbg_msg("bad key type at slot %d: %d", ubifs_err("bad key type at slot %d: %d",
i, key_type(c, &zbr->key)); i, key_type(c, &zbr->key));
err = 3; err = 3;
goto out_dump; goto out_dump;
} }
......
...@@ -42,16 +42,15 @@ ...@@ -42,16 +42,15 @@
#define UBIFS_VERSION 1 #define UBIFS_VERSION 1
/* Normal UBIFS messages */ /* Normal UBIFS messages */
#define ubifs_msg(fmt, ...) \ #define ubifs_msg(fmt, ...) pr_notice("UBIFS: " fmt "\n", ##__VA_ARGS__)
printk(KERN_NOTICE "UBIFS: " fmt "\n", ##__VA_ARGS__)
/* UBIFS error messages */ /* UBIFS error messages */
#define ubifs_err(fmt, ...) \ #define ubifs_err(fmt, ...) \
printk(KERN_ERR "UBIFS error (pid %d): %s: " fmt "\n", current->pid, \ pr_err("UBIFS error (pid %d): %s: " fmt "\n", current->pid, \
__func__, ##__VA_ARGS__) __func__, ##__VA_ARGS__)
/* UBIFS warning messages */ /* UBIFS warning messages */
#define ubifs_warn(fmt, ...) \ #define ubifs_warn(fmt, ...) \
printk(KERN_WARNING "UBIFS warning (pid %d): %s: " fmt "\n", \ pr_warn("UBIFS warning (pid %d): %s: " fmt "\n", \
current->pid, __func__, ##__VA_ARGS__) current->pid, __func__, ##__VA_ARGS__)
/* UBIFS file system VFS magic number */ /* UBIFS file system VFS magic number */
#define UBIFS_SUPER_MAGIC 0x24051905 #define UBIFS_SUPER_MAGIC 0x24051905
......
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