diff options
author | Mingming Cao <cmm@us.ibm.com> | 2009-09-28 21:48:41 +0200 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-09-28 21:48:41 +0200 |
commit | 4c0425ff68b1b87b802ffeda7b6a46ff7da7241c (patch) | |
tree | a8718f5f4574af8e15fd876b24f4aec88d62451b /fs/ext4/ext4.h | |
parent | ext4: Split uninitialized extents for direct I/O (diff) | |
download | linux-4c0425ff68b1b87b802ffeda7b6a46ff7da7241c.tar.xz linux-4c0425ff68b1b87b802ffeda7b6a46ff7da7241c.zip |
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.h | 3 |
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 { unsigned int s_log_groups_per_flex; struct flex_groups *s_flex_groups; + + /* workqueue for dio unwritten */ + struct workqueue_struct *dio_unwritten_wq; }; static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) |