Skip to content

Commit 4776004

Browse files
committed
ext4: Add printk priority levels to clean up checkpatch warnings
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
1 parent 1f7c14c commit 4776004

7 files changed

Lines changed: 71 additions & 54 deletions

File tree

‎fs/ext4/balloc.c‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -379,34 +379,36 @@ static void __rsv_window_dump(struct rb_root *root, int verbose,
379379
bad = 0;
380380
prev = NULL;
381381

382-
printk("Block Allocation Reservation Windows Map (%s):\n", fn);
382+
printk(KERN_DEBUG "Block Allocation Reservation "
383+
"Windows Map (%s):\n", fn);
383384
while (n) {
384385
rsv = rb_entry(n, struct ext4_reserve_window_node, rsv_node);
385386
if (verbose)
386-
printk("reservation window 0x%p "
387+
printk(KERN_DEBUG "reservation window 0x%p "
387388
"start: %llu, end: %llu\n",
388389
rsv, rsv->rsv_start, rsv->rsv_end);
389390
if (rsv->rsv_start && rsv->rsv_start >= rsv->rsv_end) {
390-
printk("Bad reservation %p (start >= end)\n",
391+
printk(KERN_DEBUG "Bad reservation %p (start >= end)\n",
391392
rsv);
392393
bad = 1;
393394
}
394395
if (prev && prev->rsv_end >= rsv->rsv_start) {
395-
printk("Bad reservation %p (prev->end >= start)\n",
396-
rsv);
396+
printk(KERN_DEBUG "Bad reservation %p "
397+
"(prev->end >= start)\n", rsv);
397398
bad = 1;
398399
}
399400
if (bad) {
400401
if (!verbose) {
401-
printk("Restarting reservation walk in verbose mode\n");
402+
printk(KERN_DEBUG "Restarting reservation "
403+
"walk in verbose mode\n");
402404
verbose = 1;
403405
goto restart;
404406
}
405407
}
406408
n = rb_next(n);
407409
prev = rsv;
408410
}
409-
printk("Window map complete.\n");
411+
printk(KERN_DEBUG "Window map complete.\n");
410412
BUG_ON(bad);
411413
}
412414
#define rsv_window_dump(root, verbose) \
@@ -1702,7 +1704,7 @@ ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode,
17021704
sb = inode->i_sb;
17031705
if (!sb) {
17041706
*errp = -ENODEV;
1705-
printk("ext4_new_block: nonexistent device");
1707+
printk(KERN_ERR "ext4_new_block: nonexistent superblock");
17061708
return 0;
17071709
}
17081710

@@ -1884,8 +1886,8 @@ ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode,
18841886
for (i = 0; i < num; i++) {
18851887
if (ext4_test_bit(grp_alloc_blk+i,
18861888
bh2jh(bitmap_bh)->b_committed_data)) {
1887-
printk("%s: block was unexpectedly set in "
1888-
"b_committed_data\n", __func__);
1889+
printk(KERN_ERR "%s: block was unexpectedly "
1890+
"set in b_committed_data\n", __func__);
18891891
}
18901892
}
18911893
}
@@ -2093,10 +2095,9 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb)
20932095
bitmap_count += x;
20942096
}
20952097
brelse(bitmap_bh);
2096-
printk("ext4_count_free_blocks: stored = %llu"
2097-
", computed = %llu, %llu\n",
2098-
ext4_free_blocks_count(es),
2099-
desc_count, bitmap_count);
2098+
printk(KERN_DEBUG "ext4_count_free_blocks: stored = %llu"
2099+
", computed = %llu, %llu\n", ext4_free_blocks_count(es),
2100+
desc_count, bitmap_count);
21002101
return bitmap_count;
21012102
#else
21022103
desc_count = 0;

‎fs/ext4/dir.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ static int call_filldir(struct file * filp, void * dirent,
400400
sb = inode->i_sb;
401401

402402
if (!fname) {
403-
printk("call_filldir: called with null fname?!?\n");
403+
printk(KERN_ERR "ext4: call_filldir: called with "
404+
"null fname?!?\n");
404405
return 0;
405406
}
406407
curr_pos = hash2pos(fname->hash, fname->minor_hash);

‎fs/ext4/extents.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,10 @@ ext4_ext_binsearch_idx(struct inode *inode,
440440
for (k = 0; k < le16_to_cpu(eh->eh_entries); k++, ix++) {
441441
if (k != 0 &&
442442
le32_to_cpu(ix->ei_block) <= le32_to_cpu(ix[-1].ei_block)) {
443-
printk("k=%d, ix=0x%p, first=0x%p\n", k,
444-
ix, EXT_FIRST_INDEX(eh));
445-
printk("%u <= %u\n",
443+
printk(KERN_DEBUG "k=%d, ix=0x%p, "
444+
"first=0x%p\n", k,
445+
ix, EXT_FIRST_INDEX(eh));
446+
printk(KERN_DEBUG "%u <= %u\n",
446447
le32_to_cpu(ix->ei_block),
447448
le32_to_cpu(ix[-1].ei_block));
448449
}
@@ -2142,7 +2143,7 @@ void ext4_ext_init(struct super_block *sb)
21422143
*/
21432144

21442145
if (test_opt(sb, EXTENTS)) {
2145-
printk("EXT4-fs: file extents enabled");
2146+
printk(KERN_INFO "EXT4-fs: file extents enabled");
21462147
#ifdef AGGRESSIVE_TEST
21472148
printk(", aggressive tests");
21482149
#endif

‎fs/ext4/ialloc.c‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,18 @@ void ext4_free_inode (handle_t *handle, struct inode * inode)
170170
ext4_group_t flex_group;
171171

172172
if (atomic_read(&inode->i_count) > 1) {
173-
printk ("ext4_free_inode: inode has count=%d\n",
174-
atomic_read(&inode->i_count));
173+
printk(KERN_ERR "ext4_free_inode: inode has count=%d\n",
174+
atomic_read(&inode->i_count));
175175
return;
176176
}
177177
if (inode->i_nlink) {
178-
printk ("ext4_free_inode: inode has nlink=%d\n",
179-
inode->i_nlink);
178+
printk(KERN_ERR "ext4_free_inode: inode has nlink=%d\n",
179+
inode->i_nlink);
180180
return;
181181
}
182182
if (!sb) {
183-
printk("ext4_free_inode: inode on nonexistent device\n");
183+
printk(KERN_ERR "ext4_free_inode: inode on "
184+
"nonexistent device\n");
184185
return;
185186
}
186187
sbi = EXT4_SB(sb);
@@ -989,8 +990,9 @@ unsigned long ext4_count_free_inodes (struct super_block * sb)
989990
bitmap_count += x;
990991
}
991992
brelse(bitmap_bh);
992-
printk("ext4_count_free_inodes: stored = %u, computed = %lu, %lu\n",
993-
le32_to_cpu(es->s_free_inodes_count), desc_count, bitmap_count);
993+
printk(KERN_DEBUG "ext4_count_free_inodes: "
994+
"stored = %u, computed = %lu, %lu\n",
995+
le32_to_cpu(es->s_free_inodes_count), desc_count, bitmap_count);
994996
return desc_count;
995997
#else
996998
desc_count = 0;

‎fs/ext4/mballoc.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,10 @@ static void mb_cmp_bitmaps(struct ext4_buddy *e4b, void *bitmap)
477477
b2 = (unsigned char *) bitmap;
478478
for (i = 0; i < e4b->bd_sb->s_blocksize; i++) {
479479
if (b1[i] != b2[i]) {
480-
printk("corruption in group %lu at byte %u(%u):"
481-
" %x in copy != %x on disk/prealloc\n",
482-
e4b->bd_group, i, i * 8, b1[i], b2[i]);
480+
printk(KERN_ERR "corruption in group %lu "
481+
"at byte %u(%u): %x in copy != %x "
482+
"on disk/prealloc\n",
483+
e4b->bd_group, i, i * 8, b1[i], b2[i]);
483484
BUG();
484485
}
485486
}
@@ -2560,7 +2561,7 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery)
25602561
ext4_mb_init_per_dev_proc(sb);
25612562
ext4_mb_history_init(sb);
25622563

2563-
printk("EXT4-fs: mballoc enabled\n");
2564+
printk(KERN_INFO "EXT4-fs: mballoc enabled\n");
25642565
return 0;
25652566
}
25662567

‎fs/ext4/namei.c‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,12 @@ static inline unsigned dx_node_limit (struct inode *dir)
254254
* Debug
255255
*/
256256
#ifdef DX_DEBUG
257-
static void dx_show_index (char * label, struct dx_entry *entries)
257+
static void dx_show_index(char * label, struct dx_entry *entries)
258258
{
259259
int i, n = dx_get_count (entries);
260-
printk("%s index ", label);
260+
printk(KERN_DEBUG "%s index ", label);
261261
for (i = 0; i < n; i++) {
262-
printk("%x->%lu ", i? dx_get_hash(entries + i) :
262+
printk("%x->%lu ", i ? dx_get_hash(entries + i) :
263263
0, (unsigned long)dx_get_block(entries + i));
264264
}
265265
printk("\n");
@@ -328,8 +328,9 @@ struct stats dx_show_entries(struct dx_hash_info *hinfo, struct inode *dir,
328328
brelse (bh);
329329
}
330330
if (bcount)
331-
printk("%snames %u, fullness %u (%u%%)\n", levels?"":" ",
332-
names, space/bcount,(space/bcount)*100/blocksize);
331+
printk(KERN_DEBUG "%snames %u, fullness %u (%u%%)\n",
332+
levels ? "" : " ", names, space/bcount,
333+
(space/bcount)*100/blocksize);
333334
return (struct stats) { names, space, bcount};
334335
}
335336
#endif /* DX_DEBUG */
@@ -635,8 +636,8 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
635636
int ret, err;
636637
__u32 hashval;
637638

638-
dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash,
639-
start_minor_hash));
639+
dxtrace(printk(KERN_DEBUG "In htree_fill_tree, start hash: %x:%x\n",
640+
start_hash, start_minor_hash));
640641
dir = dir_file->f_path.dentry->d_inode;
641642
if (!(EXT4_I(dir)->i_flags & EXT4_INDEX_FL)) {
642643
hinfo.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
@@ -694,8 +695,8 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
694695
break;
695696
}
696697
dx_release(frames);
697-
dxtrace(printk("Fill tree: returned %d entries, next hash: %x\n",
698-
count, *next_hash));
698+
dxtrace(printk(KERN_DEBUG "Fill tree: returned %d entries, "
699+
"next hash: %x\n", count, *next_hash));
699700
return count;
700701
errout:
701702
dx_release(frames);
@@ -882,7 +883,8 @@ static struct buffer_head * ext4_find_entry (struct dentry *dentry,
882883
*/
883884
if (bh || (err != ERR_BAD_DX_DIR))
884885
return bh;
885-
dxtrace(printk("ext4_find_entry: dx failed, falling back\n"));
886+
dxtrace(printk(KERN_DEBUG "ext4_find_entry: dx failed, "
887+
"falling back\n"));
886888
}
887889
nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb);
888890
start = EXT4_I(dir)->i_dir_start_lookup;
@@ -1025,7 +1027,7 @@ static struct buffer_head * ext4_dx_find_entry(struct dentry *dentry,
10251027

10261028
*err = -ENOENT;
10271029
errout:
1028-
dxtrace(printk("%s not found\n", name));
1030+
dxtrace(printk(KERN_DEBUG "%s not found\n", name));
10291031
dx_release (frames);
10301032
return NULL;
10311033
}
@@ -1377,7 +1379,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
13771379
struct fake_dirent *fde;
13781380

13791381
blocksize = dir->i_sb->s_blocksize;
1380-
dxtrace(printk("Creating index\n"));
1382+
dxtrace(printk(KERN_DEBUG "Creating index\n"));
13811383
retval = ext4_journal_get_write_access(handle, bh);
13821384
if (retval) {
13831385
ext4_std_error(dir->i_sb, retval);
@@ -1527,7 +1529,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
15271529
}
15281530

15291531
/* Block full, should compress but for now just split */
1530-
dxtrace(printk("using %u of %u node entries\n",
1532+
dxtrace(printk(KERN_DEBUG "using %u of %u node entries\n",
15311533
dx_get_count(entries), dx_get_limit(entries)));
15321534
/* Need to split index? */
15331535
if (dx_get_count(entries) == dx_get_limit(entries)) {
@@ -1559,7 +1561,8 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
15591561
if (levels) {
15601562
unsigned icount1 = icount/2, icount2 = icount - icount1;
15611563
unsigned hash2 = dx_get_hash(entries + icount1);
1562-
dxtrace(printk("Split index %i/%i\n", icount1, icount2));
1564+
dxtrace(printk(KERN_DEBUG "Split index %i/%i\n",
1565+
icount1, icount2));
15631566

15641567
BUFFER_TRACE(frame->bh, "get_write_access"); /* index root */
15651568
err = ext4_journal_get_write_access(handle,
@@ -1588,7 +1591,8 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
15881591
goto journal_error;
15891592
brelse (bh2);
15901593
} else {
1591-
dxtrace(printk("Creating second level index...\n"));
1594+
dxtrace(printk(KERN_DEBUG
1595+
"Creating second level index...\n"));
15921596
memcpy((char *) entries2, (char *) entries,
15931597
icount * sizeof(struct dx_entry));
15941598
dx_set_limit(entries2, dx_node_limit(dir));

‎fs/ext4/super.c‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ static ext4_fsblk_t get_sb_block(void **data)
981981
/*todo: use simple_strtoll with >32bit ext4 */
982982
sb_block = simple_strtoul(options, &options, 0);
983983
if (*options && *options != ',') {
984-
printk("EXT4-fs: Invalid sb specification: %s\n",
984+
printk(KERN_ERR "EXT4-fs: Invalid sb specification: %s\n",
985985
(char *) *data);
986986
return 1;
987987
}
@@ -1082,7 +1082,8 @@ static int parse_options(char *options, struct super_block *sb,
10821082
#else
10831083
case Opt_user_xattr:
10841084
case Opt_nouser_xattr:
1085-
printk("EXT4 (no)user_xattr options not supported\n");
1085+
printk(KERN_ERR "EXT4 (no)user_xattr options "
1086+
"not supported\n");
10861087
break;
10871088
#endif
10881089
#ifdef CONFIG_EXT4DEV_FS_POSIX_ACL
@@ -1095,7 +1096,8 @@ static int parse_options(char *options, struct super_block *sb,
10951096
#else
10961097
case Opt_acl:
10971098
case Opt_noacl:
1098-
printk("EXT4 (no)acl options not supported\n");
1099+
printk(KERN_ERR "EXT4 (no)acl options "
1100+
"not supported\n");
10991101
break;
11001102
#endif
11011103
case Opt_reservation:
@@ -1189,8 +1191,8 @@ static int parse_options(char *options, struct super_block *sb,
11891191
sb_any_quota_suspended(sb)) &&
11901192
!sbi->s_qf_names[qtype]) {
11911193
printk(KERN_ERR
1192-
"EXT4-fs: Cannot change journaled "
1193-
"quota options when quota turned on.\n");
1194+
"EXT4-fs: Cannot change journaled "
1195+
"quota options when quota turned on.\n");
11941196
return 0;
11951197
}
11961198
qname = match_strdup(&args[0]);
@@ -1473,14 +1475,14 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es,
14731475
EXT4_INODES_PER_GROUP(sb),
14741476
sbi->s_mount_opt);
14751477

1476-
printk(KERN_INFO "EXT4 FS on %s, ", sb->s_id);
14771478
if (EXT4_SB(sb)->s_journal->j_inode == NULL) {
14781479
char b[BDEVNAME_SIZE];
14791480

1480-
printk("external journal on %s\n",
1481-
bdevname(EXT4_SB(sb)->s_journal->j_dev, b));
1481+
printk(KERN_INFO "EXT4 FS on %s, external journal on %s\n",
1482+
sb->s_id, bdevname(EXT4_SB(sb)->s_journal->j_dev, b));
14821483
} else {
1483-
printk("internal journal\n");
1484+
printk(KERN_INFO "EXT4 FS on %s, internal journal\n",
1485+
sb->s_id);
14841486
}
14851487
return res;
14861488
}
@@ -2715,6 +2717,11 @@ static int ext4_load_journal(struct super_block *sb,
27152717
return -EINVAL;
27162718
}
27172719

2720+
if (journal->j_flags & JBD2_BARRIER)
2721+
printk(KERN_INFO "EXT4-fs: barriers enabled\n");
2722+
else
2723+
printk(KERN_INFO "EXT4-fs: barriers disabled\n");
2724+
27182725
if (!really_read_only && test_opt(sb, UPDATE_JOURNAL)) {
27192726
err = jbd2_journal_update_format(journal);
27202727
if (err) {

0 commit comments

Comments
 (0)