aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorMingming Cao <cmm@us.ibm.com>2009-09-28 15:48:29 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-09-28 15:48:29 -0400
commit8d5d02e6b176565c77ff03604908b1453a22044d (patch)
tree0d29e4f28233f24960c7921c1c0a7608077bf713 /fs/ext4/super.c
parent4c0425ff68b1b87b802ffeda7b6a46ff7da7241c (diff)
ext4: async direct IO for holes and fallocate support
For async direct IO that covers holes or fallocate, the end_io callback function now queued the convertion work on workqueue but don't flush the work rightaway as it might take too long to afford. But when fsync is called after all the data is completed, user expects the metadata also being updated before fsync returns. Thus we need to flush the conversion work when fsync() is called. This patch keep track of a listed of completed async direct io that has a work queued on workqueue. When fsync() is called, it will go through the list and do the conversion. Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 1a03ea98fdd1..f095c60b569e 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -687,6 +687,8 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
687 ei->i_allocated_meta_blocks = 0; 687 ei->i_allocated_meta_blocks = 0;
688 ei->i_delalloc_reserved_flag = 0; 688 ei->i_delalloc_reserved_flag = 0;
689 spin_lock_init(&(ei->i_block_reservation_lock)); 689 spin_lock_init(&(ei->i_block_reservation_lock));
690 INIT_LIST_HEAD(&ei->i_aio_dio_complete_list);
691 ei->cur_aio_dio = NULL;
690 692
691 return &ei->vfs_inode; 693 return &ei->vfs_inode;
692} 694}
@@ -3375,11 +3377,13 @@ static int ext4_sync_fs(struct super_block *sb, int wait)
3375{ 3377{
3376 int ret = 0; 3378 int ret = 0;
3377 tid_t target; 3379 tid_t target;
3380 struct ext4_sb_info *sbi = EXT4_SB(sb);
3378 3381
3379 trace_ext4_sync_fs(sb, wait); 3382 trace_ext4_sync_fs(sb, wait);
3380 if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, &target)) { 3383 flush_workqueue(sbi->dio_unwritten_wq);
3384 if (jbd2_journal_start_commit(sbi->s_journal, &target)) {
3381 if (wait) 3385 if (wait)
3382 jbd2_log_wait_commit(EXT4_SB(sb)->s_journal, target); 3386 jbd2_log_wait_commit(sbi->s_journal, target);
3383 } 3387 }
3384 return ret; 3388 return ret;
3385} 3389}