Commit c349179b authored by Theodore Ts'o's avatar Theodore Ts'o

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: default avatar"Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: default avatarZheng Liu <wenqing.lz@taobao.com>
parent 7d7ea89e
...@@ -407,7 +407,7 @@ static int ext4_valid_extent_entries(struct inode *inode, ...@@ -407,7 +407,7 @@ static int ext4_valid_extent_entries(struct inode *inode,
static int __ext4_ext_check(const char *function, unsigned int line, static int __ext4_ext_check(const char *function, unsigned int line,
struct inode *inode, struct ext4_extent_header *eh, struct inode *inode, struct ext4_extent_header *eh,
int depth) int depth, ext4_fsblk_t pblk)
{ {
const char *error_msg; const char *error_msg;
int max = 0; int max = 0;
...@@ -447,21 +447,21 @@ static int __ext4_ext_check(const char *function, unsigned int line, ...@@ -447,21 +447,21 @@ static int __ext4_ext_check(const char *function, unsigned int line,
corrupted: corrupted:
ext4_error_inode(inode, function, line, 0, ext4_error_inode(inode, function, line, 0,
"bad header/extent: %s - magic %x, " "pblk %llu bad header/extent: %s - magic %x, "
"entries %u, max %u(%u), depth %u(%u)", "entries %u, max %u(%u), depth %u(%u)",
error_msg, le16_to_cpu(eh->eh_magic), (unsigned long long) pblk, error_msg,
le16_to_cpu(eh->eh_magic),
le16_to_cpu(eh->eh_entries), le16_to_cpu(eh->eh_max), le16_to_cpu(eh->eh_entries), le16_to_cpu(eh->eh_max),
max, le16_to_cpu(eh->eh_depth), depth); max, le16_to_cpu(eh->eh_depth), depth);
return -EIO; return -EIO;
} }
#define ext4_ext_check(inode, eh, depth) \ #define ext4_ext_check(inode, eh, depth, pblk) \
__ext4_ext_check(__func__, __LINE__, inode, eh, depth) __ext4_ext_check(__func__, __LINE__, (inode), (eh), (depth), (pblk))
int ext4_ext_check_inode(struct inode *inode) int ext4_ext_check_inode(struct inode *inode)
{ {
return ext4_ext_check(inode, ext_inode_hdr(inode), ext_depth(inode)); return ext4_ext_check(inode, ext_inode_hdr(inode), ext_depth(inode), 0);
} }
static struct buffer_head * static struct buffer_head *
...@@ -484,7 +484,7 @@ __read_extent_tree_block(const char *function, unsigned int line, ...@@ -484,7 +484,7 @@ __read_extent_tree_block(const char *function, unsigned int line,
if (buffer_verified(bh)) if (buffer_verified(bh))
return bh; return bh;
err = __ext4_ext_check(function, line, inode, err = __ext4_ext_check(function, line, inode,
ext_block_hdr(bh), depth); ext_block_hdr(bh), depth, pblk);
if (err) if (err)
goto errout; goto errout;
set_buffer_verified(bh); set_buffer_verified(bh);
...@@ -2775,7 +2775,7 @@ int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start, ...@@ -2775,7 +2775,7 @@ int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start,
path[0].p_hdr = ext_inode_hdr(inode); path[0].p_hdr = ext_inode_hdr(inode);
i = 0; i = 0;
if (ext4_ext_check(inode, path[0].p_hdr, depth)) { if (ext4_ext_check(inode, path[0].p_hdr, depth, 0)) {
err = -EIO; err = -EIO;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment