Commit feee880f authored by Ryusuke Konishi's avatar Ryusuke Konishi Committed by Linus Torvalds

nilfs2: reduce bare use of printk() with nilfs_msg()

Replace most use of printk() in nilfs2 implementation with nilfs_msg(),
and reduce the following checkpatch.pl warning:

  "WARNING: Prefer [subsystem eg: netdev]_crit([subsystem]dev, ...
   then dev_crit(dev, ... then pr_crit(...  to printk(KERN_CRIT ..."

This patch also fixes a minor checkpatch warning "WARNING: quoted string
split across lines" that often accompanies the prior warning, and amends
message format as needed.

Link: http://lkml.kernel.org/r/1464875891-5443-5-git-send-email-konishi.ryusuke@lab.ntt.co.jpSigned-off-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6625689e
...@@ -339,12 +339,14 @@ static int nilfs_btree_node_lookup(const struct nilfs_btree_node *node, ...@@ -339,12 +339,14 @@ static int nilfs_btree_node_lookup(const struct nilfs_btree_node *node,
* nilfs_btree_node_broken - verify consistency of btree node * nilfs_btree_node_broken - verify consistency of btree node
* @node: btree node block to be examined * @node: btree node block to be examined
* @size: node size (in bytes) * @size: node size (in bytes)
* @inode: host inode of btree
* @blocknr: block number * @blocknr: block number
* *
* Return Value: If node is broken, 1 is returned. Otherwise, 0 is returned. * Return Value: If node is broken, 1 is returned. Otherwise, 0 is returned.
*/ */
static int nilfs_btree_node_broken(const struct nilfs_btree_node *node, static int nilfs_btree_node_broken(const struct nilfs_btree_node *node,
size_t size, sector_t blocknr) size_t size, struct inode *inode,
sector_t blocknr)
{ {
int level, flags, nchildren; int level, flags, nchildren;
int ret = 0; int ret = 0;
...@@ -358,9 +360,10 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node, ...@@ -358,9 +360,10 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node,
(flags & NILFS_BTREE_NODE_ROOT) || (flags & NILFS_BTREE_NODE_ROOT) ||
nchildren < 0 || nchildren < 0 ||
nchildren > NILFS_BTREE_NODE_NCHILDREN_MAX(size))) { nchildren > NILFS_BTREE_NODE_NCHILDREN_MAX(size))) {
printk(KERN_CRIT "NILFS: bad btree node (blocknr=%llu): " nilfs_msg(inode->i_sb, KERN_CRIT,
"level = %d, flags = 0x%x, nchildren = %d\n", "bad btree node (ino=%lu, blocknr=%llu): level = %d, flags = 0x%x, nchildren = %d",
(unsigned long long)blocknr, level, flags, nchildren); inode->i_ino, (unsigned long long)blocknr, level,
flags, nchildren);
ret = 1; ret = 1;
} }
return ret; return ret;
...@@ -369,12 +372,12 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node, ...@@ -369,12 +372,12 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node,
/** /**
* nilfs_btree_root_broken - verify consistency of btree root node * nilfs_btree_root_broken - verify consistency of btree root node
* @node: btree root node to be examined * @node: btree root node to be examined
* @ino: inode number * @inode: host inode of btree
* *
* Return Value: If node is broken, 1 is returned. Otherwise, 0 is returned. * Return Value: If node is broken, 1 is returned. Otherwise, 0 is returned.
*/ */
static int nilfs_btree_root_broken(const struct nilfs_btree_node *node, static int nilfs_btree_root_broken(const struct nilfs_btree_node *node,
unsigned long ino) struct inode *inode)
{ {
int level, flags, nchildren; int level, flags, nchildren;
int ret = 0; int ret = 0;
...@@ -387,8 +390,9 @@ static int nilfs_btree_root_broken(const struct nilfs_btree_node *node, ...@@ -387,8 +390,9 @@ static int nilfs_btree_root_broken(const struct nilfs_btree_node *node,
level >= NILFS_BTREE_LEVEL_MAX || level >= NILFS_BTREE_LEVEL_MAX ||
nchildren < 0 || nchildren < 0 ||
nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) { nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) {
pr_crit("NILFS: bad btree root (inode number=%lu): level = %d, flags = 0x%x, nchildren = %d\n", nilfs_msg(inode->i_sb, KERN_CRIT,
ino, level, flags, nchildren); "bad btree root (ino=%lu): level = %d, flags = 0x%x, nchildren = %d",
inode->i_ino, level, flags, nchildren);
ret = 1; ret = 1;
} }
return ret; return ret;
...@@ -396,13 +400,15 @@ static int nilfs_btree_root_broken(const struct nilfs_btree_node *node, ...@@ -396,13 +400,15 @@ static int nilfs_btree_root_broken(const struct nilfs_btree_node *node,
int nilfs_btree_broken_node_block(struct buffer_head *bh) int nilfs_btree_broken_node_block(struct buffer_head *bh)
{ {
struct inode *inode;
int ret; int ret;
if (buffer_nilfs_checked(bh)) if (buffer_nilfs_checked(bh))
return 0; return 0;
inode = bh->b_page->mapping->host;
ret = nilfs_btree_node_broken((struct nilfs_btree_node *)bh->b_data, ret = nilfs_btree_node_broken((struct nilfs_btree_node *)bh->b_data,
bh->b_size, bh->b_blocknr); bh->b_size, inode, bh->b_blocknr);
if (likely(!ret)) if (likely(!ret))
set_buffer_nilfs_checked(bh); set_buffer_nilfs_checked(bh);
return ret; return ret;
...@@ -448,13 +454,15 @@ nilfs_btree_get_node(const struct nilfs_bmap *btree, ...@@ -448,13 +454,15 @@ nilfs_btree_get_node(const struct nilfs_bmap *btree,
return node; return node;
} }
static int static int nilfs_btree_bad_node(const struct nilfs_bmap *btree,
nilfs_btree_bad_node(struct nilfs_btree_node *node, int level) struct nilfs_btree_node *node, int level)
{ {
if (unlikely(nilfs_btree_node_get_level(node) != level)) { if (unlikely(nilfs_btree_node_get_level(node) != level)) {
dump_stack(); dump_stack();
printk(KERN_CRIT "NILFS: btree level mismatch: %d != %d\n", nilfs_msg(btree->b_inode->i_sb, KERN_CRIT,
nilfs_btree_node_get_level(node), level); "btree level mismatch (ino=%lu): %d != %d",
btree->b_inode->i_ino,
nilfs_btree_node_get_level(node), level);
return 1; return 1;
} }
return 0; return 0;
...@@ -568,7 +576,7 @@ static int nilfs_btree_do_lookup(const struct nilfs_bmap *btree, ...@@ -568,7 +576,7 @@ static int nilfs_btree_do_lookup(const struct nilfs_bmap *btree,
return ret; return ret;
node = nilfs_btree_get_nonroot_node(path, level); node = nilfs_btree_get_nonroot_node(path, level);
if (nilfs_btree_bad_node(node, level)) if (nilfs_btree_bad_node(btree, node, level))
return -EINVAL; return -EINVAL;
if (!found) if (!found)
found = nilfs_btree_node_lookup(node, key, &index); found = nilfs_btree_node_lookup(node, key, &index);
...@@ -616,7 +624,7 @@ static int nilfs_btree_do_lookup_last(const struct nilfs_bmap *btree, ...@@ -616,7 +624,7 @@ static int nilfs_btree_do_lookup_last(const struct nilfs_bmap *btree,
if (ret < 0) if (ret < 0)
return ret; return ret;
node = nilfs_btree_get_nonroot_node(path, level); node = nilfs_btree_get_nonroot_node(path, level);
if (nilfs_btree_bad_node(node, level)) if (nilfs_btree_bad_node(btree, node, level))
return -EINVAL; return -EINVAL;
index = nilfs_btree_node_get_nchildren(node) - 1; index = nilfs_btree_node_get_nchildren(node) - 1;
ptr = nilfs_btree_node_get_ptr(node, index, ncmax); ptr = nilfs_btree_node_get_ptr(node, index, ncmax);
...@@ -2072,8 +2080,10 @@ static int nilfs_btree_propagate(struct nilfs_bmap *btree, ...@@ -2072,8 +2080,10 @@ static int nilfs_btree_propagate(struct nilfs_bmap *btree,
ret = nilfs_btree_do_lookup(btree, path, key, NULL, level + 1, 0); ret = nilfs_btree_do_lookup(btree, path, key, NULL, level + 1, 0);
if (ret < 0) { if (ret < 0) {
if (unlikely(ret == -ENOENT)) if (unlikely(ret == -ENOENT))
printk(KERN_CRIT "%s: key = %llu, level == %d\n", nilfs_msg(btree->b_inode->i_sb, KERN_CRIT,
__func__, (unsigned long long)key, level); "writing node/leaf block does not appear in b-tree (ino=%lu) at key=%llu, level=%d",
btree->b_inode->i_ino,
(unsigned long long)key, level);
goto out; goto out;
} }
...@@ -2110,12 +2120,11 @@ static void nilfs_btree_add_dirty_buffer(struct nilfs_bmap *btree, ...@@ -2110,12 +2120,11 @@ static void nilfs_btree_add_dirty_buffer(struct nilfs_bmap *btree,
if (level < NILFS_BTREE_LEVEL_NODE_MIN || if (level < NILFS_BTREE_LEVEL_NODE_MIN ||
level >= NILFS_BTREE_LEVEL_MAX) { level >= NILFS_BTREE_LEVEL_MAX) {
dump_stack(); dump_stack();
printk(KERN_WARNING nilfs_msg(btree->b_inode->i_sb, KERN_WARNING,
"%s: invalid btree level: %d (key=%llu, ino=%lu, " "invalid btree level: %d (key=%llu, ino=%lu, blocknr=%llu)",
"blocknr=%llu)\n", level, (unsigned long long)key,
__func__, level, (unsigned long long)key, btree->b_inode->i_ino,
NILFS_BMAP_I(btree)->vfs_inode.i_ino, (unsigned long long)bh->b_blocknr);
(unsigned long long)bh->b_blocknr);
return; return;
} }
...@@ -2394,8 +2403,7 @@ int nilfs_btree_init(struct nilfs_bmap *bmap) ...@@ -2394,8 +2403,7 @@ int nilfs_btree_init(struct nilfs_bmap *bmap)
__nilfs_btree_init(bmap); __nilfs_btree_init(bmap);
if (nilfs_btree_root_broken(nilfs_btree_get_root(bmap), if (nilfs_btree_root_broken(nilfs_btree_get_root(bmap), bmap->b_inode))
bmap->b_inode->i_ino))
ret = -EIO; ret = -EIO;
return ret; return ret;
} }
......
...@@ -332,9 +332,9 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, ...@@ -332,9 +332,9 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
int ret, ncps, nicps, nss, count, i; int ret, ncps, nicps, nss, count, i;
if (unlikely(start == 0 || start > end)) { if (unlikely(start == 0 || start > end)) {
printk(KERN_ERR "%s: invalid range of checkpoint numbers: " nilfs_msg(cpfile->i_sb, KERN_ERR,
"[%llu, %llu)\n", __func__, "cannot delete checkpoints: invalid range [%llu, %llu)",
(unsigned long long)start, (unsigned long long)end); (unsigned long long)start, (unsigned long long)end);
return -EINVAL; return -EINVAL;
} }
...@@ -386,9 +386,9 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, ...@@ -386,9 +386,9 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
cpfile, cno); cpfile, cno);
if (ret == 0) if (ret == 0)
continue; continue;
printk(KERN_ERR nilfs_msg(cpfile->i_sb, KERN_ERR,
"%s: cannot delete block\n", "error %d deleting checkpoint block",
__func__); ret);
break; break;
} }
} }
...@@ -991,14 +991,12 @@ int nilfs_cpfile_read(struct super_block *sb, size_t cpsize, ...@@ -991,14 +991,12 @@ int nilfs_cpfile_read(struct super_block *sb, size_t cpsize,
int err; int err;
if (cpsize > sb->s_blocksize) { if (cpsize > sb->s_blocksize) {
printk(KERN_ERR nilfs_msg(sb, KERN_ERR,
"NILFS: too large checkpoint size: %zu bytes.\n", "too large checkpoint size: %zu bytes", cpsize);
cpsize);
return -EINVAL; return -EINVAL;
} else if (cpsize < NILFS_MIN_CHECKPOINT_SIZE) { } else if (cpsize < NILFS_MIN_CHECKPOINT_SIZE) {
printk(KERN_ERR nilfs_msg(sb, KERN_ERR,
"NILFS: too small checkpoint size: %zu bytes.\n", "too small checkpoint size: %zu bytes", cpsize);
cpsize);
return -EINVAL; return -EINVAL;
} }
......
...@@ -349,10 +349,11 @@ int nilfs_dat_move(struct inode *dat, __u64 vblocknr, sector_t blocknr) ...@@ -349,10 +349,11 @@ int nilfs_dat_move(struct inode *dat, __u64 vblocknr, sector_t blocknr)
kaddr = kmap_atomic(entry_bh->b_page); kaddr = kmap_atomic(entry_bh->b_page);
entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr); entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr);
if (unlikely(entry->de_blocknr == cpu_to_le64(0))) { if (unlikely(entry->de_blocknr == cpu_to_le64(0))) {
printk(KERN_CRIT "%s: vbn = %llu, [%llu, %llu)\n", __func__, nilfs_msg(dat->i_sb, KERN_CRIT,
(unsigned long long)vblocknr, "%s: invalid vblocknr = %llu, [%llu, %llu)",
(unsigned long long)le64_to_cpu(entry->de_start), __func__, (unsigned long long)vblocknr,
(unsigned long long)le64_to_cpu(entry->de_end)); (unsigned long long)le64_to_cpu(entry->de_start),
(unsigned long long)le64_to_cpu(entry->de_end));
kunmap_atomic(kaddr); kunmap_atomic(kaddr);
brelse(entry_bh); brelse(entry_bh);
return -EINVAL; return -EINVAL;
...@@ -479,14 +480,12 @@ int nilfs_dat_read(struct super_block *sb, size_t entry_size, ...@@ -479,14 +480,12 @@ int nilfs_dat_read(struct super_block *sb, size_t entry_size,
int err; int err;
if (entry_size > sb->s_blocksize) { if (entry_size > sb->s_blocksize) {
printk(KERN_ERR nilfs_msg(sb, KERN_ERR, "too large DAT entry size: %zu bytes",
"NILFS: too large DAT entry size: %zu bytes.\n", entry_size);
entry_size);
return -EINVAL; return -EINVAL;
} else if (entry_size < NILFS_MIN_DAT_ENTRY_SIZE) { } else if (entry_size < NILFS_MIN_DAT_ENTRY_SIZE) {
printk(KERN_ERR nilfs_msg(sb, KERN_ERR, "too small DAT entry size: %zu bytes",
"NILFS: too small DAT entry size: %zu bytes.\n", entry_size);
entry_size);
return -EINVAL; return -EINVAL;
} }
......
...@@ -337,14 +337,16 @@ static int nilfs_direct_assign(struct nilfs_bmap *bmap, ...@@ -337,14 +337,16 @@ static int nilfs_direct_assign(struct nilfs_bmap *bmap,
key = nilfs_bmap_data_get_key(bmap, *bh); key = nilfs_bmap_data_get_key(bmap, *bh);
if (unlikely(key > NILFS_DIRECT_KEY_MAX)) { if (unlikely(key > NILFS_DIRECT_KEY_MAX)) {
printk(KERN_CRIT "%s: invalid key: %llu\n", __func__, nilfs_msg(bmap->b_inode->i_sb, KERN_CRIT,
(unsigned long long)key); "%s (ino=%lu): invalid key: %llu", __func__,
bmap->b_inode->i_ino, (unsigned long long)key);
return -EINVAL; return -EINVAL;
} }
ptr = nilfs_direct_get_ptr(bmap, key); ptr = nilfs_direct_get_ptr(bmap, key);
if (unlikely(ptr == NILFS_BMAP_INVALID_PTR)) { if (unlikely(ptr == NILFS_BMAP_INVALID_PTR)) {
printk(KERN_CRIT "%s: invalid pointer: %llu\n", __func__, nilfs_msg(bmap->b_inode->i_sb, KERN_CRIT,
(unsigned long long)ptr); "%s (ino=%lu): invalid pointer: %llu", __func__,
bmap->b_inode->i_ino, (unsigned long long)ptr);
return -EINVAL; return -EINVAL;
} }
......
...@@ -112,13 +112,10 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff, ...@@ -112,13 +112,10 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,
* However, the page having this block must * However, the page having this block must
* be locked in this case. * be locked in this case.
*/ */
printk(KERN_WARNING nilfs_msg(inode->i_sb, KERN_WARNING,
"nilfs_get_block: a race condition " "%s (ino=%lu): a race condition while inserting a data block at offset=%llu",
"while inserting a data block. " __func__, inode->i_ino,
"(inode number=%lu, file block " (unsigned long long)blkoff);
"offset=%llu)\n",
inode->i_ino,
(unsigned long long)blkoff);
err = 0; err = 0;
} }
nilfs_transaction_abort(inode->i_sb); nilfs_transaction_abort(inode->i_sb);
......
...@@ -584,27 +584,25 @@ static int nilfs_ioctl_move_inode_block(struct inode *inode, ...@@ -584,27 +584,25 @@ static int nilfs_ioctl_move_inode_block(struct inode *inode,
if (unlikely(ret < 0)) { if (unlikely(ret < 0)) {
if (ret == -ENOENT) if (ret == -ENOENT)
printk(KERN_CRIT nilfs_msg(inode->i_sb, KERN_CRIT,
"%s: invalid virtual block address (%s): " "%s: invalid virtual block address (%s): ino=%llu, cno=%llu, offset=%llu, blocknr=%llu, vblocknr=%llu",
"ino=%llu, cno=%llu, offset=%llu, " __func__, vdesc->vd_flags ? "node" : "data",
"blocknr=%llu, vblocknr=%llu\n", (unsigned long long)vdesc->vd_ino,
__func__, vdesc->vd_flags ? "node" : "data", (unsigned long long)vdesc->vd_cno,
(unsigned long long)vdesc->vd_ino, (unsigned long long)vdesc->vd_offset,
(unsigned long long)vdesc->vd_cno, (unsigned long long)vdesc->vd_blocknr,
(unsigned long long)vdesc->vd_offset, (unsigned long long)vdesc->vd_vblocknr);
(unsigned long long)vdesc->vd_blocknr,
(unsigned long long)vdesc->vd_vblocknr);
return ret; return ret;
} }
if (unlikely(!list_empty(&bh->b_assoc_buffers))) { if (unlikely(!list_empty(&bh->b_assoc_buffers))) {
printk(KERN_CRIT "%s: conflicting %s buffer: ino=%llu, " nilfs_msg(inode->i_sb, KERN_CRIT,
"cno=%llu, offset=%llu, blocknr=%llu, vblocknr=%llu\n", "%s: conflicting %s buffer: ino=%llu, cno=%llu, offset=%llu, blocknr=%llu, vblocknr=%llu",
__func__, vdesc->vd_flags ? "node" : "data", __func__, vdesc->vd_flags ? "node" : "data",
(unsigned long long)vdesc->vd_ino, (unsigned long long)vdesc->vd_ino,
(unsigned long long)vdesc->vd_cno, (unsigned long long)vdesc->vd_cno,
(unsigned long long)vdesc->vd_offset, (unsigned long long)vdesc->vd_offset,
(unsigned long long)vdesc->vd_blocknr, (unsigned long long)vdesc->vd_blocknr,
(unsigned long long)vdesc->vd_vblocknr); (unsigned long long)vdesc->vd_vblocknr);
brelse(bh); brelse(bh);
return -EEXIST; return -EEXIST;
} }
...@@ -854,8 +852,8 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs, ...@@ -854,8 +852,8 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *nilfs,
return 0; return 0;
failed: failed:
printk(KERN_ERR "NILFS: GC failed during preparation: %s: err=%d\n", nilfs_msg(nilfs->ns_sb, KERN_ERR, "error %d preparing GC: %s", ret,
msg, ret); msg);
return ret; return ret;
} }
...@@ -963,10 +961,11 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp, ...@@ -963,10 +961,11 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
} }
ret = nilfs_ioctl_move_blocks(inode->i_sb, &argv[0], kbufs[0]); ret = nilfs_ioctl_move_blocks(inode->i_sb, &argv[0], kbufs[0]);
if (ret < 0) if (ret < 0) {
printk(KERN_ERR "NILFS: GC failed during preparation: " nilfs_msg(inode->i_sb, KERN_ERR,
"cannot read source blocks: err=%d\n", ret); "error %d preparing GC: cannot read source blocks",
else { ret);
} else {
if (nilfs_sb_need_update(nilfs)) if (nilfs_sb_need_update(nilfs))
set_nilfs_discontinued(nilfs); set_nilfs_discontinued(nilfs);
ret = nilfs_clean_segments(inode->i_sb, argv, kbufs); ret = nilfs_clean_segments(inode->i_sb, argv, kbufs);
......
...@@ -54,38 +54,37 @@ struct nilfs_recovery_block { ...@@ -54,38 +54,37 @@ struct nilfs_recovery_block {
}; };
static int nilfs_warn_segment_error(int err) static int nilfs_warn_segment_error(struct super_block *sb, int err)
{ {
const char *msg = NULL;
switch (err) { switch (err) {
case NILFS_SEG_FAIL_IO: case NILFS_SEG_FAIL_IO:
printk(KERN_WARNING nilfs_msg(sb, KERN_ERR, "I/O error reading segment");
"NILFS warning: I/O error on loading last segment\n");
return -EIO; return -EIO;
case NILFS_SEG_FAIL_MAGIC: case NILFS_SEG_FAIL_MAGIC:
printk(KERN_WARNING msg = "Magic number mismatch";
"NILFS warning: Segment magic number invalid\n");
break; break;
case NILFS_SEG_FAIL_SEQ: case NILFS_SEG_FAIL_SEQ:
printk(KERN_WARNING msg = "Sequence number mismatch";
"NILFS warning: Sequence number mismatch\n");
break; break;
case NILFS_SEG_FAIL_CHECKSUM_SUPER_ROOT: case NILFS_SEG_FAIL_CHECKSUM_SUPER_ROOT:
printk(KERN_WARNING msg = "Checksum error in super root";
"NILFS warning: Checksum error in super root\n");
break; break;
case NILFS_SEG_FAIL_CHECKSUM_FULL: case NILFS_SEG_FAIL_CHECKSUM_FULL:
printk(KERN_WARNING msg = "Checksum error in segment payload";
"NILFS warning: Checksum error in segment payload\n");
break; break;
case NILFS_SEG_FAIL_CONSISTENCY: case NILFS_SEG_FAIL_CONSISTENCY:
printk(KERN_WARNING msg = "Inconsistency found";
"NILFS warning: Inconsistent segment\n");
break; break;
case NILFS_SEG_NO_SUPER_ROOT: case NILFS_SEG_NO_SUPER_ROOT:
printk(KERN_WARNING msg = "No super root in the last segment";
"NILFS warning: No super root in the last segment\n");
break; break;
default:
nilfs_msg(sb, KERN_ERR, "unrecognized segment error %d", err);
return -EINVAL;
} }
nilfs_msg(sb, KERN_WARNING, "invalid segment: %s", msg);
return -EINVAL; return -EINVAL;
} }
...@@ -178,7 +177,7 @@ int nilfs_read_super_root_block(struct the_nilfs *nilfs, sector_t sr_block, ...@@ -178,7 +177,7 @@ int nilfs_read_super_root_block(struct the_nilfs *nilfs, sector_t sr_block,
brelse(bh_sr); brelse(bh_sr);
failed: failed:
return nilfs_warn_segment_error(ret); return nilfs_warn_segment_error(nilfs->ns_sb, ret);
} }
/** /**
...@@ -553,11 +552,10 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs, ...@@ -553,11 +552,10 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs,
put_page(page); put_page(page);
failed_inode: failed_inode:
printk(KERN_WARNING nilfs_msg(sb, KERN_WARNING,
"NILFS warning: error recovering data block " "error %d recovering data block (ino=%lu, block-offset=%llu)",
"(err=%d, ino=%lu, block-offset=%llu)\n", err, (unsigned long)rb->ino,
err, (unsigned long)rb->ino, (unsigned long long)rb->blkoff);
(unsigned long long)rb->blkoff);
if (!err2) if (!err2)
err2 = err; err2 = err;
next: next:
...@@ -680,8 +678,8 @@ static int nilfs_do_roll_forward(struct the_nilfs *nilfs, ...@@ -680,8 +678,8 @@ static int nilfs_do_roll_forward(struct the_nilfs *nilfs,
} }
if (nsalvaged_blocks) { if (nsalvaged_blocks) {
printk(KERN_INFO "NILFS (device %s): salvaged %lu blocks\n", nilfs_msg(sb, KERN_INFO, "salvaged %lu blocks",
sb->s_id, nsalvaged_blocks); nsalvaged_blocks);
ri->ri_need_recovery = NILFS_RECOVERY_ROLLFORWARD_DONE; ri->ri_need_recovery = NILFS_RECOVERY_ROLLFORWARD_DONE;
} }
out: out:
...@@ -692,10 +690,9 @@ static int nilfs_do_roll_forward(struct the_nilfs *nilfs, ...@@ -692,10 +690,9 @@ static int nilfs_do_roll_forward(struct the_nilfs *nilfs,
confused: confused:
err = -EINVAL; err = -EINVAL;
failed: failed:
printk(KERN_ERR nilfs_msg(sb, KERN_ERR,
"NILFS (device %s): Error roll-forwarding " "error %d roll-forwarding partial segment at blocknr = %llu",
"(err=%d, pseg block=%llu). ", err, (unsigned long long)pseg_start);
sb->s_id, err, (unsigned long long)pseg_start);
goto out; goto out;
} }
...@@ -715,9 +712,8 @@ static void nilfs_finish_roll_forward(struct the_nilfs *nilfs, ...@@ -715,9 +712,8 @@ static void nilfs_finish_roll_forward(struct the_nilfs *nilfs,
set_buffer_dirty(bh); set_buffer_dirty(bh);
err = sync_dirty_buffer(bh); err = sync_dirty_buffer(bh);
if (unlikely(err)) if (unlikely(err))
printk(KERN_WARNING nilfs_msg(nilfs->ns_sb, KERN_WARNING,
"NILFS warning: buffer sync write failed during " "buffer sync write failed during post-cleaning of recovery.");
"post-cleaning of recovery.\n");
brelse(bh); brelse(bh);
} }
...@@ -752,8 +748,8 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs, ...@@ -752,8 +748,8 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs,
err = nilfs_attach_checkpoint(sb, ri->ri_cno, true, &root); err = nilfs_attach_checkpoint(sb, ri->ri_cno, true, &root);
if (unlikely(err)) { if (unlikely(err)) {
printk(KERN_ERR nilfs_msg(sb, KERN_ERR,
"NILFS: error loading the latest checkpoint.\n"); "error %d loading the latest checkpoint", err);
return err; return err;
} }
...@@ -764,8 +760,9 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs, ...@@ -764,8 +760,9 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs,
if (ri->ri_need_recovery == NILFS_RECOVERY_ROLLFORWARD_DONE) { if (ri->ri_need_recovery == NILFS_RECOVERY_ROLLFORWARD_DONE) {
err = nilfs_prepare_segment_for_recovery(nilfs, sb, ri); err = nilfs_prepare_segment_for_recovery(nilfs, sb, ri);
if (unlikely(err)) { if (unlikely(err)) {
printk(KERN_ERR "NILFS: Error preparing segments for " nilfs_msg(sb, KERN_ERR,
"recovery.\n"); "error %d preparing segment for recovery",
err);
goto failed; goto failed;
} }
...@@ -778,8 +775,9 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs, ...@@ -778,8 +775,9 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs,
nilfs_detach_log_writer(sb); nilfs_detach_log_writer(sb);
if (unlikely(err)) { if (unlikely(err)) {
printk(KERN_ERR "NILFS: Oops! recovery failed. " nilfs_msg(sb, KERN_ERR,
"(err=%d)\n", err); "error %d writing segment for recovery",
err);
goto failed; goto failed;
} }
...@@ -961,5 +959,5 @@ int nilfs_search_super_root(struct the_nilfs *nilfs, ...@@ -961,5 +959,5 @@ int nilfs_search_super_root(struct the_nilfs *nilfs,
failed: failed:
brelse(bh_sum); brelse(bh_sum);
nilfs_dispose_segment_list(&segments); nilfs_dispose_segment_list(&segments);
return (ret < 0) ? ret : nilfs_warn_segment_error(ret); return ret < 0 ? ret : nilfs_warn_segment_error(nilfs->ns_sb, ret);
} }
...@@ -514,7 +514,11 @@ static int nilfs_segbuf_wait(struct nilfs_segment_buffer *segbuf) ...@@ -514,7 +514,11 @@ static int nilfs_segbuf_wait(struct nilfs_segment_buffer *segbuf)
} while (--segbuf->sb_nbio > 0); } while (--segbuf->sb_nbio > 0);
if (unlikely(atomic_read(&segbuf->sb_err) > 0)) { if (unlikely(atomic_read(&segbuf->sb_err) > 0)) {
printk(KERN_ERR "NILFS: IO error writing segment\n"); nilfs_msg(segbuf->sb_super, KERN_ERR,
"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,
(unsigned long long)segbuf->sb_segnum);
err = -EIO; err = -EIO;
} }
return err; return err;
......
...@@ -150,7 +150,8 @@ static void nilfs_dispose_list(struct the_nilfs *, struct list_head *, int); ...@@ -150,7 +150,8 @@ static void nilfs_dispose_list(struct the_nilfs *, struct list_head *, int);
#define nilfs_cnt32_lt(a, b) nilfs_cnt32_gt(b, a) #define nilfs_cnt32_lt(a, b) nilfs_cnt32_gt(b, a)
#define nilfs_cnt32_le(a, b) nilfs_cnt32_ge(b, a) #define nilfs_cnt32_le(a, b) nilfs_cnt32_ge(b, a)
static int nilfs_prepare_segment_lock(struct nilfs_transaction_info *ti) static int nilfs_prepare_segment_lock(struct super_block *sb,
struct nilfs_transaction_info *ti)
{ {
struct nilfs_transaction_info *cur_ti = current->journal_info; struct nilfs_transaction_info *cur_ti = current->journal_info;
void *save = NULL; void *save = NULL;
...@@ -164,8 +165,7 @@ static int nilfs_prepare_segment_lock(struct nilfs_transaction_info *ti) ...@@ -164,8 +165,7 @@ static int nilfs_prepare_segment_lock(struct nilfs_transaction_info *ti)
* it is saved and will be restored on * it is saved and will be restored on
* nilfs_transaction_commit(). * nilfs_transaction_commit().
*/ */
printk(KERN_WARNING nilfs_msg(sb, KERN_WARNING, "journal info from a different FS");
"NILFS warning: journal info from a different FS\n");
save = current->journal_info; save = current->journal_info;
} }
if (!ti) { if (!ti) {
...@@ -215,7 +215,7 @@ int nilfs_transaction_begin(struct super_block *sb, ...@@ -215,7 +215,7 @@ int nilfs_transaction_begin(struct super_block *sb,
int vacancy_check) int vacancy_check)
{ {
struct the_nilfs *nilfs; struct the_nilfs *nilfs;
int ret = nilfs_prepare_segment_lock(ti); int ret = nilfs_prepare_segment_lock(sb, ti);
struct nilfs_transaction_info *trace_ti; struct nilfs_transaction_info *trace_ti;
if (unlikely(ret < 0)) if (unlikely(ret < 0))
...@@ -2467,9 +2467,9 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv, ...@@ -2467,9 +2467,9 @@ int nilfs_clean_segments(struct super_block *sb, struct nilfs_argv *argv,
int ret = nilfs_discard_segments(nilfs, sci->sc_freesegs, int ret = nilfs_discard_segments(nilfs, sci->sc_freesegs,
sci->sc_nfreesegs); sci->sc_nfreesegs);
if (ret) { if (ret) {
printk(KERN_WARNING nilfs_msg(sb, KERN_WARNING,
"NILFS warning: error %d on discard request, " "error %d on discard request, turning discards off for the device",
"turning discards off for the device\n", ret); ret);
nilfs_clear_opt(nilfs, DISCARD); nilfs_clear_opt(nilfs, DISCARD);
} }
} }
...@@ -2551,10 +2551,9 @@ static int nilfs_segctor_thread(void *arg) ...@@ -2551,10 +2551,9 @@ static int nilfs_segctor_thread(void *arg)
/* start sync. */ /* start sync. */
sci->sc_task = current; sci->sc_task = current;
wake_up(&sci->sc_wait_task); /* for nilfs_segctor_start_thread() */ wake_up(&sci->sc_wait_task); /* for nilfs_segctor_start_thread() */
printk(KERN_INFO nilfs_msg(sci->sc_super, KERN_INFO,
"segctord starting. Construction interval = %lu seconds, " "segctord starting. Construction interval = %lu seconds, CP frequency < %lu seconds",
"CP frequency < %lu seconds\n", sci->sc_interval / HZ, sci->sc_mjcp_freq / HZ);
sci->sc_interval / HZ, sci->sc_mjcp_freq / HZ);
spin_lock(&sci->sc_state_lock); spin_lock(&sci->sc_state_lock);
loop: loop:
...@@ -2628,8 +2627,8 @@ static int nilfs_segctor_start_thread(struct nilfs_sc_info *sci) ...@@ -2628,8 +2627,8 @@ static int nilfs_segctor_start_thread(struct nilfs_sc_info *sci)
if (IS_ERR(t)) { if (IS_ERR(t)) {
int err = PTR_ERR(t); int err = PTR_ERR(t);
printk(KERN_ERR "NILFS: error %d creating segctord thread\n", nilfs_msg(sci->sc_super, KERN_ERR,
err); "error %d creating segctord thread", err);
return err; return err;
} }
wait_event(sci->sc_wait_task, sci->sc_task != NULL); wait_event(sci->sc_wait_task, sci->sc_task != NULL);
......
...@@ -181,9 +181,9 @@ int nilfs_sufile_updatev(struct inode *sufile, __u64 *segnumv, size_t nsegs, ...@@ -181,9 +181,9 @@ int nilfs_sufile_updatev(struct inode *sufile, __u64 *segnumv, size_t nsegs,
down_write(&NILFS_MDT(sufile)->mi_sem); down_write(&NILFS_MDT(sufile)->mi_sem);
for (seg = segnumv; seg < segnumv + nsegs; seg++) { for (seg = segnumv; seg < segnumv + nsegs; seg++) {
if (unlikely(*seg >= nilfs_sufile_get_nsegments(sufile))) { if (unlikely(*seg >= nilfs_sufile_get_nsegments(sufile))) {
printk(KERN_WARNING nilfs_msg(sufile->i_sb, KERN_WARNING,
"%s: invalid segment number: %llu\n", __func__, "%s: invalid segment number: %llu",
(unsigned long long)*seg); __func__, (unsigned long long)*seg);
nerr++; nerr++;
} }
} }
...@@ -240,8 +240,9 @@ int nilfs_sufile_update(struct inode *sufile, __u64 segnum, int create, ...@@ -240,8 +240,9 @@ int nilfs_sufile_update(struct inode *sufile, __u64 segnum, int create,
int ret; int ret;
if (unlikely(segnum >= nilfs_sufile_get_nsegments(sufile))) { if (unlikely(segnum >= nilfs_sufile_get_nsegments(sufile))) {
printk(KERN_WARNING "%s: invalid segment number: %llu\n", nilfs_msg(sufile->i_sb, KERN_WARNING,
__func__, (unsigned long long)segnum); "%s: invalid segment number: %llu",
__func__, (unsigned long long)segnum);
return -EINVAL; return -EINVAL;
} }
down_write(&NILFS_MDT(sufile)->mi_sem); down_write(&NILFS_MDT(sufile)->mi_sem);
...@@ -419,8 +420,9 @@ void nilfs_sufile_do_cancel_free(struct inode *sufile, __u64 segnum, ...@@ -419,8 +420,9 @@ void nilfs_sufile_do_cancel_free(struct inode *sufile, __u64 segnum,
kaddr = kmap_atomic(su_bh->b_page); kaddr = kmap_atomic(su_bh->b_page);
su = nilfs_sufile_block_get_segment_usage(sufile, segnum, su_bh, kaddr); su = nilfs_sufile_block_get_segment_usage(sufile, segnum, su_bh, kaddr);
if (unlikely(!nilfs_segment_usage_clean(su))) { if (unlikely(!nilfs_segment_usage_clean(su))) {
printk(KERN_WARNING "%s: segment %llu must be clean\n", nilfs_msg(sufile->i_sb, KERN_WARNING,
__func__, (unsigned long long)segnum); "%s: segment %llu must be clean", __func__,
(unsigned long long)segnum);
kunmap_atomic(kaddr); kunmap_atomic(kaddr);
return; return;
} }
...@@ -476,8 +478,9 @@ void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum, ...@@ -476,8 +478,9 @@ void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum,
kaddr = kmap_atomic(su_bh->b_page); kaddr = kmap_atomic(su_bh->b_page);
su = nilfs_sufile_block_get_segment_usage(sufile, segnum, su_bh, kaddr); su = nilfs_sufile_block_get_segment_usage(sufile, segnum, su_bh, kaddr);
if (nilfs_segment_usage_clean(su)) { if (nilfs_segment_usage_clean(su)) {
printk(KERN_WARNING "%s: segment %llu is already clean\n", nilfs_msg(sufile->i_sb, KERN_WARNING,
__func__, (unsigned long long)segnum); "%s: segment %llu is already clean",
__func__, (unsigned long long)segnum);
kunmap_atomic(kaddr); kunmap_atomic(kaddr);
return; return;
} }
...@@ -1175,14 +1178,12 @@ int nilfs_sufile_read(struct super_block *sb, size_t susize, ...@@ -1175,14 +1178,12 @@ int nilfs_sufile_read(struct super_block *sb, size_t susize,
int err; int err;
if (susize > sb->s_blocksize) { if (susize > sb->s_blocksize) {
printk(KERN_ERR nilfs_msg(sb, KERN_ERR,
"NILFS: too large segment usage size: %zu bytes.\n", "too large segment usage size: %zu bytes", susize);
susize);
return -EINVAL; return -EINVAL;
} else if (susize < NILFS_MIN_SEGMENT_USAGE_SIZE) { } else if (susize < NILFS_MIN_SEGMENT_USAGE_SIZE) {
printk(KERN_ERR nilfs_msg(sb, KERN_ERR,
"NILFS: too small segment usage size: %zu bytes.\n", "too small segment usage size: %zu bytes", susize);
susize);
return -EINVAL; return -EINVAL;
} }
......
...@@ -214,8 +214,8 @@ static int nilfs_sync_super(struct super_block *sb, int flag) ...@@ -214,8 +214,8 @@ static int nilfs_sync_super(struct super_block *sb, int flag)
} }
if (unlikely(err)) { if (unlikely(err)) {
printk(KERN_ERR nilfs_msg(sb, KERN_ERR, "unable to write superblock: err=%d",
"NILFS: unable to write superblock (err=%d)\n", err); err);
if (err == -EIO && nilfs->ns_sbh[1]) { if (err == -EIO && nilfs->ns_sbh[1]) {
/* /*
* sbp[0] points to newer log than sbp[1], * sbp[0] points to newer log than sbp[1],
...@@ -285,8 +285,7 @@ struct nilfs_super_block **nilfs_prepare_super(struct super_block *sb, ...@@ -285,8 +285,7 @@ struct nilfs_super_block **nilfs_prepare_super(struct super_block *sb,
sbp[1]->s_magic == cpu_to_le16(NILFS_SUPER_MAGIC)) { sbp[1]->s_magic == cpu_to_le16(NILFS_SUPER_MAGIC)) {
memcpy(sbp[0], sbp[1], nilfs->ns_sbsize); memcpy(sbp[0], sbp[1], nilfs->ns_sbsize);
} else { } else {
printk(KERN_CRIT "NILFS: superblock broke on dev %s\n", nilfs_msg(sb, KERN_CRIT, "superblock broke");
sb->s_id);
return NULL; return NULL;
} }
} else if (sbp[1] && } else if (sbp[1] &&
...@@ -396,9 +395,9 @@ static int nilfs_move_2nd_super(struct super_block *sb, loff_t sb2off) ...@@ -396,9 +395,9 @@ static int nilfs_move_2nd_super(struct super_block *sb, loff_t sb2off)
offset = sb2off & (nilfs->ns_blocksize - 1); offset = sb2off & (nilfs->ns_blocksize - 1);
nsbh = sb_getblk(sb, newblocknr); nsbh = sb_getblk(sb, newblocknr);
if (!nsbh) { if (!nsbh) {
printk(KERN_WARNING nilfs_msg(sb, KERN_WARNING,
"NILFS warning: unable to move secondary superblock " "unable to move secondary superblock to block %llu",
"to block %llu\n", (unsigned long long)newblocknr); (unsigned long long)newblocknr);
ret = -EIO; ret = -EIO;
goto out; goto out;
} }
...@@ -561,10 +560,9 @@ int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt, ...@@ -561,10 +560,9 @@ int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt,
up_read(&nilfs->ns_segctor_sem); up_read(&nilfs->ns_segctor_sem);
if (unlikely(err)) { if (unlikely(err)) {
if (err == -ENOENT || err == -EINVAL) { if (err == -ENOENT || err == -EINVAL) {
printk(KERN_ERR nilfs_msg(sb, KERN_ERR,
"NILFS: Invalid checkpoint " "Invalid checkpoint (checkpoint number=%llu)",
"(checkpoint number=%llu)\n", (unsigned long long)cno);
(unsigned long long)cno);
err = -EINVAL; err = -EINVAL;
} }
goto failed; goto failed;
...@@ -660,9 +658,8 @@ static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -660,9 +658,8 @@ static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf)
err = nilfs_ifile_count_free_inodes(root->ifile, err = nilfs_ifile_count_free_inodes(root->ifile,
&nmaxinodes, &nfreeinodes); &nmaxinodes, &nfreeinodes);
if (unlikely(err)) { if (unlikely(err)) {
printk(KERN_WARNING nilfs_msg(sb, KERN_WARNING,
"NILFS warning: fail to count free inodes: err %d.\n", "failed to count free inodes: err=%d", err);
err);
if (err == -ERANGE) { if (err == -ERANGE) {
/* /*
* If nilfs_palloc_count_max_entries() returns * If nilfs_palloc_count_max_entries() returns
...@@ -794,9 +791,9 @@ static int parse_options(char *options, struct super_block *sb, int is_remount) ...@@ -794,9 +791,9 @@ static int parse_options(char *options, struct super_block *sb, int is_remount)
break; break;
case Opt_snapshot: case Opt_snapshot:
if (is_remount) { if (is_remount) {
printk(KERN_ERR nilfs_msg(sb, KERN_ERR,
"NILFS: \"%s\" option is invalid " "\"%s\" option is invalid for remount",
"for remount.\n", p); p);
return 0; return 0;
} }
break; break;
...@@ -810,8 +807,8 @@ static int parse_options(char *options, struct super_block *sb, int is_remount) ...@@ -810,8 +807,8 @@ static int parse_options(char *options, struct super_block *sb, int is_remount)
nilfs_clear_opt(nilfs, DISCARD); nilfs_clear_opt(nilfs, DISCARD);
break; break;
default: default:
printk(KERN_ERR nilfs_msg(sb, KERN_ERR,
"NILFS: Unrecognized mount option \"%s\"\n", p); "unrecognized mount option \"%s\"", p);
return 0; return 0;
} }
} }
...@@ -847,12 +844,10 @@ static int nilfs_setup_super(struct super_block *sb, int is_mount) ...@@ -847,12 +844,10 @@ static int nilfs_setup_super(struct super_block *sb, int is_mount)
mnt_count = le16_to_cpu(sbp[0]->s_mnt_count); mnt_count = le16_to_cpu(sbp[0]->s_mnt_count);
if (nilfs->ns_mount_state & NILFS_ERROR_FS) { if (nilfs->ns_mount_state & NILFS_ERROR_FS) {
printk(KERN_WARNING nilfs_msg(sb, KERN_WARNING, "mounting fs with errors");
"NILFS warning: mounting fs with errors\n");
#if 0 #if 0
} else if (max_mnt_count >= 0 && mnt_count >= max_mnt_count) { } else if (max_mnt_count >= 0 && mnt_count >= max_mnt_count) {
printk(KERN_WARNING nilfs_msg(sb, KERN_WARNING, "maximal mount count reached");
"NILFS warning: maximal mount count reached\n");
#endif #endif
} }
if (!max_mnt_count) if (!max_mnt_count)
...@@ -915,17 +910,17 @@ int nilfs_check_feature_compatibility(struct super_block *sb, ...@@ -915,17 +910,17 @@ int nilfs_check_feature_compatibility(struct super_block *sb,
features = le64_to_cpu(sbp->s_feature_incompat) & features = le64_to_cpu(sbp->s_feature_incompat) &
~NILFS_FEATURE_INCOMPAT_SUPP; ~NILFS_FEATURE_INCOMPAT_SUPP;
if (features) { if (features) {
printk(KERN_ERR "NILFS: couldn't mount because of unsupported " nilfs_msg(sb, KERN_ERR,
"optional features (%llx)\n", "couldn't mount because of unsupported optional features (%llx)",
(unsigned long long)features); (unsigned long long)features);
return -EINVAL; return -EINVAL;
} }
features = le64_to_cpu(sbp->s_feature_compat_ro) & features = le64_to_cpu(sbp->s_feature_compat_ro) &
~NILFS_FEATURE_COMPAT_RO_SUPP; ~NILFS_FEATURE_COMPAT_RO_SUPP;
if (!(sb->s_flags & MS_RDONLY) && features) { if (!(sb->s_flags & MS_RDONLY) && features) {
printk(KERN_ERR "NILFS: couldn't mount RDWR because of " nilfs_msg(sb, KERN_ERR,
"unsupported optional features (%llx)\n", "couldn't mount RDWR because of unsupported optional features (%llx)",
(unsigned long long)features); (unsigned long long)features);
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -941,13 +936,13 @@ static int nilfs_get_root_dentry(struct super_block *sb, ...@@ -941,13 +936,13 @@ static int nilfs_get_root_dentry(struct super_block *sb,
inode = nilfs_iget(sb, root, NILFS_ROOT_INO); inode = nilfs_iget(sb, root, NILFS_ROOT_INO);
if (IS_ERR(inode)) { if (IS_ERR(inode)) {
printk(KERN_ERR "NILFS: get root inode failed\n");
ret = PTR_ERR(inode); ret = PTR_ERR(inode);
nilfs_msg(sb, KERN_ERR, "error %d getting root inode", ret);
goto out; goto out;
} }
if (!S_ISDIR(inode->i_mode) || !inode->i_blocks || !inode->i_size) { if (!S_ISDIR(inode->i_mode) || !inode->i_blocks || !inode->i_size) {
iput(inode); iput(inode);
printk(KERN_ERR "NILFS: corrupt root inode.\n"); nilfs_msg(sb, KERN_ERR, "corrupt root inode");
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -975,7 +970,7 @@ static int nilfs_get_root_dentry(struct super_block *sb, ...@@ -975,7 +970,7 @@ static int nilfs_get_root_dentry(struct super_block *sb,
return ret; return ret;
failed_dentry: failed_dentry:
printk(KERN_ERR "NILFS: get root dentry failed\n"); nilfs_msg(sb, KERN_ERR, "error %d getting root dentry", ret);
goto out; goto out;
} }
...@@ -995,18 +990,18 @@ static int nilfs_attach_snapshot(struct super_block *s, __u64 cno, ...@@ -995,18 +990,18 @@ static int nilfs_attach_snapshot(struct super_block *s, __u64 cno,
ret = (ret == -ENOENT) ? -EINVAL : ret; ret = (ret == -ENOENT) ? -EINVAL : ret;
goto out; goto out;
} else if (!ret) { } else if (!ret) {
printk(KERN_ERR "NILFS: The specified checkpoint is " nilfs_msg(s, KERN_ERR,
"not a snapshot (checkpoint number=%llu).\n", "The specified checkpoint is not a snapshot (checkpoint number=%llu)",
(unsigned long long)cno); (unsigned long long)cno);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
ret = nilfs_attach_checkpoint(s, cno, false, &root); ret = nilfs_attach_checkpoint(s, cno, false, &root);
if (ret) { if (ret) {
printk(KERN_ERR "NILFS: error loading snapshot " nilfs_msg(s, KERN_ERR,
"(checkpoint number=%llu).\n", "error %d while loading snapshot (checkpoint number=%llu)",
(unsigned long long)cno); ret, (unsigned long long)cno);
goto out; goto out;
} }
ret = nilfs_get_root_dentry(s, root, root_dentry); ret = nilfs_get_root_dentry(s, root, root_dentry);
...@@ -1101,8 +1096,9 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1101,8 +1096,9 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent)
cno = nilfs_last_cno(nilfs); cno = nilfs_last_cno(nilfs);
err = nilfs_attach_checkpoint(sb, cno, true, &fsroot); err = nilfs_attach_checkpoint(sb, cno, true, &fsroot);
if (err) { if (err) {
printk(KERN_ERR "NILFS: error loading last checkpoint " nilfs_msg(sb, KERN_ERR,
"(checkpoint number=%llu).\n", (unsigned long long)cno); "error %d while loading last checkpoint (checkpoint number=%llu)",
err, (unsigned long long)cno);
goto failed_unload; goto failed_unload;
} }
...@@ -1162,9 +1158,8 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -1162,9 +1158,8 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)
err = -EINVAL; err = -EINVAL;
if (!nilfs_valid_fs(nilfs)) { if (!nilfs_valid_fs(nilfs)) {
printk(KERN_WARNING "NILFS (device %s): couldn't " nilfs_msg(sb, KERN_WARNING,
"remount because the filesystem is in an " "couldn't remount because the filesystem is in an incomplete recovery state");
"incomplete recovery state.\n", sb->s_id);
goto restore_opts; goto restore_opts;
} }
...@@ -1196,10 +1191,9 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -1196,10 +1191,9 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)
~NILFS_FEATURE_COMPAT_RO_SUPP; ~NILFS_FEATURE_COMPAT_RO_SUPP;
up_read(&nilfs->ns_sem); up_read(&nilfs->ns_sem);
if (features) { if (features) {
printk(KERN_WARNING "NILFS (device %s): couldn't " nilfs_msg(sb, KERN_WARNING,
"remount RDWR because of unsupported optional " "couldn't remount RDWR because of unsupported optional features (%llx)",
"features (%llx)\n", (unsigned long long)features);
sb->s_id, (unsigned long long)features);
err = -EROFS; err = -EROFS;
goto restore_opts; goto restore_opts;
} }
...@@ -1262,8 +1256,8 @@ static int nilfs_identify(char *data, struct nilfs_super_data *sd) ...@@ -1262,8 +1256,8 @@ static int nilfs_identify(char *data, struct nilfs_super_data *sd)
} }
} }
if (ret) if (ret)
printk(KERN_ERR nilfs_msg(NULL, KERN_ERR,
"NILFS: invalid mount option: %s\n", p); "invalid mount option: %s", p);
} }
if (!options) if (!options)
break; break;
...@@ -1344,10 +1338,10 @@ nilfs_mount(struct file_system_type *fs_type, int flags, ...@@ -1344,10 +1338,10 @@ nilfs_mount(struct file_system_type *fs_type, int flags,
} else if (!sd.cno) { } else if (!sd.cno) {
if (nilfs_tree_is_busy(s->s_root)) { if (nilfs_tree_is_busy(s->s_root)) {
if ((flags ^ s->s_flags) & MS_RDONLY) { if ((flags ^ s->s_flags) & MS_RDONLY) {
printk(KERN_ERR "NILFS: the device already " nilfs_msg(s, KERN_ERR,
"has a %s mount.\n", "the device already has a %s mount.",
(s->s_flags & MS_RDONLY) ? (s->s_flags & MS_RDONLY) ?
"read-only" : "read/write"); "read-only" : "read/write");
err = -EBUSY; err = -EBUSY;
goto failed_super; goto failed_super;
} }
......
...@@ -272,8 +272,8 @@ nilfs_checkpoints_checkpoints_number_show(struct nilfs_checkpoints_attr *attr, ...@@ -272,8 +272,8 @@ nilfs_checkpoints_checkpoints_number_show(struct nilfs_checkpoints_attr *attr,
err = nilfs_cpfile_get_stat(nilfs->ns_cpfile, &cpstat); err = nilfs_cpfile_get_stat(nilfs->ns_cpfile, &cpstat);
up_read(&nilfs->ns_segctor_sem); up_read(&nilfs->ns_segctor_sem);
if (err < 0) { if (err < 0) {
printk(KERN_ERR "NILFS: unable to get checkpoint stat: err=%d\n", nilfs_msg(nilfs->ns_sb, KERN_ERR,
err); "unable to get checkpoint stat: err=%d", err);
return err; return err;
} }
...@@ -295,8 +295,8 @@ nilfs_checkpoints_snapshots_number_show(struct nilfs_checkpoints_attr *attr, ...@@ -295,8 +295,8 @@ nilfs_checkpoints_snapshots_number_show(struct nilfs_checkpoints_attr *attr,
err = nilfs_cpfile_get_stat(nilfs->ns_cpfile, &cpstat); err = nilfs_cpfile_get_stat(nilfs->ns_cpfile, &cpstat);
up_read(&nilfs->ns_segctor_sem); up_read(&nilfs->ns_segctor_sem);
if (err < 0) { if (err < 0) {
printk(KERN_ERR "NILFS: unable to get checkpoint stat: err=%d\n", nilfs_msg(nilfs->ns_sb, KERN_ERR,
err); "unable to get checkpoint stat: err=%d", err);
return err; return err;
} }
...@@ -414,8 +414,8 @@ nilfs_segments_dirty_segments_show(struct nilfs_segments_attr *attr, ...@@ -414,8 +414,8 @@ nilfs_segments_dirty_segments_show(struct nilfs_segments_attr *attr,
err = nilfs_sufile_get_stat(nilfs->ns_sufile, &sustat); err = nilfs_sufile_get_stat(nilfs->ns_sufile, &sustat);
up_read(&nilfs->ns_segctor_sem); up_read(&nilfs->ns_segctor_sem);
if (err < 0) { if (err < 0) {
printk(KERN_ERR "NILFS: unable to get segment stat: err=%d\n", nilfs_msg(nilfs->ns_sb, KERN_ERR,
err); "unable to get segment stat: err=%d", err);
return err; return err;
} }
...@@ -789,14 +789,15 @@ nilfs_superblock_sb_update_frequency_store(struct nilfs_superblock_attr *attr, ...@@ -789,14 +789,15 @@ nilfs_superblock_sb_update_frequency_store(struct nilfs_superblock_attr *attr,
err = kstrtouint(skip_spaces(buf), 0, &val); err = kstrtouint(skip_spaces(buf), 0, &val);
if (err) { if (err) {
printk(KERN_ERR "NILFS: unable to convert string: err=%d\n", nilfs_msg(nilfs->ns_sb, KERN_ERR,
err); "unable to convert string: err=%d", err);
return err; return err;
} }
if (val < NILFS_SB_FREQ) { if (val < NILFS_SB_FREQ) {
val = NILFS_SB_FREQ; val = NILFS_SB_FREQ;
printk(KERN_WARNING "NILFS: superblock update frequency cannot be lesser than 10 seconds\n"); nilfs_msg(nilfs->ns_sb, KERN_WARNING,
"superblock update frequency cannot be lesser than 10 seconds");
} }
down_write(&nilfs->ns_sem); down_write(&nilfs->ns_sem);
...@@ -999,7 +1000,8 @@ int nilfs_sysfs_create_device_group(struct super_block *sb) ...@@ -999,7 +1000,8 @@ int nilfs_sysfs_create_device_group(struct super_block *sb)
nilfs->ns_dev_subgroups = kzalloc(devgrp_size, GFP_KERNEL); nilfs->ns_dev_subgroups = kzalloc(devgrp_size, GFP_KERNEL);
if (unlikely(!nilfs->ns_dev_subgroups)) { if (unlikely(!nilfs->ns_dev_subgroups)) {
err = -ENOMEM; err = -ENOMEM;
printk(KERN_ERR "NILFS: unable to allocate memory for device group\n"); nilfs_msg(sb, KERN_ERR,
"unable to allocate memory for device group");
goto failed_create_device_group; goto failed_create_device_group;
} }
...@@ -1109,15 +1111,15 @@ int __init nilfs_sysfs_init(void) ...@@ -1109,15 +1111,15 @@ int __init nilfs_sysfs_init(void)
nilfs_kset = kset_create_and_add(NILFS_ROOT_GROUP_NAME, NULL, fs_kobj); nilfs_kset = kset_create_and_add(NILFS_ROOT_GROUP_NAME, NULL, fs_kobj);
if (!nilfs_kset) { if (!nilfs_kset) {
err = -ENOMEM; err = -ENOMEM;
printk(KERN_ERR "NILFS: unable to create sysfs entry: err %d\n", nilfs_msg(NULL, KERN_ERR,
err); "unable to create sysfs entry: err=%d", err);
goto failed_sysfs_init; goto failed_sysfs_init;
} }
err = sysfs_create_group(&nilfs_kset->kobj, &nilfs_feature_attr_group); err = sysfs_create_group(&nilfs_kset->kobj, &nilfs_feature_attr_group);
if (unlikely(err)) { if (unlikely(err)) {
printk(KERN_ERR "NILFS: unable to create feature group: err %d\n", nilfs_msg(NULL, KERN_ERR,
err); "unable to create feature group: err=%d", err);
goto cleanup_sysfs_init; goto cleanup_sysfs_init;
} }
......
...@@ -192,7 +192,10 @@ static int nilfs_store_log_cursor(struct the_nilfs *nilfs, ...@@ -192,7 +192,10 @@ static int nilfs_store_log_cursor(struct the_nilfs *nilfs,
nilfs_get_segnum_of_block(nilfs, nilfs->ns_last_pseg); nilfs_get_segnum_of_block(nilfs, nilfs->ns_last_pseg);
nilfs->ns_cno = nilfs->ns_last_cno + 1; nilfs->ns_cno = nilfs->ns_last_cno + 1;
if (nilfs->ns_segnum >= nilfs->ns_nsegments) { if (nilfs->ns_segnum >= nilfs->ns_nsegments) {
printk(KERN_ERR "NILFS invalid last segment number.\n"); nilfs_msg(nilfs->ns_sb, KERN_ERR,
"pointed segment number is out of range: segnum=%llu, nsegments=%lu",
(unsigned long long)nilfs->ns_segnum,
nilfs->ns_nsegments);
ret = -EINVAL; ret = -EINVAL;
} }
return ret; return ret;
...@@ -216,12 +219,12 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb) ...@@ -216,12 +219,12 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb)
int err; int err;
if (!valid_fs) { if (!valid_fs) {
printk(KERN_WARNING "NILFS warning: mounting unchecked fs\n"); nilfs_msg(sb, KERN_WARNING, "mounting unchecked fs");
if (s_flags & MS_RDONLY) { if (s_flags & MS_RDONLY) {
printk(KERN_INFO "NILFS: INFO: recovery " nilfs_msg(sb, KERN_INFO,
"required for readonly filesystem.\n"); "recovery required for readonly filesystem");
printk(KERN_INFO "NILFS: write access will " nilfs_msg(sb, KERN_INFO,
"be enabled during recovery.\n"); "write access will be enabled during recovery");
} }
} }
...@@ -236,13 +239,12 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb) ...@@ -236,13 +239,12 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb)
goto scan_error; goto scan_error;
if (!nilfs_valid_sb(sbp[1])) { if (!nilfs_valid_sb(sbp[1])) {
printk(KERN_WARNING nilfs_msg(sb, KERN_WARNING,
"NILFS warning: unable to fall back to spare" "unable to fall back to spare super block");
"super block\n");
goto scan_error; goto scan_error;
} }
printk(KERN_INFO nilfs_msg(sb, KERN_INFO,
"NILFS: try rollback from an earlier position\n"); "trying rollback from an earlier position");
/* /*
* restore super block with its spare and reconfigure * restore super block with its spare and reconfigure
...@@ -255,10 +257,9 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb) ...@@ -255,10 +257,9 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb)
/* verify consistency between two super blocks */ /* verify consistency between two super blocks */
blocksize = BLOCK_SIZE << le32_to_cpu(sbp[0]->s_log_block_size); blocksize = BLOCK_SIZE << le32_to_cpu(sbp[0]->s_log_block_size);
if (blocksize != nilfs->ns_blocksize) { if (blocksize != nilfs->ns_blocksize) {
printk(KERN_WARNING nilfs_msg(sb, KERN_WARNING,
"NILFS warning: blocksize differs between " "blocksize differs between two super blocks (%d != %d)",
"two super blocks (%d != %d)\n", blocksize, nilfs->ns_blocksize);
blocksize, nilfs->ns_blocksize);
goto scan_error; goto scan_error;
} }
...@@ -277,7 +278,8 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb) ...@@ -277,7 +278,8 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb)
err = nilfs_load_super_root(nilfs, sb, ri.ri_super_root); err = nilfs_load_super_root(nilfs, sb, ri.ri_super_root);
if (unlikely(err)) { if (unlikely(err)) {
printk(KERN_ERR "NILFS: error loading super root.\n"); nilfs_msg(sb, KERN_ERR, "error %d while loading super root",
err);
goto failed; goto failed;
} }
...@@ -288,30 +290,29 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb) ...@@ -288,30 +290,29 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb)
__u64 features; __u64 features;
if (nilfs_test_opt(nilfs, NORECOVERY)) { if (nilfs_test_opt(nilfs, NORECOVERY)) {
printk(KERN_INFO "NILFS: norecovery option specified. " nilfs_msg(sb, KERN_INFO,
"skipping roll-forward recovery\n"); "norecovery option specified, skipping roll-forward recovery");
goto skip_recovery; goto skip_recovery;
} }
features = le64_to_cpu(nilfs->ns_sbp[0]->s_feature_compat_ro) & features = le64_to_cpu(nilfs->ns_sbp[0]->s_feature_compat_ro) &
~NILFS_FEATURE_COMPAT_RO_SUPP; ~NILFS_FEATURE_COMPAT_RO_SUPP;
if (features) { if (features) {
printk(KERN_ERR "NILFS: couldn't proceed with " nilfs_msg(sb, KERN_ERR,
"recovery because of unsupported optional " "couldn't proceed with recovery because of unsupported optional features (%llx)",
"features (%llx)\n", (unsigned long long)features);
(unsigned long long)features);
err = -EROFS; err = -EROFS;
goto failed_unload; goto failed_unload;
} }
if (really_read_only) { if (really_read_only) {
printk(KERN_ERR "NILFS: write access " nilfs_msg(sb, KERN_ERR,
"unavailable, cannot proceed.\n"); "write access unavailable, cannot proceed");
err = -EROFS; err = -EROFS;
goto failed_unload; goto failed_unload;
} }
sb->s_flags &= ~MS_RDONLY; sb->s_flags &= ~MS_RDONLY;
} else if (nilfs_test_opt(nilfs, NORECOVERY)) { } else if (nilfs_test_opt(nilfs, NORECOVERY)) {
printk(KERN_ERR "NILFS: recovery cancelled because norecovery " nilfs_msg(sb, KERN_ERR,
"option was specified for a read/write mount\n"); "recovery cancelled because norecovery option was specified for a read/write mount");
err = -EINVAL; err = -EINVAL;
goto failed_unload; goto failed_unload;
} }
...@@ -326,11 +327,12 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb) ...@@ -326,11 +327,12 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb)
up_write(&nilfs->ns_sem); up_write(&nilfs->ns_sem);
if (err) { if (err) {
printk(KERN_ERR "NILFS: failed to update super block. " nilfs_msg(sb, KERN_ERR,
"recovery unfinished.\n"); "error %d updating super block. recovery unfinished.",
err);
goto failed_unload; goto failed_unload;
} }
printk(KERN_INFO "NILFS: recovery complete.\n"); nilfs_msg(sb, KERN_INFO, "recovery complete");
skip_recovery: skip_recovery:
nilfs_clear_recovery_info(&ri); nilfs_clear_recovery_info(&ri);
...@@ -338,7 +340,7 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb) ...@@ -338,7 +340,7 @@ int load_nilfs(struct the_nilfs *nilfs, struct super_block *sb)
return 0; return 0;
scan_error: scan_error:
printk(KERN_ERR "NILFS: error searching super root.\n"); nilfs_msg(sb, KERN_ERR, "error %d while searching super root", err);
goto failed; goto failed;
failed_unload: failed_unload:
...@@ -385,12 +387,11 @@ static int nilfs_store_disk_layout(struct the_nilfs *nilfs, ...@@ -385,12 +387,11 @@ static int nilfs_store_disk_layout(struct the_nilfs *nilfs,
struct nilfs_super_block *sbp) struct nilfs_super_block *sbp)
{ {
if (le32_to_cpu(sbp->s_rev_level) < NILFS_MIN_SUPP_REV) { if (le32_to_cpu(sbp->s_rev_level) < NILFS_MIN_SUPP_REV) {
printk(KERN_ERR "NILFS: unsupported revision " nilfs_msg(nilfs->ns_sb, KERN_ERR,
"(superblock rev.=%d.%d, current rev.=%d.%d). " "unsupported revision (superblock rev.=%d.%d, current rev.=%d.%d). Please check the version of mkfs.nilfs(2).",
"Please check the version of mkfs.nilfs.\n", le32_to_cpu(sbp->s_rev_level),
le32_to_cpu(sbp->s_rev_level), le16_to_cpu(sbp->s_minor_rev_level),
le16_to_cpu(sbp->s_minor_rev_level), NILFS_CURRENT_REV, NILFS_MINOR_REV);
NILFS_CURRENT_REV, NILFS_MINOR_REV);
return -EINVAL; return -EINVAL;
} }
nilfs->ns_sbsize = le16_to_cpu(sbp->s_bytes); nilfs->ns_sbsize = le16_to_cpu(sbp->s_bytes);
...@@ -399,12 +400,14 @@ static int nilfs_store_disk_layout(struct the_nilfs *nilfs, ...@@ -399,12 +400,14 @@ static int nilfs_store_disk_layout(struct the_nilfs *nilfs,
nilfs->ns_inode_size = le16_to_cpu(sbp->s_inode_size); nilfs->ns_inode_size = le16_to_cpu(sbp->s_inode_size);
if (nilfs->ns_inode_size > nilfs->ns_blocksize) { if (nilfs->ns_inode_size > nilfs->ns_blocksize) {
printk(KERN_ERR "NILFS: too large inode size: %d bytes.\n", nilfs_msg(nilfs->ns_sb, KERN_ERR,
nilfs->ns_inode_size); "too large inode size: %d bytes",
nilfs->ns_inode_size);
return -EINVAL; return -EINVAL;
} else if (nilfs->ns_inode_size < NILFS_MIN_INODE_SIZE) { } else if (nilfs->ns_inode_size < NILFS_MIN_INODE_SIZE) {
printk(KERN_ERR "NILFS: too small inode size: %d bytes.\n", nilfs_msg(nilfs->ns_sb, KERN_ERR,
nilfs->ns_inode_size); "too small inode size: %d bytes",
nilfs->ns_inode_size);
return -EINVAL; return -EINVAL;
} }
...@@ -412,7 +415,9 @@ static int nilfs_store_disk_layout(struct the_nilfs *nilfs, ...@@ -412,7 +415,9 @@ static int nilfs_store_disk_layout(struct the_nilfs *nilfs,
nilfs->ns_blocks_per_segment = le32_to_cpu(sbp->s_blocks_per_segment); nilfs->ns_blocks_per_segment = le32_to_cpu(sbp->s_blocks_per_segment);
if (nilfs->ns_blocks_per_segment < NILFS_SEG_MIN_BLOCKS) { if (nilfs->ns_blocks_per_segment < NILFS_SEG_MIN_BLOCKS) {
printk(KERN_ERR "NILFS: too short segment.\n"); nilfs_msg(nilfs->ns_sb, KERN_ERR,
"too short segment: %lu blocks",
nilfs->ns_blocks_per_segment);
return -EINVAL; return -EINVAL;
} }
...@@ -421,7 +426,9 @@ static int nilfs_store_disk_layout(struct the_nilfs *nilfs, ...@@ -421,7 +426,9 @@ static int nilfs_store_disk_layout(struct the_nilfs *nilfs,
le32_to_cpu(sbp->s_r_segments_percentage); le32_to_cpu(sbp->s_r_segments_percentage);
if (nilfs->ns_r_segments_percentage < 1 || if (nilfs->ns_r_segments_percentage < 1 ||
nilfs->ns_r_segments_percentage > 99) { nilfs->ns_r_segments_percentage > 99) {
printk(KERN_ERR "NILFS: invalid reserved segments percentage.\n"); nilfs_msg(nilfs->ns_sb, KERN_ERR,
"invalid reserved segments percentage: %lu",
nilfs->ns_r_segments_percentage);
return -EINVAL; return -EINVAL;
} }
...@@ -505,16 +512,16 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs, ...@@ -505,16 +512,16 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,
if (!sbp[0]) { if (!sbp[0]) {
if (!sbp[1]) { if (!sbp[1]) {
printk(KERN_ERR "NILFS: unable to read superblock\n"); nilfs_msg(sb, KERN_ERR, "unable to read superblock");
return -EIO; return -EIO;
} }
printk(KERN_WARNING nilfs_msg(sb, KERN_WARNING,
"NILFS warning: unable to read primary superblock " "unable to read primary superblock (blocksize = %d)",
"(blocksize = %d)\n", blocksize); blocksize);
} else if (!sbp[1]) { } else if (!sbp[1]) {
printk(KERN_WARNING nilfs_msg(sb, KERN_WARNING,
"NILFS warning: unable to read secondary superblock " "unable to read secondary superblock (blocksize = %d)",
"(blocksize = %d)\n", blocksize); blocksize);
} }
/* /*
...@@ -536,14 +543,14 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs, ...@@ -536,14 +543,14 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,
} }
if (!valid[swp]) { if (!valid[swp]) {
nilfs_release_super_block(nilfs); nilfs_release_super_block(nilfs);
printk(KERN_ERR "NILFS: Can't find nilfs on dev %s.\n", nilfs_msg(sb, KERN_ERR, "couldn't find nilfs on the device");
sb->s_id);
return -EINVAL; return -EINVAL;
} }
if (!valid[!swp]) if (!valid[!swp])
printk(KERN_WARNING "NILFS warning: broken superblock. " nilfs_msg(sb, KERN_WARNING,
"using spare superblock (blocksize = %d).\n", blocksize); "broken superblock, retrying with spare superblock (blocksize = %d)",
blocksize);
if (swp) if (swp)
nilfs_swap_super_block(nilfs); nilfs_swap_super_block(nilfs);
...@@ -577,7 +584,7 @@ int init_nilfs(struct the_nilfs *nilfs, struct super_block *sb, char *data) ...@@ -577,7 +584,7 @@ int init_nilfs(struct the_nilfs *nilfs, struct super_block *sb, char *data)
blocksize = sb_min_blocksize(sb, NILFS_MIN_BLOCK_SIZE); blocksize = sb_min_blocksize(sb, NILFS_MIN_BLOCK_SIZE);
if (!blocksize) { if (!blocksize) {
printk(KERN_ERR "NILFS: unable to set blocksize\n"); nilfs_msg(sb, KERN_ERR, "unable to set blocksize");
err = -EINVAL; err = -EINVAL;
goto out; goto out;
} }
...@@ -596,8 +603,9 @@ int init_nilfs(struct the_nilfs *nilfs, struct super_block *sb, char *data) ...@@ -596,8 +603,9 @@ int init_nilfs(struct the_nilfs *nilfs, struct super_block *sb, char *data)
blocksize = BLOCK_SIZE << le32_to_cpu(sbp->s_log_block_size); blocksize = BLOCK_SIZE << le32_to_cpu(sbp->s_log_block_size);
if (blocksize < NILFS_MIN_BLOCK_SIZE || if (blocksize < NILFS_MIN_BLOCK_SIZE ||
blocksize > NILFS_MAX_BLOCK_SIZE) { blocksize > NILFS_MAX_BLOCK_SIZE) {
printk(KERN_ERR "NILFS: couldn't mount because of unsupported " nilfs_msg(sb, KERN_ERR,
"filesystem blocksize %d\n", blocksize); "couldn't mount because of unsupported filesystem blocksize %d",
blocksize);
err = -EINVAL; err = -EINVAL;
goto failed_sbh; goto failed_sbh;
} }
...@@ -605,10 +613,9 @@ int init_nilfs(struct the_nilfs *nilfs, struct super_block *sb, char *data) ...@@ -605,10 +613,9 @@ int init_nilfs(struct the_nilfs *nilfs, struct super_block *sb, char *data)
int hw_blocksize = bdev_logical_block_size(sb->s_bdev); int hw_blocksize = bdev_logical_block_size(sb->s_bdev);
if (blocksize < hw_blocksize) { if (blocksize < hw_blocksize) {
printk(KERN_ERR nilfs_msg(sb, KERN_ERR,
"NILFS: blocksize %d too small for device " "blocksize %d too small for device (sector-size = %d)",
"(sector-size = %d).\n", blocksize, hw_blocksize);
blocksize, hw_blocksize);
err = -EINVAL; err = -EINVAL;
goto failed_sbh; goto failed_sbh;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment