nilfs2: replace nilfs_warning() with nilfs_msg()
Use nilfs_msg() to output warning messages and get rid of nilfs_warning() function. This also removes function names from the messages unless we embed them explicitly in format strings. Instead, some messages are revised to clarify the context. [arnd@arndb.de: avoid warning about unused variables] Link: http://lkml.kernel.org/r/20160615201945.3348205-1-arnd@arndb.de Link: http://lkml.kernel.org/r/1464875891-5443-6-git-send-email-konishi.ryusuke@lab.ntt.co.jp Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
feee880fa5
commit
d6517deb01
|
@ -622,10 +622,10 @@ void nilfs_palloc_commit_free_entry(struct inode *inode,
|
||||||
lock = nilfs_mdt_bgl_lock(inode, group);
|
lock = nilfs_mdt_bgl_lock(inode, group);
|
||||||
|
|
||||||
if (!nilfs_clear_bit_atomic(lock, group_offset, bitmap))
|
if (!nilfs_clear_bit_atomic(lock, group_offset, bitmap))
|
||||||
nilfs_warning(inode->i_sb, __func__,
|
nilfs_msg(inode->i_sb, KERN_WARNING,
|
||||||
"entry number %llu already freed: ino=%lu",
|
"%s (ino=%lu): entry number %llu already freed",
|
||||||
(unsigned long long)req->pr_entry_nr,
|
__func__, inode->i_ino,
|
||||||
(unsigned long)inode->i_ino);
|
(unsigned long long)req->pr_entry_nr);
|
||||||
else
|
else
|
||||||
nilfs_palloc_group_desc_add_entries(desc, lock, 1);
|
nilfs_palloc_group_desc_add_entries(desc, lock, 1);
|
||||||
|
|
||||||
|
@ -663,10 +663,10 @@ void nilfs_palloc_abort_alloc_entry(struct inode *inode,
|
||||||
lock = nilfs_mdt_bgl_lock(inode, group);
|
lock = nilfs_mdt_bgl_lock(inode, group);
|
||||||
|
|
||||||
if (!nilfs_clear_bit_atomic(lock, group_offset, bitmap))
|
if (!nilfs_clear_bit_atomic(lock, group_offset, bitmap))
|
||||||
nilfs_warning(inode->i_sb, __func__,
|
nilfs_msg(inode->i_sb, KERN_WARNING,
|
||||||
"entry number %llu already freed: ino=%lu",
|
"%s (ino=%lu): entry number %llu already freed",
|
||||||
(unsigned long long)req->pr_entry_nr,
|
__func__, inode->i_ino,
|
||||||
(unsigned long)inode->i_ino);
|
(unsigned long long)req->pr_entry_nr);
|
||||||
else
|
else
|
||||||
nilfs_palloc_group_desc_add_entries(desc, lock, 1);
|
nilfs_palloc_group_desc_add_entries(desc, lock, 1);
|
||||||
|
|
||||||
|
@ -772,10 +772,10 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
|
||||||
do {
|
do {
|
||||||
if (!nilfs_clear_bit_atomic(lock, group_offset,
|
if (!nilfs_clear_bit_atomic(lock, group_offset,
|
||||||
bitmap)) {
|
bitmap)) {
|
||||||
nilfs_warning(inode->i_sb, __func__,
|
nilfs_msg(inode->i_sb, KERN_WARNING,
|
||||||
"entry number %llu already freed: ino=%lu",
|
"%s (ino=%lu): entry number %llu already freed",
|
||||||
(unsigned long long)entry_nrs[j],
|
__func__, inode->i_ino,
|
||||||
(unsigned long)inode->i_ino);
|
(unsigned long long)entry_nrs[j]);
|
||||||
} else {
|
} else {
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
@ -816,12 +816,11 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
|
||||||
for (k = 0; k < nempties; k++) {
|
for (k = 0; k < nempties; k++) {
|
||||||
ret = nilfs_palloc_delete_entry_block(inode,
|
ret = nilfs_palloc_delete_entry_block(inode,
|
||||||
last_nrs[k]);
|
last_nrs[k]);
|
||||||
if (ret && ret != -ENOENT) {
|
if (ret && ret != -ENOENT)
|
||||||
nilfs_warning(inode->i_sb, __func__,
|
nilfs_msg(inode->i_sb, KERN_WARNING,
|
||||||
"failed to delete block of entry %llu: ino=%lu, err=%d",
|
"error %d deleting block that object (entry=%llu, ino=%lu) belongs to",
|
||||||
(unsigned long long)last_nrs[k],
|
ret, (unsigned long long)last_nrs[k],
|
||||||
(unsigned long)inode->i_ino, ret);
|
inode->i_ino);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
desc_kaddr = kmap_atomic(desc_bh->b_page);
|
desc_kaddr = kmap_atomic(desc_bh->b_page);
|
||||||
|
@ -835,12 +834,10 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
|
||||||
|
|
||||||
if (nfree == nilfs_palloc_entries_per_group(inode)) {
|
if (nfree == nilfs_palloc_entries_per_group(inode)) {
|
||||||
ret = nilfs_palloc_delete_bitmap_block(inode, group);
|
ret = nilfs_palloc_delete_bitmap_block(inode, group);
|
||||||
if (ret && ret != -ENOENT) {
|
if (ret && ret != -ENOENT)
|
||||||
nilfs_warning(inode->i_sb, __func__,
|
nilfs_msg(inode->i_sb, KERN_WARNING,
|
||||||
"failed to delete bitmap block of group %lu: ino=%lu, err=%d",
|
"error %d deleting bitmap block of group=%lu, ino=%lu",
|
||||||
group,
|
ret, group, inode->i_ino);
|
||||||
(unsigned long)inode->i_ino, ret);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -151,8 +151,8 @@ int nilfs_ifile_get_inode_block(struct inode *ifile, ino_t ino,
|
||||||
|
|
||||||
err = nilfs_palloc_get_entry_block(ifile, ino, 0, out_bh);
|
err = nilfs_palloc_get_entry_block(ifile, ino, 0, out_bh);
|
||||||
if (unlikely(err))
|
if (unlikely(err))
|
||||||
nilfs_warning(sb, __func__, "unable to read inode: %lu",
|
nilfs_msg(sb, KERN_WARNING, "error %d reading inode: ino=%lu",
|
||||||
(unsigned long) ino);
|
err, (unsigned long)ino);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -723,9 +723,9 @@ repeat:
|
||||||
goto repeat;
|
goto repeat;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
nilfs_warning(ii->vfs_inode.i_sb, __func__,
|
nilfs_msg(ii->vfs_inode.i_sb, KERN_WARNING,
|
||||||
"failed to truncate bmap (ino=%lu, err=%d)",
|
"error %d truncating bmap (ino=%lu)", ret,
|
||||||
ii->vfs_inode.i_ino, ret);
|
ii->vfs_inode.i_ino);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nilfs_truncate(struct inode *inode)
|
void nilfs_truncate(struct inode *inode)
|
||||||
|
@ -936,9 +936,9 @@ int nilfs_set_file_dirty(struct inode *inode, unsigned int nr_dirty)
|
||||||
* This will happen when somebody is freeing
|
* This will happen when somebody is freeing
|
||||||
* this inode.
|
* this inode.
|
||||||
*/
|
*/
|
||||||
nilfs_warning(inode->i_sb, __func__,
|
nilfs_msg(inode->i_sb, KERN_WARNING,
|
||||||
"cannot get inode (ino=%lu)",
|
"cannot set file dirty (ino=%lu): the file is being freed",
|
||||||
inode->i_ino);
|
inode->i_ino);
|
||||||
spin_unlock(&nilfs->ns_inode_lock);
|
spin_unlock(&nilfs->ns_inode_lock);
|
||||||
return -EINVAL; /*
|
return -EINVAL; /*
|
||||||
* NILFS_I_DIRTY may remain for
|
* NILFS_I_DIRTY may remain for
|
||||||
|
@ -959,8 +959,9 @@ int __nilfs_mark_inode_dirty(struct inode *inode, int flags)
|
||||||
|
|
||||||
err = nilfs_load_inode_block(inode, &ibh);
|
err = nilfs_load_inode_block(inode, &ibh);
|
||||||
if (unlikely(err)) {
|
if (unlikely(err)) {
|
||||||
nilfs_warning(inode->i_sb, __func__,
|
nilfs_msg(inode->i_sb, KERN_WARNING,
|
||||||
"failed to reget inode block.");
|
"cannot mark inode dirty (ino=%lu): error %d loading inode block",
|
||||||
|
inode->i_ino, err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
nilfs_update_inode(inode, ibh, flags);
|
nilfs_update_inode(inode, ibh, flags);
|
||||||
|
@ -986,8 +987,8 @@ void nilfs_dirty_inode(struct inode *inode, int flags)
|
||||||
struct nilfs_mdt_info *mdi = NILFS_MDT(inode);
|
struct nilfs_mdt_info *mdi = NILFS_MDT(inode);
|
||||||
|
|
||||||
if (is_bad_inode(inode)) {
|
if (is_bad_inode(inode)) {
|
||||||
nilfs_warning(inode->i_sb, __func__,
|
nilfs_msg(inode->i_sb, KERN_WARNING,
|
||||||
"tried to mark bad_inode dirty. ignored.");
|
"tried to mark bad_inode dirty. ignored.");
|
||||||
dump_stack();
|
dump_stack();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,9 +283,9 @@ static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!inode->i_nlink) {
|
if (!inode->i_nlink) {
|
||||||
nilfs_warning(inode->i_sb, __func__,
|
nilfs_msg(inode->i_sb, KERN_WARNING,
|
||||||
"deleting nonexistent file (%lu), %d",
|
"deleting nonexistent file (ino=%lu), %d",
|
||||||
inode->i_ino, inode->i_nlink);
|
inode->i_ino, inode->i_nlink);
|
||||||
set_nlink(inode, 1);
|
set_nlink(inode, 1);
|
||||||
}
|
}
|
||||||
err = nilfs_delete_entry(de, page);
|
err = nilfs_delete_entry(de, page);
|
||||||
|
|
|
@ -306,8 +306,6 @@ void __nilfs_msg(struct super_block *sb, const char *level,
|
||||||
extern __printf(3, 4)
|
extern __printf(3, 4)
|
||||||
void __nilfs_error(struct super_block *sb, const char *function,
|
void __nilfs_error(struct super_block *sb, const char *function,
|
||||||
const char *fmt, ...);
|
const char *fmt, ...);
|
||||||
extern __printf(3, 4)
|
|
||||||
void nilfs_warning(struct super_block *, const char *, const char *, ...);
|
|
||||||
|
|
||||||
#ifdef CONFIG_PRINTK
|
#ifdef CONFIG_PRINTK
|
||||||
|
|
||||||
|
@ -319,7 +317,10 @@ void nilfs_warning(struct super_block *, const char *, const char *, ...);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define nilfs_msg(sb, level, fmt, ...) \
|
#define nilfs_msg(sb, level, fmt, ...) \
|
||||||
no_printk(fmt, ##__VA_ARGS__)
|
do { \
|
||||||
|
no_printk(fmt, ##__VA_ARGS__); \
|
||||||
|
(void)(sb); \
|
||||||
|
} while (0)
|
||||||
#define nilfs_error(sb, fmt, ...) \
|
#define nilfs_error(sb, fmt, ...) \
|
||||||
do { \
|
do { \
|
||||||
no_printk(fmt, ##__VA_ARGS__); \
|
no_printk(fmt, ##__VA_ARGS__); \
|
||||||
|
|
|
@ -403,11 +403,10 @@ void nilfs_clear_dirty_page(struct page *page, bool silent)
|
||||||
|
|
||||||
BUG_ON(!PageLocked(page));
|
BUG_ON(!PageLocked(page));
|
||||||
|
|
||||||
if (!silent) {
|
if (!silent)
|
||||||
nilfs_warning(sb, __func__,
|
nilfs_msg(sb, KERN_WARNING,
|
||||||
"discard page: offset %lld, ino %lu",
|
"discard dirty page: offset=%lld, ino=%lu",
|
||||||
page_offset(page), inode->i_ino);
|
page_offset(page), inode->i_ino);
|
||||||
}
|
|
||||||
|
|
||||||
ClearPageUptodate(page);
|
ClearPageUptodate(page);
|
||||||
ClearPageMappedToDisk(page);
|
ClearPageMappedToDisk(page);
|
||||||
|
@ -422,11 +421,11 @@ void nilfs_clear_dirty_page(struct page *page, bool silent)
|
||||||
bh = head = page_buffers(page);
|
bh = head = page_buffers(page);
|
||||||
do {
|
do {
|
||||||
lock_buffer(bh);
|
lock_buffer(bh);
|
||||||
if (!silent) {
|
if (!silent)
|
||||||
nilfs_warning(sb, __func__,
|
nilfs_msg(sb, KERN_WARNING,
|
||||||
"discard block %llu, size %zu",
|
"discard dirty block: blocknr=%llu, size=%zu",
|
||||||
(u64)bh->b_blocknr, bh->b_size);
|
(u64)bh->b_blocknr, bh->b_size);
|
||||||
}
|
|
||||||
set_mask_bits(&bh->b_state, clear_bits, 0);
|
set_mask_bits(&bh->b_state, clear_bits, 0);
|
||||||
unlock_buffer(bh);
|
unlock_buffer(bh);
|
||||||
} while (bh = bh->b_this_page, bh != head);
|
} while (bh = bh->b_this_page, bh != head);
|
||||||
|
|
|
@ -1951,8 +1951,9 @@ static int nilfs_segctor_collect_dirty_files(struct nilfs_sc_info *sci,
|
||||||
err = nilfs_ifile_get_inode_block(
|
err = nilfs_ifile_get_inode_block(
|
||||||
ifile, ii->vfs_inode.i_ino, &ibh);
|
ifile, ii->vfs_inode.i_ino, &ibh);
|
||||||
if (unlikely(err)) {
|
if (unlikely(err)) {
|
||||||
nilfs_warning(sci->sc_super, __func__,
|
nilfs_msg(sci->sc_super, KERN_WARNING,
|
||||||
"failed to get inode block.");
|
"log writer: error %d getting inode block (ino=%lu)",
|
||||||
|
err, ii->vfs_inode.i_ino);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
mark_buffer_dirty(ibh);
|
mark_buffer_dirty(ibh);
|
||||||
|
@ -2458,8 +2459,7 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
|
||||||
if (likely(!err))
|
if (likely(!err))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
nilfs_warning(sb, __func__,
|
nilfs_msg(sb, KERN_WARNING, "error %d cleaning segments", err);
|
||||||
"segment construction failed. (err=%d)", err);
|
|
||||||
set_current_state(TASK_INTERRUPTIBLE);
|
set_current_state(TASK_INTERRUPTIBLE);
|
||||||
schedule_timeout(sci->sc_interval);
|
schedule_timeout(sci->sc_interval);
|
||||||
}
|
}
|
||||||
|
@ -2738,14 +2738,14 @@ static void nilfs_segctor_destroy(struct nilfs_sc_info *sci)
|
||||||
nilfs_segctor_write_out(sci);
|
nilfs_segctor_write_out(sci);
|
||||||
|
|
||||||
if (!list_empty(&sci->sc_dirty_files)) {
|
if (!list_empty(&sci->sc_dirty_files)) {
|
||||||
nilfs_warning(sci->sc_super, __func__,
|
nilfs_msg(sci->sc_super, KERN_WARNING,
|
||||||
"dirty file(s) after the final construction");
|
"disposed unprocessed dirty file(s) when stopping log writer");
|
||||||
nilfs_dispose_list(nilfs, &sci->sc_dirty_files, 1);
|
nilfs_dispose_list(nilfs, &sci->sc_dirty_files, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!list_empty(&sci->sc_iput_queue)) {
|
if (!list_empty(&sci->sc_iput_queue)) {
|
||||||
nilfs_warning(sci->sc_super, __func__,
|
nilfs_msg(sci->sc_super, KERN_WARNING,
|
||||||
"iput queue is not empty");
|
"disposed unprocessed inode(s) in iput queue when stopping log writer");
|
||||||
nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 1);
|
nilfs_dispose_list(nilfs, &sci->sc_iput_queue, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2821,8 +2821,8 @@ void nilfs_detach_log_writer(struct super_block *sb)
|
||||||
spin_lock(&nilfs->ns_inode_lock);
|
spin_lock(&nilfs->ns_inode_lock);
|
||||||
if (!list_empty(&nilfs->ns_dirty_files)) {
|
if (!list_empty(&nilfs->ns_dirty_files)) {
|
||||||
list_splice_init(&nilfs->ns_dirty_files, &garbage_list);
|
list_splice_init(&nilfs->ns_dirty_files, &garbage_list);
|
||||||
nilfs_warning(sb, __func__,
|
nilfs_msg(sb, KERN_WARNING,
|
||||||
"Hit dirty file after stopped log writer");
|
"disposed unprocessed dirty file(s) when detaching log writer");
|
||||||
}
|
}
|
||||||
spin_unlock(&nilfs->ns_inode_lock);
|
spin_unlock(&nilfs->ns_inode_lock);
|
||||||
up_write(&nilfs->ns_segctor_sem);
|
up_write(&nilfs->ns_segctor_sem);
|
||||||
|
|
|
@ -115,8 +115,7 @@ static void nilfs_set_error(struct super_block *sb)
|
||||||
*
|
*
|
||||||
* This implements the body of nilfs_error() macro. Normally,
|
* This implements the body of nilfs_error() macro. Normally,
|
||||||
* nilfs_error() should be used. As for sustainable errors such as a
|
* nilfs_error() should be used. As for sustainable errors such as a
|
||||||
* single-shot I/O error, nilfs_warning() or printk() should be used
|
* single-shot I/O error, nilfs_msg() should be used instead.
|
||||||
* instead.
|
|
||||||
*
|
*
|
||||||
* Callers should not add a trailing newline since this will do it.
|
* Callers should not add a trailing newline since this will do it.
|
||||||
*/
|
*/
|
||||||
|
@ -151,24 +150,6 @@ void __nilfs_error(struct super_block *sb, const char *function,
|
||||||
sb->s_id);
|
sb->s_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nilfs_warning(struct super_block *sb, const char *function,
|
|
||||||
const char *fmt, ...)
|
|
||||||
{
|
|
||||||
struct va_format vaf;
|
|
||||||
va_list args;
|
|
||||||
|
|
||||||
va_start(args, fmt);
|
|
||||||
|
|
||||||
vaf.fmt = fmt;
|
|
||||||
vaf.va = &args;
|
|
||||||
|
|
||||||
printk(KERN_WARNING "NILFS warning (device %s): %s: %pV\n",
|
|
||||||
sb->s_id, function, &vaf);
|
|
||||||
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct inode *nilfs_alloc_inode(struct super_block *sb)
|
struct inode *nilfs_alloc_inode(struct super_block *sb)
|
||||||
{
|
{
|
||||||
struct nilfs_inode_info *ii;
|
struct nilfs_inode_info *ii;
|
||||||
|
|
Loading…
Reference in New Issue