diff options
author | Jan Kara <jack@suse.cz> | 2014-11-25 11:41:49 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-11-25 11:41:49 -0500 |
commit | cbd7584e6ead1b79fb0b81573f158b57fa1f0b49 (patch) | |
tree | 55594320c91d408ab9aa63f8fc1ef79b3556cd14 /fs/ext4/ext4.h | |
parent | 0756b908a364c217bc2d8063783992ffe338b143 (diff) |
ext4: fix block reservation for bigalloc filesystems
For bigalloc filesystems we have to check whether newly requested inode
block isn't already part of a cluster for which we already have delayed
allocation reservation. This check happens in ext4_ext_map_blocks() and
that function sets EXT4_MAP_FROM_CLUSTER if that's the case. However if
ext4_da_map_blocks() finds in extent cache information about the block,
we don't call into ext4_ext_map_blocks() and thus we always end up
getting new reservation even if the space for cluster is already
reserved. This results in overreservation and premature ENOSPC reports.
Fix the problem by checking for existing cluster reservation already in
ext4_da_map_blocks(). That simplifies the logic and actually allows us
to get rid of the EXT4_MAP_FROM_CLUSTER flag completely.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 21a3b38395ff..7b3f3b1decff 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -158,17 +158,8 @@ struct ext4_allocation_request { | |||
158 | #define EXT4_MAP_MAPPED (1 << BH_Mapped) | 158 | #define EXT4_MAP_MAPPED (1 << BH_Mapped) |
159 | #define EXT4_MAP_UNWRITTEN (1 << BH_Unwritten) | 159 | #define EXT4_MAP_UNWRITTEN (1 << BH_Unwritten) |
160 | #define EXT4_MAP_BOUNDARY (1 << BH_Boundary) | 160 | #define EXT4_MAP_BOUNDARY (1 << BH_Boundary) |
161 | /* Sometimes (in the bigalloc case, from ext4_da_get_block_prep) the caller of | ||
162 | * ext4_map_blocks wants to know whether or not the underlying cluster has | ||
163 | * already been accounted for. EXT4_MAP_FROM_CLUSTER conveys to the caller that | ||
164 | * the requested mapping was from previously mapped (or delayed allocated) | ||
165 | * cluster. We use BH_AllocFromCluster only for this flag. BH_AllocFromCluster | ||
166 | * should never appear on buffer_head's state flags. | ||
167 | */ | ||
168 | #define EXT4_MAP_FROM_CLUSTER (1 << BH_AllocFromCluster) | ||
169 | #define EXT4_MAP_FLAGS (EXT4_MAP_NEW | EXT4_MAP_MAPPED |\ | 161 | #define EXT4_MAP_FLAGS (EXT4_MAP_NEW | EXT4_MAP_MAPPED |\ |
170 | EXT4_MAP_UNWRITTEN | EXT4_MAP_BOUNDARY |\ | 162 | EXT4_MAP_UNWRITTEN | EXT4_MAP_BOUNDARY) |
171 | EXT4_MAP_FROM_CLUSTER) | ||
172 | 163 | ||
173 | struct ext4_map_blocks { | 164 | struct ext4_map_blocks { |
174 | ext4_fsblk_t m_pblk; | 165 | ext4_fsblk_t m_pblk; |
@@ -2790,16 +2781,6 @@ extern int ext4_bio_write_page(struct ext4_io_submit *io, | |||
2790 | extern int ext4_multi_mount_protect(struct super_block *, ext4_fsblk_t); | 2781 | extern int ext4_multi_mount_protect(struct super_block *, ext4_fsblk_t); |
2791 | 2782 | ||
2792 | /* | 2783 | /* |
2793 | * Note that these flags will never ever appear in a buffer_head's state flag. | ||
2794 | * See EXT4_MAP_... to see where this is used. | ||
2795 | */ | ||
2796 | enum ext4_state_bits { | ||
2797 | BH_AllocFromCluster /* allocated blocks were part of already | ||
2798 | * allocated cluster. */ | ||
2799 | = BH_JBDPrivateStart | ||
2800 | }; | ||
2801 | |||
2802 | /* | ||
2803 | * Add new method to test whether block and inode bitmaps are properly | 2784 | * Add new method to test whether block and inode bitmaps are properly |
2804 | * initialized. With uninit_bg reading the block from disk is not enough | 2785 | * initialized. With uninit_bg reading the block from disk is not enough |
2805 | * to mark the bitmap uptodate. We need to also zero-out the bitmap | 2786 | * to mark the bitmap uptodate. We need to also zero-out the bitmap |