diff options
-rw-r--r-- | fs/ext4/extents.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index c2b004e29ad8..f4ef0b745a53 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -2570,8 +2570,18 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, | |||
2570 | } | 2570 | } |
2571 | if (create == EXT4_CREATE_UNINITIALIZED_EXT) | 2571 | if (create == EXT4_CREATE_UNINITIALIZED_EXT) |
2572 | goto out; | 2572 | goto out; |
2573 | if (!create) | 2573 | if (!create) { |
2574 | /* | ||
2575 | * We have blocks reserved already. We | ||
2576 | * return allocated blocks so that delalloc | ||
2577 | * won't do block reservation for us. But | ||
2578 | * the buffer head will be unmapped so that | ||
2579 | * a read from the block returns 0s. | ||
2580 | */ | ||
2581 | if (allocated > max_blocks) | ||
2582 | allocated = max_blocks; | ||
2574 | goto out2; | 2583 | goto out2; |
2584 | } | ||
2575 | 2585 | ||
2576 | ret = ext4_ext_convert_to_initialized(handle, inode, | 2586 | ret = ext4_ext_convert_to_initialized(handle, inode, |
2577 | path, iblock, | 2587 | path, iblock, |