diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-30 16:25:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-30 16:25:56 -0500 |
commit | 1f11abc966b82b9fd0c834707486ef301b2f398d (patch) | |
tree | 4e9d49b00ab034f1fc7f11cb1ff54e3121a728ae /fs/ext4/extents.c | |
parent | f8e9766dd1bacd5f32f9ac4322b55fbfd46b778e (diff) | |
parent | 0637c6f4135f592f094207c7c21e7c0fc5557834 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: Patch up how we claim metadata blocks for quota purposes
ext4: Ensure zeroout blocks have no dirty metadata
ext4: return correct wbc.nr_to_write in ext4_da_writepages
ext4: Update documentation to correct the inode_readahead_blks option name
jbd2: don't use __GFP_NOFAIL in journal_init_common()
ext4: flush delalloc blocks when space is low
fs-writeback: Add helper function to start writeback if idle
ext4: Eliminate potential double free on error path
ext4: fix unsigned long long printk warning in super.c
ext4, jbd2: Add barriers for file systems with exernal journals
ext4: replace BUG() with return -EIO in ext4_ext_get_blocks
ext4: add module aliases for ext2 and ext3
ext4: Don't ask about supporting ext2/3 in ext4 if ext4 is not configured
ext4: remove unused #include <linux/version.h>
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r-- | fs/ext4/extents.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 3a7928f825e4..91ae46098ea4 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -3023,6 +3023,14 @@ out: | |||
3023 | return err; | 3023 | return err; |
3024 | } | 3024 | } |
3025 | 3025 | ||
3026 | static void unmap_underlying_metadata_blocks(struct block_device *bdev, | ||
3027 | sector_t block, int count) | ||
3028 | { | ||
3029 | int i; | ||
3030 | for (i = 0; i < count; i++) | ||
3031 | unmap_underlying_metadata(bdev, block + i); | ||
3032 | } | ||
3033 | |||
3026 | static int | 3034 | static int |
3027 | ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, | 3035 | ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, |
3028 | ext4_lblk_t iblock, unsigned int max_blocks, | 3036 | ext4_lblk_t iblock, unsigned int max_blocks, |
@@ -3098,6 +3106,18 @@ out: | |||
3098 | } else | 3106 | } else |
3099 | allocated = ret; | 3107 | allocated = ret; |
3100 | set_buffer_new(bh_result); | 3108 | set_buffer_new(bh_result); |
3109 | /* | ||
3110 | * if we allocated more blocks than requested | ||
3111 | * we need to make sure we unmap the extra block | ||
3112 | * allocated. The actual needed block will get | ||
3113 | * unmapped later when we find the buffer_head marked | ||
3114 | * new. | ||
3115 | */ | ||
3116 | if (allocated > max_blocks) { | ||
3117 | unmap_underlying_metadata_blocks(inode->i_sb->s_bdev, | ||
3118 | newblock + max_blocks, | ||
3119 | allocated - max_blocks); | ||
3120 | } | ||
3101 | map_out: | 3121 | map_out: |
3102 | set_buffer_mapped(bh_result); | 3122 | set_buffer_mapped(bh_result); |
3103 | out1: | 3123 | out1: |
@@ -3190,7 +3210,13 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, | |||
3190 | * this situation is possible, though, _during_ tree modification; | 3210 | * this situation is possible, though, _during_ tree modification; |
3191 | * this is why assert can't be put in ext4_ext_find_extent() | 3211 | * this is why assert can't be put in ext4_ext_find_extent() |
3192 | */ | 3212 | */ |
3193 | BUG_ON(path[depth].p_ext == NULL && depth != 0); | 3213 | if (path[depth].p_ext == NULL && depth != 0) { |
3214 | ext4_error(inode->i_sb, __func__, "bad extent address " | ||
3215 | "inode: %lu, iblock: %d, depth: %d", | ||
3216 | inode->i_ino, iblock, depth); | ||
3217 | err = -EIO; | ||
3218 | goto out2; | ||
3219 | } | ||
3194 | eh = path[depth].p_hdr; | 3220 | eh = path[depth].p_hdr; |
3195 | 3221 | ||
3196 | ex = path[depth].p_ext; | 3222 | ex = path[depth].p_ext; |