aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4.h
diff options
context:
space:
mode:
authorMingming Cao <cmm@us.ibm.com>2009-09-28 15:48:41 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-09-28 15:48:41 -0400
commit4c0425ff68b1b87b802ffeda7b6a46ff7da7241c (patch)
treea8718f5f4574af8e15fd876b24f4aec88d62451b /fs/ext4/ext4.h
parent0031462b5b392f90d17f1d75abb795883c44e969 (diff)
ext4: Use end_io callback to avoid direct I/O fallback to buffered I/O
Currently the DIO VFS code passes create = 0 when writing to the middle of file. It does this to avoid block allocation for holes, so as not to expose stale data out when there is a parallel buffered read (which does not hold the i_mutex lock). Direct I/O writes into holes falls back to buffered IO for this reason. Since preallocated extents are treated as holes when doing a get_block() look up (buffer is not mapped), direct IO over fallocate also falls back to buffered IO. Thus ext4 actually silently falls back to buffered IO in above two cases, which is undesirable. To fix this, this patch creates unitialized extents when a direct I/O write into holes in sparse files, and registering an end_io callback which converts the uninitialized extent to an initialized extent after the I/O is completed. Singed-Off-By: Mingming Cao <cmm@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r--fs/ext4/ext4.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 2b4293aac162..ccb4dbf359c4 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -999,6 +999,9 @@ struct ext4_sb_info {
999 999
1000 unsigned int s_log_groups_per_flex; 1000 unsigned int s_log_groups_per_flex;
1001 struct flex_groups *s_flex_groups; 1001 struct flex_groups *s_flex_groups;
1002
1003 /* workqueue for dio unwritten */
1004 struct workqueue_struct *dio_unwritten_wq;
1002}; 1005};
1003 1006
1004static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) 1007static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb)