diff options
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 64baadb4956d..69ea663ef03e 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -337,7 +337,8 @@ static int ext4_block_to_path(struct inode *inode, | |||
337 | return n; | 337 | return n; |
338 | } | 338 | } |
339 | 339 | ||
340 | static int __ext4_check_blockref(const char *function, struct inode *inode, | 340 | static int __ext4_check_blockref(const char *function, unsigned int line, |
341 | struct inode *inode, | ||
341 | __le32 *p, unsigned int max) | 342 | __le32 *p, unsigned int max) |
342 | { | 343 | { |
343 | __le32 *bref = p; | 344 | __le32 *bref = p; |
@@ -348,8 +349,8 @@ static int __ext4_check_blockref(const char *function, struct inode *inode, | |||
348 | if (blk && | 349 | if (blk && |
349 | unlikely(!ext4_data_block_valid(EXT4_SB(inode->i_sb), | 350 | unlikely(!ext4_data_block_valid(EXT4_SB(inode->i_sb), |
350 | blk, 1))) { | 351 | blk, 1))) { |
351 | ext4_error_inode(function, inode, | 352 | ext4_error_inode(inode, function, line, blk, |
352 | "invalid block reference %u", blk); | 353 | "invalid block"); |
353 | return -EIO; | 354 | return -EIO; |
354 | } | 355 | } |
355 | } | 356 | } |
@@ -358,11 +359,13 @@ static int __ext4_check_blockref(const char *function, struct inode *inode, | |||
358 | 359 | ||
359 | 360 | ||
360 | #define ext4_check_indirect_blockref(inode, bh) \ | 361 | #define ext4_check_indirect_blockref(inode, bh) \ |
361 | __ext4_check_blockref(__func__, inode, (__le32 *)(bh)->b_data, \ | 362 | __ext4_check_blockref(__func__, __LINE__, inode, \ |
363 | (__le32 *)(bh)->b_data, \ | ||
362 | EXT4_ADDR_PER_BLOCK((inode)->i_sb)) | 364 | EXT4_ADDR_PER_BLOCK((inode)->i_sb)) |
363 | 365 | ||
364 | #define ext4_check_inode_blockref(inode) \ | 366 | #define ext4_check_inode_blockref(inode) \ |
365 | __ext4_check_blockref(__func__, inode, EXT4_I(inode)->i_data, \ | 367 | __ext4_check_blockref(__func__, __LINE__, inode, \ |
368 | EXT4_I(inode)->i_data, \ | ||
366 | EXT4_NDIR_BLOCKS) | 369 | EXT4_NDIR_BLOCKS) |
367 | 370 | ||
368 | /** | 371 | /** |
@@ -1129,21 +1132,22 @@ void ext4_da_update_reserve_space(struct inode *inode, | |||
1129 | } | 1132 | } |
1130 | 1133 | ||
1131 | static int __check_block_validity(struct inode *inode, const char *func, | 1134 | static int __check_block_validity(struct inode *inode, const char *func, |
1132 | struct ext4_map_blocks *map) | 1135 | unsigned int line, |
1136 | struct ext4_map_blocks *map) | ||
1133 | { | 1137 | { |
1134 | if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), map->m_pblk, | 1138 | if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), map->m_pblk, |
1135 | map->m_len)) { | 1139 | map->m_len)) { |
1136 | ext4_error_inode(func, inode, | 1140 | ext4_error_inode(inode, func, line, map->m_pblk, |
1137 | "lblock %lu mapped to illegal pblock %llu " | 1141 | "lblock %lu mapped to illegal pblock " |
1138 | "(length %d)", (unsigned long) map->m_lblk, | 1142 | "(length %d)", (unsigned long) map->m_lblk, |
1139 | map->m_pblk, map->m_len); | 1143 | map->m_len); |
1140 | return -EIO; | 1144 | return -EIO; |
1141 | } | 1145 | } |
1142 | return 0; | 1146 | return 0; |
1143 | } | 1147 | } |
1144 | 1148 | ||
1145 | #define check_block_validity(inode, map) \ | 1149 | #define check_block_validity(inode, map) \ |
1146 | __check_block_validity((inode), __func__, (map)) | 1150 | __check_block_validity((inode), __func__, __LINE__, (map)) |
1147 | 1151 | ||
1148 | /* | 1152 | /* |
1149 | * Return the number of contiguous dirty pages in a given inode | 1153 | * Return the number of contiguous dirty pages in a given inode |
@@ -4471,9 +4475,8 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode, | |||
4471 | * (should be rare). | 4475 | * (should be rare). |
4472 | */ | 4476 | */ |
4473 | if (!bh) { | 4477 | if (!bh) { |
4474 | EXT4_ERROR_INODE(inode, | 4478 | EXT4_ERROR_INODE_BLOCK(inode, nr, |
4475 | "Read failure block=%llu", | 4479 | "Read failure"); |
4476 | (unsigned long long) nr); | ||
4477 | continue; | 4480 | continue; |
4478 | } | 4481 | } |
4479 | 4482 | ||
@@ -4788,8 +4791,8 @@ static int __ext4_get_inode_loc(struct inode *inode, | |||
4788 | 4791 | ||
4789 | bh = sb_getblk(sb, block); | 4792 | bh = sb_getblk(sb, block); |
4790 | if (!bh) { | 4793 | if (!bh) { |
4791 | EXT4_ERROR_INODE(inode, "unable to read inode block - " | 4794 | EXT4_ERROR_INODE_BLOCK(inode, block, |
4792 | "block %llu", block); | 4795 | "unable to read itable block"); |
4793 | return -EIO; | 4796 | return -EIO; |
4794 | } | 4797 | } |
4795 | if (!buffer_uptodate(bh)) { | 4798 | if (!buffer_uptodate(bh)) { |
@@ -4887,8 +4890,8 @@ make_io: | |||
4887 | submit_bh(READ_META, bh); | 4890 | submit_bh(READ_META, bh); |
4888 | wait_on_buffer(bh); | 4891 | wait_on_buffer(bh); |
4889 | if (!buffer_uptodate(bh)) { | 4892 | if (!buffer_uptodate(bh)) { |
4890 | EXT4_ERROR_INODE(inode, "unable to read inode " | 4893 | EXT4_ERROR_INODE_BLOCK(inode, block, |
4891 | "block %llu", block); | 4894 | "unable to read itable block"); |
4892 | brelse(bh); | 4895 | brelse(bh); |
4893 | return -EIO; | 4896 | return -EIO; |
4894 | } | 4897 | } |
@@ -5389,9 +5392,8 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
5389 | if (wbc->sync_mode == WB_SYNC_ALL) | 5392 | if (wbc->sync_mode == WB_SYNC_ALL) |
5390 | sync_dirty_buffer(iloc.bh); | 5393 | sync_dirty_buffer(iloc.bh); |
5391 | if (buffer_req(iloc.bh) && !buffer_uptodate(iloc.bh)) { | 5394 | if (buffer_req(iloc.bh) && !buffer_uptodate(iloc.bh)) { |
5392 | EXT4_ERROR_INODE(inode, | 5395 | EXT4_ERROR_INODE_BLOCK(inode, iloc.bh->b_blocknr, |
5393 | "IO error syncing inode (block=%llu)", | 5396 | "IO error syncing inode"); |
5394 | (unsigned long long) iloc.bh->b_blocknr); | ||
5395 | err = -EIO; | 5397 | err = -EIO; |
5396 | } | 5398 | } |
5397 | brelse(iloc.bh); | 5399 | brelse(iloc.bh); |