aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2009-05-12 13:51:29 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-05-12 13:51:29 -0400
commita2dc52b5d1d8cc280b3e795abf1c80ac8c49f30c (patch)
tree2f425d897dfdab9f2a5997f9801c6ccbea7c1323 /fs/ext4
parentb920c75502cb2c48654ef196d647c8eb81ab608a (diff)
ext4: Add BUG_ON debugging checks to noalloc_get_block_write()
Enforce that noalloc_get_block_write() is only called to map one block at a time, and that it always is successful in finding a mapping for given an inode's logical block block number if it is called with create == 1. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/inode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index fd5f27a9b81b..e6113c3a126f 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2433,11 +2433,14 @@ static int noalloc_get_block_write(struct inode *inode, sector_t iblock,
2433 int ret = 0; 2433 int ret = 0;
2434 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits; 2434 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits;
2435 2435
2436 BUG_ON(bh_result->b_size != inode->i_sb->s_blocksize);
2437
2436 /* 2438 /*
2437 * we don't want to do block allocation in writepage 2439 * we don't want to do block allocation in writepage
2438 * so call get_block_wrap with create = 0 2440 * so call get_block_wrap with create = 0
2439 */ 2441 */
2440 ret = ext4_get_blocks(NULL, inode, iblock, max_blocks, bh_result, 0); 2442 ret = ext4_get_blocks(NULL, inode, iblock, max_blocks, bh_result, 0);
2443 BUG_ON(create && ret == 0);
2441 if (ret > 0) { 2444 if (ret > 0) {
2442 bh_result->b_size = (ret << inode->i_blkbits); 2445 bh_result->b_size = (ret << inode->i_blkbits);
2443 ret = 0; 2446 ret = 0;