Skip to content

Commit d1727d5

Browse files
JoePerchesnamjaejeon
authored andcommitted
exfat: Use a more common logging style
Remove the direct use of KERN_<LEVEL> in functions by creating separate exfat_<level> macros. Miscellanea: o Remove several unnecessary terminating newlines in formats o Realign arguments and fit to 80 columns where appropriate Signed-off-by: Joe Perches <[email protected]> Signed-off-by: Namjae Jeon <[email protected]>
1 parent 197298a commit d1727d5

File tree

8 files changed

+60
-74
lines changed

8 files changed

+60
-74
lines changed

fs/exfat/balloc.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ static int exfat_allocate_bitmap(struct super_block *sb,
5858
need_map_size = ((EXFAT_DATA_CLUSTER_COUNT(sbi) - 1) / BITS_PER_BYTE)
5959
+ 1;
6060
if (need_map_size != map_size) {
61-
exfat_msg(sb, KERN_ERR,
62-
"bogus allocation bitmap size(need : %u, cur : %lld)",
63-
need_map_size, map_size);
61+
exfat_err(sb, "bogus allocation bitmap size(need : %u, cur : %lld)",
62+
need_map_size, map_size);
6463
/*
6564
* Only allowed when bogus allocation
6665
* bitmap size is large
@@ -192,8 +191,7 @@ void exfat_clear_bitmap(struct inode *inode, unsigned int clu)
192191
(1 << sbi->sect_per_clus_bits), GFP_NOFS, 0);
193192

194193
if (ret_discard == -EOPNOTSUPP) {
195-
exfat_msg(sb, KERN_ERR,
196-
"discard not supported by device, disabling");
194+
exfat_err(sb, "discard not supported by device, disabling");
197195
opts->discard = 0;
198196
}
199197
}

fs/exfat/dir.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -720,9 +720,8 @@ static int exfat_dir_readahead(struct super_block *sb, sector_t sec)
720720
return 0;
721721

722722
if (sec < sbi->data_start_sector) {
723-
exfat_msg(sb, KERN_ERR,
724-
"requested sector is invalid(sect:%llu, root:%llu)",
725-
(unsigned long long)sec, sbi->data_start_sector);
723+
exfat_err(sb, "requested sector is invalid(sect:%llu, root:%llu)",
724+
(unsigned long long)sec, sbi->data_start_sector);
726725
return -EIO;
727726
}
728727

@@ -750,7 +749,7 @@ struct exfat_dentry *exfat_get_dentry(struct super_block *sb,
750749
sector_t sec;
751750

752751
if (p_dir->dir == DIR_DELETED) {
753-
exfat_msg(sb, KERN_ERR, "abnormal access to deleted dentry\n");
752+
exfat_err(sb, "abnormal access to deleted dentry");
754753
return NULL;
755754
}
756755

@@ -853,7 +852,7 @@ struct exfat_entry_set_cache *exfat_get_dentry_set(struct super_block *sb,
853852
struct buffer_head *bh;
854853

855854
if (p_dir->dir == DIR_DELETED) {
856-
exfat_msg(sb, KERN_ERR, "access to deleted dentry\n");
855+
exfat_err(sb, "access to deleted dentry");
857856
return NULL;
858857
}
859858

fs/exfat/exfat_fs.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,13 @@ void __exfat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
505505
fmt, ## args)
506506
void exfat_msg(struct super_block *sb, const char *lv, const char *fmt, ...)
507507
__printf(3, 4) __cold;
508+
#define exfat_err(sb, fmt, ...) \
509+
exfat_msg(sb, KERN_ERR, fmt, ##__VA_ARGS__)
510+
#define exfat_warn(sb, fmt, ...) \
511+
exfat_msg(sb, KERN_WARNING, fmt, ##__VA_ARGS__)
512+
#define exfat_info(sb, fmt, ...) \
513+
exfat_msg(sb, KERN_INFO, fmt, ##__VA_ARGS__)
514+
508515
void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
509516
u8 tz, __le16 time, __le16 date, u8 time_ms);
510517
void exfat_truncate_atime(struct timespec64 *ts);

fs/exfat/fatent.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ int exfat_free_cluster(struct inode *inode, struct exfat_chain *p_chain)
170170

171171
/* check cluster validation */
172172
if (p_chain->dir < 2 && p_chain->dir >= sbi->num_clusters) {
173-
exfat_msg(sb, KERN_ERR, "invalid start cluster (%u)",
174-
p_chain->dir);
173+
exfat_err(sb, "invalid start cluster (%u)", p_chain->dir);
175174
return -EIO;
176175
}
177176

@@ -305,8 +304,7 @@ int exfat_zeroed_cluster(struct inode *dir, unsigned int clu)
305304
return 0;
306305

307306
release_bhs:
308-
exfat_msg(sb, KERN_ERR, "failed zeroed sect %llu\n",
309-
(unsigned long long)blknr);
307+
exfat_err(sb, "failed zeroed sect %llu\n", (unsigned long long)blknr);
310308
for (i = 0; i < n; i++)
311309
bforget(bhs[i]);
312310
return err;
@@ -337,9 +335,8 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc,
337335
/* find new cluster */
338336
if (hint_clu == EXFAT_EOF_CLUSTER) {
339337
if (sbi->clu_srch_ptr < EXFAT_FIRST_CLUSTER) {
340-
exfat_msg(sb, KERN_ERR,
341-
"sbi->clu_srch_ptr is invalid (%u)\n",
342-
sbi->clu_srch_ptr);
338+
exfat_err(sb, "sbi->clu_srch_ptr is invalid (%u)\n",
339+
sbi->clu_srch_ptr);
343340
sbi->clu_srch_ptr = EXFAT_FIRST_CLUSTER;
344341
}
345342

@@ -350,7 +347,7 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc,
350347

351348
/* check cluster validation */
352349
if (hint_clu < EXFAT_FIRST_CLUSTER && hint_clu >= sbi->num_clusters) {
353-
exfat_msg(sb, KERN_ERR, "hint_cluster is invalid (%u)\n",
350+
exfat_err(sb, "hint_cluster is invalid (%u)",
354351
hint_clu);
355352
hint_clu = EXFAT_FIRST_CLUSTER;
356353
if (p_chain->flags == ALLOC_NO_FAT_CHAIN) {

fs/exfat/misc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void __exfat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
3232
va_start(args, fmt);
3333
vaf.fmt = fmt;
3434
vaf.va = &args;
35-
exfat_msg(sb, KERN_ERR, "error, %pV\n", &vaf);
35+
exfat_err(sb, "error, %pV", &vaf);
3636
va_end(args);
3737
}
3838

@@ -41,7 +41,7 @@ void __exfat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
4141
sb->s_id);
4242
} else if (opts->errors == EXFAT_ERRORS_RO && !sb_rdonly(sb)) {
4343
sb->s_flags |= SB_RDONLY;
44-
exfat_msg(sb, KERN_ERR, "Filesystem has been set read-only");
44+
exfat_err(sb, "Filesystem has been set read-only");
4545
}
4646
}
4747

fs/exfat/namei.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -773,8 +773,8 @@ static struct dentry *exfat_lookup(struct inode *dir, struct dentry *dentry,
773773
if (d_unhashed(alias)) {
774774
WARN_ON(alias->d_name.hash_len !=
775775
dentry->d_name.hash_len);
776-
exfat_msg(sb, KERN_INFO,
777-
"rehashed a dentry(%p) in read lookup", alias);
776+
exfat_info(sb, "rehashed a dentry(%p) in read lookup",
777+
alias);
778778
d_drop(dentry);
779779
d_rehash(alias);
780780
} else if (!S_ISDIR(i_mode)) {
@@ -819,7 +819,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
819819
exfat_chain_dup(&cdir, &ei->dir);
820820
entry = ei->entry;
821821
if (ei->dir.dir == DIR_DELETED) {
822-
exfat_msg(sb, KERN_ERR, "abnormal access to deleted dentry");
822+
exfat_err(sb, "abnormal access to deleted dentry");
823823
err = -ENOENT;
824824
goto unlock;
825825
}
@@ -974,7 +974,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
974974
entry = ei->entry;
975975

976976
if (ei->dir.dir == DIR_DELETED) {
977-
exfat_msg(sb, KERN_ERR, "abnormal access to deleted dentry");
977+
exfat_err(sb, "abnormal access to deleted dentry");
978978
err = -ENOENT;
979979
goto unlock;
980980
}
@@ -986,9 +986,8 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
986986
err = exfat_check_dir_empty(sb, &clu_to_free);
987987
if (err) {
988988
if (err == -EIO)
989-
exfat_msg(sb, KERN_ERR,
990-
"failed to exfat_check_dir_empty : err(%d)",
991-
err);
989+
exfat_err(sb, "failed to exfat_check_dir_empty : err(%d)",
990+
err);
992991
goto unlock;
993992
}
994993

@@ -1009,9 +1008,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
10091008

10101009
err = exfat_remove_entries(dir, &cdir, entry, 0, num_entries);
10111010
if (err) {
1012-
exfat_msg(sb, KERN_ERR,
1013-
"failed to exfat_remove_entries : err(%d)",
1014-
err);
1011+
exfat_err(sb, "failed to exfat_remove_entries : err(%d)", err);
10151012
goto unlock;
10161013
}
10171014
ei->dir.dir = DIR_DELETED;
@@ -1240,8 +1237,7 @@ static int __exfat_rename(struct inode *old_parent_inode,
12401237
return -EINVAL;
12411238

12421239
if (ei->dir.dir == DIR_DELETED) {
1243-
exfat_msg(sb, KERN_ERR,
1244-
"abnormal access to deleted source dentry");
1240+
exfat_err(sb, "abnormal access to deleted source dentry");
12451241
return -ENOENT;
12461242
}
12471243

@@ -1263,8 +1259,7 @@ static int __exfat_rename(struct inode *old_parent_inode,
12631259
new_ei = EXFAT_I(new_inode);
12641260

12651261
if (new_ei->dir.dir == DIR_DELETED) {
1266-
exfat_msg(sb, KERN_ERR,
1267-
"abnormal access to deleted target dentry");
1262+
exfat_err(sb, "abnormal access to deleted target dentry");
12681263
goto out;
12691264
}
12701265

@@ -1426,8 +1421,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
14261421
if (S_ISDIR(new_inode->i_mode))
14271422
drop_nlink(new_inode);
14281423
} else {
1429-
exfat_msg(sb, KERN_WARNING,
1430-
"abnormal access to an inode dropped");
1424+
exfat_warn(sb, "abnormal access to an inode dropped");
14311425
WARN_ON(new_inode->i_nlink == 0);
14321426
}
14331427
new_inode->i_ctime = EXFAT_I(new_inode)->i_crtime =

fs/exfat/nls.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -503,16 +503,14 @@ static int exfat_utf8_to_utf16(struct super_block *sb,
503503
unilen = utf8s_to_utf16s(p_cstring, len, UTF16_HOST_ENDIAN,
504504
(wchar_t *)uniname, MAX_NAME_LENGTH + 2);
505505
if (unilen < 0) {
506-
exfat_msg(sb, KERN_ERR,
507-
"failed to %s (err : %d) nls len : %d",
508-
__func__, unilen, len);
506+
exfat_err(sb, "failed to %s (err : %d) nls len : %d",
507+
__func__, unilen, len);
509508
return unilen;
510509
}
511510

512511
if (unilen > MAX_NAME_LENGTH) {
513-
exfat_msg(sb, KERN_ERR,
514-
"failed to %s (estr:ENAMETOOLONG) nls len : %d, unilen : %d > %d",
515-
__func__, len, unilen, MAX_NAME_LENGTH);
512+
exfat_err(sb, "failed to %s (estr:ENAMETOOLONG) nls len : %d, unilen : %d > %d",
513+
__func__, len, unilen, MAX_NAME_LENGTH);
516514
return -ENAMETOOLONG;
517515
}
518516

@@ -687,9 +685,8 @@ static int exfat_load_upcase_table(struct super_block *sb,
687685

688686
bh = sb_bread(sb, sector);
689687
if (!bh) {
690-
exfat_msg(sb, KERN_ERR,
691-
"failed to read sector(0x%llx)\n",
692-
(unsigned long long)sector);
688+
exfat_err(sb, "failed to read sector(0x%llx)\n",
689+
(unsigned long long)sector);
693690
ret = -EIO;
694691
goto free_table;
695692
}
@@ -722,9 +719,8 @@ static int exfat_load_upcase_table(struct super_block *sb,
722719
if (index >= 0xFFFF && utbl_checksum == checksum)
723720
return 0;
724721

725-
exfat_msg(sb, KERN_ERR,
726-
"failed to load upcase table (idx : 0x%08x, chksum : 0x%08x, utbl_chksum : 0x%08x)\n",
727-
index, checksum, utbl_checksum);
722+
exfat_err(sb, "failed to load upcase table (idx : 0x%08x, chksum : 0x%08x, utbl_chksum : 0x%08x)",
723+
index, checksum, utbl_checksum);
728724
ret = -EINVAL;
729725
free_table:
730726
exfat_free_upcase_table(sbi);

0 commit comments

Comments
 (0)