From 507388c9e9685f44cc32e5318109a343e3ff567c Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 28 Mar 2003 03:19:58 -0800 Subject: [PATCH] [PATCH] speed up ext3_sync_file() There is never a need to write out b_assoc_buffers() in ext3_sync_file(). --- fs/ext3/fsync.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/fs/ext3/fsync.c b/fs/ext3/fsync.c index 463f2981437ef..e42ce093011ff 100644 --- a/fs/ext3/fsync.c +++ b/fs/ext3/fsync.c @@ -34,7 +34,7 @@ * akpm: A new design for ext3_sync_file(). * * This is only called from sys_fsync(), sys_fdatasync() and sys_msync(). - * There cannot be a transaction open by this task. (AKPM: quotas?) + * There cannot be a transaction open by this task. * Another task could have dirtied this inode. Its data can be in any * state in the journalling system. * @@ -50,19 +50,28 @@ int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync) { struct inode *inode = dentry->d_inode; - int ret; J_ASSERT(ext3_journal_current_handle() == 0); /* - * fsync_inode_buffers() just walks private_list and waits - * on them. It's a no-op for full data journalling because - * private_list will be empty. - * Really, we only need to start I/O on the dirty buffers - - * we'll end up waiting on them in commit. + * data=writeback: + * The caller's filemap_fdatawrite()/wait will sync the data. + * ext3_force_commit() will sync the metadata + * + * data=ordered: + * The caller's filemap_fdatawrite() will write the data and + * ext3_force_commit() will wait on the buffers. Then the caller's + * filemap_fdatawait() will wait on the pages (but all IO is complete) + * Not pretty, but it works. + * + * data=journal: + * filemap_fdatawrite won't do anything (the buffers are clean). + * ext3_force_commit will write the file data into the journal and + * will wait on that. + * filemap_fdatawait() will encounter a ton of newly-dirtied pages + * (they were dirtied by commit). But that's OK - the blocks are + * safe in-journal, which is all fsync() needs to ensure. */ - ret = sync_mapping_buffers(inode->i_mapping); ext3_force_commit(inode->i_sb); - - return ret; + return 0; } -- 2.53.0