aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/extents.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2013-08-16 21:21:41 -0400
committerTheodore Ts'o <tytso@mit.edu>2013-08-16 21:21:41 -0400
commitc349179b4808f7c8e1ff1b4dd967c047eefd24bc (patch)
tree39b7286f02be7df26c6140ae1bec8c520ec23e33 /fs/ext4/extents.c
parent7d7ea89e756ea18a3b08cd396e2a4c0c12d473a8 (diff)
ext4: print the block number of invalid extent tree blocks
When we find an invalid extent tree block, report the block number of the bad block for debugging purposes. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r--fs/ext4/extents.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index a40be59ddce6..6e7b7d928f4a 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -407,7 +407,7 @@ static int ext4_valid_extent_entries(struct inode *inode,
407 407
408static int __ext4_ext_check(const char *function, unsigned int line, 408static int __ext4_ext_check(const char *function, unsigned int line,
409 struct inode *inode, struct ext4_extent_header *eh, 409 struct inode *inode, struct ext4_extent_header *eh,
410 int depth) 410 int depth, ext4_fsblk_t pblk)
411{ 411{
412 const char *error_msg; 412 const char *error_msg;
413 int max = 0; 413 int max = 0;
@@ -447,21 +447,21 @@ static int __ext4_ext_check(const char *function, unsigned int line,
447 447
448corrupted: 448corrupted:
449 ext4_error_inode(inode, function, line, 0, 449 ext4_error_inode(inode, function, line, 0,
450 "bad header/extent: %s - magic %x, " 450 "pblk %llu bad header/extent: %s - magic %x, "
451 "entries %u, max %u(%u), depth %u(%u)", 451 "entries %u, max %u(%u), depth %u(%u)",
452 error_msg, le16_to_cpu(eh->eh_magic), 452 (unsigned long long) pblk, error_msg,
453 le16_to_cpu(eh->eh_entries), le16_to_cpu(eh->eh_max), 453 le16_to_cpu(eh->eh_magic),
454 max, le16_to_cpu(eh->eh_depth), depth); 454 le16_to_cpu(eh->eh_entries), le16_to_cpu(eh->eh_max),
455 455 max, le16_to_cpu(eh->eh_depth), depth);
456 return -EIO; 456 return -EIO;
457} 457}
458 458
459#define ext4_ext_check(inode, eh, depth) \ 459#define ext4_ext_check(inode, eh, depth, pblk) \
460 __ext4_ext_check(__func__, __LINE__, inode, eh, depth) 460 __ext4_ext_check(__func__, __LINE__, (inode), (eh), (depth), (pblk))
461 461
462int ext4_ext_check_inode(struct inode *inode) 462int ext4_ext_check_inode(struct inode *inode)
463{ 463{
464 return ext4_ext_check(inode, ext_inode_hdr(inode), ext_depth(inode)); 464 return ext4_ext_check(inode, ext_inode_hdr(inode), ext_depth(inode), 0);
465} 465}
466 466
467static struct buffer_head * 467static struct buffer_head *
@@ -484,7 +484,7 @@ __read_extent_tree_block(const char *function, unsigned int line,
484 if (buffer_verified(bh)) 484 if (buffer_verified(bh))
485 return bh; 485 return bh;
486 err = __ext4_ext_check(function, line, inode, 486 err = __ext4_ext_check(function, line, inode,
487 ext_block_hdr(bh), depth); 487 ext_block_hdr(bh), depth, pblk);
488 if (err) 488 if (err)
489 goto errout; 489 goto errout;
490 set_buffer_verified(bh); 490 set_buffer_verified(bh);
@@ -2775,7 +2775,7 @@ again:
2775 path[0].p_hdr = ext_inode_hdr(inode); 2775 path[0].p_hdr = ext_inode_hdr(inode);
2776 i = 0; 2776 i = 0;
2777 2777
2778 if (ext4_ext_check(inode, path[0].p_hdr, depth)) { 2778 if (ext4_ext_check(inode, path[0].p_hdr, depth, 0)) {
2779 err = -EIO; 2779 err = -EIO;
2780 goto out; 2780 goto out;
2781 } 2781 }