Skip to content

Commit f2a4452

Browse files
guaneryutytso
authored andcommitted
jbd2: Unify log messages in jbd2 code
Some jbd2 code prints out kernel messages with "JBD2: " prefix, at the same time other jbd2 code prints with "JBD: " prefix. Unify the prefix to "JBD2: ". Signed-off-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1 parent 8762202 commit f2a4452

4 files changed

Lines changed: 47 additions & 47 deletions

File tree

‎fs/jbd2/commit.c‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
352352
J_ASSERT(commit_transaction->t_state == T_RUNNING);
353353

354354
trace_jbd2_start_commit(journal, commit_transaction);
355-
jbd_debug(1, "JBD: starting commit of transaction %d\n",
355+
jbd_debug(1, "JBD2: starting commit of transaction %d\n",
356356
commit_transaction->t_tid);
357357

358358
write_lock(&journal->j_state_lock);
@@ -427,7 +427,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
427427
__jbd2_journal_clean_checkpoint_list(journal);
428428
spin_unlock(&journal->j_list_lock);
429429

430-
jbd_debug (3, "JBD: commit phase 1\n");
430+
jbd_debug(3, "JBD2: commit phase 1\n");
431431

432432
/*
433433
* Switch to a new revoke table.
@@ -447,7 +447,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
447447
wake_up(&journal->j_wait_transaction_locked);
448448
write_unlock(&journal->j_state_lock);
449449

450-
jbd_debug (3, "JBD: commit phase 2\n");
450+
jbd_debug(3, "JBD2: commit phase 2\n");
451451

452452
/*
453453
* Now start flushing things to disk, in the order they appear
@@ -462,7 +462,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
462462
WRITE_SYNC);
463463
blk_finish_plug(&plug);
464464

465-
jbd_debug(3, "JBD: commit phase 2\n");
465+
jbd_debug(3, "JBD2: commit phase 2\n");
466466

467467
/*
468468
* Way to go: we have now written out all of the data for a
@@ -522,7 +522,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
522522

523523
J_ASSERT (bufs == 0);
524524

525-
jbd_debug(4, "JBD: get descriptor\n");
525+
jbd_debug(4, "JBD2: get descriptor\n");
526526

527527
descriptor = jbd2_journal_get_descriptor_buffer(journal);
528528
if (!descriptor) {
@@ -531,7 +531,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
531531
}
532532

533533
bh = jh2bh(descriptor);
534-
jbd_debug(4, "JBD: got buffer %llu (%p)\n",
534+
jbd_debug(4, "JBD2: got buffer %llu (%p)\n",
535535
(unsigned long long)bh->b_blocknr, bh->b_data);
536536
header = (journal_header_t *)&bh->b_data[0];
537537
header->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER);
@@ -625,7 +625,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
625625
commit_transaction->t_buffers == NULL ||
626626
space_left < tag_bytes + 16) {
627627

628-
jbd_debug(4, "JBD: Submit %d IOs\n", bufs);
628+
jbd_debug(4, "JBD2: Submit %d IOs\n", bufs);
629629

630630
/* Write an end-of-descriptor marker before
631631
submitting the IOs. "tag" still points to
@@ -707,7 +707,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
707707
so we incur less scheduling load.
708708
*/
709709

710-
jbd_debug(3, "JBD: commit phase 3\n");
710+
jbd_debug(3, "JBD2: commit phase 3\n");
711711

712712
/*
713713
* akpm: these are BJ_IO, and j_list_lock is not needed.
@@ -771,7 +771,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
771771

772772
J_ASSERT (commit_transaction->t_shadow_list == NULL);
773773

774-
jbd_debug(3, "JBD: commit phase 4\n");
774+
jbd_debug(3, "JBD2: commit phase 4\n");
775775

776776
/* Here we wait for the revoke record and descriptor record buffers */
777777
wait_for_ctlbuf:
@@ -801,7 +801,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
801801
if (err)
802802
jbd2_journal_abort(journal, err);
803803

804-
jbd_debug(3, "JBD: commit phase 5\n");
804+
jbd_debug(3, "JBD2: commit phase 5\n");
805805
write_lock(&journal->j_state_lock);
806806
J_ASSERT(commit_transaction->t_state == T_COMMIT_DFLUSH);
807807
commit_transaction->t_state = T_COMMIT_JFLUSH;
@@ -830,7 +830,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
830830
transaction can be removed from any checkpoint list it was on
831831
before. */
832832

833-
jbd_debug(3, "JBD: commit phase 6\n");
833+
jbd_debug(3, "JBD2: commit phase 6\n");
834834

835835
J_ASSERT(list_empty(&commit_transaction->t_inode_list));
836836
J_ASSERT(commit_transaction->t_buffers == NULL);
@@ -964,7 +964,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
964964

965965
/* Done with this transaction! */
966966

967-
jbd_debug(3, "JBD: commit phase 7\n");
967+
jbd_debug(3, "JBD2: commit phase 7\n");
968968

969969
J_ASSERT(commit_transaction->t_state == T_COMMIT_JFLUSH);
970970

@@ -1039,7 +1039,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
10391039
journal->j_commit_callback(journal, commit_transaction);
10401040

10411041
trace_jbd2_end_commit(journal, commit_transaction);
1042-
jbd_debug(1, "JBD: commit %d complete, head %d\n",
1042+
jbd_debug(1, "JBD2: commit %d complete, head %d\n",
10431043
journal->j_commit_sequence, journal->j_tail_sequence);
10441044
if (to_free)
10451045
kfree(commit_transaction);

‎fs/jbd2/journal.c‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ int __jbd2_log_start_commit(journal_t *journal, tid_t target)
491491
*/
492492

493493
journal->j_commit_request = target;
494-
jbd_debug(1, "JBD: requesting commit %d/%d\n",
494+
jbd_debug(1, "JBD2: requesting commit %d/%d\n",
495495
journal->j_commit_request,
496496
journal->j_commit_sequence);
497497
wake_up(&journal->j_wait_commit);
@@ -500,7 +500,7 @@ int __jbd2_log_start_commit(journal_t *journal, tid_t target)
500500
/* This should never happen, but if it does, preserve
501501
the evidence before kjournald goes into a loop and
502502
increments j_commit_sequence beyond all recognition. */
503-
WARN_ONCE(1, "jbd: bad log_start_commit: %u %u %u %u\n",
503+
WARN_ONCE(1, "JBD2: bad log_start_commit: %u %u %u %u\n",
504504
journal->j_commit_request,
505505
journal->j_commit_sequence,
506506
target, journal->j_running_transaction ?
@@ -645,7 +645,7 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid)
645645
}
646646
#endif
647647
while (tid_gt(tid, journal->j_commit_sequence)) {
648-
jbd_debug(1, "JBD: want %d, j_commit_sequence=%d\n",
648+
jbd_debug(1, "JBD2: want %d, j_commit_sequence=%d\n",
649649
tid, journal->j_commit_sequence);
650650
wake_up(&journal->j_wait_commit);
651651
read_unlock(&journal->j_state_lock);
@@ -1093,7 +1093,7 @@ static int journal_reset(journal_t *journal)
10931093
first = be32_to_cpu(sb->s_first);
10941094
last = be32_to_cpu(sb->s_maxlen);
10951095
if (first + JBD2_MIN_JOURNAL_BLOCKS > last + 1) {
1096-
printk(KERN_ERR "JBD: Journal too short (blocks %llu-%llu).\n",
1096+
printk(KERN_ERR "JBD2: Journal too short (blocks %llu-%llu).\n",
10971097
first, last);
10981098
journal_fail_superblock(journal);
10991099
return -EINVAL;
@@ -1139,7 +1139,7 @@ void jbd2_journal_update_superblock(journal_t *journal, int wait)
11391139
*/
11401140
if (sb->s_start == 0 && journal->j_tail_sequence ==
11411141
journal->j_transaction_sequence) {
1142-
jbd_debug(1,"JBD: Skipping superblock update on recovered sb "
1142+
jbd_debug(1, "JBD2: Skipping superblock update on recovered sb "
11431143
"(start %ld, seq %d, errno %d)\n",
11441144
journal->j_tail, journal->j_tail_sequence,
11451145
journal->j_errno);
@@ -1163,7 +1163,7 @@ void jbd2_journal_update_superblock(journal_t *journal, int wait)
11631163
}
11641164

11651165
read_lock(&journal->j_state_lock);
1166-
jbd_debug(1,"JBD: updating superblock (start %ld, seq %d, errno %d)\n",
1166+
jbd_debug(1, "JBD2: updating superblock (start %ld, seq %d, errno %d)\n",
11671167
journal->j_tail, journal->j_tail_sequence, journal->j_errno);
11681168

11691169
sb->s_sequence = cpu_to_be32(journal->j_tail_sequence);
@@ -1216,8 +1216,8 @@ static int journal_get_superblock(journal_t *journal)
12161216
ll_rw_block(READ, 1, &bh);
12171217
wait_on_buffer(bh);
12181218
if (!buffer_uptodate(bh)) {
1219-
printk (KERN_ERR
1220-
"JBD: IO error reading journal superblock\n");
1219+
printk(KERN_ERR
1220+
"JBD2: IO error reading journal superblock\n");
12211221
goto out;
12221222
}
12231223
}
@@ -1228,7 +1228,7 @@ static int journal_get_superblock(journal_t *journal)
12281228

12291229
if (sb->s_header.h_magic != cpu_to_be32(JBD2_MAGIC_NUMBER) ||
12301230
sb->s_blocksize != cpu_to_be32(journal->j_blocksize)) {
1231-
printk(KERN_WARNING "JBD: no valid journal superblock found\n");
1231+
printk(KERN_WARNING "JBD2: no valid journal superblock found\n");
12321232
goto out;
12331233
}
12341234

@@ -1240,14 +1240,14 @@ static int journal_get_superblock(journal_t *journal)
12401240
journal->j_format_version = 2;
12411241
break;
12421242
default:
1243-
printk(KERN_WARNING "JBD: unrecognised superblock format ID\n");
1243+
printk(KERN_WARNING "JBD2: unrecognised superblock format ID\n");
12441244
goto out;
12451245
}
12461246

12471247
if (be32_to_cpu(sb->s_maxlen) < journal->j_maxlen)
12481248
journal->j_maxlen = be32_to_cpu(sb->s_maxlen);
12491249
else if (be32_to_cpu(sb->s_maxlen) > journal->j_maxlen) {
1250-
printk (KERN_WARNING "JBD: journal file too short\n");
1250+
printk(KERN_WARNING "JBD2: journal file too short\n");
12511251
goto out;
12521252
}
12531253

@@ -1318,8 +1318,8 @@ int jbd2_journal_load(journal_t *journal)
13181318
~cpu_to_be32(JBD2_KNOWN_ROCOMPAT_FEATURES)) ||
13191319
(sb->s_feature_incompat &
13201320
~cpu_to_be32(JBD2_KNOWN_INCOMPAT_FEATURES))) {
1321-
printk (KERN_WARNING
1322-
"JBD: Unrecognised features on journal\n");
1321+
printk(KERN_WARNING
1322+
"JBD2: Unrecognised features on journal\n");
13231323
return -EINVAL;
13241324
}
13251325
}
@@ -1354,7 +1354,7 @@ int jbd2_journal_load(journal_t *journal)
13541354
return 0;
13551355

13561356
recovery_error:
1357-
printk (KERN_WARNING "JBD: recovery failed\n");
1357+
printk(KERN_WARNING "JBD2: recovery failed\n");
13581358
return -EIO;
13591359
}
13601360

@@ -1585,7 +1585,7 @@ static int journal_convert_superblock_v1(journal_t *journal,
15851585
struct buffer_head *bh;
15861586

15871587
printk(KERN_WARNING
1588-
"JBD: Converting superblock from version 1 to 2.\n");
1588+
"JBD2: Converting superblock from version 1 to 2.\n");
15891589

15901590
/* Pre-initialise new fields to zero */
15911591
offset = ((char *) &(sb->s_feature_compat)) - ((char *) sb);
@@ -1702,7 +1702,7 @@ int jbd2_journal_wipe(journal_t *journal, int write)
17021702
if (!journal->j_tail)
17031703
goto no_recovery;
17041704

1705-
printk (KERN_WARNING "JBD: %s recovery information on journal\n",
1705+
printk(KERN_WARNING "JBD2: %s recovery information on journal\n",
17061706
write ? "Clearing" : "Ignoring");
17071707

17081708
err = jbd2_journal_skip_recovery(journal);
@@ -2028,7 +2028,7 @@ static int journal_init_jbd2_journal_head_cache(void)
20282028
retval = 0;
20292029
if (!jbd2_journal_head_cache) {
20302030
retval = -ENOMEM;
2031-
printk(KERN_EMERG "JBD: no memory for journal_head cache\n");
2031+
printk(KERN_EMERG "JBD2: no memory for journal_head cache\n");
20322032
}
20332033
return retval;
20342034
}
@@ -2391,7 +2391,7 @@ static void __exit journal_exit(void)
23912391
#ifdef CONFIG_JBD2_DEBUG
23922392
int n = atomic_read(&nr_journal_heads);
23932393
if (n)
2394-
printk(KERN_EMERG "JBD: leaked %d journal_heads!\n", n);
2394+
printk(KERN_EMERG "JBD2: leaked %d journal_heads!\n", n);
23952395
#endif
23962396
jbd2_remove_debugfs_entry();
23972397
jbd2_remove_jbd_stats_proc_entry();

‎fs/jbd2/recovery.c‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static int do_readahead(journal_t *journal, unsigned int start)
8989
err = jbd2_journal_bmap(journal, next, &blocknr);
9090

9191
if (err) {
92-
printk (KERN_ERR "JBD: bad block at offset %u\n",
92+
printk(KERN_ERR "JBD2: bad block at offset %u\n",
9393
next);
9494
goto failed;
9595
}
@@ -138,14 +138,14 @@ static int jread(struct buffer_head **bhp, journal_t *journal,
138138
*bhp = NULL;
139139

140140
if (offset >= journal->j_maxlen) {
141-
printk(KERN_ERR "JBD: corrupted journal superblock\n");
141+
printk(KERN_ERR "JBD2: corrupted journal superblock\n");
142142
return -EIO;
143143
}
144144

145145
err = jbd2_journal_bmap(journal, offset, &blocknr);
146146

147147
if (err) {
148-
printk (KERN_ERR "JBD: bad block at offset %u\n",
148+
printk(KERN_ERR "JBD2: bad block at offset %u\n",
149149
offset);
150150
return err;
151151
}
@@ -163,7 +163,7 @@ static int jread(struct buffer_head **bhp, journal_t *journal,
163163
}
164164

165165
if (!buffer_uptodate(bh)) {
166-
printk (KERN_ERR "JBD: Failed to read block at offset %u\n",
166+
printk(KERN_ERR "JBD2: Failed to read block at offset %u\n",
167167
offset);
168168
brelse(bh);
169169
return -EIO;
@@ -251,10 +251,10 @@ int jbd2_journal_recover(journal_t *journal)
251251
if (!err)
252252
err = do_one_pass(journal, &info, PASS_REPLAY);
253253

254-
jbd_debug(1, "JBD: recovery, exit status %d, "
254+
jbd_debug(1, "JBD2: recovery, exit status %d, "
255255
"recovered transactions %u to %u\n",
256256
err, info.start_transaction, info.end_transaction);
257-
jbd_debug(1, "JBD: Replayed %d and revoked %d/%d blocks\n",
257+
jbd_debug(1, "JBD2: Replayed %d and revoked %d/%d blocks\n",
258258
info.nr_replays, info.nr_revoke_hits, info.nr_revokes);
259259

260260
/* Restart the log at the next transaction ID, thus invalidating
@@ -293,14 +293,14 @@ int jbd2_journal_skip_recovery(journal_t *journal)
293293
err = do_one_pass(journal, &info, PASS_SCAN);
294294

295295
if (err) {
296-
printk(KERN_ERR "JBD: error %d scanning journal\n", err);
296+
printk(KERN_ERR "JBD2: error %d scanning journal\n", err);
297297
++journal->j_transaction_sequence;
298298
} else {
299299
#ifdef CONFIG_JBD2_DEBUG
300300
int dropped = info.end_transaction -
301301
be32_to_cpu(journal->j_superblock->s_sequence);
302302
jbd_debug(1,
303-
"JBD: ignoring %d transaction%s from the journal.\n",
303+
"JBD2: ignoring %d transaction%s from the journal.\n",
304304
dropped, (dropped == 1) ? "" : "s");
305305
#endif
306306
journal->j_transaction_sequence = ++info.end_transaction;
@@ -338,7 +338,7 @@ static int calc_chksums(journal_t *journal, struct buffer_head *bh,
338338
wrap(journal, *next_log_block);
339339
err = jread(&obh, journal, io_block);
340340
if (err) {
341-
printk(KERN_ERR "JBD: IO error %d recovering block "
341+
printk(KERN_ERR "JBD2: IO error %d recovering block "
342342
"%lu in log\n", err, io_block);
343343
return 1;
344344
} else {
@@ -411,7 +411,7 @@ static int do_one_pass(journal_t *journal,
411411
* either the next descriptor block or the final commit
412412
* record. */
413413

414-
jbd_debug(3, "JBD: checking block %ld\n", next_log_block);
414+
jbd_debug(3, "JBD2: checking block %ld\n", next_log_block);
415415
err = jread(&bh, journal, next_log_block);
416416
if (err)
417417
goto failed;
@@ -491,8 +491,8 @@ static int do_one_pass(journal_t *journal,
491491
/* Recover what we can, but
492492
* report failure at the end. */
493493
success = err;
494-
printk (KERN_ERR
495-
"JBD: IO error %d recovering "
494+
printk(KERN_ERR
495+
"JBD2: IO error %d recovering "
496496
"block %ld in log\n",
497497
err, io_block);
498498
} else {
@@ -520,7 +520,7 @@ static int do_one_pass(journal_t *journal,
520520
journal->j_blocksize);
521521
if (nbh == NULL) {
522522
printk(KERN_ERR
523-
"JBD: Out of memory "
523+
"JBD2: Out of memory "
524524
"during recovery.\n");
525525
err = -ENOMEM;
526526
brelse(bh);
@@ -689,7 +689,7 @@ static int do_one_pass(journal_t *journal,
689689
/* It's really bad news if different passes end up at
690690
* different places (but possible due to IO errors). */
691691
if (info->end_transaction != next_commit_ID) {
692-
printk (KERN_ERR "JBD: recovery pass %d ended at "
692+
printk(KERN_ERR "JBD2: recovery pass %d ended at "
693693
"transaction %u, expected %u\n",
694694
pass, next_commit_ID, info->end_transaction);
695695
if (!success)

‎fs/jbd2/transaction.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static int start_this_handle(journal_t *journal, handle_t *handle,
125125
unsigned long ts = jiffies;
126126

127127
if (nblocks > journal->j_max_transaction_buffers) {
128-
printk(KERN_ERR "JBD: %s wants too many credits (%d > %d)\n",
128+
printk(KERN_ERR "JBD2: %s wants too many credits (%d > %d)\n",
129129
current->comm, nblocks,
130130
journal->j_max_transaction_buffers);
131131
return -ENOSPC;
@@ -564,7 +564,7 @@ static void warn_dirty_buffer(struct buffer_head *bh)
564564
char b[BDEVNAME_SIZE];
565565

566566
printk(KERN_WARNING
567-
"JBD: Spotted dirty metadata buffer (dev = %s, blocknr = %llu). "
567+
"JBD2: Spotted dirty metadata buffer (dev = %s, blocknr = %llu). "
568568
"There's a risk of filesystem corruption in case of system "
569569
"crash.\n",
570570
bdevname(bh->b_bdev, b), (unsigned long long)bh->b_blocknr);

0 commit comments

Comments
 (0)