linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Oliva <oliva@gnu.org>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] [btrfs] add volid to failed csum messages
Date: Tue, 20 May 2014 12:37:07 -0300	[thread overview]
Message-ID: <orsio41mxo.fsf@free.home> (raw)

The failed csum messages generated by btrfs mention the inode number,
but on filesystems with multiple subvolumes, that's not enough to
identify the file.  I've added the inode number to the messages so
that they're more complete.

I also noticed that the extent/offset information printed for the file
isn't always correct.  Indeed, when we print an offset that could be
fed to inspect-internal logical-resolve, we used the term offset, that
doesn't make it clear it's a logical offset, whereas when we print a
physical disk offset, as in compression.c, we used the term extent,
which incorrectly implied it to be a logical offset.  I've renamed
them to lofst and phofst, which are hopefully clearer.  Ideally, we'd
uniformly print logical offsets in these messages, but presumably the
information isn't readily available for check_compressed_csum.

I haven't quite tested this beyond building it (I don't have a sure way
to trigger csum errors :-), but AFAICT the objectid I've added is the
same number that one can pass to mount as subvolid, or look up in the
btrfs subvol list table.

Signed-off-by: Alexandre Oliva <oliva@gnu.org>
---
 fs/btrfs/compression.c |    8 +++++---
 fs/btrfs/inode.c       |   12 ++++++++----
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index b01fb6c..9f095b3 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -129,9 +129,11 @@ static int check_compressed_csum(struct inode *inode,
 
 		if (csum != *cb_sum) {
 			btrfs_info(BTRFS_I(inode)->root->fs_info,
-			   "csum failed ino %llu extent %llu csum %u wanted %u mirror %d",
-			   btrfs_ino(inode), disk_start, csum, *cb_sum,
-			   cb->mirror_num);
+				   "csum failed ino %llu vol %llu phofst %llu csum %u wanted %u mirror %d",
+				   btrfs_ino(inode),
+				   BTRFS_I(inode)->root->root_key.objectid,
+				   disk_start, csum, *cb_sum,
+				   cb->mirror_num);
 			ret = -EIO;
 			goto fail;
 		}
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d3d4448..cc32b84 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2829,8 +2829,10 @@ good:
 
 zeroit:
 	if (__ratelimit(&_rs))
-		btrfs_info(root->fs_info, "csum failed ino %llu off %llu csum %u expected csum %u",
-			btrfs_ino(page->mapping->host), start, csum, csum_expected);
+		btrfs_info(root->fs_info, "csum failed ino %llu vol %llu lofst %llu csum %u expected csum %u",
+			   btrfs_ino(page->mapping->host),
+			   root->root_key.objectid,
+			   start, csum, csum_expected);
 	memset(kaddr + offset, 1, end - start + 1);
 	flush_dcache_page(page);
 	kunmap_atomic(kaddr);
@@ -6981,8 +6983,10 @@ static void btrfs_endio_direct_read(struct bio *bio, int err)
 
 			flush_dcache_page(bvec->bv_page);
 			if (csum != csums[i]) {
-				btrfs_err(root->fs_info, "csum failed ino %llu off %llu csum %u expected csum %u",
-					  btrfs_ino(inode), start, csum,
+				btrfs_err(root->fs_info, "csum failed ino %llu vol %llu lofst %llu csum %u expected csum %u",
+					  btrfs_ino(inode),
+					  root->root_key.objectid,
+					  start, csum,
 					  csums[i]);
 				err = -EIO;
 			}


-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer

             reply	other threads:[~2014-05-20 15:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 15:37 Alexandre Oliva [this message]
2014-05-20 23:10 ` [PATCH] [btrfs] add volid to failed csum messages Duncan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=orsio41mxo.fsf@free.home \
    --to=oliva@gnu.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).