浏览代码

nilfs2: emit error message when I/O error is detected

When nilfs returned -EIO as an error code, it's not always clear if it
came from the underlying block device or not.  This will mend the issue
by having low level I/O routines of nilfs output an error message when
they detected an I/O error.

Link: http://lkml.kernel.org/r/1464875891-5443-7-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>
Ryusuke Konishi 9 年之前
父节点
当前提交
39a9dcca61
共有 3 个文件被更改,包括 16 次插入2 次删除
  1. 3 0
      fs/nilfs2/btree.c
  2. 8 1
      fs/nilfs2/gcinode.c
  3. 5 1
      fs/nilfs2/mdt.c

+ 3 - 0
fs/nilfs2/btree.c

@@ -517,6 +517,9 @@ static int __nilfs_btree_get_block(const struct nilfs_bmap *btree, __u64 ptr,
 
 
  out_no_wait:
  out_no_wait:
 	if (!buffer_uptodate(bh)) {
 	if (!buffer_uptodate(bh)) {
+		nilfs_msg(btree->b_inode->i_sb, KERN_ERR,
+			  "I/O error reading b-tree node block (ino=%lu, blocknr=%llu)",
+			  btree->b_inode->i_ino, (unsigned long long)ptr);
 		brelse(bh);
 		brelse(bh);
 		return -EIO;
 		return -EIO;
 	}
 	}

+ 8 - 1
fs/nilfs2/gcinode.c

@@ -148,8 +148,15 @@ int nilfs_gccache_submit_read_node(struct inode *inode, sector_t pbn,
 int nilfs_gccache_wait_and_mark_dirty(struct buffer_head *bh)
 int nilfs_gccache_wait_and_mark_dirty(struct buffer_head *bh)
 {
 {
 	wait_on_buffer(bh);
 	wait_on_buffer(bh);
-	if (!buffer_uptodate(bh))
+	if (!buffer_uptodate(bh)) {
+		struct inode *inode = bh->b_page->mapping->host;
+
+		nilfs_msg(inode->i_sb, KERN_ERR,
+			  "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);
 		return -EIO;
 		return -EIO;
+	}
 	if (buffer_dirty(bh))
 	if (buffer_dirty(bh))
 		return -EEXIST;
 		return -EEXIST;
 
 

+ 5 - 1
fs/nilfs2/mdt.c

@@ -207,8 +207,12 @@ static int nilfs_mdt_read_block(struct inode *inode, unsigned long block,
 
 
  out_no_wait:
  out_no_wait:
 	err = -EIO;
 	err = -EIO;
-	if (!buffer_uptodate(first_bh))
+	if (!buffer_uptodate(first_bh)) {
+		nilfs_msg(inode->i_sb, KERN_ERR,
+			  "I/O error reading meta-data file (ino=%lu, block-offset=%lu)",
+			  inode->i_ino, block);
 		goto failed_bh;
 		goto failed_bh;
+	}
  out:
  out:
 	*out_bh = first_bh;
 	*out_bh = first_bh;
 	return 0;
 	return 0;