diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 23:47:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 23:47:48 -0400 |
commit | 782c3fb22baa103abbcd30dfc99cad24bb09f1df (patch) | |
tree | acda25cba653a55497f8030323437527258e747f /fs/ubifs | |
parent | 60c7b4df82d0ec44fe10487eadec737abea55b34 (diff) | |
parent | 3668b70fcf1fdc6799abf15f70fe3f50f407ec82 (diff) |
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
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/budget.c | 5 | ||||
-rw-r--r-- | fs/ubifs/commit.c | 8 | ||||
-rw-r--r-- | fs/ubifs/compress.c | 7 | ||||
-rw-r--r-- | fs/ubifs/debug.c | 633 | ||||
-rw-r--r-- | fs/ubifs/debug.h | 15 | ||||
-rw-r--r-- | fs/ubifs/dir.c | 4 | ||||
-rw-r--r-- | fs/ubifs/file.c | 4 | ||||
-rw-r--r-- | fs/ubifs/gc.c | 6 | ||||
-rw-r--r-- | fs/ubifs/log.c | 14 | ||||
-rw-r--r-- | fs/ubifs/lprops.c | 66 | ||||
-rw-r--r-- | fs/ubifs/lpt.c | 5 | ||||
-rw-r--r-- | fs/ubifs/lpt_commit.c | 58 | ||||
-rw-r--r-- | fs/ubifs/orphan.c | 7 | ||||
-rw-r--r-- | fs/ubifs/recovery.c | 11 | ||||
-rw-r--r-- | fs/ubifs/replay.c | 16 | ||||
-rw-r--r-- | fs/ubifs/sb.c | 19 | ||||
-rw-r--r-- | fs/ubifs/scan.c | 15 | ||||
-rw-r--r-- | fs/ubifs/super.c | 119 | ||||
-rw-r--r-- | fs/ubifs/tnc_misc.c | 4 | ||||
-rw-r--r-- | fs/ubifs/ubifs.h | 13 |
20 files changed, 451 insertions, 578 deletions
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c index 969489e478bc..e8e01d74dc05 100644 --- a/fs/ubifs/budget.c +++ b/fs/ubifs/budget.c | |||
@@ -342,9 +342,8 @@ static int do_budget_space(struct ubifs_info *c) | |||
342 | lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt - | 342 | lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt - |
343 | c->lst.taken_empty_lebs; | 343 | c->lst.taken_empty_lebs; |
344 | if (unlikely(rsvd_idx_lebs > lebs)) { | 344 | if (unlikely(rsvd_idx_lebs > lebs)) { |
345 | dbg_budg("out of indexing space: min_idx_lebs %d (old %d), " | 345 | dbg_budg("out of indexing space: min_idx_lebs %d (old %d), rsvd_idx_lebs %d", |
346 | "rsvd_idx_lebs %d", min_idx_lebs, c->bi.min_idx_lebs, | 346 | min_idx_lebs, c->bi.min_idx_lebs, rsvd_idx_lebs); |
347 | rsvd_idx_lebs); | ||
348 | return -ENOSPC; | 347 | return -ENOSPC; |
349 | } | 348 | } |
350 | 349 | ||
diff --git a/fs/ubifs/commit.c b/fs/ubifs/commit.c index 8eda717cb99b..ff8229340cd5 100644 --- a/fs/ubifs/commit.c +++ b/fs/ubifs/commit.c | |||
@@ -293,8 +293,8 @@ int ubifs_bg_thread(void *info) | |||
293 | int err; | 293 | int err; |
294 | struct ubifs_info *c = info; | 294 | struct ubifs_info *c = info; |
295 | 295 | ||
296 | dbg_msg("background thread \"%s\" started, PID %d", | 296 | ubifs_msg("background thread \"%s\" started, PID %d", |
297 | c->bgt_name, current->pid); | 297 | c->bgt_name, current->pid); |
298 | set_freezable(); | 298 | set_freezable(); |
299 | 299 | ||
300 | while (1) { | 300 | while (1) { |
@@ -328,7 +328,7 @@ int ubifs_bg_thread(void *info) | |||
328 | cond_resched(); | 328 | cond_resched(); |
329 | } | 329 | } |
330 | 330 | ||
331 | dbg_msg("background thread \"%s\" stops", c->bgt_name); | 331 | ubifs_msg("background thread \"%s\" stops", c->bgt_name); |
332 | return 0; | 332 | return 0; |
333 | } | 333 | } |
334 | 334 | ||
@@ -514,7 +514,7 @@ struct idx_node { | |||
514 | struct list_head list; | 514 | struct list_head list; |
515 | int iip; | 515 | int iip; |
516 | union ubifs_key upper_key; | 516 | union ubifs_key upper_key; |
517 | struct ubifs_idx_node idx __attribute__((aligned(8))); | 517 | struct ubifs_idx_node idx __aligned(8); |
518 | }; | 518 | }; |
519 | 519 | ||
520 | /** | 520 | /** |
diff --git a/fs/ubifs/compress.c b/fs/ubifs/compress.c index 11e4132f314a..2bfa0953335d 100644 --- a/fs/ubifs/compress.c +++ b/fs/ubifs/compress.c | |||
@@ -112,8 +112,7 @@ void ubifs_compress(const void *in_buf, int in_len, void *out_buf, int *out_len, | |||
112 | if (compr->comp_mutex) | 112 | if (compr->comp_mutex) |
113 | mutex_unlock(compr->comp_mutex); | 113 | mutex_unlock(compr->comp_mutex); |
114 | if (unlikely(err)) { | 114 | if (unlikely(err)) { |
115 | ubifs_warn("cannot compress %d bytes, compressor %s, " | 115 | ubifs_warn("cannot compress %d bytes, compressor %s, error %d, leave data uncompressed", |
116 | "error %d, leave data uncompressed", | ||
117 | in_len, compr->name, err); | 116 | in_len, compr->name, err); |
118 | goto no_compr; | 117 | goto no_compr; |
119 | } | 118 | } |
@@ -176,8 +175,8 @@ int ubifs_decompress(const void *in_buf, int in_len, void *out_buf, | |||
176 | if (compr->decomp_mutex) | 175 | if (compr->decomp_mutex) |
177 | mutex_unlock(compr->decomp_mutex); | 176 | mutex_unlock(compr->decomp_mutex); |
178 | if (err) | 177 | if (err) |
179 | ubifs_err("cannot decompress %d bytes, compressor %s, " | 178 | ubifs_err("cannot decompress %d bytes, compressor %s, error %d", |
180 | "error %d", in_len, compr->name, err); | 179 | in_len, compr->name, err); |
181 | 180 | ||
182 | return err; | 181 | return err; |
183 | } | 182 | } |
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 340d1afc1302..62911637e12f 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -219,15 +219,15 @@ const char *dbg_jhead(int jhead) | |||
219 | 219 | ||
220 | static void dump_ch(const struct ubifs_ch *ch) | 220 | static void dump_ch(const struct ubifs_ch *ch) |
221 | { | 221 | { |
222 | printk(KERN_ERR "\tmagic %#x\n", le32_to_cpu(ch->magic)); | 222 | pr_err("\tmagic %#x\n", le32_to_cpu(ch->magic)); |
223 | printk(KERN_ERR "\tcrc %#x\n", le32_to_cpu(ch->crc)); | 223 | pr_err("\tcrc %#x\n", le32_to_cpu(ch->crc)); |
224 | printk(KERN_ERR "\tnode_type %d (%s)\n", ch->node_type, | 224 | pr_err("\tnode_type %d (%s)\n", ch->node_type, |
225 | dbg_ntype(ch->node_type)); | 225 | dbg_ntype(ch->node_type)); |
226 | printk(KERN_ERR "\tgroup_type %d (%s)\n", ch->group_type, | 226 | pr_err("\tgroup_type %d (%s)\n", ch->group_type, |
227 | dbg_gtype(ch->group_type)); | 227 | dbg_gtype(ch->group_type)); |
228 | printk(KERN_ERR "\tsqnum %llu\n", | 228 | pr_err("\tsqnum %llu\n", |
229 | (unsigned long long)le64_to_cpu(ch->sqnum)); | 229 | (unsigned long long)le64_to_cpu(ch->sqnum)); |
230 | printk(KERN_ERR "\tlen %u\n", le32_to_cpu(ch->len)); | 230 | pr_err("\tlen %u\n", le32_to_cpu(ch->len)); |
231 | } | 231 | } |
232 | 232 | ||
233 | void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode) | 233 | 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 | struct ubifs_dent_node *dent, *pdent = NULL; | 238 | struct ubifs_dent_node *dent, *pdent = NULL; |
239 | int count = 2; | 239 | int count = 2; |
240 | 240 | ||
241 | printk(KERN_ERR "Dump in-memory inode:"); | 241 | pr_err("Dump in-memory inode:"); |
242 | printk(KERN_ERR "\tinode %lu\n", inode->i_ino); | 242 | pr_err("\tinode %lu\n", inode->i_ino); |
243 | printk(KERN_ERR "\tsize %llu\n", | 243 | pr_err("\tsize %llu\n", |
244 | (unsigned long long)i_size_read(inode)); | 244 | (unsigned long long)i_size_read(inode)); |
245 | printk(KERN_ERR "\tnlink %u\n", inode->i_nlink); | 245 | pr_err("\tnlink %u\n", inode->i_nlink); |
246 | printk(KERN_ERR "\tuid %u\n", (unsigned int)i_uid_read(inode)); | 246 | pr_err("\tuid %u\n", (unsigned int)i_uid_read(inode)); |
247 | printk(KERN_ERR "\tgid %u\n", (unsigned int)i_gid_read(inode)); | 247 | pr_err("\tgid %u\n", (unsigned int)i_gid_read(inode)); |
248 | printk(KERN_ERR "\tatime %u.%u\n", | 248 | pr_err("\tatime %u.%u\n", |
249 | (unsigned int)inode->i_atime.tv_sec, | 249 | (unsigned int)inode->i_atime.tv_sec, |
250 | (unsigned int)inode->i_atime.tv_nsec); | 250 | (unsigned int)inode->i_atime.tv_nsec); |
251 | printk(KERN_ERR "\tmtime %u.%u\n", | 251 | pr_err("\tmtime %u.%u\n", |
252 | (unsigned int)inode->i_mtime.tv_sec, | 252 | (unsigned int)inode->i_mtime.tv_sec, |
253 | (unsigned int)inode->i_mtime.tv_nsec); | 253 | (unsigned int)inode->i_mtime.tv_nsec); |
254 | printk(KERN_ERR "\tctime %u.%u\n", | 254 | pr_err("\tctime %u.%u\n", |
255 | (unsigned int)inode->i_ctime.tv_sec, | 255 | (unsigned int)inode->i_ctime.tv_sec, |
256 | (unsigned int)inode->i_ctime.tv_nsec); | 256 | (unsigned int)inode->i_ctime.tv_nsec); |
257 | printk(KERN_ERR "\tcreat_sqnum %llu\n", ui->creat_sqnum); | 257 | pr_err("\tcreat_sqnum %llu\n", ui->creat_sqnum); |
258 | printk(KERN_ERR "\txattr_size %u\n", ui->xattr_size); | 258 | pr_err("\txattr_size %u\n", ui->xattr_size); |
259 | printk(KERN_ERR "\txattr_cnt %u\n", ui->xattr_cnt); | 259 | pr_err("\txattr_cnt %u\n", ui->xattr_cnt); |
260 | printk(KERN_ERR "\txattr_names %u\n", ui->xattr_names); | 260 | pr_err("\txattr_names %u\n", ui->xattr_names); |
261 | printk(KERN_ERR "\tdirty %u\n", ui->dirty); | 261 | pr_err("\tdirty %u\n", ui->dirty); |
262 | printk(KERN_ERR "\txattr %u\n", ui->xattr); | 262 | pr_err("\txattr %u\n", ui->xattr); |
263 | printk(KERN_ERR "\tbulk_read %u\n", ui->xattr); | 263 | pr_err("\tbulk_read %u\n", ui->xattr); |
264 | printk(KERN_ERR "\tsynced_i_size %llu\n", | 264 | pr_err("\tsynced_i_size %llu\n", |
265 | (unsigned long long)ui->synced_i_size); | 265 | (unsigned long long)ui->synced_i_size); |
266 | printk(KERN_ERR "\tui_size %llu\n", | 266 | pr_err("\tui_size %llu\n", |
267 | (unsigned long long)ui->ui_size); | 267 | (unsigned long long)ui->ui_size); |
268 | printk(KERN_ERR "\tflags %d\n", ui->flags); | 268 | pr_err("\tflags %d\n", ui->flags); |
269 | printk(KERN_ERR "\tcompr_type %d\n", ui->compr_type); | 269 | pr_err("\tcompr_type %d\n", ui->compr_type); |
270 | printk(KERN_ERR "\tlast_page_read %lu\n", ui->last_page_read); | 270 | pr_err("\tlast_page_read %lu\n", ui->last_page_read); |
271 | printk(KERN_ERR "\tread_in_a_row %lu\n", ui->read_in_a_row); | 271 | pr_err("\tread_in_a_row %lu\n", ui->read_in_a_row); |
272 | printk(KERN_ERR "\tdata_len %d\n", ui->data_len); | 272 | pr_err("\tdata_len %d\n", ui->data_len); |
273 | 273 | ||
274 | if (!S_ISDIR(inode->i_mode)) | 274 | if (!S_ISDIR(inode->i_mode)) |
275 | return; | 275 | return; |
276 | 276 | ||
277 | printk(KERN_ERR "List of directory entries:\n"); | 277 | pr_err("List of directory entries:\n"); |
278 | ubifs_assert(!mutex_is_locked(&c->tnc_mutex)); | 278 | ubifs_assert(!mutex_is_locked(&c->tnc_mutex)); |
279 | 279 | ||
280 | lowest_dent_key(c, &key, inode->i_ino); | 280 | 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 | dent = ubifs_tnc_next_ent(c, &key, &nm); | 282 | dent = ubifs_tnc_next_ent(c, &key, &nm); |
283 | if (IS_ERR(dent)) { | 283 | if (IS_ERR(dent)) { |
284 | if (PTR_ERR(dent) != -ENOENT) | 284 | if (PTR_ERR(dent) != -ENOENT) |
285 | printk(KERN_ERR "error %ld\n", PTR_ERR(dent)); | 285 | pr_err("error %ld\n", PTR_ERR(dent)); |
286 | break; | 286 | break; |
287 | } | 287 | } |
288 | 288 | ||
289 | printk(KERN_ERR "\t%d: %s (%s)\n", | 289 | pr_err("\t%d: %s (%s)\n", |
290 | count++, dent->name, get_dent_type(dent->type)); | 290 | count++, dent->name, get_dent_type(dent->type)); |
291 | 291 | ||
292 | nm.name = dent->name; | 292 | nm.name = dent->name; |
@@ -305,12 +305,9 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
305 | const struct ubifs_ch *ch = node; | 305 | const struct ubifs_ch *ch = node; |
306 | char key_buf[DBG_KEY_BUF_LEN]; | 306 | char key_buf[DBG_KEY_BUF_LEN]; |
307 | 307 | ||
308 | if (dbg_is_tst_rcvry(c)) | ||
309 | return; | ||
310 | |||
311 | /* If the magic is incorrect, just hexdump the first bytes */ | 308 | /* If the magic is incorrect, just hexdump the first bytes */ |
312 | if (le32_to_cpu(ch->magic) != UBIFS_NODE_MAGIC) { | 309 | if (le32_to_cpu(ch->magic) != UBIFS_NODE_MAGIC) { |
313 | printk(KERN_ERR "Not a node, first %zu bytes:", UBIFS_CH_SZ); | 310 | pr_err("Not a node, first %zu bytes:", UBIFS_CH_SZ); |
314 | print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 32, 1, | 311 | print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 32, 1, |
315 | (void *)node, UBIFS_CH_SZ, 1); | 312 | (void *)node, UBIFS_CH_SZ, 1); |
316 | return; | 313 | return; |
@@ -324,8 +321,7 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
324 | { | 321 | { |
325 | const struct ubifs_pad_node *pad = node; | 322 | const struct ubifs_pad_node *pad = node; |
326 | 323 | ||
327 | printk(KERN_ERR "\tpad_len %u\n", | 324 | pr_err("\tpad_len %u\n", le32_to_cpu(pad->pad_len)); |
328 | le32_to_cpu(pad->pad_len)); | ||
329 | break; | 325 | break; |
330 | } | 326 | } |
331 | case UBIFS_SB_NODE: | 327 | case UBIFS_SB_NODE: |
@@ -333,112 +329,77 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
333 | const struct ubifs_sb_node *sup = node; | 329 | const struct ubifs_sb_node *sup = node; |
334 | unsigned int sup_flags = le32_to_cpu(sup->flags); | 330 | unsigned int sup_flags = le32_to_cpu(sup->flags); |
335 | 331 | ||
336 | printk(KERN_ERR "\tkey_hash %d (%s)\n", | 332 | pr_err("\tkey_hash %d (%s)\n", |
337 | (int)sup->key_hash, get_key_hash(sup->key_hash)); | 333 | (int)sup->key_hash, get_key_hash(sup->key_hash)); |
338 | printk(KERN_ERR "\tkey_fmt %d (%s)\n", | 334 | pr_err("\tkey_fmt %d (%s)\n", |
339 | (int)sup->key_fmt, get_key_fmt(sup->key_fmt)); | 335 | (int)sup->key_fmt, get_key_fmt(sup->key_fmt)); |
340 | printk(KERN_ERR "\tflags %#x\n", sup_flags); | 336 | pr_err("\tflags %#x\n", sup_flags); |
341 | printk(KERN_ERR "\t big_lpt %u\n", | 337 | pr_err("\t big_lpt %u\n", |
342 | !!(sup_flags & UBIFS_FLG_BIGLPT)); | 338 | !!(sup_flags & UBIFS_FLG_BIGLPT)); |
343 | printk(KERN_ERR "\t space_fixup %u\n", | 339 | pr_err("\t space_fixup %u\n", |
344 | !!(sup_flags & UBIFS_FLG_SPACE_FIXUP)); | 340 | !!(sup_flags & UBIFS_FLG_SPACE_FIXUP)); |
345 | printk(KERN_ERR "\tmin_io_size %u\n", | 341 | pr_err("\tmin_io_size %u\n", le32_to_cpu(sup->min_io_size)); |
346 | le32_to_cpu(sup->min_io_size)); | 342 | pr_err("\tleb_size %u\n", le32_to_cpu(sup->leb_size)); |
347 | printk(KERN_ERR "\tleb_size %u\n", | 343 | pr_err("\tleb_cnt %u\n", le32_to_cpu(sup->leb_cnt)); |
348 | le32_to_cpu(sup->leb_size)); | 344 | pr_err("\tmax_leb_cnt %u\n", le32_to_cpu(sup->max_leb_cnt)); |
349 | printk(KERN_ERR "\tleb_cnt %u\n", | 345 | pr_err("\tmax_bud_bytes %llu\n", |
350 | le32_to_cpu(sup->leb_cnt)); | ||
351 | printk(KERN_ERR "\tmax_leb_cnt %u\n", | ||
352 | le32_to_cpu(sup->max_leb_cnt)); | ||
353 | printk(KERN_ERR "\tmax_bud_bytes %llu\n", | ||
354 | (unsigned long long)le64_to_cpu(sup->max_bud_bytes)); | 346 | (unsigned long long)le64_to_cpu(sup->max_bud_bytes)); |
355 | printk(KERN_ERR "\tlog_lebs %u\n", | 347 | pr_err("\tlog_lebs %u\n", le32_to_cpu(sup->log_lebs)); |
356 | le32_to_cpu(sup->log_lebs)); | 348 | pr_err("\tlpt_lebs %u\n", le32_to_cpu(sup->lpt_lebs)); |
357 | printk(KERN_ERR "\tlpt_lebs %u\n", | 349 | pr_err("\torph_lebs %u\n", le32_to_cpu(sup->orph_lebs)); |
358 | le32_to_cpu(sup->lpt_lebs)); | 350 | pr_err("\tjhead_cnt %u\n", le32_to_cpu(sup->jhead_cnt)); |
359 | printk(KERN_ERR "\torph_lebs %u\n", | 351 | pr_err("\tfanout %u\n", le32_to_cpu(sup->fanout)); |
360 | le32_to_cpu(sup->orph_lebs)); | 352 | pr_err("\tlsave_cnt %u\n", le32_to_cpu(sup->lsave_cnt)); |
361 | printk(KERN_ERR "\tjhead_cnt %u\n", | 353 | pr_err("\tdefault_compr %u\n", |
362 | le32_to_cpu(sup->jhead_cnt)); | ||
363 | printk(KERN_ERR "\tfanout %u\n", | ||
364 | le32_to_cpu(sup->fanout)); | ||
365 | printk(KERN_ERR "\tlsave_cnt %u\n", | ||
366 | le32_to_cpu(sup->lsave_cnt)); | ||
367 | printk(KERN_ERR "\tdefault_compr %u\n", | ||
368 | (int)le16_to_cpu(sup->default_compr)); | 354 | (int)le16_to_cpu(sup->default_compr)); |
369 | printk(KERN_ERR "\trp_size %llu\n", | 355 | pr_err("\trp_size %llu\n", |
370 | (unsigned long long)le64_to_cpu(sup->rp_size)); | 356 | (unsigned long long)le64_to_cpu(sup->rp_size)); |
371 | printk(KERN_ERR "\trp_uid %u\n", | 357 | pr_err("\trp_uid %u\n", le32_to_cpu(sup->rp_uid)); |
372 | le32_to_cpu(sup->rp_uid)); | 358 | pr_err("\trp_gid %u\n", le32_to_cpu(sup->rp_gid)); |
373 | printk(KERN_ERR "\trp_gid %u\n", | 359 | pr_err("\tfmt_version %u\n", le32_to_cpu(sup->fmt_version)); |
374 | le32_to_cpu(sup->rp_gid)); | 360 | pr_err("\ttime_gran %u\n", le32_to_cpu(sup->time_gran)); |
375 | printk(KERN_ERR "\tfmt_version %u\n", | 361 | pr_err("\tUUID %pUB\n", sup->uuid); |
376 | le32_to_cpu(sup->fmt_version)); | ||
377 | printk(KERN_ERR "\ttime_gran %u\n", | ||
378 | le32_to_cpu(sup->time_gran)); | ||
379 | printk(KERN_ERR "\tUUID %pUB\n", | ||
380 | sup->uuid); | ||
381 | break; | 362 | break; |
382 | } | 363 | } |
383 | case UBIFS_MST_NODE: | 364 | case UBIFS_MST_NODE: |
384 | { | 365 | { |
385 | const struct ubifs_mst_node *mst = node; | 366 | const struct ubifs_mst_node *mst = node; |
386 | 367 | ||
387 | printk(KERN_ERR "\thighest_inum %llu\n", | 368 | pr_err("\thighest_inum %llu\n", |
388 | (unsigned long long)le64_to_cpu(mst->highest_inum)); | 369 | (unsigned long long)le64_to_cpu(mst->highest_inum)); |
389 | printk(KERN_ERR "\tcommit number %llu\n", | 370 | pr_err("\tcommit number %llu\n", |
390 | (unsigned long long)le64_to_cpu(mst->cmt_no)); | 371 | (unsigned long long)le64_to_cpu(mst->cmt_no)); |
391 | printk(KERN_ERR "\tflags %#x\n", | 372 | pr_err("\tflags %#x\n", le32_to_cpu(mst->flags)); |
392 | le32_to_cpu(mst->flags)); | 373 | pr_err("\tlog_lnum %u\n", le32_to_cpu(mst->log_lnum)); |
393 | printk(KERN_ERR "\tlog_lnum %u\n", | 374 | pr_err("\troot_lnum %u\n", le32_to_cpu(mst->root_lnum)); |
394 | le32_to_cpu(mst->log_lnum)); | 375 | pr_err("\troot_offs %u\n", le32_to_cpu(mst->root_offs)); |
395 | printk(KERN_ERR "\troot_lnum %u\n", | 376 | pr_err("\troot_len %u\n", le32_to_cpu(mst->root_len)); |
396 | le32_to_cpu(mst->root_lnum)); | 377 | pr_err("\tgc_lnum %u\n", le32_to_cpu(mst->gc_lnum)); |
397 | printk(KERN_ERR "\troot_offs %u\n", | 378 | pr_err("\tihead_lnum %u\n", le32_to_cpu(mst->ihead_lnum)); |
398 | le32_to_cpu(mst->root_offs)); | 379 | pr_err("\tihead_offs %u\n", le32_to_cpu(mst->ihead_offs)); |
399 | printk(KERN_ERR "\troot_len %u\n", | 380 | pr_err("\tindex_size %llu\n", |
400 | le32_to_cpu(mst->root_len)); | ||
401 | printk(KERN_ERR "\tgc_lnum %u\n", | ||
402 | le32_to_cpu(mst->gc_lnum)); | ||
403 | printk(KERN_ERR "\tihead_lnum %u\n", | ||
404 | le32_to_cpu(mst->ihead_lnum)); | ||
405 | printk(KERN_ERR "\tihead_offs %u\n", | ||
406 | le32_to_cpu(mst->ihead_offs)); | ||
407 | printk(KERN_ERR "\tindex_size %llu\n", | ||
408 | (unsigned long long)le64_to_cpu(mst->index_size)); | 381 | (unsigned long long)le64_to_cpu(mst->index_size)); |
409 | printk(KERN_ERR "\tlpt_lnum %u\n", | 382 | pr_err("\tlpt_lnum %u\n", le32_to_cpu(mst->lpt_lnum)); |
410 | le32_to_cpu(mst->lpt_lnum)); | 383 | pr_err("\tlpt_offs %u\n", le32_to_cpu(mst->lpt_offs)); |
411 | printk(KERN_ERR "\tlpt_offs %u\n", | 384 | pr_err("\tnhead_lnum %u\n", le32_to_cpu(mst->nhead_lnum)); |
412 | le32_to_cpu(mst->lpt_offs)); | 385 | pr_err("\tnhead_offs %u\n", le32_to_cpu(mst->nhead_offs)); |
413 | printk(KERN_ERR "\tnhead_lnum %u\n", | 386 | pr_err("\tltab_lnum %u\n", le32_to_cpu(mst->ltab_lnum)); |
414 | le32_to_cpu(mst->nhead_lnum)); | 387 | pr_err("\tltab_offs %u\n", le32_to_cpu(mst->ltab_offs)); |
415 | printk(KERN_ERR "\tnhead_offs %u\n", | 388 | pr_err("\tlsave_lnum %u\n", le32_to_cpu(mst->lsave_lnum)); |
416 | le32_to_cpu(mst->nhead_offs)); | 389 | pr_err("\tlsave_offs %u\n", le32_to_cpu(mst->lsave_offs)); |
417 | printk(KERN_ERR "\tltab_lnum %u\n", | 390 | pr_err("\tlscan_lnum %u\n", le32_to_cpu(mst->lscan_lnum)); |
418 | le32_to_cpu(mst->ltab_lnum)); | 391 | pr_err("\tleb_cnt %u\n", le32_to_cpu(mst->leb_cnt)); |
419 | printk(KERN_ERR "\tltab_offs %u\n", | 392 | pr_err("\tempty_lebs %u\n", le32_to_cpu(mst->empty_lebs)); |
420 | le32_to_cpu(mst->ltab_offs)); | 393 | pr_err("\tidx_lebs %u\n", le32_to_cpu(mst->idx_lebs)); |
421 | printk(KERN_ERR "\tlsave_lnum %u\n", | 394 | pr_err("\ttotal_free %llu\n", |
422 | le32_to_cpu(mst->lsave_lnum)); | ||
423 | printk(KERN_ERR "\tlsave_offs %u\n", | ||
424 | le32_to_cpu(mst->lsave_offs)); | ||
425 | printk(KERN_ERR "\tlscan_lnum %u\n", | ||
426 | le32_to_cpu(mst->lscan_lnum)); | ||
427 | printk(KERN_ERR "\tleb_cnt %u\n", | ||
428 | le32_to_cpu(mst->leb_cnt)); | ||
429 | printk(KERN_ERR "\tempty_lebs %u\n", | ||
430 | le32_to_cpu(mst->empty_lebs)); | ||
431 | printk(KERN_ERR "\tidx_lebs %u\n", | ||
432 | le32_to_cpu(mst->idx_lebs)); | ||
433 | printk(KERN_ERR "\ttotal_free %llu\n", | ||
434 | (unsigned long long)le64_to_cpu(mst->total_free)); | 395 | (unsigned long long)le64_to_cpu(mst->total_free)); |
435 | printk(KERN_ERR "\ttotal_dirty %llu\n", | 396 | pr_err("\ttotal_dirty %llu\n", |
436 | (unsigned long long)le64_to_cpu(mst->total_dirty)); | 397 | (unsigned long long)le64_to_cpu(mst->total_dirty)); |
437 | printk(KERN_ERR "\ttotal_used %llu\n", | 398 | pr_err("\ttotal_used %llu\n", |
438 | (unsigned long long)le64_to_cpu(mst->total_used)); | 399 | (unsigned long long)le64_to_cpu(mst->total_used)); |
439 | printk(KERN_ERR "\ttotal_dead %llu\n", | 400 | pr_err("\ttotal_dead %llu\n", |
440 | (unsigned long long)le64_to_cpu(mst->total_dead)); | 401 | (unsigned long long)le64_to_cpu(mst->total_dead)); |
441 | printk(KERN_ERR "\ttotal_dark %llu\n", | 402 | pr_err("\ttotal_dark %llu\n", |
442 | (unsigned long long)le64_to_cpu(mst->total_dark)); | 403 | (unsigned long long)le64_to_cpu(mst->total_dark)); |
443 | break; | 404 | break; |
444 | } | 405 | } |
@@ -446,12 +407,9 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
446 | { | 407 | { |
447 | const struct ubifs_ref_node *ref = node; | 408 | const struct ubifs_ref_node *ref = node; |
448 | 409 | ||
449 | printk(KERN_ERR "\tlnum %u\n", | 410 | pr_err("\tlnum %u\n", le32_to_cpu(ref->lnum)); |
450 | le32_to_cpu(ref->lnum)); | 411 | pr_err("\toffs %u\n", le32_to_cpu(ref->offs)); |
451 | printk(KERN_ERR "\toffs %u\n", | 412 | pr_err("\tjhead %u\n", le32_to_cpu(ref->jhead)); |
452 | le32_to_cpu(ref->offs)); | ||
453 | printk(KERN_ERR "\tjhead %u\n", | ||
454 | le32_to_cpu(ref->jhead)); | ||
455 | break; | 413 | break; |
456 | } | 414 | } |
457 | case UBIFS_INO_NODE: | 415 | case UBIFS_INO_NODE: |
@@ -459,41 +417,32 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
459 | const struct ubifs_ino_node *ino = node; | 417 | const struct ubifs_ino_node *ino = node; |
460 | 418 | ||
461 | key_read(c, &ino->key, &key); | 419 | key_read(c, &ino->key, &key); |
462 | printk(KERN_ERR "\tkey %s\n", | 420 | pr_err("\tkey %s\n", |
463 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); | 421 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); |
464 | printk(KERN_ERR "\tcreat_sqnum %llu\n", | 422 | pr_err("\tcreat_sqnum %llu\n", |
465 | (unsigned long long)le64_to_cpu(ino->creat_sqnum)); | 423 | (unsigned long long)le64_to_cpu(ino->creat_sqnum)); |
466 | printk(KERN_ERR "\tsize %llu\n", | 424 | pr_err("\tsize %llu\n", |
467 | (unsigned long long)le64_to_cpu(ino->size)); | 425 | (unsigned long long)le64_to_cpu(ino->size)); |
468 | printk(KERN_ERR "\tnlink %u\n", | 426 | pr_err("\tnlink %u\n", le32_to_cpu(ino->nlink)); |
469 | le32_to_cpu(ino->nlink)); | 427 | pr_err("\tatime %lld.%u\n", |
470 | printk(KERN_ERR "\tatime %lld.%u\n", | ||
471 | (long long)le64_to_cpu(ino->atime_sec), | 428 | (long long)le64_to_cpu(ino->atime_sec), |
472 | le32_to_cpu(ino->atime_nsec)); | 429 | le32_to_cpu(ino->atime_nsec)); |
473 | printk(KERN_ERR "\tmtime %lld.%u\n", | 430 | pr_err("\tmtime %lld.%u\n", |
474 | (long long)le64_to_cpu(ino->mtime_sec), | 431 | (long long)le64_to_cpu(ino->mtime_sec), |
475 | le32_to_cpu(ino->mtime_nsec)); | 432 | le32_to_cpu(ino->mtime_nsec)); |
476 | printk(KERN_ERR "\tctime %lld.%u\n", | 433 | pr_err("\tctime %lld.%u\n", |
477 | (long long)le64_to_cpu(ino->ctime_sec), | 434 | (long long)le64_to_cpu(ino->ctime_sec), |
478 | le32_to_cpu(ino->ctime_nsec)); | 435 | le32_to_cpu(ino->ctime_nsec)); |
479 | printk(KERN_ERR "\tuid %u\n", | 436 | pr_err("\tuid %u\n", le32_to_cpu(ino->uid)); |
480 | le32_to_cpu(ino->uid)); | 437 | pr_err("\tgid %u\n", le32_to_cpu(ino->gid)); |
481 | printk(KERN_ERR "\tgid %u\n", | 438 | pr_err("\tmode %u\n", le32_to_cpu(ino->mode)); |
482 | le32_to_cpu(ino->gid)); | 439 | pr_err("\tflags %#x\n", le32_to_cpu(ino->flags)); |
483 | printk(KERN_ERR "\tmode %u\n", | 440 | pr_err("\txattr_cnt %u\n", le32_to_cpu(ino->xattr_cnt)); |
484 | le32_to_cpu(ino->mode)); | 441 | pr_err("\txattr_size %u\n", le32_to_cpu(ino->xattr_size)); |
485 | printk(KERN_ERR "\tflags %#x\n", | 442 | pr_err("\txattr_names %u\n", le32_to_cpu(ino->xattr_names)); |
486 | le32_to_cpu(ino->flags)); | 443 | pr_err("\tcompr_type %#x\n", |
487 | printk(KERN_ERR "\txattr_cnt %u\n", | ||
488 | le32_to_cpu(ino->xattr_cnt)); | ||
489 | printk(KERN_ERR "\txattr_size %u\n", | ||
490 | le32_to_cpu(ino->xattr_size)); | ||
491 | printk(KERN_ERR "\txattr_names %u\n", | ||
492 | le32_to_cpu(ino->xattr_names)); | ||
493 | printk(KERN_ERR "\tcompr_type %#x\n", | ||
494 | (int)le16_to_cpu(ino->compr_type)); | 444 | (int)le16_to_cpu(ino->compr_type)); |
495 | printk(KERN_ERR "\tdata len %u\n", | 445 | pr_err("\tdata len %u\n", le32_to_cpu(ino->data_len)); |
496 | le32_to_cpu(ino->data_len)); | ||
497 | break; | 446 | break; |
498 | } | 447 | } |
499 | case UBIFS_DENT_NODE: | 448 | case UBIFS_DENT_NODE: |
@@ -503,22 +452,21 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
503 | int nlen = le16_to_cpu(dent->nlen); | 452 | int nlen = le16_to_cpu(dent->nlen); |
504 | 453 | ||
505 | key_read(c, &dent->key, &key); | 454 | key_read(c, &dent->key, &key); |
506 | printk(KERN_ERR "\tkey %s\n", | 455 | pr_err("\tkey %s\n", |
507 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); | 456 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); |
508 | printk(KERN_ERR "\tinum %llu\n", | 457 | pr_err("\tinum %llu\n", |
509 | (unsigned long long)le64_to_cpu(dent->inum)); | 458 | (unsigned long long)le64_to_cpu(dent->inum)); |
510 | printk(KERN_ERR "\ttype %d\n", (int)dent->type); | 459 | pr_err("\ttype %d\n", (int)dent->type); |
511 | printk(KERN_ERR "\tnlen %d\n", nlen); | 460 | pr_err("\tnlen %d\n", nlen); |
512 | printk(KERN_ERR "\tname "); | 461 | pr_err("\tname "); |
513 | 462 | ||
514 | if (nlen > UBIFS_MAX_NLEN) | 463 | if (nlen > UBIFS_MAX_NLEN) |
515 | printk(KERN_ERR "(bad name length, not printing, " | 464 | pr_err("(bad name length, not printing, bad or corrupted node)"); |
516 | "bad or corrupted node)"); | ||
517 | else { | 465 | else { |
518 | for (i = 0; i < nlen && dent->name[i]; i++) | 466 | for (i = 0; i < nlen && dent->name[i]; i++) |
519 | printk(KERN_CONT "%c", dent->name[i]); | 467 | pr_cont("%c", dent->name[i]); |
520 | } | 468 | } |
521 | printk(KERN_CONT "\n"); | 469 | pr_cont("\n"); |
522 | 470 | ||
523 | break; | 471 | break; |
524 | } | 472 | } |
@@ -528,15 +476,13 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
528 | int dlen = le32_to_cpu(ch->len) - UBIFS_DATA_NODE_SZ; | 476 | int dlen = le32_to_cpu(ch->len) - UBIFS_DATA_NODE_SZ; |
529 | 477 | ||
530 | key_read(c, &dn->key, &key); | 478 | key_read(c, &dn->key, &key); |
531 | printk(KERN_ERR "\tkey %s\n", | 479 | pr_err("\tkey %s\n", |
532 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); | 480 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); |
533 | printk(KERN_ERR "\tsize %u\n", | 481 | pr_err("\tsize %u\n", le32_to_cpu(dn->size)); |
534 | le32_to_cpu(dn->size)); | 482 | pr_err("\tcompr_typ %d\n", |
535 | printk(KERN_ERR "\tcompr_typ %d\n", | ||
536 | (int)le16_to_cpu(dn->compr_type)); | 483 | (int)le16_to_cpu(dn->compr_type)); |
537 | printk(KERN_ERR "\tdata size %d\n", | 484 | pr_err("\tdata size %d\n", dlen); |
538 | dlen); | 485 | pr_err("\tdata:\n"); |
539 | printk(KERN_ERR "\tdata:\n"); | ||
540 | print_hex_dump(KERN_ERR, "\t", DUMP_PREFIX_OFFSET, 32, 1, | 486 | print_hex_dump(KERN_ERR, "\t", DUMP_PREFIX_OFFSET, 32, 1, |
541 | (void *)&dn->data, dlen, 0); | 487 | (void *)&dn->data, dlen, 0); |
542 | break; | 488 | break; |
@@ -545,11 +491,10 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
545 | { | 491 | { |
546 | const struct ubifs_trun_node *trun = node; | 492 | const struct ubifs_trun_node *trun = node; |
547 | 493 | ||
548 | printk(KERN_ERR "\tinum %u\n", | 494 | pr_err("\tinum %u\n", le32_to_cpu(trun->inum)); |
549 | le32_to_cpu(trun->inum)); | 495 | pr_err("\told_size %llu\n", |
550 | printk(KERN_ERR "\told_size %llu\n", | ||
551 | (unsigned long long)le64_to_cpu(trun->old_size)); | 496 | (unsigned long long)le64_to_cpu(trun->old_size)); |
552 | printk(KERN_ERR "\tnew_size %llu\n", | 497 | pr_err("\tnew_size %llu\n", |
553 | (unsigned long long)le64_to_cpu(trun->new_size)); | 498 | (unsigned long long)le64_to_cpu(trun->new_size)); |
554 | break; | 499 | break; |
555 | } | 500 | } |
@@ -558,17 +503,16 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
558 | const struct ubifs_idx_node *idx = node; | 503 | const struct ubifs_idx_node *idx = node; |
559 | 504 | ||
560 | n = le16_to_cpu(idx->child_cnt); | 505 | n = le16_to_cpu(idx->child_cnt); |
561 | printk(KERN_ERR "\tchild_cnt %d\n", n); | 506 | pr_err("\tchild_cnt %d\n", n); |
562 | printk(KERN_ERR "\tlevel %d\n", | 507 | pr_err("\tlevel %d\n", (int)le16_to_cpu(idx->level)); |
563 | (int)le16_to_cpu(idx->level)); | 508 | pr_err("\tBranches:\n"); |
564 | printk(KERN_ERR "\tBranches:\n"); | ||
565 | 509 | ||
566 | for (i = 0; i < n && i < c->fanout - 1; i++) { | 510 | for (i = 0; i < n && i < c->fanout - 1; i++) { |
567 | const struct ubifs_branch *br; | 511 | const struct ubifs_branch *br; |
568 | 512 | ||
569 | br = ubifs_idx_branch(c, idx, i); | 513 | br = ubifs_idx_branch(c, idx, i); |
570 | key_read(c, &br->key, &key); | 514 | key_read(c, &br->key, &key); |
571 | printk(KERN_ERR "\t%d: LEB %d:%d len %d key %s\n", | 515 | pr_err("\t%d: LEB %d:%d len %d key %s\n", |
572 | i, le32_to_cpu(br->lnum), le32_to_cpu(br->offs), | 516 | i, le32_to_cpu(br->lnum), le32_to_cpu(br->offs), |
573 | le32_to_cpu(br->len), | 517 | le32_to_cpu(br->len), |
574 | dbg_snprintf_key(c, &key, key_buf, | 518 | dbg_snprintf_key(c, &key, key_buf, |
@@ -582,20 +526,20 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
582 | { | 526 | { |
583 | const struct ubifs_orph_node *orph = node; | 527 | const struct ubifs_orph_node *orph = node; |
584 | 528 | ||
585 | printk(KERN_ERR "\tcommit number %llu\n", | 529 | pr_err("\tcommit number %llu\n", |
586 | (unsigned long long) | 530 | (unsigned long long) |
587 | le64_to_cpu(orph->cmt_no) & LLONG_MAX); | 531 | le64_to_cpu(orph->cmt_no) & LLONG_MAX); |
588 | printk(KERN_ERR "\tlast node flag %llu\n", | 532 | pr_err("\tlast node flag %llu\n", |
589 | (unsigned long long)(le64_to_cpu(orph->cmt_no)) >> 63); | 533 | (unsigned long long)(le64_to_cpu(orph->cmt_no)) >> 63); |
590 | n = (le32_to_cpu(ch->len) - UBIFS_ORPH_NODE_SZ) >> 3; | 534 | n = (le32_to_cpu(ch->len) - UBIFS_ORPH_NODE_SZ) >> 3; |
591 | printk(KERN_ERR "\t%d orphan inode numbers:\n", n); | 535 | pr_err("\t%d orphan inode numbers:\n", n); |
592 | for (i = 0; i < n; i++) | 536 | for (i = 0; i < n; i++) |
593 | printk(KERN_ERR "\t ino %llu\n", | 537 | pr_err("\t ino %llu\n", |
594 | (unsigned long long)le64_to_cpu(orph->inos[i])); | 538 | (unsigned long long)le64_to_cpu(orph->inos[i])); |
595 | break; | 539 | break; |
596 | } | 540 | } |
597 | default: | 541 | default: |
598 | printk(KERN_ERR "node type %d was not recognized\n", | 542 | pr_err("node type %d was not recognized\n", |
599 | (int)ch->node_type); | 543 | (int)ch->node_type); |
600 | } | 544 | } |
601 | spin_unlock(&dbg_lock); | 545 | spin_unlock(&dbg_lock); |
@@ -604,16 +548,16 @@ void ubifs_dump_node(const struct ubifs_info *c, const void *node) | |||
604 | void ubifs_dump_budget_req(const struct ubifs_budget_req *req) | 548 | void ubifs_dump_budget_req(const struct ubifs_budget_req *req) |
605 | { | 549 | { |
606 | spin_lock(&dbg_lock); | 550 | spin_lock(&dbg_lock); |
607 | printk(KERN_ERR "Budgeting request: new_ino %d, dirtied_ino %d\n", | 551 | pr_err("Budgeting request: new_ino %d, dirtied_ino %d\n", |
608 | req->new_ino, req->dirtied_ino); | 552 | req->new_ino, req->dirtied_ino); |
609 | printk(KERN_ERR "\tnew_ino_d %d, dirtied_ino_d %d\n", | 553 | pr_err("\tnew_ino_d %d, dirtied_ino_d %d\n", |
610 | req->new_ino_d, req->dirtied_ino_d); | 554 | req->new_ino_d, req->dirtied_ino_d); |
611 | printk(KERN_ERR "\tnew_page %d, dirtied_page %d\n", | 555 | pr_err("\tnew_page %d, dirtied_page %d\n", |
612 | req->new_page, req->dirtied_page); | 556 | req->new_page, req->dirtied_page); |
613 | printk(KERN_ERR "\tnew_dent %d, mod_dent %d\n", | 557 | pr_err("\tnew_dent %d, mod_dent %d\n", |
614 | req->new_dent, req->mod_dent); | 558 | req->new_dent, req->mod_dent); |
615 | printk(KERN_ERR "\tidx_growth %d\n", req->idx_growth); | 559 | pr_err("\tidx_growth %d\n", req->idx_growth); |
616 | printk(KERN_ERR "\tdata_growth %d dd_growth %d\n", | 560 | pr_err("\tdata_growth %d dd_growth %d\n", |
617 | req->data_growth, req->dd_growth); | 561 | req->data_growth, req->dd_growth); |
618 | spin_unlock(&dbg_lock); | 562 | spin_unlock(&dbg_lock); |
619 | } | 563 | } |
@@ -621,14 +565,12 @@ void ubifs_dump_budget_req(const struct ubifs_budget_req *req) | |||
621 | void ubifs_dump_lstats(const struct ubifs_lp_stats *lst) | 565 | void ubifs_dump_lstats(const struct ubifs_lp_stats *lst) |
622 | { | 566 | { |
623 | spin_lock(&dbg_lock); | 567 | spin_lock(&dbg_lock); |
624 | printk(KERN_ERR "(pid %d) Lprops statistics: empty_lebs %d, " | 568 | pr_err("(pid %d) Lprops statistics: empty_lebs %d, idx_lebs %d\n", |
625 | "idx_lebs %d\n", current->pid, lst->empty_lebs, lst->idx_lebs); | 569 | current->pid, lst->empty_lebs, lst->idx_lebs); |
626 | printk(KERN_ERR "\ttaken_empty_lebs %d, total_free %lld, " | 570 | pr_err("\ttaken_empty_lebs %d, total_free %lld, total_dirty %lld\n", |
627 | "total_dirty %lld\n", lst->taken_empty_lebs, lst->total_free, | 571 | lst->taken_empty_lebs, lst->total_free, lst->total_dirty); |
628 | lst->total_dirty); | 572 | pr_err("\ttotal_used %lld, total_dark %lld, total_dead %lld\n", |
629 | printk(KERN_ERR "\ttotal_used %lld, total_dark %lld, " | 573 | lst->total_used, lst->total_dark, lst->total_dead); |
630 | "total_dead %lld\n", lst->total_used, lst->total_dark, | ||
631 | lst->total_dead); | ||
632 | spin_unlock(&dbg_lock); | 574 | spin_unlock(&dbg_lock); |
633 | } | 575 | } |
634 | 576 | ||
@@ -642,21 +584,17 @@ void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi) | |||
642 | 584 | ||
643 | spin_lock(&c->space_lock); | 585 | spin_lock(&c->space_lock); |
644 | spin_lock(&dbg_lock); | 586 | spin_lock(&dbg_lock); |
645 | printk(KERN_ERR "(pid %d) Budgeting info: data budget sum %lld, " | 587 | pr_err("(pid %d) Budgeting info: data budget sum %lld, total budget sum %lld\n", |
646 | "total budget sum %lld\n", current->pid, | 588 | current->pid, bi->data_growth + bi->dd_growth, |
647 | bi->data_growth + bi->dd_growth, | ||
648 | bi->data_growth + bi->dd_growth + bi->idx_growth); | 589 | bi->data_growth + bi->dd_growth + bi->idx_growth); |
649 | printk(KERN_ERR "\tbudg_data_growth %lld, budg_dd_growth %lld, " | 590 | pr_err("\tbudg_data_growth %lld, budg_dd_growth %lld, budg_idx_growth %lld\n", |
650 | "budg_idx_growth %lld\n", bi->data_growth, bi->dd_growth, | 591 | bi->data_growth, bi->dd_growth, bi->idx_growth); |
651 | bi->idx_growth); | 592 | pr_err("\tmin_idx_lebs %d, old_idx_sz %llu, uncommitted_idx %lld\n", |
652 | printk(KERN_ERR "\tmin_idx_lebs %d, old_idx_sz %llu, " | 593 | bi->min_idx_lebs, bi->old_idx_sz, bi->uncommitted_idx); |
653 | "uncommitted_idx %lld\n", bi->min_idx_lebs, bi->old_idx_sz, | 594 | pr_err("\tpage_budget %d, inode_budget %d, dent_budget %d\n", |
654 | bi->uncommitted_idx); | ||
655 | printk(KERN_ERR "\tpage_budget %d, inode_budget %d, dent_budget %d\n", | ||
656 | bi->page_budget, bi->inode_budget, bi->dent_budget); | 595 | bi->page_budget, bi->inode_budget, bi->dent_budget); |
657 | printk(KERN_ERR "\tnospace %u, nospace_rp %u\n", | 596 | pr_err("\tnospace %u, nospace_rp %u\n", bi->nospace, bi->nospace_rp); |
658 | bi->nospace, bi->nospace_rp); | 597 | pr_err("\tdark_wm %d, dead_wm %d, max_idx_node_sz %d\n", |
659 | printk(KERN_ERR "\tdark_wm %d, dead_wm %d, max_idx_node_sz %d\n", | ||
660 | c->dark_wm, c->dead_wm, c->max_idx_node_sz); | 598 | c->dark_wm, c->dead_wm, c->max_idx_node_sz); |
661 | 599 | ||
662 | if (bi != &c->bi) | 600 | if (bi != &c->bi) |
@@ -667,38 +605,37 @@ void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi) | |||
667 | */ | 605 | */ |
668 | goto out_unlock; | 606 | goto out_unlock; |
669 | 607 | ||
670 | printk(KERN_ERR "\tfreeable_cnt %d, calc_idx_sz %lld, idx_gc_cnt %d\n", | 608 | pr_err("\tfreeable_cnt %d, calc_idx_sz %lld, idx_gc_cnt %d\n", |
671 | c->freeable_cnt, c->calc_idx_sz, c->idx_gc_cnt); | 609 | c->freeable_cnt, c->calc_idx_sz, c->idx_gc_cnt); |
672 | printk(KERN_ERR "\tdirty_pg_cnt %ld, dirty_zn_cnt %ld, " | 610 | pr_err("\tdirty_pg_cnt %ld, dirty_zn_cnt %ld, clean_zn_cnt %ld\n", |
673 | "clean_zn_cnt %ld\n", atomic_long_read(&c->dirty_pg_cnt), | 611 | atomic_long_read(&c->dirty_pg_cnt), |
674 | atomic_long_read(&c->dirty_zn_cnt), | 612 | atomic_long_read(&c->dirty_zn_cnt), |
675 | atomic_long_read(&c->clean_zn_cnt)); | 613 | atomic_long_read(&c->clean_zn_cnt)); |
676 | printk(KERN_ERR "\tgc_lnum %d, ihead_lnum %d\n", | 614 | pr_err("\tgc_lnum %d, ihead_lnum %d\n", c->gc_lnum, c->ihead_lnum); |
677 | c->gc_lnum, c->ihead_lnum); | ||
678 | 615 | ||
679 | /* If we are in R/O mode, journal heads do not exist */ | 616 | /* If we are in R/O mode, journal heads do not exist */ |
680 | if (c->jheads) | 617 | if (c->jheads) |
681 | for (i = 0; i < c->jhead_cnt; i++) | 618 | for (i = 0; i < c->jhead_cnt; i++) |
682 | printk(KERN_ERR "\tjhead %s\t LEB %d\n", | 619 | pr_err("\tjhead %s\t LEB %d\n", |
683 | dbg_jhead(c->jheads[i].wbuf.jhead), | 620 | dbg_jhead(c->jheads[i].wbuf.jhead), |
684 | c->jheads[i].wbuf.lnum); | 621 | c->jheads[i].wbuf.lnum); |
685 | for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) { | 622 | for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) { |
686 | bud = rb_entry(rb, struct ubifs_bud, rb); | 623 | bud = rb_entry(rb, struct ubifs_bud, rb); |
687 | printk(KERN_ERR "\tbud LEB %d\n", bud->lnum); | 624 | pr_err("\tbud LEB %d\n", bud->lnum); |
688 | } | 625 | } |
689 | list_for_each_entry(bud, &c->old_buds, list) | 626 | list_for_each_entry(bud, &c->old_buds, list) |
690 | printk(KERN_ERR "\told bud LEB %d\n", bud->lnum); | 627 | pr_err("\told bud LEB %d\n", bud->lnum); |
691 | list_for_each_entry(idx_gc, &c->idx_gc, list) | 628 | list_for_each_entry(idx_gc, &c->idx_gc, list) |
692 | printk(KERN_ERR "\tGC'ed idx LEB %d unmap %d\n", | 629 | pr_err("\tGC'ed idx LEB %d unmap %d\n", |
693 | idx_gc->lnum, idx_gc->unmap); | 630 | idx_gc->lnum, idx_gc->unmap); |
694 | printk(KERN_ERR "\tcommit state %d\n", c->cmt_state); | 631 | pr_err("\tcommit state %d\n", c->cmt_state); |
695 | 632 | ||
696 | /* Print budgeting predictions */ | 633 | /* Print budgeting predictions */ |
697 | available = ubifs_calc_available(c, c->bi.min_idx_lebs); | 634 | available = ubifs_calc_available(c, c->bi.min_idx_lebs); |
698 | outstanding = c->bi.data_growth + c->bi.dd_growth; | 635 | outstanding = c->bi.data_growth + c->bi.dd_growth; |
699 | free = ubifs_get_free_space_nolock(c); | 636 | free = ubifs_get_free_space_nolock(c); |
700 | printk(KERN_ERR "Budgeting predictions:\n"); | 637 | pr_err("Budgeting predictions:\n"); |
701 | printk(KERN_ERR "\tavailable: %lld, outstanding %lld, free %lld\n", | 638 | pr_err("\tavailable: %lld, outstanding %lld, free %lld\n", |
702 | available, outstanding, free); | 639 | available, outstanding, free); |
703 | out_unlock: | 640 | out_unlock: |
704 | spin_unlock(&dbg_lock); | 641 | spin_unlock(&dbg_lock); |
@@ -718,21 +655,19 @@ void ubifs_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) | |||
718 | dark = ubifs_calc_dark(c, spc); | 655 | dark = ubifs_calc_dark(c, spc); |
719 | 656 | ||
720 | if (lp->flags & LPROPS_INDEX) | 657 | if (lp->flags & LPROPS_INDEX) |
721 | printk(KERN_ERR "LEB %-7d free %-8d dirty %-8d used %-8d " | 658 | pr_err("LEB %-7d free %-8d dirty %-8d used %-8d free + dirty %-8d flags %#x (", |
722 | "free + dirty %-8d flags %#x (", lp->lnum, lp->free, | 659 | lp->lnum, lp->free, lp->dirty, c->leb_size - spc, spc, |
723 | lp->dirty, c->leb_size - spc, spc, lp->flags); | 660 | lp->flags); |
724 | else | 661 | else |
725 | printk(KERN_ERR "LEB %-7d free %-8d dirty %-8d used %-8d " | 662 | pr_err("LEB %-7d free %-8d dirty %-8d used %-8d free + dirty %-8d dark %-4d dead %-4d nodes fit %-3d flags %#-4x (", |
726 | "free + dirty %-8d dark %-4d dead %-4d nodes fit %-3d " | 663 | lp->lnum, lp->free, lp->dirty, c->leb_size - spc, spc, |
727 | "flags %#-4x (", lp->lnum, lp->free, lp->dirty, | 664 | dark, dead, (int)(spc / UBIFS_MAX_NODE_SZ), lp->flags); |
728 | c->leb_size - spc, spc, dark, dead, | ||
729 | (int)(spc / UBIFS_MAX_NODE_SZ), lp->flags); | ||
730 | 665 | ||
731 | if (lp->flags & LPROPS_TAKEN) { | 666 | if (lp->flags & LPROPS_TAKEN) { |
732 | if (lp->flags & LPROPS_INDEX) | 667 | if (lp->flags & LPROPS_INDEX) |
733 | printk(KERN_CONT "index, taken"); | 668 | pr_cont("index, taken"); |
734 | else | 669 | else |
735 | printk(KERN_CONT "taken"); | 670 | pr_cont("taken"); |
736 | } else { | 671 | } else { |
737 | const char *s; | 672 | const char *s; |
738 | 673 | ||
@@ -769,7 +704,7 @@ void ubifs_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) | |||
769 | break; | 704 | break; |
770 | } | 705 | } |
771 | } | 706 | } |
772 | printk(KERN_CONT "%s", s); | 707 | pr_cont("%s", s); |
773 | } | 708 | } |
774 | 709 | ||
775 | for (rb = rb_first((struct rb_root *)&c->buds); rb; rb = rb_next(rb)) { | 710 | 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 | */ | 719 | */ |
785 | if (c->jheads && | 720 | if (c->jheads && |
786 | lp->lnum == c->jheads[i].wbuf.lnum) { | 721 | lp->lnum == c->jheads[i].wbuf.lnum) { |
787 | printk(KERN_CONT ", jhead %s", | 722 | pr_cont(", jhead %s", dbg_jhead(i)); |
788 | dbg_jhead(i)); | ||
789 | head = 1; | 723 | head = 1; |
790 | } | 724 | } |
791 | } | 725 | } |
792 | if (!head) | 726 | if (!head) |
793 | printk(KERN_CONT ", bud of jhead %s", | 727 | pr_cont(", bud of jhead %s", |
794 | dbg_jhead(bud->jhead)); | 728 | dbg_jhead(bud->jhead)); |
795 | } | 729 | } |
796 | } | 730 | } |
797 | if (lp->lnum == c->gc_lnum) | 731 | if (lp->lnum == c->gc_lnum) |
798 | printk(KERN_CONT ", GC LEB"); | 732 | pr_cont(", GC LEB"); |
799 | printk(KERN_CONT ")\n"); | 733 | pr_cont(")\n"); |
800 | } | 734 | } |
801 | 735 | ||
802 | void ubifs_dump_lprops(struct ubifs_info *c) | 736 | void ubifs_dump_lprops(struct ubifs_info *c) |
@@ -805,8 +739,7 @@ void ubifs_dump_lprops(struct ubifs_info *c) | |||
805 | struct ubifs_lprops lp; | 739 | struct ubifs_lprops lp; |
806 | struct ubifs_lp_stats lst; | 740 | struct ubifs_lp_stats lst; |
807 | 741 | ||
808 | printk(KERN_ERR "(pid %d) start dumping LEB properties\n", | 742 | pr_err("(pid %d) start dumping LEB properties\n", current->pid); |
809 | current->pid); | ||
810 | ubifs_get_lp_stats(c, &lst); | 743 | ubifs_get_lp_stats(c, &lst); |
811 | ubifs_dump_lstats(&lst); | 744 | ubifs_dump_lstats(&lst); |
812 | 745 | ||
@@ -817,8 +750,7 @@ void ubifs_dump_lprops(struct ubifs_info *c) | |||
817 | 750 | ||
818 | ubifs_dump_lprop(c, &lp); | 751 | ubifs_dump_lprop(c, &lp); |
819 | } | 752 | } |
820 | printk(KERN_ERR "(pid %d) finish dumping LEB properties\n", | 753 | pr_err("(pid %d) finish dumping LEB properties\n", current->pid); |
821 | current->pid); | ||
822 | } | 754 | } |
823 | 755 | ||
824 | void ubifs_dump_lpt_info(struct ubifs_info *c) | 756 | void ubifs_dump_lpt_info(struct ubifs_info *c) |
@@ -826,37 +758,36 @@ void ubifs_dump_lpt_info(struct ubifs_info *c) | |||
826 | int i; | 758 | int i; |
827 | 759 | ||
828 | spin_lock(&dbg_lock); | 760 | spin_lock(&dbg_lock); |
829 | printk(KERN_ERR "(pid %d) dumping LPT information\n", current->pid); | 761 | pr_err("(pid %d) dumping LPT information\n", current->pid); |
830 | printk(KERN_ERR "\tlpt_sz: %lld\n", c->lpt_sz); | 762 | pr_err("\tlpt_sz: %lld\n", c->lpt_sz); |
831 | printk(KERN_ERR "\tpnode_sz: %d\n", c->pnode_sz); | 763 | pr_err("\tpnode_sz: %d\n", c->pnode_sz); |
832 | printk(KERN_ERR "\tnnode_sz: %d\n", c->nnode_sz); | 764 | pr_err("\tnnode_sz: %d\n", c->nnode_sz); |
833 | printk(KERN_ERR "\tltab_sz: %d\n", c->ltab_sz); | 765 | pr_err("\tltab_sz: %d\n", c->ltab_sz); |
834 | printk(KERN_ERR "\tlsave_sz: %d\n", c->lsave_sz); | 766 | pr_err("\tlsave_sz: %d\n", c->lsave_sz); |
835 | printk(KERN_ERR "\tbig_lpt: %d\n", c->big_lpt); | 767 | pr_err("\tbig_lpt: %d\n", c->big_lpt); |
836 | printk(KERN_ERR "\tlpt_hght: %d\n", c->lpt_hght); | 768 | pr_err("\tlpt_hght: %d\n", c->lpt_hght); |
837 | printk(KERN_ERR "\tpnode_cnt: %d\n", c->pnode_cnt); | 769 | pr_err("\tpnode_cnt: %d\n", c->pnode_cnt); |
838 | printk(KERN_ERR "\tnnode_cnt: %d\n", c->nnode_cnt); | 770 | pr_err("\tnnode_cnt: %d\n", c->nnode_cnt); |
839 | printk(KERN_ERR "\tdirty_pn_cnt: %d\n", c->dirty_pn_cnt); | 771 | pr_err("\tdirty_pn_cnt: %d\n", c->dirty_pn_cnt); |
840 | printk(KERN_ERR "\tdirty_nn_cnt: %d\n", c->dirty_nn_cnt); | 772 | pr_err("\tdirty_nn_cnt: %d\n", c->dirty_nn_cnt); |
841 | printk(KERN_ERR "\tlsave_cnt: %d\n", c->lsave_cnt); | 773 | pr_err("\tlsave_cnt: %d\n", c->lsave_cnt); |
842 | printk(KERN_ERR "\tspace_bits: %d\n", c->space_bits); | 774 | pr_err("\tspace_bits: %d\n", c->space_bits); |
843 | printk(KERN_ERR "\tlpt_lnum_bits: %d\n", c->lpt_lnum_bits); | 775 | pr_err("\tlpt_lnum_bits: %d\n", c->lpt_lnum_bits); |
844 | printk(KERN_ERR "\tlpt_offs_bits: %d\n", c->lpt_offs_bits); | 776 | pr_err("\tlpt_offs_bits: %d\n", c->lpt_offs_bits); |
845 | printk(KERN_ERR "\tlpt_spc_bits: %d\n", c->lpt_spc_bits); | 777 | pr_err("\tlpt_spc_bits: %d\n", c->lpt_spc_bits); |
846 | printk(KERN_ERR "\tpcnt_bits: %d\n", c->pcnt_bits); | 778 | pr_err("\tpcnt_bits: %d\n", c->pcnt_bits); |
847 | printk(KERN_ERR "\tlnum_bits: %d\n", c->lnum_bits); | 779 | pr_err("\tlnum_bits: %d\n", c->lnum_bits); |
848 | printk(KERN_ERR "\tLPT root is at %d:%d\n", c->lpt_lnum, c->lpt_offs); | 780 | pr_err("\tLPT root is at %d:%d\n", c->lpt_lnum, c->lpt_offs); |
849 | printk(KERN_ERR "\tLPT head is at %d:%d\n", | 781 | pr_err("\tLPT head is at %d:%d\n", |
850 | c->nhead_lnum, c->nhead_offs); | 782 | c->nhead_lnum, c->nhead_offs); |
851 | printk(KERN_ERR "\tLPT ltab is at %d:%d\n", | 783 | pr_err("\tLPT ltab is at %d:%d\n", c->ltab_lnum, c->ltab_offs); |
852 | c->ltab_lnum, c->ltab_offs); | ||
853 | if (c->big_lpt) | 784 | if (c->big_lpt) |
854 | printk(KERN_ERR "\tLPT lsave is at %d:%d\n", | 785 | pr_err("\tLPT lsave is at %d:%d\n", |
855 | c->lsave_lnum, c->lsave_offs); | 786 | c->lsave_lnum, c->lsave_offs); |
856 | for (i = 0; i < c->lpt_lebs; i++) | 787 | for (i = 0; i < c->lpt_lebs; i++) |
857 | printk(KERN_ERR "\tLPT LEB %d free %d dirty %d tgc %d " | 788 | pr_err("\tLPT LEB %d free %d dirty %d tgc %d cmt %d\n", |
858 | "cmt %d\n", i + c->lpt_first, c->ltab[i].free, | 789 | i + c->lpt_first, c->ltab[i].free, c->ltab[i].dirty, |
859 | c->ltab[i].dirty, c->ltab[i].tgc, c->ltab[i].cmt); | 790 | c->ltab[i].tgc, c->ltab[i].cmt); |
860 | spin_unlock(&dbg_lock); | 791 | spin_unlock(&dbg_lock); |
861 | } | 792 | } |
862 | 793 | ||
@@ -865,13 +796,13 @@ void ubifs_dump_sleb(const struct ubifs_info *c, | |||
865 | { | 796 | { |
866 | struct ubifs_scan_node *snod; | 797 | struct ubifs_scan_node *snod; |
867 | 798 | ||
868 | printk(KERN_ERR "(pid %d) start dumping scanned data from LEB %d:%d\n", | 799 | pr_err("(pid %d) start dumping scanned data from LEB %d:%d\n", |
869 | current->pid, sleb->lnum, offs); | 800 | current->pid, sleb->lnum, offs); |
870 | 801 | ||
871 | list_for_each_entry(snod, &sleb->nodes, list) { | 802 | list_for_each_entry(snod, &sleb->nodes, list) { |
872 | cond_resched(); | 803 | cond_resched(); |
873 | printk(KERN_ERR "Dumping node at LEB %d:%d len %d\n", sleb->lnum, | 804 | pr_err("Dumping node at LEB %d:%d len %d\n", |
874 | snod->offs, snod->len); | 805 | sleb->lnum, snod->offs, snod->len); |
875 | ubifs_dump_node(c, snod->node); | 806 | ubifs_dump_node(c, snod->node); |
876 | } | 807 | } |
877 | } | 808 | } |
@@ -882,11 +813,7 @@ void ubifs_dump_leb(const struct ubifs_info *c, int lnum) | |||
882 | struct ubifs_scan_node *snod; | 813 | struct ubifs_scan_node *snod; |
883 | void *buf; | 814 | void *buf; |
884 | 815 | ||
885 | if (dbg_is_tst_rcvry(c)) | 816 | pr_err("(pid %d) start dumping LEB %d\n", current->pid, lnum); |
886 | return; | ||
887 | |||
888 | printk(KERN_ERR "(pid %d) start dumping LEB %d\n", | ||
889 | current->pid, lnum); | ||
890 | 817 | ||
891 | buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); | 818 | buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); |
892 | if (!buf) { | 819 | if (!buf) { |
@@ -900,18 +827,17 @@ void ubifs_dump_leb(const struct ubifs_info *c, int lnum) | |||
900 | goto out; | 827 | goto out; |
901 | } | 828 | } |
902 | 829 | ||
903 | printk(KERN_ERR "LEB %d has %d nodes ending at %d\n", lnum, | 830 | pr_err("LEB %d has %d nodes ending at %d\n", lnum, |
904 | sleb->nodes_cnt, sleb->endpt); | 831 | sleb->nodes_cnt, sleb->endpt); |
905 | 832 | ||
906 | list_for_each_entry(snod, &sleb->nodes, list) { | 833 | list_for_each_entry(snod, &sleb->nodes, list) { |
907 | cond_resched(); | 834 | cond_resched(); |
908 | printk(KERN_ERR "Dumping node at LEB %d:%d len %d\n", lnum, | 835 | pr_err("Dumping node at LEB %d:%d len %d\n", lnum, |
909 | snod->offs, snod->len); | 836 | snod->offs, snod->len); |
910 | ubifs_dump_node(c, snod->node); | 837 | ubifs_dump_node(c, snod->node); |
911 | } | 838 | } |
912 | 839 | ||
913 | printk(KERN_ERR "(pid %d) finish dumping LEB %d\n", | 840 | pr_err("(pid %d) finish dumping LEB %d\n", current->pid, lnum); |
914 | current->pid, lnum); | ||
915 | ubifs_scan_destroy(sleb); | 841 | ubifs_scan_destroy(sleb); |
916 | 842 | ||
917 | out: | 843 | out: |
@@ -932,33 +858,28 @@ void ubifs_dump_znode(const struct ubifs_info *c, | |||
932 | else | 858 | else |
933 | zbr = &c->zroot; | 859 | zbr = &c->zroot; |
934 | 860 | ||
935 | printk(KERN_ERR "znode %p, LEB %d:%d len %d parent %p iip %d level %d" | 861 | pr_err("znode %p, LEB %d:%d len %d parent %p iip %d level %d child_cnt %d flags %lx\n", |
936 | " child_cnt %d flags %lx\n", znode, zbr->lnum, zbr->offs, | 862 | znode, zbr->lnum, zbr->offs, zbr->len, znode->parent, znode->iip, |
937 | zbr->len, znode->parent, znode->iip, znode->level, | 863 | znode->level, znode->child_cnt, znode->flags); |
938 | znode->child_cnt, znode->flags); | ||
939 | 864 | ||
940 | if (znode->child_cnt <= 0 || znode->child_cnt > c->fanout) { | 865 | if (znode->child_cnt <= 0 || znode->child_cnt > c->fanout) { |
941 | spin_unlock(&dbg_lock); | 866 | spin_unlock(&dbg_lock); |
942 | return; | 867 | return; |
943 | } | 868 | } |
944 | 869 | ||
945 | printk(KERN_ERR "zbranches:\n"); | 870 | pr_err("zbranches:\n"); |
946 | for (n = 0; n < znode->child_cnt; n++) { | 871 | for (n = 0; n < znode->child_cnt; n++) { |
947 | zbr = &znode->zbranch[n]; | 872 | zbr = &znode->zbranch[n]; |
948 | if (znode->level > 0) | 873 | if (znode->level > 0) |
949 | printk(KERN_ERR "\t%d: znode %p LEB %d:%d len %d key " | 874 | pr_err("\t%d: znode %p LEB %d:%d len %d key %s\n", |
950 | "%s\n", n, zbr->znode, zbr->lnum, | 875 | n, zbr->znode, zbr->lnum, zbr->offs, zbr->len, |
951 | zbr->offs, zbr->len, | 876 | dbg_snprintf_key(c, &zbr->key, key_buf, |
952 | dbg_snprintf_key(c, &zbr->key, | 877 | DBG_KEY_BUF_LEN)); |
953 | key_buf, | ||
954 | DBG_KEY_BUF_LEN)); | ||
955 | else | 878 | else |
956 | printk(KERN_ERR "\t%d: LNC %p LEB %d:%d len %d key " | 879 | pr_err("\t%d: LNC %p LEB %d:%d len %d key %s\n", |
957 | "%s\n", n, zbr->znode, zbr->lnum, | 880 | n, zbr->znode, zbr->lnum, zbr->offs, zbr->len, |
958 | zbr->offs, zbr->len, | 881 | dbg_snprintf_key(c, &zbr->key, key_buf, |
959 | dbg_snprintf_key(c, &zbr->key, | 882 | DBG_KEY_BUF_LEN)); |
960 | key_buf, | ||
961 | DBG_KEY_BUF_LEN)); | ||
962 | } | 883 | } |
963 | spin_unlock(&dbg_lock); | 884 | spin_unlock(&dbg_lock); |
964 | } | 885 | } |
@@ -967,16 +888,16 @@ void ubifs_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat) | |||
967 | { | 888 | { |
968 | int i; | 889 | int i; |
969 | 890 | ||
970 | printk(KERN_ERR "(pid %d) start dumping heap cat %d (%d elements)\n", | 891 | pr_err("(pid %d) start dumping heap cat %d (%d elements)\n", |
971 | current->pid, cat, heap->cnt); | 892 | current->pid, cat, heap->cnt); |
972 | for (i = 0; i < heap->cnt; i++) { | 893 | for (i = 0; i < heap->cnt; i++) { |
973 | struct ubifs_lprops *lprops = heap->arr[i]; | 894 | struct ubifs_lprops *lprops = heap->arr[i]; |
974 | 895 | ||
975 | printk(KERN_ERR "\t%d. LEB %d hpos %d free %d dirty %d " | 896 | pr_err("\t%d. LEB %d hpos %d free %d dirty %d flags %d\n", |
976 | "flags %d\n", i, lprops->lnum, lprops->hpos, | 897 | i, lprops->lnum, lprops->hpos, lprops->free, |
977 | lprops->free, lprops->dirty, lprops->flags); | 898 | lprops->dirty, lprops->flags); |
978 | } | 899 | } |
979 | printk(KERN_ERR "(pid %d) finish dumping heap\n", current->pid); | 900 | pr_err("(pid %d) finish dumping heap\n", current->pid); |
980 | } | 901 | } |
981 | 902 | ||
982 | void ubifs_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | 903 | 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 | { | 905 | { |
985 | int i; | 906 | int i; |
986 | 907 | ||
987 | printk(KERN_ERR "(pid %d) dumping pnode:\n", current->pid); | 908 | pr_err("(pid %d) dumping pnode:\n", current->pid); |
988 | printk(KERN_ERR "\taddress %zx parent %zx cnext %zx\n", | 909 | pr_err("\taddress %zx parent %zx cnext %zx\n", |
989 | (size_t)pnode, (size_t)parent, (size_t)pnode->cnext); | 910 | (size_t)pnode, (size_t)parent, (size_t)pnode->cnext); |
990 | printk(KERN_ERR "\tflags %lu iip %d level %d num %d\n", | 911 | pr_err("\tflags %lu iip %d level %d num %d\n", |
991 | pnode->flags, iip, pnode->level, pnode->num); | 912 | pnode->flags, iip, pnode->level, pnode->num); |
992 | for (i = 0; i < UBIFS_LPT_FANOUT; i++) { | 913 | for (i = 0; i < UBIFS_LPT_FANOUT; i++) { |
993 | struct ubifs_lprops *lp = &pnode->lprops[i]; | 914 | struct ubifs_lprops *lp = &pnode->lprops[i]; |
994 | 915 | ||
995 | printk(KERN_ERR "\t%d: free %d dirty %d flags %d lnum %d\n", | 916 | pr_err("\t%d: free %d dirty %d flags %d lnum %d\n", |
996 | i, lp->free, lp->dirty, lp->flags, lp->lnum); | 917 | i, lp->free, lp->dirty, lp->flags, lp->lnum); |
997 | } | 918 | } |
998 | } | 919 | } |
@@ -1002,20 +923,20 @@ void ubifs_dump_tnc(struct ubifs_info *c) | |||
1002 | struct ubifs_znode *znode; | 923 | struct ubifs_znode *znode; |
1003 | int level; | 924 | int level; |
1004 | 925 | ||
1005 | printk(KERN_ERR "\n"); | 926 | pr_err("\n"); |
1006 | printk(KERN_ERR "(pid %d) start dumping TNC tree\n", current->pid); | 927 | pr_err("(pid %d) start dumping TNC tree\n", current->pid); |
1007 | znode = ubifs_tnc_levelorder_next(c->zroot.znode, NULL); | 928 | znode = ubifs_tnc_levelorder_next(c->zroot.znode, NULL); |
1008 | level = znode->level; | 929 | level = znode->level; |
1009 | printk(KERN_ERR "== Level %d ==\n", level); | 930 | pr_err("== Level %d ==\n", level); |
1010 | while (znode) { | 931 | while (znode) { |
1011 | if (level != znode->level) { | 932 | if (level != znode->level) { |
1012 | level = znode->level; | 933 | level = znode->level; |
1013 | printk(KERN_ERR "== Level %d ==\n", level); | 934 | pr_err("== Level %d ==\n", level); |
1014 | } | 935 | } |
1015 | ubifs_dump_znode(c, znode); | 936 | ubifs_dump_znode(c, znode); |
1016 | znode = ubifs_tnc_levelorder_next(c->zroot.znode, znode); | 937 | znode = ubifs_tnc_levelorder_next(c->zroot.znode, znode); |
1017 | } | 938 | } |
1018 | printk(KERN_ERR "(pid %d) finish dumping TNC tree\n", current->pid); | 939 | pr_err("(pid %d) finish dumping TNC tree\n", current->pid); |
1019 | } | 940 | } |
1020 | 941 | ||
1021 | static int dump_znode(struct ubifs_info *c, struct ubifs_znode *znode, | 942 | 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 | mutex_lock(&ui->ui_mutex); | 1075 | mutex_lock(&ui->ui_mutex); |
1155 | spin_lock(&ui->ui_lock); | 1076 | spin_lock(&ui->ui_lock); |
1156 | if (ui->ui_size != ui->synced_i_size && !ui->dirty) { | 1077 | if (ui->ui_size != ui->synced_i_size && !ui->dirty) { |
1157 | ubifs_err("ui_size is %lld, synced_i_size is %lld, but inode " | 1078 | ubifs_err("ui_size is %lld, synced_i_size is %lld, but inode is clean", |
1158 | "is clean", ui->ui_size, ui->synced_i_size); | 1079 | ui->ui_size, ui->synced_i_size); |
1159 | ubifs_err("i_ino %lu, i_mode %#x, i_size %lld", inode->i_ino, | 1080 | ubifs_err("i_ino %lu, i_mode %#x, i_size %lld", inode->i_ino, |
1160 | inode->i_mode, i_size_read(inode)); | 1081 | inode->i_mode, i_size_read(inode)); |
1161 | dump_stack(); | 1082 | dump_stack(); |
@@ -1217,17 +1138,16 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir) | |||
1217 | kfree(pdent); | 1138 | kfree(pdent); |
1218 | 1139 | ||
1219 | if (i_size_read(dir) != size) { | 1140 | if (i_size_read(dir) != size) { |
1220 | ubifs_err("directory inode %lu has size %llu, " | 1141 | ubifs_err("directory inode %lu has size %llu, but calculated size is %llu", |
1221 | "but calculated size is %llu", dir->i_ino, | 1142 | dir->i_ino, (unsigned long long)i_size_read(dir), |
1222 | (unsigned long long)i_size_read(dir), | ||
1223 | (unsigned long long)size); | 1143 | (unsigned long long)size); |
1224 | ubifs_dump_inode(c, dir); | 1144 | ubifs_dump_inode(c, dir); |
1225 | dump_stack(); | 1145 | dump_stack(); |
1226 | return -EINVAL; | 1146 | return -EINVAL; |
1227 | } | 1147 | } |
1228 | if (dir->i_nlink != nlink) { | 1148 | if (dir->i_nlink != nlink) { |
1229 | ubifs_err("directory inode %lu has nlink %u, but calculated " | 1149 | ubifs_err("directory inode %lu has nlink %u, but calculated nlink is %u", |
1230 | "nlink is %u", dir->i_ino, dir->i_nlink, nlink); | 1150 | dir->i_ino, dir->i_nlink, nlink); |
1231 | ubifs_dump_inode(c, dir); | 1151 | ubifs_dump_inode(c, dir); |
1232 | dump_stack(); | 1152 | dump_stack(); |
1233 | return -EINVAL; | 1153 | return -EINVAL; |
@@ -1686,8 +1606,8 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, | |||
1686 | if (znode_cb) { | 1606 | if (znode_cb) { |
1687 | err = znode_cb(c, znode, priv); | 1607 | err = znode_cb(c, znode, priv); |
1688 | if (err) { | 1608 | if (err) { |
1689 | ubifs_err("znode checking function returned " | 1609 | ubifs_err("znode checking function returned error %d", |
1690 | "error %d", err); | 1610 | err); |
1691 | ubifs_dump_znode(c, znode); | 1611 | ubifs_dump_znode(c, znode); |
1692 | goto out_dump; | 1612 | goto out_dump; |
1693 | } | 1613 | } |
@@ -1697,9 +1617,7 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, | |||
1697 | zbr = &znode->zbranch[idx]; | 1617 | zbr = &znode->zbranch[idx]; |
1698 | err = leaf_cb(c, zbr, priv); | 1618 | err = leaf_cb(c, zbr, priv); |
1699 | if (err) { | 1619 | if (err) { |
1700 | ubifs_err("leaf checking function " | 1620 | ubifs_err("leaf checking function returned error %d, for leaf at LEB %d:%d", |
1701 | "returned error %d, for leaf " | ||
1702 | "at LEB %d:%d", | ||
1703 | err, zbr->lnum, zbr->offs); | 1621 | err, zbr->lnum, zbr->offs); |
1704 | goto out_dump; | 1622 | goto out_dump; |
1705 | } | 1623 | } |
@@ -1807,8 +1725,8 @@ int dbg_check_idx_size(struct ubifs_info *c, long long idx_size) | |||
1807 | } | 1725 | } |
1808 | 1726 | ||
1809 | if (calc != idx_size) { | 1727 | if (calc != idx_size) { |
1810 | ubifs_err("index size check failed: calculated size is %lld, " | 1728 | ubifs_err("index size check failed: calculated size is %lld, should be %lld", |
1811 | "should be %lld", calc, idx_size); | 1729 | calc, idx_size); |
1812 | dump_stack(); | 1730 | dump_stack(); |
1813 | return -EINVAL; | 1731 | return -EINVAL; |
1814 | } | 1732 | } |
@@ -2120,8 +2038,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2120 | fscki = read_add_inode(c, priv, inum); | 2038 | fscki = read_add_inode(c, priv, inum); |
2121 | if (IS_ERR(fscki)) { | 2039 | if (IS_ERR(fscki)) { |
2122 | err = PTR_ERR(fscki); | 2040 | err = PTR_ERR(fscki); |
2123 | ubifs_err("error %d while processing data node and " | 2041 | ubifs_err("error %d while processing data node and trying to find inode node %lu", |
2124 | "trying to find inode node %lu", | ||
2125 | err, (unsigned long)inum); | 2042 | err, (unsigned long)inum); |
2126 | goto out_dump; | 2043 | goto out_dump; |
2127 | } | 2044 | } |
@@ -2131,9 +2048,8 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2131 | blk_offs <<= UBIFS_BLOCK_SHIFT; | 2048 | blk_offs <<= UBIFS_BLOCK_SHIFT; |
2132 | blk_offs += le32_to_cpu(dn->size); | 2049 | blk_offs += le32_to_cpu(dn->size); |
2133 | if (blk_offs > fscki->size) { | 2050 | if (blk_offs > fscki->size) { |
2134 | ubifs_err("data node at LEB %d:%d is not within inode " | 2051 | ubifs_err("data node at LEB %d:%d is not within inode size %lld", |
2135 | "size %lld", zbr->lnum, zbr->offs, | 2052 | zbr->lnum, zbr->offs, fscki->size); |
2136 | fscki->size); | ||
2137 | err = -EINVAL; | 2053 | err = -EINVAL; |
2138 | goto out_dump; | 2054 | goto out_dump; |
2139 | } | 2055 | } |
@@ -2154,8 +2070,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2154 | fscki = read_add_inode(c, priv, inum); | 2070 | fscki = read_add_inode(c, priv, inum); |
2155 | if (IS_ERR(fscki)) { | 2071 | if (IS_ERR(fscki)) { |
2156 | err = PTR_ERR(fscki); | 2072 | err = PTR_ERR(fscki); |
2157 | ubifs_err("error %d while processing entry node and " | 2073 | ubifs_err("error %d while processing entry node and trying to find inode node %lu", |
2158 | "trying to find inode node %lu", | ||
2159 | err, (unsigned long)inum); | 2074 | err, (unsigned long)inum); |
2160 | goto out_dump; | 2075 | goto out_dump; |
2161 | } | 2076 | } |
@@ -2167,8 +2082,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2167 | fscki1 = read_add_inode(c, priv, inum); | 2082 | fscki1 = read_add_inode(c, priv, inum); |
2168 | if (IS_ERR(fscki1)) { | 2083 | if (IS_ERR(fscki1)) { |
2169 | err = PTR_ERR(fscki1); | 2084 | err = PTR_ERR(fscki1); |
2170 | ubifs_err("error %d while processing entry node and " | 2085 | ubifs_err("error %d while processing entry node and trying to find parent inode node %lu", |
2171 | "trying to find parent inode node %lu", | ||
2172 | err, (unsigned long)inum); | 2086 | err, (unsigned long)inum); |
2173 | goto out_dump; | 2087 | goto out_dump; |
2174 | } | 2088 | } |
@@ -2258,61 +2172,52 @@ static int check_inodes(struct ubifs_info *c, struct fsck_data *fsckd) | |||
2258 | */ | 2172 | */ |
2259 | if (fscki->inum != UBIFS_ROOT_INO && | 2173 | if (fscki->inum != UBIFS_ROOT_INO && |
2260 | fscki->references != 1) { | 2174 | fscki->references != 1) { |
2261 | ubifs_err("directory inode %lu has %d " | 2175 | ubifs_err("directory inode %lu has %d direntries which refer it, but should be 1", |
2262 | "direntries which refer it, but " | ||
2263 | "should be 1", | ||
2264 | (unsigned long)fscki->inum, | 2176 | (unsigned long)fscki->inum, |
2265 | fscki->references); | 2177 | fscki->references); |
2266 | goto out_dump; | 2178 | goto out_dump; |
2267 | } | 2179 | } |
2268 | if (fscki->inum == UBIFS_ROOT_INO && | 2180 | if (fscki->inum == UBIFS_ROOT_INO && |
2269 | fscki->references != 0) { | 2181 | fscki->references != 0) { |
2270 | ubifs_err("root inode %lu has non-zero (%d) " | 2182 | ubifs_err("root inode %lu has non-zero (%d) direntries which refer it", |
2271 | "direntries which refer it", | ||
2272 | (unsigned long)fscki->inum, | 2183 | (unsigned long)fscki->inum, |
2273 | fscki->references); | 2184 | fscki->references); |
2274 | goto out_dump; | 2185 | goto out_dump; |
2275 | } | 2186 | } |
2276 | if (fscki->calc_sz != fscki->size) { | 2187 | if (fscki->calc_sz != fscki->size) { |
2277 | ubifs_err("directory inode %lu size is %lld, " | 2188 | ubifs_err("directory inode %lu size is %lld, but calculated size is %lld", |
2278 | "but calculated size is %lld", | ||
2279 | (unsigned long)fscki->inum, | 2189 | (unsigned long)fscki->inum, |
2280 | fscki->size, fscki->calc_sz); | 2190 | fscki->size, fscki->calc_sz); |
2281 | goto out_dump; | 2191 | goto out_dump; |
2282 | } | 2192 | } |
2283 | if (fscki->calc_cnt != fscki->nlink) { | 2193 | if (fscki->calc_cnt != fscki->nlink) { |
2284 | ubifs_err("directory inode %lu nlink is %d, " | 2194 | ubifs_err("directory inode %lu nlink is %d, but calculated nlink is %d", |
2285 | "but calculated nlink is %d", | ||
2286 | (unsigned long)fscki->inum, | 2195 | (unsigned long)fscki->inum, |
2287 | fscki->nlink, fscki->calc_cnt); | 2196 | fscki->nlink, fscki->calc_cnt); |
2288 | goto out_dump; | 2197 | goto out_dump; |
2289 | } | 2198 | } |
2290 | } else { | 2199 | } else { |
2291 | if (fscki->references != fscki->nlink) { | 2200 | if (fscki->references != fscki->nlink) { |
2292 | ubifs_err("inode %lu nlink is %d, but " | 2201 | ubifs_err("inode %lu nlink is %d, but calculated nlink is %d", |
2293 | "calculated nlink is %d", | ||
2294 | (unsigned long)fscki->inum, | 2202 | (unsigned long)fscki->inum, |
2295 | fscki->nlink, fscki->references); | 2203 | fscki->nlink, fscki->references); |
2296 | goto out_dump; | 2204 | goto out_dump; |
2297 | } | 2205 | } |
2298 | } | 2206 | } |
2299 | if (fscki->xattr_sz != fscki->calc_xsz) { | 2207 | if (fscki->xattr_sz != fscki->calc_xsz) { |
2300 | ubifs_err("inode %lu has xattr size %u, but " | 2208 | ubifs_err("inode %lu has xattr size %u, but calculated size is %lld", |
2301 | "calculated size is %lld", | ||
2302 | (unsigned long)fscki->inum, fscki->xattr_sz, | 2209 | (unsigned long)fscki->inum, fscki->xattr_sz, |
2303 | fscki->calc_xsz); | 2210 | fscki->calc_xsz); |
2304 | goto out_dump; | 2211 | goto out_dump; |
2305 | } | 2212 | } |
2306 | if (fscki->xattr_cnt != fscki->calc_xcnt) { | 2213 | if (fscki->xattr_cnt != fscki->calc_xcnt) { |
2307 | ubifs_err("inode %lu has %u xattrs, but " | 2214 | ubifs_err("inode %lu has %u xattrs, but calculated count is %lld", |
2308 | "calculated count is %lld", | ||
2309 | (unsigned long)fscki->inum, | 2215 | (unsigned long)fscki->inum, |
2310 | fscki->xattr_cnt, fscki->calc_xcnt); | 2216 | fscki->xattr_cnt, fscki->calc_xcnt); |
2311 | goto out_dump; | 2217 | goto out_dump; |
2312 | } | 2218 | } |
2313 | if (fscki->xattr_nms != fscki->calc_xnms) { | 2219 | if (fscki->xattr_nms != fscki->calc_xnms) { |
2314 | ubifs_err("inode %lu has xattr names' size %u, but " | 2220 | ubifs_err("inode %lu has xattr names' size %u, but calculated names' size is %lld", |
2315 | "calculated names' size is %lld", | ||
2316 | (unsigned long)fscki->inum, fscki->xattr_nms, | 2221 | (unsigned long)fscki->inum, fscki->xattr_nms, |
2317 | fscki->calc_xnms); | 2222 | fscki->calc_xnms); |
2318 | goto out_dump; | 2223 | goto out_dump; |
@@ -2652,20 +2557,18 @@ static int power_cut_emulated(struct ubifs_info *c, int lnum, int write) | |||
2652 | return 1; | 2557 | return 1; |
2653 | } | 2558 | } |
2654 | 2559 | ||
2655 | static void cut_data(const void *buf, unsigned int len) | 2560 | static int corrupt_data(const struct ubifs_info *c, const void *buf, |
2561 | unsigned int len) | ||
2656 | { | 2562 | { |
2657 | unsigned int from, to, i, ffs = chance(1, 2); | 2563 | unsigned int from, to, i, ffs = chance(1, 2); |
2658 | unsigned char *p = (void *)buf; | 2564 | unsigned char *p = (void *)buf; |
2659 | 2565 | ||
2660 | from = random32() % (len + 1); | 2566 | from = random32() % (len + 1); |
2661 | if (chance(1, 2)) | 2567 | /* Corruption may only span one max. write unit */ |
2662 | to = random32() % (len - from + 1); | 2568 | to = min(len, ALIGN(from, c->max_write_size)); |
2663 | else | ||
2664 | to = len; | ||
2665 | 2569 | ||
2666 | if (from < to) | 2570 | ubifs_warn("filled bytes %u-%u with %s", from, to - 1, |
2667 | ubifs_warn("filled bytes %u-%u with %s", from, to - 1, | 2571 | ffs ? "0xFFs" : "random data"); |
2668 | ffs ? "0xFFs" : "random data"); | ||
2669 | 2572 | ||
2670 | if (ffs) | 2573 | if (ffs) |
2671 | for (i = from; i < to; i++) | 2574 | for (i = from; i < to; i++) |
@@ -2673,6 +2576,8 @@ static void cut_data(const void *buf, unsigned int len) | |||
2673 | else | 2576 | else |
2674 | for (i = from; i < to; i++) | 2577 | for (i = from; i < to; i++) |
2675 | p[i] = random32() % 0x100; | 2578 | p[i] = random32() % 0x100; |
2579 | |||
2580 | return to; | ||
2676 | } | 2581 | } |
2677 | 2582 | ||
2678 | int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, | 2583 | 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 | 2590 | ||
2686 | failing = power_cut_emulated(c, lnum, 1); | 2591 | failing = power_cut_emulated(c, lnum, 1); |
2687 | if (failing) | 2592 | if (failing) |
2688 | cut_data(buf, len); | 2593 | len = corrupt_data(c, buf, len); |
2594 | ubifs_warn("actually write %d bytes to LEB %d:%d (the buffer was corrupted)", | ||
2595 | len, lnum, offs); | ||
2689 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len); | 2596 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len); |
2690 | if (err) | 2597 | if (err) |
2691 | return err; | 2598 | return err; |
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 760de723dadb..e03d5179769a 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h | |||
@@ -150,7 +150,7 @@ struct ubifs_global_debug_info { | |||
150 | 150 | ||
151 | #define ubifs_assert(expr) do { \ | 151 | #define ubifs_assert(expr) do { \ |
152 | if (unlikely(!(expr))) { \ | 152 | if (unlikely(!(expr))) { \ |
153 | printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ | 153 | pr_crit("UBIFS assert failed in %s at %u (pid %d)\n", \ |
154 | __func__, __LINE__, current->pid); \ | 154 | __func__, __LINE__, current->pid); \ |
155 | dump_stack(); \ | 155 | dump_stack(); \ |
156 | } \ | 156 | } \ |
@@ -159,26 +159,23 @@ struct ubifs_global_debug_info { | |||
159 | #define ubifs_assert_cmt_locked(c) do { \ | 159 | #define ubifs_assert_cmt_locked(c) do { \ |
160 | if (unlikely(down_write_trylock(&(c)->commit_sem))) { \ | 160 | if (unlikely(down_write_trylock(&(c)->commit_sem))) { \ |
161 | up_write(&(c)->commit_sem); \ | 161 | up_write(&(c)->commit_sem); \ |
162 | printk(KERN_CRIT "commit lock is not locked!\n"); \ | 162 | pr_crit("commit lock is not locked!\n"); \ |
163 | ubifs_assert(0); \ | 163 | ubifs_assert(0); \ |
164 | } \ | 164 | } \ |
165 | } while (0) | 165 | } while (0) |
166 | 166 | ||
167 | #define ubifs_dbg_msg(type, fmt, ...) \ | 167 | #define ubifs_dbg_msg(type, fmt, ...) \ |
168 | pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__) | 168 | pr_debug("UBIFS DBG " type " (pid %d): " fmt "\n", current->pid, \ |
169 | ##__VA_ARGS__) | ||
169 | 170 | ||
170 | #define DBG_KEY_BUF_LEN 48 | 171 | #define DBG_KEY_BUF_LEN 48 |
171 | #define ubifs_dbg_msg_key(type, key, fmt, ...) do { \ | 172 | #define ubifs_dbg_msg_key(type, key, fmt, ...) do { \ |
172 | char __tmp_key_buf[DBG_KEY_BUF_LEN]; \ | 173 | char __tmp_key_buf[DBG_KEY_BUF_LEN]; \ |
173 | pr_debug("UBIFS DBG " type ": " fmt "%s\n", ##__VA_ARGS__, \ | 174 | pr_debug("UBIFS DBG " type " (pid %d): " fmt "%s\n", current->pid, \ |
175 | ##__VA_ARGS__, \ | ||
174 | dbg_snprintf_key(c, key, __tmp_key_buf, DBG_KEY_BUF_LEN)); \ | 176 | dbg_snprintf_key(c, key, __tmp_key_buf, DBG_KEY_BUF_LEN)); \ |
175 | } while (0) | 177 | } while (0) |
176 | 178 | ||
177 | /* Just a debugging messages not related to any specific UBIFS subsystem */ | ||
178 | #define dbg_msg(fmt, ...) \ | ||
179 | printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n", current->pid, \ | ||
180 | __func__, ##__VA_ARGS__) | ||
181 | |||
182 | /* General messages */ | 179 | /* General messages */ |
183 | #define dbg_gen(fmt, ...) ubifs_dbg_msg("gen", fmt, ##__VA_ARGS__) | 180 | #define dbg_gen(fmt, ...) ubifs_dbg_msg("gen", fmt, ##__VA_ARGS__) |
184 | /* Additional journal messages */ | 181 | /* Additional journal messages */ |
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index c95681cf1b71..e271fba1651b 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
@@ -980,8 +980,8 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
980 | * separately. | 980 | * separately. |
981 | */ | 981 | */ |
982 | 982 | ||
983 | dbg_gen("dent '%.*s' ino %lu in dir ino %lu to dent '%.*s' in " | 983 | dbg_gen("dent '%.*s' ino %lu in dir ino %lu to dent '%.*s' in dir ino %lu", |
984 | "dir ino %lu", old_dentry->d_name.len, old_dentry->d_name.name, | 984 | old_dentry->d_name.len, old_dentry->d_name.name, |
985 | old_inode->i_ino, old_dir->i_ino, new_dentry->d_name.len, | 985 | old_inode->i_ino, old_dir->i_ino, new_dentry->d_name.len, |
986 | new_dentry->d_name.name, new_dir->i_ino); | 986 | new_dentry->d_name.name, new_dir->i_ino); |
987 | ubifs_assert(mutex_is_locked(&old_dir->i_mutex)); | 987 | ubifs_assert(mutex_is_locked(&old_dir->i_mutex)); |
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 7bd6e72afd11..ff48c5a85309 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
@@ -1486,8 +1486,8 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, | |||
1486 | err = ubifs_budget_space(c, &req); | 1486 | err = ubifs_budget_space(c, &req); |
1487 | if (unlikely(err)) { | 1487 | if (unlikely(err)) { |
1488 | if (err == -ENOSPC) | 1488 | if (err == -ENOSPC) |
1489 | ubifs_warn("out of space for mmapped file " | 1489 | ubifs_warn("out of space for mmapped file (inode number %lu)", |
1490 | "(inode number %lu)", inode->i_ino); | 1490 | inode->i_ino); |
1491 | return VM_FAULT_SIGBUS; | 1491 | return VM_FAULT_SIGBUS; |
1492 | } | 1492 | } |
1493 | 1493 | ||
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 04dd6f47635e..76ca53cd3eee 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c | |||
@@ -714,9 +714,9 @@ int ubifs_garbage_collect(struct ubifs_info *c, int anyway) | |||
714 | break; | 714 | break; |
715 | } | 715 | } |
716 | 716 | ||
717 | dbg_gc("found LEB %d: free %d, dirty %d, sum %d " | 717 | dbg_gc("found LEB %d: free %d, dirty %d, sum %d (min. space %d)", |
718 | "(min. space %d)", lp.lnum, lp.free, lp.dirty, | 718 | lp.lnum, lp.free, lp.dirty, lp.free + lp.dirty, |
719 | lp.free + lp.dirty, min_space); | 719 | min_space); |
720 | 720 | ||
721 | space_before = c->leb_size - wbuf->offs - wbuf->used; | 721 | space_before = c->leb_size - wbuf->offs - wbuf->used; |
722 | if (wbuf->lnum == -1) | 722 | if (wbuf->lnum == -1) |
diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index c80b15d6c8de..36bd4efd0819 100644 --- a/fs/ubifs/log.c +++ b/fs/ubifs/log.c | |||
@@ -315,17 +315,15 @@ static void remove_buds(struct ubifs_info *c) | |||
315 | * heads (non-closed buds). | 315 | * heads (non-closed buds). |
316 | */ | 316 | */ |
317 | c->cmt_bud_bytes += wbuf->offs - bud->start; | 317 | c->cmt_bud_bytes += wbuf->offs - bud->start; |
318 | dbg_log("preserve %d:%d, jhead %s, bud bytes %d, " | 318 | dbg_log("preserve %d:%d, jhead %s, bud bytes %d, cmt_bud_bytes %lld", |
319 | "cmt_bud_bytes %lld", bud->lnum, bud->start, | 319 | bud->lnum, bud->start, dbg_jhead(bud->jhead), |
320 | dbg_jhead(bud->jhead), wbuf->offs - bud->start, | 320 | wbuf->offs - bud->start, c->cmt_bud_bytes); |
321 | c->cmt_bud_bytes); | ||
322 | bud->start = wbuf->offs; | 321 | bud->start = wbuf->offs; |
323 | } else { | 322 | } else { |
324 | c->cmt_bud_bytes += c->leb_size - bud->start; | 323 | c->cmt_bud_bytes += c->leb_size - bud->start; |
325 | dbg_log("remove %d:%d, jhead %s, bud bytes %d, " | 324 | dbg_log("remove %d:%d, jhead %s, bud bytes %d, cmt_bud_bytes %lld", |
326 | "cmt_bud_bytes %lld", bud->lnum, bud->start, | 325 | bud->lnum, bud->start, dbg_jhead(bud->jhead), |
327 | dbg_jhead(bud->jhead), c->leb_size - bud->start, | 326 | c->leb_size - bud->start, c->cmt_bud_bytes); |
328 | c->cmt_bud_bytes); | ||
329 | rb_erase(p1, &c->buds); | 327 | rb_erase(p1, &c->buds); |
330 | /* | 328 | /* |
331 | * If the commit does not finish, the recovery will need | 329 | * If the commit does not finish, the recovery will need |
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c index 86eb8e533249..e5a2a35a46dc 100644 --- a/fs/ubifs/lprops.c +++ b/fs/ubifs/lprops.c | |||
@@ -867,15 +867,15 @@ int dbg_check_cats(struct ubifs_info *c) | |||
867 | 867 | ||
868 | list_for_each_entry(lprops, &c->empty_list, list) { | 868 | list_for_each_entry(lprops, &c->empty_list, list) { |
869 | if (lprops->free != c->leb_size) { | 869 | if (lprops->free != c->leb_size) { |
870 | ubifs_err("non-empty LEB %d on empty list " | 870 | ubifs_err("non-empty LEB %d on empty list (free %d dirty %d flags %d)", |
871 | "(free %d dirty %d flags %d)", lprops->lnum, | 871 | lprops->lnum, lprops->free, lprops->dirty, |
872 | lprops->free, lprops->dirty, lprops->flags); | 872 | lprops->flags); |
873 | return -EINVAL; | 873 | return -EINVAL; |
874 | } | 874 | } |
875 | if (lprops->flags & LPROPS_TAKEN) { | 875 | if (lprops->flags & LPROPS_TAKEN) { |
876 | ubifs_err("taken LEB %d on empty list " | 876 | ubifs_err("taken LEB %d on empty list (free %d dirty %d flags %d)", |
877 | "(free %d dirty %d flags %d)", lprops->lnum, | 877 | lprops->lnum, lprops->free, lprops->dirty, |
878 | lprops->free, lprops->dirty, lprops->flags); | 878 | lprops->flags); |
879 | return -EINVAL; | 879 | return -EINVAL; |
880 | } | 880 | } |
881 | } | 881 | } |
@@ -883,15 +883,15 @@ int dbg_check_cats(struct ubifs_info *c) | |||
883 | i = 0; | 883 | i = 0; |
884 | list_for_each_entry(lprops, &c->freeable_list, list) { | 884 | list_for_each_entry(lprops, &c->freeable_list, list) { |
885 | if (lprops->free + lprops->dirty != c->leb_size) { | 885 | if (lprops->free + lprops->dirty != c->leb_size) { |
886 | ubifs_err("non-freeable LEB %d on freeable list " | 886 | ubifs_err("non-freeable LEB %d on freeable list (free %d dirty %d flags %d)", |
887 | "(free %d dirty %d flags %d)", lprops->lnum, | 887 | lprops->lnum, lprops->free, lprops->dirty, |
888 | lprops->free, lprops->dirty, lprops->flags); | 888 | lprops->flags); |
889 | return -EINVAL; | 889 | return -EINVAL; |
890 | } | 890 | } |
891 | if (lprops->flags & LPROPS_TAKEN) { | 891 | if (lprops->flags & LPROPS_TAKEN) { |
892 | ubifs_err("taken LEB %d on freeable list " | 892 | ubifs_err("taken LEB %d on freeable list (free %d dirty %d flags %d)", |
893 | "(free %d dirty %d flags %d)", lprops->lnum, | 893 | lprops->lnum, lprops->free, lprops->dirty, |
894 | lprops->free, lprops->dirty, lprops->flags); | 894 | lprops->flags); |
895 | return -EINVAL; | 895 | return -EINVAL; |
896 | } | 896 | } |
897 | i += 1; | 897 | i += 1; |
@@ -913,21 +913,21 @@ int dbg_check_cats(struct ubifs_info *c) | |||
913 | 913 | ||
914 | list_for_each_entry(lprops, &c->frdi_idx_list, list) { | 914 | list_for_each_entry(lprops, &c->frdi_idx_list, list) { |
915 | if (lprops->free + lprops->dirty != c->leb_size) { | 915 | if (lprops->free + lprops->dirty != c->leb_size) { |
916 | ubifs_err("non-freeable LEB %d on frdi_idx list " | 916 | ubifs_err("non-freeable LEB %d on frdi_idx list (free %d dirty %d flags %d)", |
917 | "(free %d dirty %d flags %d)", lprops->lnum, | 917 | lprops->lnum, lprops->free, lprops->dirty, |
918 | lprops->free, lprops->dirty, lprops->flags); | 918 | lprops->flags); |
919 | return -EINVAL; | 919 | return -EINVAL; |
920 | } | 920 | } |
921 | if (lprops->flags & LPROPS_TAKEN) { | 921 | if (lprops->flags & LPROPS_TAKEN) { |
922 | ubifs_err("taken LEB %d on frdi_idx list " | 922 | ubifs_err("taken LEB %d on frdi_idx list (free %d dirty %d flags %d)", |
923 | "(free %d dirty %d flags %d)", lprops->lnum, | 923 | lprops->lnum, lprops->free, lprops->dirty, |
924 | lprops->free, lprops->dirty, lprops->flags); | 924 | lprops->flags); |
925 | return -EINVAL; | 925 | return -EINVAL; |
926 | } | 926 | } |
927 | if (!(lprops->flags & LPROPS_INDEX)) { | 927 | if (!(lprops->flags & LPROPS_INDEX)) { |
928 | ubifs_err("non-index LEB %d on frdi_idx list " | 928 | ubifs_err("non-index LEB %d on frdi_idx list (free %d dirty %d flags %d)", |
929 | "(free %d dirty %d flags %d)", lprops->lnum, | 929 | lprops->lnum, lprops->free, lprops->dirty, |
930 | lprops->free, lprops->dirty, lprops->flags); | 930 | lprops->flags); |
931 | return -EINVAL; | 931 | return -EINVAL; |
932 | } | 932 | } |
933 | } | 933 | } |
@@ -982,9 +982,9 @@ void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, | |||
982 | goto out; | 982 | goto out; |
983 | } | 983 | } |
984 | if (lprops != lp) { | 984 | if (lprops != lp) { |
985 | dbg_msg("lprops %zx lp %zx lprops->lnum %d lp->lnum %d", | 985 | ubifs_err("lprops %zx lp %zx lprops->lnum %d lp->lnum %d", |
986 | (size_t)lprops, (size_t)lp, lprops->lnum, | 986 | (size_t)lprops, (size_t)lp, lprops->lnum, |
987 | lp->lnum); | 987 | lp->lnum); |
988 | err = 4; | 988 | err = 4; |
989 | goto out; | 989 | goto out; |
990 | } | 990 | } |
@@ -1002,7 +1002,7 @@ void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, | |||
1002 | } | 1002 | } |
1003 | out: | 1003 | out: |
1004 | if (err) { | 1004 | if (err) { |
1005 | dbg_msg("failed cat %d hpos %d err %d", cat, i, err); | 1005 | ubifs_err("failed cat %d hpos %d err %d", cat, i, err); |
1006 | dump_stack(); | 1006 | dump_stack(); |
1007 | ubifs_dump_heap(c, heap, cat); | 1007 | ubifs_dump_heap(c, heap, cat); |
1008 | } | 1008 | } |
@@ -1153,8 +1153,8 @@ static int scan_check_cb(struct ubifs_info *c, | |||
1153 | 1153 | ||
1154 | if (free > c->leb_size || free < 0 || dirty > c->leb_size || | 1154 | if (free > c->leb_size || free < 0 || dirty > c->leb_size || |
1155 | dirty < 0) { | 1155 | dirty < 0) { |
1156 | ubifs_err("bad calculated accounting for LEB %d: " | 1156 | ubifs_err("bad calculated accounting for LEB %d: free %d, dirty %d", |
1157 | "free %d, dirty %d", lnum, free, dirty); | 1157 | lnum, free, dirty); |
1158 | goto out_destroy; | 1158 | goto out_destroy; |
1159 | } | 1159 | } |
1160 | 1160 | ||
@@ -1200,8 +1200,7 @@ static int scan_check_cb(struct ubifs_info *c, | |||
1200 | /* Free but not unmapped LEB, it's fine */ | 1200 | /* Free but not unmapped LEB, it's fine */ |
1201 | is_idx = 0; | 1201 | is_idx = 0; |
1202 | else { | 1202 | else { |
1203 | ubifs_err("indexing node without indexing " | 1203 | ubifs_err("indexing node without indexing flag"); |
1204 | "flag"); | ||
1205 | goto out_print; | 1204 | goto out_print; |
1206 | } | 1205 | } |
1207 | } | 1206 | } |
@@ -1236,8 +1235,7 @@ static int scan_check_cb(struct ubifs_info *c, | |||
1236 | return LPT_SCAN_CONTINUE; | 1235 | return LPT_SCAN_CONTINUE; |
1237 | 1236 | ||
1238 | out_print: | 1237 | out_print: |
1239 | ubifs_err("bad accounting of LEB %d: free %d, dirty %d flags %#x, " | 1238 | ubifs_err("bad accounting of LEB %d: free %d, dirty %d flags %#x, should be free %d, dirty %d", |
1240 | "should be free %d, dirty %d", | ||
1241 | lnum, lp->free, lp->dirty, lp->flags, free, dirty); | 1239 | lnum, lp->free, lp->dirty, lp->flags, free, dirty); |
1242 | ubifs_dump_leb(c, lnum); | 1240 | ubifs_dump_leb(c, lnum); |
1243 | out_destroy: | 1241 | out_destroy: |
@@ -1290,12 +1288,10 @@ int dbg_check_lprops(struct ubifs_info *c) | |||
1290 | lst.total_dirty != c->lst.total_dirty || | 1288 | lst.total_dirty != c->lst.total_dirty || |
1291 | lst.total_used != c->lst.total_used) { | 1289 | lst.total_used != c->lst.total_used) { |
1292 | ubifs_err("bad overall accounting"); | 1290 | ubifs_err("bad overall accounting"); |
1293 | ubifs_err("calculated: empty_lebs %d, idx_lebs %d, " | 1291 | ubifs_err("calculated: empty_lebs %d, idx_lebs %d, total_free %lld, total_dirty %lld, total_used %lld", |
1294 | "total_free %lld, total_dirty %lld, total_used %lld", | ||
1295 | lst.empty_lebs, lst.idx_lebs, lst.total_free, | 1292 | lst.empty_lebs, lst.idx_lebs, lst.total_free, |
1296 | lst.total_dirty, lst.total_used); | 1293 | lst.total_dirty, lst.total_used); |
1297 | ubifs_err("read from lprops: empty_lebs %d, idx_lebs %d, " | 1294 | ubifs_err("read from lprops: empty_lebs %d, idx_lebs %d, total_free %lld, total_dirty %lld, total_used %lld", |
1298 | "total_free %lld, total_dirty %lld, total_used %lld", | ||
1299 | c->lst.empty_lebs, c->lst.idx_lebs, c->lst.total_free, | 1295 | c->lst.empty_lebs, c->lst.idx_lebs, c->lst.total_free, |
1300 | c->lst.total_dirty, c->lst.total_used); | 1296 | c->lst.total_dirty, c->lst.total_used); |
1301 | err = -EINVAL; | 1297 | err = -EINVAL; |
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index 8640920766ed..d46b19ec1815 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c | |||
@@ -1311,7 +1311,7 @@ out: | |||
1311 | ubifs_err("error %d reading pnode at %d:%d", err, lnum, offs); | 1311 | ubifs_err("error %d reading pnode at %d:%d", err, lnum, offs); |
1312 | ubifs_dump_pnode(c, pnode, parent, iip); | 1312 | ubifs_dump_pnode(c, pnode, parent, iip); |
1313 | dump_stack(); | 1313 | dump_stack(); |
1314 | dbg_msg("calc num: %d", calc_pnode_num_from_parent(c, parent, iip)); | 1314 | ubifs_err("calc num: %d", calc_pnode_num_from_parent(c, parent, iip)); |
1315 | kfree(pnode); | 1315 | kfree(pnode); |
1316 | return err; | 1316 | return err; |
1317 | } | 1317 | } |
@@ -2237,8 +2237,7 @@ int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode, | |||
2237 | /* cnode is a nnode */ | 2237 | /* cnode is a nnode */ |
2238 | num = calc_nnode_num(row, col); | 2238 | num = calc_nnode_num(row, col); |
2239 | if (cnode->num != num) { | 2239 | if (cnode->num != num) { |
2240 | ubifs_err("nnode num %d expected %d " | 2240 | ubifs_err("nnode num %d expected %d parent num %d iip %d", |
2241 | "parent num %d iip %d", | ||
2242 | cnode->num, num, | 2241 | cnode->num, num, |
2243 | (nnode ? nnode->num : 0), cnode->iip); | 2242 | (nnode ? nnode->num : 0), cnode->iip); |
2244 | return -EINVAL; | 2243 | return -EINVAL; |
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index 4fa70734e6e7..9daaeef675dd 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c | |||
@@ -320,8 +320,8 @@ static int layout_cnodes(struct ubifs_info *c) | |||
320 | return 0; | 320 | return 0; |
321 | 321 | ||
322 | no_space: | 322 | no_space: |
323 | ubifs_err("LPT out of space at LEB %d:%d needing %d, done_ltab %d, " | 323 | ubifs_err("LPT out of space at LEB %d:%d needing %d, done_ltab %d, done_lsave %d", |
324 | "done_lsave %d", lnum, offs, len, done_ltab, done_lsave); | 324 | lnum, offs, len, done_ltab, done_lsave); |
325 | ubifs_dump_lpt_info(c); | 325 | ubifs_dump_lpt_info(c); |
326 | ubifs_dump_lpt_lebs(c); | 326 | ubifs_dump_lpt_lebs(c); |
327 | dump_stack(); | 327 | dump_stack(); |
@@ -545,8 +545,8 @@ static int write_cnodes(struct ubifs_info *c) | |||
545 | return 0; | 545 | return 0; |
546 | 546 | ||
547 | no_space: | 547 | no_space: |
548 | ubifs_err("LPT out of space mismatch at LEB %d:%d needing %d, done_ltab " | 548 | ubifs_err("LPT out of space mismatch at LEB %d:%d needing %d, done_ltab %d, done_lsave %d", |
549 | "%d, done_lsave %d", lnum, offs, len, done_ltab, done_lsave); | 549 | lnum, offs, len, done_ltab, done_lsave); |
550 | ubifs_dump_lpt_info(c); | 550 | ubifs_dump_lpt_info(c); |
551 | ubifs_dump_lpt_lebs(c); | 551 | ubifs_dump_lpt_lebs(c); |
552 | dump_stack(); | 552 | dump_stack(); |
@@ -1662,21 +1662,19 @@ static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum) | |||
1662 | continue; | 1662 | continue; |
1663 | } | 1663 | } |
1664 | if (!dbg_is_all_ff(p, len)) { | 1664 | if (!dbg_is_all_ff(p, len)) { |
1665 | dbg_msg("invalid empty space in LEB %d at %d", | 1665 | ubifs_err("invalid empty space in LEB %d at %d", |
1666 | lnum, c->leb_size - len); | 1666 | lnum, c->leb_size - len); |
1667 | err = -EINVAL; | 1667 | err = -EINVAL; |
1668 | } | 1668 | } |
1669 | i = lnum - c->lpt_first; | 1669 | i = lnum - c->lpt_first; |
1670 | if (len != c->ltab[i].free) { | 1670 | if (len != c->ltab[i].free) { |
1671 | dbg_msg("invalid free space in LEB %d " | 1671 | ubifs_err("invalid free space in LEB %d (free %d, expected %d)", |
1672 | "(free %d, expected %d)", | 1672 | lnum, len, c->ltab[i].free); |
1673 | lnum, len, c->ltab[i].free); | ||
1674 | err = -EINVAL; | 1673 | err = -EINVAL; |
1675 | } | 1674 | } |
1676 | if (dirty != c->ltab[i].dirty) { | 1675 | if (dirty != c->ltab[i].dirty) { |
1677 | dbg_msg("invalid dirty space in LEB %d " | 1676 | ubifs_err("invalid dirty space in LEB %d (dirty %d, expected %d)", |
1678 | "(dirty %d, expected %d)", | 1677 | lnum, dirty, c->ltab[i].dirty); |
1679 | lnum, dirty, c->ltab[i].dirty); | ||
1680 | err = -EINVAL; | 1678 | err = -EINVAL; |
1681 | } | 1679 | } |
1682 | goto out; | 1680 | goto out; |
@@ -1888,8 +1886,7 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) | |||
1888 | int err, len = c->leb_size, node_type, node_num, node_len, offs; | 1886 | int err, len = c->leb_size, node_type, node_num, node_len, offs; |
1889 | void *buf, *p; | 1887 | void *buf, *p; |
1890 | 1888 | ||
1891 | printk(KERN_DEBUG "(pid %d) start dumping LEB %d\n", | 1889 | pr_err("(pid %d) start dumping LEB %d\n", current->pid, lnum); |
1892 | current->pid, lnum); | ||
1893 | buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); | 1890 | buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); |
1894 | if (!buf) { | 1891 | if (!buf) { |
1895 | ubifs_err("cannot allocate memory to dump LPT"); | 1892 | 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 | 1904 | ||
1908 | pad_len = get_pad_len(c, p, len); | 1905 | pad_len = get_pad_len(c, p, len); |
1909 | if (pad_len) { | 1906 | if (pad_len) { |
1910 | printk(KERN_DEBUG "LEB %d:%d, pad %d bytes\n", | 1907 | pr_err("LEB %d:%d, pad %d bytes\n", |
1911 | lnum, offs, pad_len); | 1908 | lnum, offs, pad_len); |
1912 | p += pad_len; | 1909 | p += pad_len; |
1913 | len -= pad_len; | 1910 | len -= pad_len; |
1914 | continue; | 1911 | continue; |
1915 | } | 1912 | } |
1916 | if (len) | 1913 | if (len) |
1917 | printk(KERN_DEBUG "LEB %d:%d, free %d bytes\n", | 1914 | pr_err("LEB %d:%d, free %d bytes\n", |
1918 | lnum, offs, len); | 1915 | lnum, offs, len); |
1919 | break; | 1916 | break; |
1920 | } | 1917 | } |
@@ -1925,11 +1922,10 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) | |||
1925 | { | 1922 | { |
1926 | node_len = c->pnode_sz; | 1923 | node_len = c->pnode_sz; |
1927 | if (c->big_lpt) | 1924 | if (c->big_lpt) |
1928 | printk(KERN_DEBUG "LEB %d:%d, pnode num %d\n", | 1925 | pr_err("LEB %d:%d, pnode num %d\n", |
1929 | lnum, offs, node_num); | 1926 | lnum, offs, node_num); |
1930 | else | 1927 | else |
1931 | printk(KERN_DEBUG "LEB %d:%d, pnode\n", | 1928 | pr_err("LEB %d:%d, pnode\n", lnum, offs); |
1932 | lnum, offs); | ||
1933 | break; | 1929 | break; |
1934 | } | 1930 | } |
1935 | case UBIFS_LPT_NNODE: | 1931 | case UBIFS_LPT_NNODE: |
@@ -1939,29 +1935,28 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) | |||
1939 | 1935 | ||
1940 | node_len = c->nnode_sz; | 1936 | node_len = c->nnode_sz; |
1941 | if (c->big_lpt) | 1937 | if (c->big_lpt) |
1942 | printk(KERN_DEBUG "LEB %d:%d, nnode num %d, ", | 1938 | pr_err("LEB %d:%d, nnode num %d, ", |
1943 | lnum, offs, node_num); | 1939 | lnum, offs, node_num); |
1944 | else | 1940 | else |
1945 | printk(KERN_DEBUG "LEB %d:%d, nnode, ", | 1941 | pr_err("LEB %d:%d, nnode, ", |
1946 | lnum, offs); | 1942 | lnum, offs); |
1947 | err = ubifs_unpack_nnode(c, p, &nnode); | 1943 | err = ubifs_unpack_nnode(c, p, &nnode); |
1948 | for (i = 0; i < UBIFS_LPT_FANOUT; i++) { | 1944 | for (i = 0; i < UBIFS_LPT_FANOUT; i++) { |
1949 | printk(KERN_CONT "%d:%d", nnode.nbranch[i].lnum, | 1945 | pr_cont("%d:%d", nnode.nbranch[i].lnum, |
1950 | nnode.nbranch[i].offs); | 1946 | nnode.nbranch[i].offs); |
1951 | if (i != UBIFS_LPT_FANOUT - 1) | 1947 | if (i != UBIFS_LPT_FANOUT - 1) |
1952 | printk(KERN_CONT ", "); | 1948 | pr_cont(", "); |
1953 | } | 1949 | } |
1954 | printk(KERN_CONT "\n"); | 1950 | pr_cont("\n"); |
1955 | break; | 1951 | break; |
1956 | } | 1952 | } |
1957 | case UBIFS_LPT_LTAB: | 1953 | case UBIFS_LPT_LTAB: |
1958 | node_len = c->ltab_sz; | 1954 | node_len = c->ltab_sz; |
1959 | printk(KERN_DEBUG "LEB %d:%d, ltab\n", | 1955 | pr_err("LEB %d:%d, ltab\n", lnum, offs); |
1960 | lnum, offs); | ||
1961 | break; | 1956 | break; |
1962 | case UBIFS_LPT_LSAVE: | 1957 | case UBIFS_LPT_LSAVE: |
1963 | node_len = c->lsave_sz; | 1958 | node_len = c->lsave_sz; |
1964 | printk(KERN_DEBUG "LEB %d:%d, lsave len\n", lnum, offs); | 1959 | pr_err("LEB %d:%d, lsave len\n", lnum, offs); |
1965 | break; | 1960 | break; |
1966 | default: | 1961 | default: |
1967 | ubifs_err("LPT node type %d not recognized", node_type); | 1962 | 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 | len -= node_len; | 1967 | len -= node_len; |
1973 | } | 1968 | } |
1974 | 1969 | ||
1975 | printk(KERN_DEBUG "(pid %d) finish dumping LEB %d\n", | 1970 | pr_err("(pid %d) finish dumping LEB %d\n", current->pid, lnum); |
1976 | current->pid, lnum); | ||
1977 | out: | 1971 | out: |
1978 | vfree(buf); | 1972 | vfree(buf); |
1979 | return; | 1973 | return; |
@@ -1990,12 +1984,10 @@ void ubifs_dump_lpt_lebs(const struct ubifs_info *c) | |||
1990 | { | 1984 | { |
1991 | int i; | 1985 | int i; |
1992 | 1986 | ||
1993 | printk(KERN_DEBUG "(pid %d) start dumping all LPT LEBs\n", | 1987 | pr_err("(pid %d) start dumping all LPT LEBs\n", current->pid); |
1994 | current->pid); | ||
1995 | for (i = 0; i < c->lpt_lebs; i++) | 1988 | for (i = 0; i < c->lpt_lebs; i++) |
1996 | dump_lpt_leb(c, i + c->lpt_first); | 1989 | dump_lpt_leb(c, i + c->lpt_first); |
1997 | printk(KERN_DEBUG "(pid %d) finish dumping all LPT LEBs\n", | 1990 | pr_err("(pid %d) finish dumping all LPT LEBs\n", current->pid); |
1998 | current->pid); | ||
1999 | } | 1991 | } |
2000 | 1992 | ||
2001 | /** | 1993 | /** |
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c index cebf17ea0458..769701ccb5c9 100644 --- a/fs/ubifs/orphan.c +++ b/fs/ubifs/orphan.c | |||
@@ -562,8 +562,8 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
562 | 562 | ||
563 | list_for_each_entry(snod, &sleb->nodes, list) { | 563 | list_for_each_entry(snod, &sleb->nodes, list) { |
564 | if (snod->type != UBIFS_ORPH_NODE) { | 564 | if (snod->type != UBIFS_ORPH_NODE) { |
565 | ubifs_err("invalid node type %d in orphan area at " | 565 | ubifs_err("invalid node type %d in orphan area at %d:%d", |
566 | "%d:%d", snod->type, sleb->lnum, snod->offs); | 566 | snod->type, sleb->lnum, snod->offs); |
567 | ubifs_dump_node(c, snod->node); | 567 | ubifs_dump_node(c, snod->node); |
568 | return -EINVAL; | 568 | return -EINVAL; |
569 | } | 569 | } |
@@ -589,8 +589,7 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
589 | * number. That makes this orphan node, out of date. | 589 | * number. That makes this orphan node, out of date. |
590 | */ | 590 | */ |
591 | if (!first) { | 591 | if (!first) { |
592 | ubifs_err("out of order commit number %llu in " | 592 | ubifs_err("out of order commit number %llu in orphan node at %d:%d", |
593 | "orphan node at %d:%d", | ||
594 | cmt_no, sleb->lnum, snod->offs); | 593 | cmt_no, sleb->lnum, snod->offs); |
595 | ubifs_dump_node(c, snod->node); | 594 | ubifs_dump_node(c, snod->node); |
596 | return -EINVAL; | 595 | return -EINVAL; |
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index edeec499c048..065096e36ed9 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c | |||
@@ -609,7 +609,8 @@ static void drop_last_node(struct ubifs_scan_leb *sleb, int *offs) | |||
609 | snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node, | 609 | snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node, |
610 | list); | 610 | list); |
611 | 611 | ||
612 | dbg_rcvry("dropping last node at %d:%d", sleb->lnum, snod->offs); | 612 | dbg_rcvry("dropping last node at %d:%d", |
613 | sleb->lnum, snod->offs); | ||
613 | *offs = snod->offs; | 614 | *offs = snod->offs; |
614 | list_del(&snod->list); | 615 | list_del(&snod->list); |
615 | kfree(snod); | 616 | kfree(snod); |
@@ -702,8 +703,8 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | |||
702 | * See header comment for this file for more | 703 | * See header comment for this file for more |
703 | * explanations about the reasons we have this check. | 704 | * explanations about the reasons we have this check. |
704 | */ | 705 | */ |
705 | ubifs_err("corrupt empty space LEB %d:%d, corruption " | 706 | ubifs_err("corrupt empty space LEB %d:%d, corruption starts at %d", |
706 | "starts at %d", lnum, offs, corruption); | 707 | lnum, offs, corruption); |
707 | /* Make sure we dump interesting non-0xFF data */ | 708 | /* Make sure we dump interesting non-0xFF data */ |
708 | offs += corruption; | 709 | offs += corruption; |
709 | buf += corruption; | 710 | buf += corruption; |
@@ -899,8 +900,8 @@ struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum, | |||
899 | } | 900 | } |
900 | } | 901 | } |
901 | if (snod->sqnum > cs_sqnum) { | 902 | if (snod->sqnum > cs_sqnum) { |
902 | ubifs_err("unrecoverable log corruption " | 903 | ubifs_err("unrecoverable log corruption in LEB %d", |
903 | "in LEB %d", lnum); | 904 | lnum); |
904 | ubifs_scan_destroy(sleb); | 905 | ubifs_scan_destroy(sleb); |
905 | return ERR_PTR(-EUCLEAN); | 906 | return ERR_PTR(-EUCLEAN); |
906 | } | 907 | } |
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index 94d78fc5d4e0..3187925e9879 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c | |||
@@ -141,9 +141,9 @@ static int set_bud_lprops(struct ubifs_info *c, struct bud_entry *b) | |||
141 | * during the replay. | 141 | * during the replay. |
142 | */ | 142 | */ |
143 | if (dirty != 0) | 143 | if (dirty != 0) |
144 | dbg_msg("LEB %d lp: %d free %d dirty " | 144 | dbg_mnt("LEB %d lp: %d free %d dirty replay: %d free %d dirty", |
145 | "replay: %d free %d dirty", b->bud->lnum, | 145 | b->bud->lnum, lp->free, lp->dirty, b->free, |
146 | lp->free, lp->dirty, b->free, b->dirty); | 146 | b->dirty); |
147 | } | 147 | } |
148 | lp = ubifs_change_lp(c, lp, b->free, dirty + b->dirty, | 148 | lp = ubifs_change_lp(c, lp, b->free, dirty + b->dirty, |
149 | lp->flags | LPROPS_TAKEN, 0); | 149 | lp->flags | LPROPS_TAKEN, 0); |
@@ -677,7 +677,8 @@ static int replay_bud(struct ubifs_info *c, struct bud_entry *b) | |||
677 | 677 | ||
678 | b->dirty = sleb->endpt - offs - used; | 678 | b->dirty = sleb->endpt - offs - used; |
679 | b->free = c->leb_size - sleb->endpt; | 679 | b->free = c->leb_size - sleb->endpt; |
680 | dbg_mnt("bud LEB %d replied: dirty %d, free %d", lnum, b->dirty, b->free); | 680 | dbg_mnt("bud LEB %d replied: dirty %d, free %d", |
681 | lnum, b->dirty, b->free); | ||
681 | 682 | ||
682 | out: | 683 | out: |
683 | ubifs_scan_destroy(sleb); | 684 | ubifs_scan_destroy(sleb); |
@@ -865,8 +866,7 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
865 | goto out_dump; | 866 | goto out_dump; |
866 | } | 867 | } |
867 | if (le64_to_cpu(node->cmt_no) != c->cmt_no) { | 868 | if (le64_to_cpu(node->cmt_no) != c->cmt_no) { |
868 | ubifs_err("first CS node at LEB %d:%d has wrong " | 869 | ubifs_err("first CS node at LEB %d:%d has wrong commit number %llu expected %llu", |
869 | "commit number %llu expected %llu", | ||
870 | lnum, offs, | 870 | lnum, offs, |
871 | (unsigned long long)le64_to_cpu(node->cmt_no), | 871 | (unsigned long long)le64_to_cpu(node->cmt_no), |
872 | c->cmt_no); | 872 | c->cmt_no); |
@@ -1058,8 +1058,8 @@ int ubifs_replay_journal(struct ubifs_info *c) | |||
1058 | c->bi.uncommitted_idx *= c->max_idx_node_sz; | 1058 | c->bi.uncommitted_idx *= c->max_idx_node_sz; |
1059 | 1059 | ||
1060 | ubifs_assert(c->bud_bytes <= c->max_bud_bytes || c->need_recovery); | 1060 | ubifs_assert(c->bud_bytes <= c->max_bud_bytes || c->need_recovery); |
1061 | dbg_mnt("finished, log head LEB %d:%d, max_sqnum %llu, " | 1061 | dbg_mnt("finished, log head LEB %d:%d, max_sqnum %llu, highest_inum %lu", |
1062 | "highest_inum %lu", c->lhead_lnum, c->lhead_offs, c->max_sqnum, | 1062 | c->lhead_lnum, c->lhead_offs, c->max_sqnum, |
1063 | (unsigned long)c->highest_inum); | 1063 | (unsigned long)c->highest_inum); |
1064 | out: | 1064 | out: |
1065 | destroy_replay_list(c); | 1065 | destroy_replay_list(c); |
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index 52c21f4190f6..4c37607a958e 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c | |||
@@ -391,9 +391,8 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) | |||
391 | min_leb_cnt += c->lpt_lebs + c->orph_lebs + c->jhead_cnt + 6; | 391 | min_leb_cnt += c->lpt_lebs + c->orph_lebs + c->jhead_cnt + 6; |
392 | 392 | ||
393 | if (c->leb_cnt < min_leb_cnt || c->leb_cnt > c->vi.size) { | 393 | if (c->leb_cnt < min_leb_cnt || c->leb_cnt > c->vi.size) { |
394 | ubifs_err("bad LEB count: %d in superblock, %d on UBI volume, " | 394 | ubifs_err("bad LEB count: %d in superblock, %d on UBI volume, %d minimum required", |
395 | "%d minimum required", c->leb_cnt, c->vi.size, | 395 | c->leb_cnt, c->vi.size, min_leb_cnt); |
396 | min_leb_cnt); | ||
397 | goto failed; | 396 | goto failed; |
398 | } | 397 | } |
399 | 398 | ||
@@ -411,15 +410,14 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) | |||
411 | 410 | ||
412 | max_bytes = (long long)c->leb_size * UBIFS_MIN_BUD_LEBS; | 411 | max_bytes = (long long)c->leb_size * UBIFS_MIN_BUD_LEBS; |
413 | if (c->max_bud_bytes < max_bytes) { | 412 | if (c->max_bud_bytes < max_bytes) { |
414 | ubifs_err("too small journal (%lld bytes), must be at least " | 413 | ubifs_err("too small journal (%lld bytes), must be at least %lld bytes", |
415 | "%lld bytes", c->max_bud_bytes, max_bytes); | 414 | c->max_bud_bytes, max_bytes); |
416 | goto failed; | 415 | goto failed; |
417 | } | 416 | } |
418 | 417 | ||
419 | max_bytes = (long long)c->leb_size * c->main_lebs; | 418 | max_bytes = (long long)c->leb_size * c->main_lebs; |
420 | if (c->max_bud_bytes > max_bytes) { | 419 | if (c->max_bud_bytes > max_bytes) { |
421 | ubifs_err("too large journal size (%lld bytes), only %lld bytes" | 420 | ubifs_err("too large journal size (%lld bytes), only %lld bytes available in the main area", |
422 | "available in the main area", | ||
423 | c->max_bud_bytes, max_bytes); | 421 | c->max_bud_bytes, max_bytes); |
424 | goto failed; | 422 | goto failed; |
425 | } | 423 | } |
@@ -549,10 +547,9 @@ int ubifs_read_superblock(struct ubifs_info *c) | |||
549 | ubifs_assert(!c->ro_media || c->ro_mount); | 547 | ubifs_assert(!c->ro_media || c->ro_mount); |
550 | if (!c->ro_mount || | 548 | if (!c->ro_mount || |
551 | c->ro_compat_version > UBIFS_RO_COMPAT_VERSION) { | 549 | c->ro_compat_version > UBIFS_RO_COMPAT_VERSION) { |
552 | ubifs_err("on-flash format version is w%d/r%d, but " | 550 | ubifs_err("on-flash format version is w%d/r%d, but software only supports up to version w%d/r%d", |
553 | "software only supports up to version " | 551 | c->fmt_version, c->ro_compat_version, |
554 | "w%d/r%d", c->fmt_version, | 552 | UBIFS_FORMAT_VERSION, |
555 | c->ro_compat_version, UBIFS_FORMAT_VERSION, | ||
556 | UBIFS_RO_COMPAT_VERSION); | 553 | UBIFS_RO_COMPAT_VERSION); |
557 | if (c->ro_compat_version <= UBIFS_RO_COMPAT_VERSION) { | 554 | if (c->ro_compat_version <= UBIFS_RO_COMPAT_VERSION) { |
558 | ubifs_msg("only R/O mounting is possible"); | 555 | ubifs_msg("only R/O mounting is possible"); |
diff --git a/fs/ubifs/scan.c b/fs/ubifs/scan.c index 7c40e6025fd6..58aa05df2bb6 100644 --- a/fs/ubifs/scan.c +++ b/fs/ubifs/scan.c | |||
@@ -75,7 +75,7 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum, | |||
75 | magic = le32_to_cpu(ch->magic); | 75 | magic = le32_to_cpu(ch->magic); |
76 | 76 | ||
77 | if (magic == 0xFFFFFFFF) { | 77 | if (magic == 0xFFFFFFFF) { |
78 | dbg_scan("hit empty space"); | 78 | dbg_scan("hit empty space at LEB %d:%d", lnum, offs); |
79 | return SCANNED_EMPTY_SPACE; | 79 | return SCANNED_EMPTY_SPACE; |
80 | } | 80 | } |
81 | 81 | ||
@@ -85,7 +85,8 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum, | |||
85 | if (len < UBIFS_CH_SZ) | 85 | if (len < UBIFS_CH_SZ) |
86 | return SCANNED_GARBAGE; | 86 | return SCANNED_GARBAGE; |
87 | 87 | ||
88 | dbg_scan("scanning %s", dbg_ntype(ch->node_type)); | 88 | dbg_scan("scanning %s at LEB %d:%d", |
89 | dbg_ntype(ch->node_type), lnum, offs); | ||
89 | 90 | ||
90 | if (ubifs_check_node(c, buf, lnum, offs, quiet, 1)) | 91 | if (ubifs_check_node(c, buf, lnum, offs, quiet, 1)) |
91 | return SCANNED_A_CORRUPT_NODE; | 92 | 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 | return SCANNED_A_BAD_PAD_NODE; | 115 | return SCANNED_A_BAD_PAD_NODE; |
115 | } | 116 | } |
116 | 117 | ||
117 | dbg_scan("%d bytes padded, offset now %d", | 118 | dbg_scan("%d bytes padded at LEB %d:%d, offset now %d", pad_len, |
118 | pad_len, ALIGN(offs + node_len + pad_len, 8)); | 119 | lnum, offs, ALIGN(offs + node_len + pad_len, 8)); |
119 | 120 | ||
120 | return node_len + pad_len; | 121 | return node_len + pad_len; |
121 | } | 122 | } |
@@ -150,8 +151,8 @@ struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum, | |||
150 | 151 | ||
151 | err = ubifs_leb_read(c, lnum, sbuf + offs, offs, c->leb_size - offs, 0); | 152 | err = ubifs_leb_read(c, lnum, sbuf + offs, offs, c->leb_size - offs, 0); |
152 | if (err && err != -EBADMSG) { | 153 | if (err && err != -EBADMSG) { |
153 | ubifs_err("cannot read %d bytes from LEB %d:%d," | 154 | ubifs_err("cannot read %d bytes from LEB %d:%d, error %d", |
154 | " error %d", c->leb_size - offs, lnum, offs, err); | 155 | c->leb_size - offs, lnum, offs, err); |
155 | kfree(sleb); | 156 | kfree(sleb); |
156 | return ERR_PTR(err); | 157 | return ERR_PTR(err); |
157 | } | 158 | } |
@@ -240,8 +241,6 @@ void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs, | |||
240 | int len; | 241 | int len; |
241 | 242 | ||
242 | ubifs_err("corruption at LEB %d:%d", lnum, offs); | 243 | ubifs_err("corruption at LEB %d:%d", lnum, offs); |
243 | if (dbg_is_tst_rcvry(c)) | ||
244 | return; | ||
245 | len = c->leb_size - offs; | 244 | len = c->leb_size - offs; |
246 | if (len > 8192) | 245 | if (len > 8192) |
247 | len = 8192; | 246 | len = 8192; |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 49825427a0e8..ddc0f6ae65e9 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -89,9 +89,8 @@ static int validate_inode(struct ubifs_info *c, const struct inode *inode) | |||
89 | return 5; | 89 | return 5; |
90 | 90 | ||
91 | if (!ubifs_compr_present(ui->compr_type)) { | 91 | if (!ubifs_compr_present(ui->compr_type)) { |
92 | ubifs_warn("inode %lu uses '%s' compression, but it was not " | 92 | ubifs_warn("inode %lu uses '%s' compression, but it was not compiled in", |
93 | "compiled in", inode->i_ino, | 93 | inode->i_ino, ubifs_compr_name(ui->compr_type)); |
94 | ubifs_compr_name(ui->compr_type)); | ||
95 | } | 94 | } |
96 | 95 | ||
97 | err = dbg_check_dir(c, inode); | 96 | err = dbg_check_dir(c, inode); |
@@ -1061,8 +1060,8 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options, | |||
1061 | 1060 | ||
1062 | flag = parse_standard_option(p); | 1061 | flag = parse_standard_option(p); |
1063 | if (!flag) { | 1062 | if (!flag) { |
1064 | ubifs_err("unrecognized mount option \"%s\" " | 1063 | ubifs_err("unrecognized mount option \"%s\" or missing value", |
1065 | "or missing value", p); | 1064 | p); |
1066 | return -EINVAL; | 1065 | return -EINVAL; |
1067 | } | 1066 | } |
1068 | sb->s_flags |= flag; | 1067 | sb->s_flags |= flag; |
@@ -1124,8 +1123,8 @@ again: | |||
1124 | } | 1123 | } |
1125 | 1124 | ||
1126 | /* Just disable bulk-read */ | 1125 | /* Just disable bulk-read */ |
1127 | ubifs_warn("Cannot allocate %d bytes of memory for bulk-read, " | 1126 | ubifs_warn("cannot allocate %d bytes of memory for bulk-read, disabling it", |
1128 | "disabling it", c->max_bu_buf_len); | 1127 | c->max_bu_buf_len); |
1129 | c->mount_opts.bulk_read = 1; | 1128 | c->mount_opts.bulk_read = 1; |
1130 | c->bulk_read = 0; | 1129 | c->bulk_read = 0; |
1131 | return; | 1130 | return; |
@@ -1161,7 +1160,7 @@ static int check_free_space(struct ubifs_info *c) | |||
1161 | static int mount_ubifs(struct ubifs_info *c) | 1160 | static int mount_ubifs(struct ubifs_info *c) |
1162 | { | 1161 | { |
1163 | int err; | 1162 | int err; |
1164 | long long x; | 1163 | long long x, y; |
1165 | size_t sz; | 1164 | size_t sz; |
1166 | 1165 | ||
1167 | c->ro_mount = !!(c->vfs_sb->s_flags & MS_RDONLY); | 1166 | c->ro_mount = !!(c->vfs_sb->s_flags & MS_RDONLY); |
@@ -1411,75 +1410,69 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1411 | 1410 | ||
1412 | c->mounting = 0; | 1411 | c->mounting = 0; |
1413 | 1412 | ||
1414 | ubifs_msg("mounted UBI device %d, volume %d, name \"%s\"", | 1413 | ubifs_msg("mounted UBI device %d, volume %d, name \"%s\"%s", |
1415 | c->vi.ubi_num, c->vi.vol_id, c->vi.name); | 1414 | c->vi.ubi_num, c->vi.vol_id, c->vi.name, |
1416 | if (c->ro_mount) | 1415 | c->ro_mount ? ", R/O mode" : NULL); |
1417 | ubifs_msg("mounted read-only"); | ||
1418 | x = (long long)c->main_lebs * c->leb_size; | 1416 | x = (long long)c->main_lebs * c->leb_size; |
1419 | ubifs_msg("file system size: %lld bytes (%lld KiB, %lld MiB, %d " | 1417 | y = (long long)c->log_lebs * c->leb_size + c->max_bud_bytes; |
1420 | "LEBs)", x, x >> 10, x >> 20, c->main_lebs); | 1418 | ubifs_msg("LEB size: %d bytes (%d KiB), min./max. I/O unit sizes: %d bytes/%d bytes", |
1421 | x = (long long)c->log_lebs * c->leb_size + c->max_bud_bytes; | 1419 | c->leb_size, c->leb_size >> 10, c->min_io_size, |
1422 | ubifs_msg("journal size: %lld bytes (%lld KiB, %lld MiB, %d " | 1420 | c->max_write_size); |
1423 | "LEBs)", x, x >> 10, x >> 20, c->log_lebs + c->max_bud_cnt); | 1421 | ubifs_msg("FS size: %lld bytes (%lld MiB, %d LEBs), journal size %lld bytes (%lld MiB, %d LEBs)", |
1424 | ubifs_msg("media format: w%d/r%d (latest is w%d/r%d)", | 1422 | x, x >> 20, c->main_lebs, |
1423 | y, y >> 20, c->log_lebs + c->max_bud_cnt); | ||
1424 | ubifs_msg("reserved for root: %llu bytes (%llu KiB)", | ||
1425 | c->report_rp_size, c->report_rp_size >> 10); | ||
1426 | ubifs_msg("media format: w%d/r%d (latest is w%d/r%d), UUID %pUB%s", | ||
1425 | c->fmt_version, c->ro_compat_version, | 1427 | c->fmt_version, c->ro_compat_version, |
1426 | UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION); | 1428 | UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION, c->uuid, |
1427 | ubifs_msg("default compressor: %s", ubifs_compr_name(c->default_compr)); | 1429 | c->big_lpt ? ", big LPT model" : ", small LPT model"); |
1428 | ubifs_msg("reserved for root: %llu bytes (%llu KiB)", | 1430 | |
1429 | c->report_rp_size, c->report_rp_size >> 10); | 1431 | dbg_gen("default compressor: %s", ubifs_compr_name(c->default_compr)); |
1430 | 1432 | dbg_gen("data journal heads: %d", | |
1431 | dbg_msg("compiled on: " __DATE__ " at " __TIME__); | ||
1432 | dbg_msg("min. I/O unit size: %d bytes", c->min_io_size); | ||
1433 | dbg_msg("max. write size: %d bytes", c->max_write_size); | ||
1434 | dbg_msg("LEB size: %d bytes (%d KiB)", | ||
1435 | c->leb_size, c->leb_size >> 10); | ||
1436 | dbg_msg("data journal heads: %d", | ||
1437 | c->jhead_cnt - NONDATA_JHEADS_CNT); | 1433 | c->jhead_cnt - NONDATA_JHEADS_CNT); |
1438 | dbg_msg("UUID: %pUB", c->uuid); | 1434 | dbg_gen("log LEBs: %d (%d - %d)", |
1439 | dbg_msg("big_lpt %d", c->big_lpt); | ||
1440 | dbg_msg("log LEBs: %d (%d - %d)", | ||
1441 | c->log_lebs, UBIFS_LOG_LNUM, c->log_last); | 1435 | c->log_lebs, UBIFS_LOG_LNUM, c->log_last); |
1442 | dbg_msg("LPT area LEBs: %d (%d - %d)", | 1436 | dbg_gen("LPT area LEBs: %d (%d - %d)", |
1443 | c->lpt_lebs, c->lpt_first, c->lpt_last); | 1437 | c->lpt_lebs, c->lpt_first, c->lpt_last); |
1444 | dbg_msg("orphan area LEBs: %d (%d - %d)", | 1438 | dbg_gen("orphan area LEBs: %d (%d - %d)", |
1445 | c->orph_lebs, c->orph_first, c->orph_last); | 1439 | c->orph_lebs, c->orph_first, c->orph_last); |
1446 | dbg_msg("main area LEBs: %d (%d - %d)", | 1440 | dbg_gen("main area LEBs: %d (%d - %d)", |
1447 | c->main_lebs, c->main_first, c->leb_cnt - 1); | 1441 | c->main_lebs, c->main_first, c->leb_cnt - 1); |
1448 | dbg_msg("index LEBs: %d", c->lst.idx_lebs); | 1442 | dbg_gen("index LEBs: %d", c->lst.idx_lebs); |
1449 | dbg_msg("total index bytes: %lld (%lld KiB, %lld MiB)", | 1443 | dbg_gen("total index bytes: %lld (%lld KiB, %lld MiB)", |
1450 | c->bi.old_idx_sz, c->bi.old_idx_sz >> 10, | 1444 | c->bi.old_idx_sz, c->bi.old_idx_sz >> 10, |
1451 | c->bi.old_idx_sz >> 20); | 1445 | c->bi.old_idx_sz >> 20); |
1452 | dbg_msg("key hash type: %d", c->key_hash_type); | 1446 | dbg_gen("key hash type: %d", c->key_hash_type); |
1453 | dbg_msg("tree fanout: %d", c->fanout); | 1447 | dbg_gen("tree fanout: %d", c->fanout); |
1454 | dbg_msg("reserved GC LEB: %d", c->gc_lnum); | 1448 | dbg_gen("reserved GC LEB: %d", c->gc_lnum); |
1455 | dbg_msg("first main LEB: %d", c->main_first); | 1449 | dbg_gen("max. znode size %d", c->max_znode_sz); |
1456 | dbg_msg("max. znode size %d", c->max_znode_sz); | 1450 | dbg_gen("max. index node size %d", c->max_idx_node_sz); |
1457 | dbg_msg("max. index node size %d", c->max_idx_node_sz); | 1451 | dbg_gen("node sizes: data %zu, inode %zu, dentry %zu", |
1458 | dbg_msg("node sizes: data %zu, inode %zu, dentry %zu", | ||
1459 | UBIFS_DATA_NODE_SZ, UBIFS_INO_NODE_SZ, UBIFS_DENT_NODE_SZ); | 1452 | UBIFS_DATA_NODE_SZ, UBIFS_INO_NODE_SZ, UBIFS_DENT_NODE_SZ); |
1460 | dbg_msg("node sizes: trun %zu, sb %zu, master %zu", | 1453 | dbg_gen("node sizes: trun %zu, sb %zu, master %zu", |
1461 | UBIFS_TRUN_NODE_SZ, UBIFS_SB_NODE_SZ, UBIFS_MST_NODE_SZ); | 1454 | UBIFS_TRUN_NODE_SZ, UBIFS_SB_NODE_SZ, UBIFS_MST_NODE_SZ); |
1462 | dbg_msg("node sizes: ref %zu, cmt. start %zu, orph %zu", | 1455 | dbg_gen("node sizes: ref %zu, cmt. start %zu, orph %zu", |
1463 | UBIFS_REF_NODE_SZ, UBIFS_CS_NODE_SZ, UBIFS_ORPH_NODE_SZ); | 1456 | UBIFS_REF_NODE_SZ, UBIFS_CS_NODE_SZ, UBIFS_ORPH_NODE_SZ); |
1464 | dbg_msg("max. node sizes: data %zu, inode %zu dentry %zu, idx %d", | 1457 | dbg_gen("max. node sizes: data %zu, inode %zu dentry %zu, idx %d", |
1465 | UBIFS_MAX_DATA_NODE_SZ, UBIFS_MAX_INO_NODE_SZ, | 1458 | UBIFS_MAX_DATA_NODE_SZ, UBIFS_MAX_INO_NODE_SZ, |
1466 | UBIFS_MAX_DENT_NODE_SZ, ubifs_idx_node_sz(c, c->fanout)); | 1459 | UBIFS_MAX_DENT_NODE_SZ, ubifs_idx_node_sz(c, c->fanout)); |
1467 | dbg_msg("dead watermark: %d", c->dead_wm); | 1460 | dbg_gen("dead watermark: %d", c->dead_wm); |
1468 | dbg_msg("dark watermark: %d", c->dark_wm); | 1461 | dbg_gen("dark watermark: %d", c->dark_wm); |
1469 | dbg_msg("LEB overhead: %d", c->leb_overhead); | 1462 | dbg_gen("LEB overhead: %d", c->leb_overhead); |
1470 | x = (long long)c->main_lebs * c->dark_wm; | 1463 | x = (long long)c->main_lebs * c->dark_wm; |
1471 | dbg_msg("max. dark space: %lld (%lld KiB, %lld MiB)", | 1464 | dbg_gen("max. dark space: %lld (%lld KiB, %lld MiB)", |
1472 | x, x >> 10, x >> 20); | 1465 | x, x >> 10, x >> 20); |
1473 | dbg_msg("maximum bud bytes: %lld (%lld KiB, %lld MiB)", | 1466 | dbg_gen("maximum bud bytes: %lld (%lld KiB, %lld MiB)", |
1474 | c->max_bud_bytes, c->max_bud_bytes >> 10, | 1467 | c->max_bud_bytes, c->max_bud_bytes >> 10, |
1475 | c->max_bud_bytes >> 20); | 1468 | c->max_bud_bytes >> 20); |
1476 | dbg_msg("BG commit bud bytes: %lld (%lld KiB, %lld MiB)", | 1469 | dbg_gen("BG commit bud bytes: %lld (%lld KiB, %lld MiB)", |
1477 | c->bg_bud_bytes, c->bg_bud_bytes >> 10, | 1470 | c->bg_bud_bytes, c->bg_bud_bytes >> 10, |
1478 | c->bg_bud_bytes >> 20); | 1471 | c->bg_bud_bytes >> 20); |
1479 | dbg_msg("current bud bytes %lld (%lld KiB, %lld MiB)", | 1472 | dbg_gen("current bud bytes %lld (%lld KiB, %lld MiB)", |
1480 | c->bud_bytes, c->bud_bytes >> 10, c->bud_bytes >> 20); | 1473 | c->bud_bytes, c->bud_bytes >> 10, c->bud_bytes >> 20); |
1481 | dbg_msg("max. seq. number: %llu", c->max_sqnum); | 1474 | dbg_gen("max. seq. number: %llu", c->max_sqnum); |
1482 | dbg_msg("commit number: %llu", c->cmt_no); | 1475 | dbg_gen("commit number: %llu", c->cmt_no); |
1483 | 1476 | ||
1484 | return 0; | 1477 | return 0; |
1485 | 1478 | ||
@@ -1564,10 +1557,9 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1564 | 1557 | ||
1565 | if (c->rw_incompat) { | 1558 | if (c->rw_incompat) { |
1566 | ubifs_err("the file-system is not R/W-compatible"); | 1559 | ubifs_err("the file-system is not R/W-compatible"); |
1567 | ubifs_msg("on-flash format version is w%d/r%d, but software " | 1560 | ubifs_msg("on-flash format version is w%d/r%d, but software only supports up to version w%d/r%d", |
1568 | "only supports up to version w%d/r%d", c->fmt_version, | 1561 | c->fmt_version, c->ro_compat_version, |
1569 | c->ro_compat_version, UBIFS_FORMAT_VERSION, | 1562 | UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION); |
1570 | UBIFS_RO_COMPAT_VERSION); | ||
1571 | return -EROFS; | 1563 | return -EROFS; |
1572 | } | 1564 | } |
1573 | 1565 | ||
@@ -1828,8 +1820,8 @@ static void ubifs_put_super(struct super_block *sb) | |||
1828 | * next mount, so we just print a message and | 1820 | * next mount, so we just print a message and |
1829 | * continue to unmount normally. | 1821 | * continue to unmount normally. |
1830 | */ | 1822 | */ |
1831 | ubifs_err("failed to write master node, " | 1823 | ubifs_err("failed to write master node, error %d", |
1832 | "error %d", err); | 1824 | err); |
1833 | } else { | 1825 | } else { |
1834 | for (i = 0; i < c->jhead_cnt; i++) | 1826 | for (i = 0; i < c->jhead_cnt; i++) |
1835 | /* Make sure write-buffer timers are canceled */ | 1827 | /* Make sure write-buffer timers are canceled */ |
@@ -2248,8 +2240,7 @@ static int __init ubifs_init(void) | |||
2248 | * UBIFS_BLOCK_SIZE. It is assumed that both are powers of 2. | 2240 | * UBIFS_BLOCK_SIZE. It is assumed that both are powers of 2. |
2249 | */ | 2241 | */ |
2250 | if (PAGE_CACHE_SIZE < UBIFS_BLOCK_SIZE) { | 2242 | if (PAGE_CACHE_SIZE < UBIFS_BLOCK_SIZE) { |
2251 | ubifs_err("VFS page cache size is %u bytes, but UBIFS requires" | 2243 | ubifs_err("VFS page cache size is %u bytes, but UBIFS requires at least 4096 bytes", |
2252 | " at least 4096 bytes", | ||
2253 | (unsigned int)PAGE_CACHE_SIZE); | 2244 | (unsigned int)PAGE_CACHE_SIZE); |
2254 | return -EINVAL; | 2245 | return -EINVAL; |
2255 | } | 2246 | } |
diff --git a/fs/ubifs/tnc_misc.c b/fs/ubifs/tnc_misc.c index d38ac7f9654b..f6bf8995c7b1 100644 --- a/fs/ubifs/tnc_misc.c +++ b/fs/ubifs/tnc_misc.c | |||
@@ -328,8 +328,8 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, | |||
328 | case UBIFS_XENT_KEY: | 328 | case UBIFS_XENT_KEY: |
329 | break; | 329 | break; |
330 | default: | 330 | default: |
331 | dbg_msg("bad key type at slot %d: %d", | 331 | ubifs_err("bad key type at slot %d: %d", |
332 | i, key_type(c, &zbr->key)); | 332 | i, key_type(c, &zbr->key)); |
333 | err = 3; | 333 | err = 3; |
334 | goto out_dump; | 334 | goto out_dump; |
335 | } | 335 | } |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 64f2367c2f4c..5486346d0a3f 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -42,16 +42,15 @@ | |||
42 | #define UBIFS_VERSION 1 | 42 | #define UBIFS_VERSION 1 |
43 | 43 | ||
44 | /* Normal UBIFS messages */ | 44 | /* Normal UBIFS messages */ |
45 | #define ubifs_msg(fmt, ...) \ | 45 | #define ubifs_msg(fmt, ...) pr_notice("UBIFS: " fmt "\n", ##__VA_ARGS__) |
46 | printk(KERN_NOTICE "UBIFS: " fmt "\n", ##__VA_ARGS__) | ||
47 | /* UBIFS error messages */ | 46 | /* UBIFS error messages */ |
48 | #define ubifs_err(fmt, ...) \ | 47 | #define ubifs_err(fmt, ...) \ |
49 | printk(KERN_ERR "UBIFS error (pid %d): %s: " fmt "\n", current->pid, \ | 48 | pr_err("UBIFS error (pid %d): %s: " fmt "\n", current->pid, \ |
50 | __func__, ##__VA_ARGS__) | 49 | __func__, ##__VA_ARGS__) |
51 | /* UBIFS warning messages */ | 50 | /* UBIFS warning messages */ |
52 | #define ubifs_warn(fmt, ...) \ | 51 | #define ubifs_warn(fmt, ...) \ |
53 | printk(KERN_WARNING "UBIFS warning (pid %d): %s: " fmt "\n", \ | 52 | pr_warn("UBIFS warning (pid %d): %s: " fmt "\n", \ |
54 | current->pid, __func__, ##__VA_ARGS__) | 53 | current->pid, __func__, ##__VA_ARGS__) |
55 | 54 | ||
56 | /* UBIFS file system VFS magic number */ | 55 | /* UBIFS file system VFS magic number */ |
57 | #define UBIFS_SUPER_MAGIC 0x24051905 | 56 | #define UBIFS_SUPER_MAGIC 0x24051905 |