Skip to content

Commit aadfeb6

Browse files
committed
Btrfs: Add some extra debugging around file data checksum failures
Signed-off-by: Chris Mason <[email protected]>
1 parent c2a8b6e commit aadfeb6

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

fs/btrfs/file-item.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans,
261261
found:
262262
csum_result = btrfs_csum_data(root, data, csum_result, len);
263263
btrfs_csum_final(csum_result, (char *)&csum_result);
264+
if (csum_result == 0) {
265+
printk("csum result is 0 for inode %lu offset %Lu\n", inode->i_ino, offset);
266+
}
267+
264268
write_extent_buffer(leaf, &csum_result, (unsigned long)item,
265269
BTRFS_CRC32_SIZE);
266270
btrfs_mark_buffer_dirty(path->nodes[0]);

fs/btrfs/inode.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ int btrfs_readpage_io_hook(struct page *page, u64 start, u64 end)
318318
if (ret == -ENOENT || ret == -EFBIG)
319319
ret = 0;
320320
csum = 0;
321+
printk("no csum found for inode %lu start %Lu\n", inode->i_ino, start);
321322
goto out;
322323
}
323324
read_extent_buffer(path->nodes[0], &csum, (unsigned long)item,
@@ -336,7 +337,7 @@ int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end)
336337
struct inode *inode = page->mapping->host;
337338
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
338339
char *kaddr;
339-
u64 private;
340+
u64 private = ~(u32)0;
340341
int ret;
341342
struct btrfs_root *root = BTRFS_I(inode)->root;
342343
u32 csum = ~(u32)0;
@@ -362,8 +363,9 @@ int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end)
362363
return 0;
363364

364365
zeroit:
365-
printk("btrfs csum failed ino %lu off %llu\n",
366-
page->mapping->host->i_ino, (unsigned long long)start);
366+
printk("btrfs csum failed ino %lu off %llu csum %u private %Lu\n",
367+
page->mapping->host->i_ino, (unsigned long long)start, csum,
368+
private);
367369
memset(kaddr + offset, 1, end - start + 1);
368370
flush_dcache_page(page);
369371
kunmap_atomic(kaddr, KM_IRQ0);

0 commit comments

Comments
 (0)