diff mbox series

[v5.2,03/12] btrfs: disk-io: Show the timing of corrupted tree block explicitly

Message ID 20190223043806.13836-1-wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Qu Wenruo Feb. 23, 2019, 4:38 a.m. UTC
Just add one extra line to show when the corruption is detected.
Currently only read time detection is possible.

The planned distinguish line would be:
  read time:
    <detail report>
    block=XXXXX read time tree block corruption detected

  write time:
    <detail report>
    block=XXXXX write time tree block corruption detected

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
---
v5.2:
- Make the read time error message only for tree checker error.
  RAID reconstruction can cause a lot of errors which are expected.
  Avoid error message flood for such use case.
---
 fs/btrfs/disk-io.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index ffe891e126ff..464e47be8002 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -658,6 +658,10 @@  static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
 
 	if (!ret)
 		set_extent_buffer_uptodate(eb);
+	else
+		btrfs_err(fs_info,
+			  "block=%llu read time tree block corruption detected",
+			  eb->start);
 err:
 	if (reads_done &&
 	    test_and_clear_bit(EXTENT_BUFFER_READAHEAD, &eb->bflags))