aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4.h
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2008-10-09 10:56:23 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-10-09 10:56:23 -0400
commita30d542a0035b886ffaafd0057ced0a2b28c3a4f (patch)
tree9e677eaf4eb1611701828554b27a1b0b0ae523fd /fs/ext4/ext4.h
parentc4a0c46ec92c194c873232b88debce4e1a448483 (diff)
ext4: Make sure all the block allocation paths reserve blocks
With delayed allocation we need to make sure block are reserved before we attempt to allocate them. Otherwise we get block allocation failure (ENOSPC) during writepages which cannot be handled. This would mean silent data loss (We do a printk stating data will be lost). This patch updates the DIO and fallocate code path to do block reservation before block allocation. This is needed to make sure parallel DIO and fallocate request doesn't take block out of delayed reserve space. When free blocks count go below a threshold we switch to a slow patch which looks at other CPU's accumulated percpu counter values. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r--fs/ext4/ext4.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 8c701318844d..0154c2d0b242 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -983,6 +983,8 @@ extern ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode,
983 unsigned long *count, int *errp); 983 unsigned long *count, int *errp);
984extern ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode, 984extern ext4_fsblk_t ext4_old_new_blocks(handle_t *handle, struct inode *inode,
985 ext4_fsblk_t goal, unsigned long *count, int *errp); 985 ext4_fsblk_t goal, unsigned long *count, int *errp);
986extern int ext4_claim_free_blocks(struct ext4_sb_info *sbi,
987 ext4_fsblk_t nblocks);
986extern ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi, 988extern ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi,
987 ext4_fsblk_t nblocks); 989 ext4_fsblk_t nblocks);
988extern void ext4_free_blocks(handle_t *handle, struct inode *inode, 990extern void ext4_free_blocks(handle_t *handle, struct inode *inode,
@@ -1207,6 +1209,17 @@ do { \
1207 __ext4_std_error((sb), __func__, (errno)); \ 1209 __ext4_std_error((sb), __func__, (errno)); \
1208} while (0) 1210} while (0)
1209 1211
1212#ifdef CONFIG_SMP
1213/* Each CPU can accumulate FBC_BATCH blocks in their local
1214 * counters. So we need to make sure we have free blocks more
1215 * than FBC_BATCH * nr_cpu_ids. Also add a window of 4 times.
1216 */
1217#define EXT4_FREEBLOCKS_WATERMARK (4 * (FBC_BATCH * nr_cpu_ids))
1218#else
1219#define EXT4_FREEBLOCKS_WATERMARK 0
1220#endif
1221
1222
1210/* 1223/*
1211 * Inodes and files operations 1224 * Inodes and files operations
1212 */ 1225 */