nilfs2: Logging style changes
cover nilfs2: Logging style changes
Reduce object size and use more common kernel logging styles.
Joe Perches (2):
nilfs2: Convert __nilfs_msg to integrate the level and format
nilfs2: Use a more common logging style
fs/nilfs2/alloc.c | 38 +++++++++---------- fs/nilfs2/btree.c | 42 ++++++++++----------- fs/nilfs2/cpfile.c | 10 ++--- fs/nilfs2/dat.c | 14 +++---- fs/nilfs2/direct.c | 14 ++++--- fs/nilfs2/gcinode.c | 2 +- fs/nilfs2/ifile.c | 4 +- fs/nilfs2/inode.c | 29 +++++++-------- fs/nilfs2/ioctl.c | 37 +++++++++---------- fs/nilfs2/mdt.c | 2 +- fs/nilfs2/namei.c | 6 +-- fs/nilfs2/nilfs.h | 18 ++++++--- fs/nilfs2/page.c | 11 +++--- fs/nilfs2/recovery.c | 32 +++++++--------- fs/nilfs2/segbuf.c | 2 +- fs/nilfs2/segment.c | 38 +++++++++---------- fs/nilfs2/sufile.c | 29 +++++++-------- fs/nilfs2/super.c | 73 +++++++++++++++++++------------------ fs/nilfs2/sysfs.c | 29 +++++++-------- fs/nilfs2/the_nilfs.c | 85 ++++++++++++++++++++----------------------- 20 files changed, 254 insertions(+), 261 deletions(-)
Signature · 1 line
2.24.0
PATCH 1/2 nilfs2: Convert __nilfs_msg to integrate the level and format
Reduce object size a bit by removing the KERN_<LEVEL> as a separate argument and adding it to the format string.
Reduce overall object size by about ~.5% (x86-64 defconfig w/ nilfs2)
old:
$ size -t fs/nilfs2/built-in.a | tail -1 191738 8676 44 200458 30f0a (TOTALS)
new:
$ size -t fs/nilfs2/built-in.a | tail -1 190971 8676 44 199691 30c0b (TOTALS)
--- fs/nilfs2/nilfs.h | 9 ++++----- fs/nilfs2/super.c | 16 +++++++++++----- 2 files changed, 15 insertions(+), 10 deletions(-)
fs/nilfs2/nilfs.h +4 -5
@@ -289,9 +289,8 @@ static inline int nilfs_mark_inode_dirty_sync(struct inode *inode)/* super.c */ extern struct inode *nilfs_alloc_inode (struct super_block *); -extern __printf(3, 4) -void __nilfs_msg(struct super_block *sb, const char *level, - const char *fmt, ...); +__printf(2, 3) +void __nilfs_msg (struct super_block *sb,const char *fmt, ...); extern __printf(3, 4) void __nilfs_error(struct super_block *sb, const char *function, const char *fmt, ...);
@@ -299,7 +298,7 @@ void __nilfs_error(struct super_block *sb, const char *function,#ifdef CONFIG_PRINTK #define nilfs_msg (sb, level, fmt, ...) \ - __nilfs_msg(sb, level, fmt, ##__VA_ARGS__) + __nilfs_msg(sb, level fmt, ##__VA_ARGS__)#define nilfs_error (sb, fmt, ...) \ __nilfs_error(sb, __func__, fmt, ##__VA_ARGS__)
@@ -307,7 +306,7 @@ void __nilfs_error(struct super_block *sb, const char *function,#define nilfs_msg (sb, level, fmt, ...) \ do { \ - no_printk(fmt, ##__VA_ARGS__); \ + no_printk(level fmt, ##__VA_ARGS__); \ (void)(sb); \ } while (0)#define nilfs_error (sb, fmt, ...) \
fs/nilfs2/super.c +11 -5
@@ -62,19 +62,25 @@ struct kmem_cache *nilfs_btree_path_cache;static int nilfs_setup_super (struct super_block *sb,int is_mount);static int nilfs_remount (struct super_block *sb,int *flags,char *data); -void __nilfs_msg (struct super_block *sb,const char *level,const char *fmt, - ...) +void __nilfs_msg (struct super_block *sb,const char *fmt, ...) {struct va_format vaf;va_list args; +int level;va_start (args, fmt); - vaf.fmt = fmt; + + level =printk_get_level (fmt); + vaf.fmt =printk_skip_level (fmt); vaf.va = &args; +if (sb) -printk ("%sNILFS (%s): %pV\n" , level, sb->s_id, &vaf); +printk ("%c%cNILFS (%s): %pV\n" , +KERN_SOH_ASCII , level, sb->s_id, &vaf);else -printk ("%sNILFS: %pV\n" , level, &vaf); +printk ("%c%cNILFS: %pV\n" , +KERN_SOH_ASCII , level, &vaf); +va_end (args); }
Signature · 1 line
2.24.0
PATCH 2/2 nilfs2: Use a more common logging style
In reply to Joe PerchesAdd macros for nilfs_<level>(sb, fmt, ...) and convert the uses of 'nilfs_msg(sb, KERN_<LEVEL>, ...)' to 'nilfs_<level>(sb, ...)' so nilfs2 uses a logging style more like the typical kernel logging style.
Miscellanea:
o Realign arguments for these uses
--- fs/nilfs2/alloc.c | 38 +++++++++---------- fs/nilfs2/btree.c | 42 ++++++++++----------- fs/nilfs2/cpfile.c | 10 ++--- fs/nilfs2/dat.c | 14 +++---- fs/nilfs2/direct.c | 14 ++++--- fs/nilfs2/gcinode.c | 2 +- fs/nilfs2/ifile.c | 4 +- fs/nilfs2/inode.c | 29 +++++++-------- fs/nilfs2/ioctl.c | 37 +++++++++---------- fs/nilfs2/mdt.c | 2 +- fs/nilfs2/namei.c | 6 +-- fs/nilfs2/nilfs.h | 9 +++++ fs/nilfs2/page.c | 11 +++--- fs/nilfs2/recovery.c | 32 +++++++--------- fs/nilfs2/segbuf.c | 2 +- fs/nilfs2/segment.c | 38 +++++++++---------- fs/nilfs2/sufile.c | 29 +++++++-------- fs/nilfs2/super.c | 57 ++++++++++++++--------------- fs/nilfs2/sysfs.c | 29 +++++++-------- fs/nilfs2/the_nilfs.c | 85 ++++++++++++++++++++----------------------- 20 files changed, 239 insertions(+), 251 deletions(-)
fs/nilfs2/alloc.c +19 -19
@@ -613,10 +613,10 @@ void nilfs_palloc_commit_free_entry(struct inode *inode, lock =nilfs_mdt_bgl_lock (inode, group);if (!nilfs_clear_bit_atomic (lock, group_offset, bitmap)) -nilfs_msg (inode->i_sb,KERN_WARNING , -"%s (ino=%lu): entry number %llu already freed" , - __func__, inode->i_ino, - (unsigned long long )req->pr_entry_nr); +nilfs_warn (inode->i_sb, +"%s (ino=%lu): entry number %llu already freed" , + __func__, inode->i_ino, + (unsigned long long )req->pr_entry_nr);else nilfs_palloc_group_desc_add_entries (desc, lock,1 );
@@ -654,10 +654,10 @@ void nilfs_palloc_abort_alloc_entry(struct inode *inode, lock =nilfs_mdt_bgl_lock (inode, group);if (!nilfs_clear_bit_atomic (lock, group_offset, bitmap)) -nilfs_msg (inode->i_sb,KERN_WARNING , -"%s (ino=%lu): entry number %llu already freed" , - __func__, inode->i_ino, - (unsigned long long )req->pr_entry_nr); +nilfs_warn (inode->i_sb, +"%s (ino=%lu): entry number %llu already freed" , + __func__, inode->i_ino, + (unsigned long long )req->pr_entry_nr);else nilfs_palloc_group_desc_add_entries (desc, lock,1 );
@@ -763,10 +763,10 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems) do { if (!nilfs_clear_bit_atomic(lock, group_offset, bitmap)) { - nilfs_msg(inode->i_sb, KERN_WARNING, - "%s (ino=%lu): entry number %llu already freed", - __func__, inode->i_ino, - (unsigned long long)entry_nrs[j]); + nilfs_warn(inode->i_sb, + "%s (ino=%lu): entry number %llu already freed", + __func__, inode->i_ino, + (unsigned long long)entry_nrs[j]); } else { n++; }
@@ -808,10 +808,10 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems) ret =nilfs_palloc_delete_entry_block (inode, last_nrs[k]);if (ret && ret != -ENOENT ) -nilfs_msg (inode->i_sb,KERN_WARNING , -"error %d deleting block that object (entry=%llu, ino=%lu) belongs to" , - ret, (unsigned long long )last_nrs[k], - inode->i_ino); +nilfs_warn (inode->i_sb, +"error %d deleting block that object (entry=%llu, ino=%lu) belongs to" , + ret, (unsigned long long )last_nrs[k], + inode->i_ino); } desc_kaddr =kmap_atomic (desc_bh->b_page);
@@ -826,9 +826,9 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)if (nfree ==nilfs_palloc_entries_per_group (inode)) { ret =nilfs_palloc_delete_bitmap_block (inode, group);if (ret && ret != -ENOENT ) -nilfs_msg (inode->i_sb,KERN_WARNING , -"error %d deleting bitmap block of group=%lu, ino=%lu" , - ret, group, inode->i_ino); +nilfs_warn (inode->i_sb, +"error %d deleting bitmap block of group=%lu, ino=%lu" , + ret, group, inode->i_ino); } }return 0 ;
fs/nilfs2/btree.c +21 -21
78 lines not on this page · raw message
fs/nilfs2/cpfile.c +4 -6
@@ -322,7 +322,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,int ret, ncps, nicps, nss, count, i;if (unlikely (start ==0 || start > end)) { -nilfs_msg (cpfile->i_sb,KERN_ERR , +nilfs_err (cpfile->i_sb,"cannot delete checkpoints: invalid range [%llu, %llu)" , (unsigned long long )start, (unsigned long long )end);return -EINVAL ;
@@ -376,7 +376,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, cpfile, cno);if (ret ==0 )continue ; -nilfs_msg (cpfile->i_sb,KERN_ERR , +nilfs_err (cpfile->i_sb,"error %d deleting checkpoint block" , ret);break ;
@@ -981,12 +981,10 @@ int nilfs_cpfile_read(struct super_block *sb, size_t cpsize,int err;if (cpsize > sb->s_blocksize) { -nilfs_msg (sb,KERN_ERR , -"too large checkpoint size: %zu bytes" , cpsize); +nilfs_err (sb,"too large checkpoint size: %zu bytes" , cpsize);return -EINVAL ; }else if (cpsize <NILFS_MIN_CHECKPOINT_SIZE ) { -nilfs_msg (sb,KERN_ERR , -"too small checkpoint size: %zu bytes" , cpsize); +nilfs_err (sb,"too small checkpoint size: %zu bytes" , cpsize);return -EINVAL ; }
fs/nilfs2/dat.c +7 -7
@@ -340,11 +340,11 @@ int nilfs_dat_move(struct inode *dat, __u64 vblocknr, sector_t blocknr) kaddr =kmap_atomic (entry_bh->b_page); entry =nilfs_palloc_block_get_entry (dat, vblocknr, entry_bh, kaddr);if (unlikely (entry->de_blocknr ==cpu_to_le64 (0 ))) { -nilfs_msg (dat->i_sb,KERN_CRIT , -"%s: invalid vblocknr = %llu, [%llu, %llu)" , - __func__, (unsigned long long )vblocknr, - (unsigned long long )le64_to_cpu (entry->de_start), - (unsigned long long )le64_to_cpu (entry->de_end)); +nilfs_crit (dat->i_sb, +"%s: invalid vblocknr = %llu, [%llu, %llu)" , + __func__, (unsigned long long )vblocknr, + (unsigned long long )le64_to_cpu (entry->de_start), + (unsigned long long )le64_to_cpu (entry->de_end));kunmap_atomic (kaddr);brelse (entry_bh);return -EINVAL ;
@@ -471,11 +471,11 @@ int nilfs_dat_read(struct super_block *sb, size_t entry_size,int err;if (entry_size > sb->s_blocksize) { -nilfs_msg (sb,KERN_ERR ,"too large DAT entry size: %zu bytes" , +nilfs_err (sb,"too large DAT entry size: %zu bytes" , entry_size);return -EINVAL ; }else if (entry_size <NILFS_MIN_DAT_ENTRY_SIZE ) { -nilfs_msg (sb,KERN_ERR ,"too small DAT entry size: %zu bytes" , +nilfs_err (sb,"too small DAT entry size: %zu bytes" , entry_size);return -EINVAL ; }
fs/nilfs2/direct.c +8 -6
@@ -328,16 +328,18 @@ static int nilfs_direct_assign(struct nilfs_bmap *bmap, key =nilfs_bmap_data_get_key (bmap, *bh);if (unlikely (key >NILFS_DIRECT_KEY_MAX )) { -nilfs_msg (bmap->b_inode->i_sb,KERN_CRIT , -"%s (ino=%lu): invalid key: %llu" , __func__, - bmap->b_inode->i_ino, (unsigned long long )key); +nilfs_crit (bmap->b_inode->i_sb, +"%s (ino=%lu): invalid key: %llu" , + __func__, + bmap->b_inode->i_ino, (unsigned long long )key);return -EINVAL ; } ptr =nilfs_direct_get_ptr (bmap, key);if (unlikely (ptr ==NILFS_BMAP_INVALID_PTR )) { -nilfs_msg (bmap->b_inode->i_sb,KERN_CRIT , -"%s (ino=%lu): invalid pointer: %llu" , __func__, - bmap->b_inode->i_ino, (unsigned long long )ptr); +nilfs_crit (bmap->b_inode->i_sb, +"%s (ino=%lu): invalid pointer: %llu" , + __func__, + bmap->b_inode->i_ino, (unsigned long long )ptr);return -EINVAL ; }
fs/nilfs2/gcinode.c +1 -1
@@ -142,7 +142,7 @@ int nilfs_gccache_wait_and_mark_dirty(struct buffer_head *bh)if (!buffer_uptodate (bh)) {struct inode *inode = bh->b_page->mapping->host; -nilfs_msg (inode->i_sb,KERN_ERR , +nilfs_err (inode->i_sb,"I/O error reading %s block for GC (ino=%lu, vblocknr=%llu)" ,buffer_nilfs_node (bh) ?"node" :"data" , inode->i_ino, (unsigned long long )bh->b_blocknr);
fs/nilfs2/ifile.c +2 -2
@@ -142,8 +142,8 @@ int nilfs_ifile_get_inode_block(struct inode *ifile, ino_t ino, err =nilfs_palloc_get_entry_block (ifile, ino,0 , out_bh);if (unlikely (err)) -nilfs_msg (sb,KERN_WARNING ,"error %d reading inode: ino=%lu" , - err, (unsigned long )ino); +nilfs_warn (sb,"error %d reading inode: ino=%lu" , + err, (unsigned long )ino);return err; }
fs/nilfs2/inode.c +14 -15
@@ -103,10 +103,10 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,* However, the page having this block must * be locked in this case. */ -nilfs_msg (inode->i_sb,KERN_WARNING , -"%s (ino=%lu): a race condition while inserting a data block at offset=%llu" , - __func__, inode->i_ino, - (unsigned long long )blkoff); +nilfs_warn (inode->i_sb, +"%s (ino=%lu): a race condition while inserting a data block at offset=%llu" , + __func__, inode->i_ino, + (unsigned long long )blkoff); err =0 ; }nilfs_transaction_abort (inode->i_sb);
@@ -714,9 +714,8 @@ static void nilfs_truncate_bmap(struct nilfs_inode_info *ii, goto repeat; failed: -nilfs_msg (ii->vfs_inode.i_sb,KERN_WARNING , -"error %d truncating bmap (ino=%lu)" , ret, - ii->vfs_inode.i_ino); +nilfs_warn (ii->vfs_inode.i_sb,"error %d truncating bmap (ino=%lu)" , + ret, ii->vfs_inode.i_ino); }void nilfs_truncate (struct inode *inode)
@@ -927,9 +926,9 @@ int nilfs_set_file_dirty(struct inode *inode, unsigned int nr_dirty)* This will happen when somebody is freeing * this inode. */ -nilfs_msg (inode->i_sb,KERN_WARNING , -"cannot set file dirty (ino=%lu): the file is being freed" , - inode->i_ino); +nilfs_warn (inode->i_sb, +"cannot set file dirty (ino=%lu): the file is being freed" , + inode->i_ino);spin_unlock (&nilfs->ns_inode_lock);return -EINVAL ;/* * NILFS_I_DIRTY may remain for
@@ -950,9 +949,9 @@ int __nilfs_mark_inode_dirty(struct inode *inode, int flags) err =nilfs_load_inode_block (inode, &ibh);if (unlikely (err)) { -nilfs_msg (inode->i_sb,KERN_WARNING , -"cannot mark inode dirty (ino=%lu): error %d loading inode block" , - inode->i_ino, err); +nilfs_warn (inode->i_sb, +"cannot mark inode dirty (ino=%lu): error %d loading inode block" , + inode->i_ino, err);return err; }nilfs_update_inode (inode, ibh, flags);
@@ -978,8 +977,8 @@ void nilfs_dirty_inode(struct inode *inode, int flags)struct nilfs_mdt_info *mdi =NILFS_MDT (inode);if (is_bad_inode (inode)) { -nilfs_msg (inode->i_sb,KERN_WARNING , -"tried to mark bad_inode dirty. ignored." ); +nilfs_warn (inode->i_sb, +"tried to mark bad_inode dirty. ignored." );dump_stack ();return ; }
fs/nilfs2/ioctl.c +18 -19
@@ -569,25 +569,25 @@ static int nilfs_ioctl_move_inode_block(struct inode *inode,if (unlikely (ret <0 )) {if (ret == -ENOENT ) -nilfs_msg (inode->i_sb,KERN_CRIT , -"%s: invalid virtual block address (%s): ino=%llu, cno=%llu, offset=%llu, blocknr=%llu, vblocknr=%llu" , - __func__, vdesc->vd_flags ?"node" :"data" , - (unsigned long long )vdesc->vd_ino, - (unsigned long long )vdesc->vd_cno, - (unsigned long long )vdesc->vd_offset, - (unsigned long long )vdesc->vd_blocknr, - (unsigned long long )vdesc->vd_vblocknr); +nilfs_crit (inode->i_sb, +"%s: invalid virtual block address (%s): ino=%llu, cno=%llu, offset=%llu, blocknr=%llu, vblocknr=%llu" , + __func__, vdesc->vd_flags ?"node" :"data" , + (unsigned long long )vdesc->vd_ino, + (unsigned long long )vdesc->vd_cno, + (unsigned long long )vdesc->vd_offset, + (unsigned long long )vdesc->vd_blocknr, + (unsigned long long )vdesc->vd_vblocknr);return ret; }if (unlikely (!list_empty (&bh->b_assoc_buffers))) { -nilfs_msg (inode->i_sb,KERN_CRIT , -"%s: conflicting %s buffer: ino=%llu, cno=%llu, offset=%llu, blocknr=%llu, vblocknr=%llu" , - __func__, vdesc->vd_flags ?"node" :"data" , - (unsigned long long )vdesc->vd_ino, - (unsigned long long )vdesc->vd_cno, - (unsigned long long )vdesc->vd_offset, - (unsigned long long )vdesc->vd_blocknr, - (unsigned long long )vdesc->vd_vblocknr); +nilfs_crit (inode->i_sb, +"%s: conflicting %s buffer: ino=%llu, cno=%llu, offset=%llu, blocknr=%llu, vblocknr=%llu" , + __func__, vdesc->vd_flags ?"node" :"data" , + (unsigned long long )vdesc->vd_ino, + (unsigned long long )vdesc->vd_cno, + (unsigned long long )vdesc->vd_offset, + (unsigned long long )vdesc->vd_blocknr, + (unsigned long long )vdesc->vd_vblocknr);brelse (bh);return -EEXIST ; }
@@ -837,8 +837,7 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,return 0 ; failed: -nilfs_msg (nilfs->ns_sb,KERN_ERR ,"error %d preparing GC: %s" , ret, - msg); +nilfs_err (nilfs->ns_sb,"error %d preparing GC: %s" , ret, msg);return ret; }
@@ -947,7 +946,7 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp, ret =nilfs_ioctl_move_blocks (inode->i_sb, &argv[0 ], kbufs[0 ]);if (ret <0 ) { -nilfs_msg (inode->i_sb,KERN_ERR , +nilfs_err (inode->i_sb,"error %d preparing GC: cannot read source blocks" , ret); }else {
fs/nilfs2/mdt.c +1 -1
@@ -199,7 +199,7 @@ static int nilfs_mdt_read_block(struct inode *inode, unsigned long block, out_no_wait: err = -EIO ;if (!buffer_uptodate (first_bh)) { -nilfs_msg (inode->i_sb,KERN_ERR , +nilfs_err (inode->i_sb,"I/O error reading meta-data file (ino=%lu, block-offset=%lu)" , inode->i_ino, block); goto failed_bh;
fs/nilfs2/namei.c +3 -3
@@ -272,9 +272,9 @@ static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry) goto out;if (!inode->i_nlink) { -nilfs_msg (inode->i_sb,KERN_WARNING , -"deleting nonexistent file (ino=%lu), %d" , - inode->i_ino, inode->i_nlink); +nilfs_warn (inode->i_sb, +"deleting nonexistent file (ino=%lu), %d" , + inode->i_ino, inode->i_nlink);set_nlink (inode,1 ); } err =nilfs_delete_entry (de, page);
fs/nilfs2/nilfs.h +9 -0
@@ -317,6 +317,15 @@ void __nilfs_error(struct super_block *sb, const char *function,#endif /* CONFIG_PRINTK */ +#define nilfs_crit (sb, fmt, ...) \ + nilfs_msg(sb, KERN_CRIT, fmt, ##__VA_ARGS__) +#define nilfs_err (sb, fmt, ...) \ + nilfs_msg(sb, KERN_ERR, fmt, ##__VA_ARGS__) +#define nilfs_warn (sb, fmt, ...) \ + nilfs_msg(sb, KERN_WARNING, fmt, ##__VA_ARGS__) +#define nilfs_info (sb, fmt, ...) \ + nilfs_msg(sb, KERN_INFO, fmt, ##__VA_ARGS__) +extern struct nilfs_super_block *nilfs_read_super_block (struct super_block *,u64 ,int ,struct buffer_head **); extern int nilfs_store_magic_and_option(struct super_block *,
fs/nilfs2/page.c +5 -6
@@ -391,9 +391,8 @@ void nilfs_clear_dirty_page(struct page *page, bool silent)BUG_ON (!PageLocked (page));if (!silent) -nilfs_msg (sb,KERN_WARNING , -"discard dirty page: offset=%lld, ino=%lu" , -page_offset (page), inode->i_ino); +nilfs_warn (sb,"discard dirty page: offset=%lld, ino=%lu" , +page_offset (page), inode->i_ino);ClearPageUptodate (page);ClearPageMappedToDisk (page);
@@ -409,9 +408,9 @@ void nilfs_clear_dirty_page(struct page *page, bool silent) do { lock_buffer(bh); if (!silent) - nilfs_msg(sb, KERN_WARNING, - "discard dirty block: blocknr=%llu, size=%zu", - (u64)bh->b_blocknr, bh->b_size); + nilfs_warn(sb, + "discard dirty block: blocknr=%llu, size=%zu", + (u64)bh->b_blocknr, bh->b_size); set_mask_bits(&bh->b_state, clear_bits, 0); unlock_buffer(bh);
fs/nilfs2/recovery.c +14 -18
@@ -51,7 +51,7 @@ static int nilfs_warn_segment_error(struct super_block *sb, int err)switch (err) {case NILFS_SEG_FAIL_IO : -nilfs_msg (sb,KERN_ERR ,"I/O error reading segment" ); +nilfs_err (sb,"I/O error reading segment" );return -EIO ;case NILFS_SEG_FAIL_MAGIC : msg ="Magic number mismatch" ;
@@ -72,10 +72,10 @@ static int nilfs_warn_segment_error(struct super_block *sb, int err) msg ="No super root in the last segment" ;break ;default : -nilfs_msg (sb,KERN_ERR ,"unrecognized segment error %d" , err); +nilfs_err (sb,"unrecognized segment error %d" , err);return -EINVAL ; } -nilfs_msg (sb,KERN_WARNING ,"invalid segment: %s" , msg); +nilfs_warn (sb,"invalid segment: %s" , msg);return -EINVAL ; }
@@ -543,10 +543,10 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs,put_page (page); failed_inode: -nilfs_msg (sb,KERN_WARNING , -"error %d recovering data block (ino=%lu, block-offset=%llu)" , - err, (unsigned long )rb->ino, - (unsigned long long )rb->blkoff); +nilfs_warn (sb, +"error %d recovering data block (ino=%lu, block-offset=%llu)" , + err, (unsigned long )rb->ino, + (unsigned long long )rb->blkoff);if (!err2) err2 = err; next:
@@ -669,8 +669,7 @@ static int nilfs_do_roll_forward(struct the_nilfs *nilfs, }if (nsalvaged_blocks) { -nilfs_msg (sb,KERN_INFO ,"salvaged %lu blocks" , - nsalvaged_blocks); +nilfs_info (sb,"salvaged %lu blocks" , nsalvaged_blocks); ri->ri_need_recovery =NILFS_RECOVERY_ROLLFORWARD_DONE ; } out:
@@ -681,7 +680,7 @@ static int nilfs_do_roll_forward(struct the_nilfs *nilfs, confused: err = -EINVAL ; failed: -nilfs_msg (sb,KERN_ERR , +nilfs_err (sb,"error %d roll-forwarding partial segment at blocknr = %llu" , err, (unsigned long long )pseg_start); goto out;
@@ -703,8 +702,8 @@ static void nilfs_finish_roll_forward(struct the_nilfs *nilfs,set_buffer_dirty (bh); err =sync_dirty_buffer (bh);if (unlikely (err)) -nilfs_msg (nilfs->ns_sb,KERN_WARNING , -"buffer sync write failed during post-cleaning of recovery." ); +nilfs_warn (nilfs->ns_sb, +"buffer sync write failed during post-cleaning of recovery." );brelse (bh); }
@@ -739,8 +738,7 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs, err =nilfs_attach_checkpoint (sb, ri->ri_cno, true, &root);if (unlikely (err)) { -nilfs_msg (sb,KERN_ERR , -"error %d loading the latest checkpoint" , err); +nilfs_err (sb,"error %d loading the latest checkpoint" , err);return err; }
@@ -751,8 +749,7 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs,if (ri->ri_need_recovery ==NILFS_RECOVERY_ROLLFORWARD_DONE ) { err =nilfs_prepare_segment_for_recovery (nilfs, sb, ri);if (unlikely (err)) { -nilfs_msg (sb,KERN_ERR , -"error %d preparing segment for recovery" , +nilfs_err (sb,"error %d preparing segment for recovery" , err); goto failed; }
@@ -766,8 +763,7 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs,nilfs_detach_log_writer (sb);if (unlikely (err)) { -nilfs_msg (sb,KERN_ERR , -"error %d writing segment for recovery" , +nilfs_err (sb,"error %d writing segment for recovery" , err); goto failed; }
fs/nilfs2/segbuf.c +1 -1
@@ -505,7 +505,7 @@ static int nilfs_segbuf_wait(struct nilfs_segment_buffer *segbuf) }while (--segbuf->sb_nbio >0 );if (unlikely (atomic_read (&segbuf->sb_err) >0 )) { - nilfs_msg(segbuf->sb_super, KERN_ERR, + nilfs_err(segbuf->sb_super, "I/O error writing log (start-blocknr=%llu, block-count=%lu) in segment %llu", (unsigned long long)segbuf->sb_pseg_start, segbuf->sb_sum.nblocks,
fs/nilfs2/segment.c +19 -19
@@ -158,7 +158,7 @@ static int nilfs_prepare_segment_lock(struct super_block *sb,* it is saved and will be restored on * nilfs_transaction_commit(). */ -nilfs_msg (sb,KERN_WARNING ,"journal info from a different FS" ); +nilfs_warn (sb,"journal info from a different FS" ); save = current->journal_info; }if (!ti) {
@@ -1940,9 +1940,9 @@ static int nilfs_segctor_collect_dirty_files(struct nilfs_sc_info *sci, err =nilfs_ifile_get_inode_block ( ifile, ii->vfs_inode.i_ino, &ibh);if (unlikely (err)) { -nilfs_msg (sci->sc_super,KERN_WARNING , -"log writer: error %d getting inode block (ino=%lu)" , - err, ii->vfs_inode.i_ino); +nilfs_warn (sci->sc_super, +"log writer: error %d getting inode block (ino=%lu)" , + err, ii->vfs_inode.i_ino);return err; }spin_lock (&nilfs->ns_inode_lock);
@@ -2449,7 +2449,7 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,if (likely (!err))break ; -nilfs_msg (sb,KERN_WARNING ,"error %d cleaning segments" , err); +nilfs_warn (sb,"error %d cleaning segments" , err);set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (sci->sc_interval); }
@@ -2457,9 +2457,9 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,int ret =nilfs_discard_segments (nilfs, sci->sc_freesegs, sci->sc_nfreesegs);if (ret) { -nilfs_msg (sb,KERN_WARNING , -"error %d on discard request, turning discards off for the device" , - ret); +nilfs_warn (sb, +"error %d on discard request, turning discards off for the device" , + ret);nilfs_clear_opt (nilfs,DISCARD ); } }
@@ -2540,9 +2540,9 @@ static int nilfs_segctor_thread(void *arg)/* start sync. */ sci->sc_task = current;wake_up (&sci->sc_wait_task);/* for nilfs_segctor_start_thread() */ -nilfs_msg (sci->sc_super,KERN_INFO , -"segctord starting. Construction interval = %lu seconds, CP frequency < %lu seconds" , - sci->sc_interval /HZ , sci->sc_mjcp_freq /HZ ); +nilfs_info (sci->sc_super, +"segctord starting. Construction interval = %lu seconds, CP frequency < %lu seconds" , + sci->sc_interval /HZ , sci->sc_mjcp_freq /HZ );spin_lock (&sci->sc_state_lock); loop:
@@ -2616,8 +2616,8 @@ static int nilfs_segctor_start_thread(struct nilfs_sc_info *sci)if (IS_ERR (t)) {int err =PTR_ERR (t); -nilfs_msg (sci->sc_super,KERN_ERR , -"error %d creating segctord thread" , err); +nilfs_err (sci->sc_super,"error %d creating segctord thread" , + err);return err; }wait_event (sci->sc_wait_task, sci->sc_task !=NULL );
@@ -2727,14 +2727,14 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci)nilfs_segctor_write_out (sci);if (!list_empty (&sci->sc_dirty_files)) { -nilfs_msg (sci->sc_super,KERN_WARNING , -"disposed unprocessed dirty file(s) when stopping log writer" ); +nilfs_warn (sci->sc_super, +"disposed unprocessed dirty file(s) when stopping log writer" );nilfs_dispose_list (nilfs, &sci->sc_dirty_files,1 ); }if (!list_empty (&sci->sc_iput_queue)) { -nilfs_msg (sci->sc_super,KERN_WARNING , -"disposed unprocessed inode(s) in iput queue when stopping log writer" ); +nilfs_warn (sci->sc_super, +"disposed unprocessed inode(s) in iput queue when stopping log writer" );nilfs_dispose_list (nilfs, &sci->sc_iput_queue,1 ); }
@@ -2810,8 +2810,8 @@ void nilfs_detach_log_writer(struct super_block *sb)spin_lock (&nilfs->ns_inode_lock);if (!list_empty (&nilfs->ns_dirty_files)) {list_splice_init (&nilfs->ns_dirty_files, &garbage_list); -nilfs_msg (sb,KERN_WARNING , -"disposed unprocessed dirty file(s) when detaching log writer" ); +nilfs_warn (sb, +"disposed unprocessed dirty file(s) when detaching log writer" ); }spin_unlock (&nilfs->ns_inode_lock);up_write (&nilfs->ns_segctor_sem);
fs/nilfs2/sufile.c +13 -16
@@ -171,9 +171,9 @@ int nilfs_sufile_updatev(struct inode *sufile, __u64 *segnumv, size_t nsegs,down_write (&NILFS_MDT (sufile)->mi_sem);for (seg = segnumv; seg < segnumv + nsegs; seg++) {if (unlikely (*seg >=nilfs_sufile_get_nsegments (sufile))) { -nilfs_msg (sufile->i_sb,KERN_WARNING , -"%s: invalid segment number: %llu" , - __func__, (unsigned long long )*seg); +nilfs_warn (sufile->i_sb, +"%s: invalid segment number: %llu" , + __func__, (unsigned long long )*seg); nerr++; } }
@@ -230,9 +230,8 @@ int nilfs_sufile_update(struct inode *sufile, __u64 segnum, int create,int ret;if (unlikely (segnum >=nilfs_sufile_get_nsegments (sufile))) { -nilfs_msg (sufile->i_sb,KERN_WARNING , -"%s: invalid segment number: %llu" , - __func__, (unsigned long long )segnum); +nilfs_warn (sufile->i_sb,"%s: invalid segment number: %llu" , + __func__, (unsigned long long )segnum);return -EINVAL ; }down_write (&NILFS_MDT (sufile)->mi_sem);
@@ -410,9 +409,8 @@ void nilfs_sufile_do_cancel_free(struct inode *sufile, __u64 segnum, kaddr =kmap_atomic (su_bh->b_page); su =nilfs_sufile_block_get_segment_usage (sufile, segnum, su_bh, kaddr);if (unlikely (!nilfs_segment_usage_clean (su))) { -nilfs_msg (sufile->i_sb,KERN_WARNING , -"%s: segment %llu must be clean" , __func__, - (unsigned long long )segnum); +nilfs_warn (sufile->i_sb,"%s: segment %llu must be clean" , + __func__, (unsigned long long )segnum);kunmap_atomic (kaddr);return ; }
@@ -468,9 +466,8 @@ void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum, kaddr =kmap_atomic (su_bh->b_page); su =nilfs_sufile_block_get_segment_usage (sufile, segnum, su_bh, kaddr);if (nilfs_segment_usage_clean (su)) { -nilfs_msg (sufile->i_sb,KERN_WARNING , -"%s: segment %llu is already clean" , - __func__, (unsigned long long )segnum); +nilfs_warn (sufile->i_sb,"%s: segment %llu is already clean" , + __func__, (unsigned long long )segnum);kunmap_atomic (kaddr);return ; }
@@ -1168,12 +1165,12 @@ int nilfs_sufile_read(struct super_block *sb, size_t susize,int err;if (susize > sb->s_blocksize) { -nilfs_msg (sb,KERN_ERR , -"too large segment usage size: %zu bytes" , susize); +nilfs_err (sb,"too large segment usage size: %zu bytes" , + susize);return -EINVAL ; }else if (susize <NILFS_MIN_SEGMENT_USAGE_SIZE ) { -nilfs_msg (sb,KERN_ERR , -"too small segment usage size: %zu bytes" , susize); +nilfs_err (sb,"too small segment usage size: %zu bytes" , + susize);return -EINVAL ; }
fs/nilfs2/super.c +27 -30
183 lines not on this page · raw message
fs/nilfs2/sysfs.c +13 -16
@@ -263,8 +263,8 @@ nilfs_checkpoints_checkpoints_number_show(struct nilfs_checkpoints_attr *attr, err =nilfs_cpfile_get_stat (nilfs->ns_cpfile, &cpstat);up_read (&nilfs->ns_segctor_sem);if (err <0 ) { -nilfs_msg (nilfs->ns_sb,KERN_ERR , -"unable to get checkpoint stat: err=%d" , err); +nilfs_err (nilfs->ns_sb,"unable to get checkpoint stat: err=%d" , + err);return err; }
@@ -286,8 +286,8 @@ nilfs_checkpoints_snapshots_number_show(struct nilfs_checkpoints_attr *attr, err =nilfs_cpfile_get_stat (nilfs->ns_cpfile, &cpstat);up_read (&nilfs->ns_segctor_sem);if (err <0 ) { -nilfs_msg (nilfs->ns_sb,KERN_ERR , -"unable to get checkpoint stat: err=%d" , err); +nilfs_err (nilfs->ns_sb,"unable to get checkpoint stat: err=%d" , + err);return err; }
@@ -405,8 +405,8 @@ nilfs_segments_dirty_segments_show(struct nilfs_segments_attr *attr, err =nilfs_sufile_get_stat (nilfs->ns_sufile, &sustat);up_read (&nilfs->ns_segctor_sem);if (err <0 ) { -nilfs_msg (nilfs->ns_sb,KERN_ERR , -"unable to get segment stat: err=%d" , err); +nilfs_err (nilfs->ns_sb,"unable to get segment stat: err=%d" , + err);return err; }
@@ -779,15 +779,15 @@ nilfs_superblock_sb_update_frequency_store(struct nilfs_superblock_attr *attr, err =kstrtouint (skip_spaces (buf),0 , &val);if (err) { -nilfs_msg (nilfs->ns_sb,KERN_ERR , -"unable to convert string: err=%d" , err); +nilfs_err (nilfs->ns_sb,"unable to convert string: err=%d" , + err);return err; }if (val <NILFS_SB_FREQ ) { val =NILFS_SB_FREQ ; -nilfs_msg (nilfs->ns_sb,KERN_WARNING , -"superblock update frequency cannot be lesser than 10 seconds" ); +nilfs_warn (nilfs->ns_sb, +"superblock update frequency cannot be lesser than 10 seconds" ); }down_write (&nilfs->ns_sem);
@@ -990,8 +990,7 @@ int nilfs_sysfs_create_device_group(struct super_block *sb) nilfs->ns_dev_subgroups =kzalloc (devgrp_size,GFP_KERNEL );if (unlikely (!nilfs->ns_dev_subgroups)) { err = -ENOMEM ; -nilfs_msg (sb,KERN_ERR , -"unable to allocate memory for device group" ); +nilfs_err (sb,"unable to allocate memory for device group" ); goto failed_create_device_group; }
@@ -1101,15 +1100,13 @@ int __init nilfs_sysfs_init(void) nilfs_kset =kset_create_and_add (NILFS_ROOT_GROUP_NAME ,NULL , fs_kobj);if (!nilfs_kset) { err = -ENOMEM ; -nilfs_msg (NULL ,KERN_ERR , -"unable to create sysfs entry: err=%d" , err); +nilfs_err (NULL ,"unable to create sysfs entry: err=%d" , err); goto failed_sysfs_init; } err =sysfs_create_group (&nilfs_kset->kobj, &nilfs_feature_attr_group);if (unlikely (err)) { -nilfs_msg (NULL ,KERN_ERR , -"unable to create feature group: err=%d" , err); +nilfs_err (NULL ,"unable to create feature group: err=%d" , err); goto cleanup_sysfs_init; }
fs/nilfs2/the_nilfs.c +40 -45
221 lines not on this page · raw message
Signature · 1 line
2.24.0
Quoted 5 lines · Joe Perches
Reduce object size and use more common kernel logging styles.
Joe Perches (2):
nilfs2: Convert__nilfs_msgto integrate the level and format
nilfs2: Use a more common logging style
Applied. Thank you.
Ryusuke Konishi
Quoted 26 lines
fs/nilfs2/alloc.c | 38 +++++++++---------- fs/nilfs2/btree.c | 42 ++++++++++----------- fs/nilfs2/cpfile.c | 10 ++--- fs/nilfs2/dat.c | 14 +++---- fs/nilfs2/direct.c | 14 ++++--- fs/nilfs2/gcinode.c | 2 +- fs/nilfs2/ifile.c | 4 +- fs/nilfs2/inode.c | 29 +++++++-------- fs/nilfs2/ioctl.c | 37 +++++++++---------- fs/nilfs2/mdt.c | 2 +- fs/nilfs2/namei.c | 6 +-- fs/nilfs2/nilfs.h | 18 ++++++--- fs/nilfs2/page.c | 11 +++--- fs/nilfs2/recovery.c | 32 +++++++--------- fs/nilfs2/segbuf.c | 2 +- fs/nilfs2/segment.c | 38 +++++++++---------- fs/nilfs2/sufile.c | 29 +++++++-------- fs/nilfs2/super.c | 73 +++++++++++++++++++------------------ fs/nilfs2/sysfs.c | 29 +++++++-------- fs/nilfs2/the_nilfs.c | 85 ++++++++++++++++++++----------------------- 20 files changed, 254 insertions(+), 261 deletions(-)Signature · 1 line
2.24.0