diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-03 14:10:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-03 14:10:33 -0400 |
commit | 20bec8ab1458c24bed0d5492ee15d87807fc415a (patch) | |
tree | e5f910947dbe314b96a591e41e2cfb2d3322caad /fs/ext3 | |
parent | 18b34b9546dc192d978dda940673f40928d2e36e (diff) | |
parent | e7c8f5079ed9ec9e6eb1abe3defc5fb4ebfdf1cb (diff) |
Merge branch 'ext3-latency-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
* 'ext3-latency-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext3: Add replace-on-rename hueristics for data=writeback mode
ext3: Add replace-on-truncate hueristics for data=writeback mode
ext3: Use WRITE_SYNC for commits which are caused by fsync()
block_write_full_page: Use synchronous writes for WBC_SYNC_ALL writebacks
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/file.c | 4 | ||||
-rw-r--r-- | fs/ext3/inode.c | 3 | ||||
-rw-r--r-- | fs/ext3/namei.c | 6 |
3 files changed, 12 insertions, 1 deletions
diff --git a/fs/ext3/file.c b/fs/ext3/file.c index 521f8238b2fa..5b49704b231b 100644 --- a/fs/ext3/file.c +++ b/fs/ext3/file.c | |||
@@ -33,6 +33,10 @@ | |||
33 | */ | 33 | */ |
34 | static int ext3_release_file (struct inode * inode, struct file * filp) | 34 | static int ext3_release_file (struct inode * inode, struct file * filp) |
35 | { | 35 | { |
36 | if (EXT3_I(inode)->i_state & EXT3_STATE_FLUSH_ON_CLOSE) { | ||
37 | filemap_flush(inode->i_mapping); | ||
38 | EXT3_I(inode)->i_state &= ~EXT3_STATE_FLUSH_ON_CLOSE; | ||
39 | } | ||
36 | /* if we are the last writer on the inode, drop the block reservation */ | 40 | /* if we are the last writer on the inode, drop the block reservation */ |
37 | if ((filp->f_mode & FMODE_WRITE) && | 41 | if ((filp->f_mode & FMODE_WRITE) && |
38 | (atomic_read(&inode->i_writecount) == 1)) | 42 | (atomic_read(&inode->i_writecount) == 1)) |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index d3ef6566b019..466a332e0bd1 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -2363,6 +2363,9 @@ void ext3_truncate(struct inode *inode) | |||
2363 | if (!ext3_can_truncate(inode)) | 2363 | if (!ext3_can_truncate(inode)) |
2364 | return; | 2364 | return; |
2365 | 2365 | ||
2366 | if (inode->i_size == 0 && ext3_should_writeback_data(inode)) | ||
2367 | ei->i_state |= EXT3_STATE_FLUSH_ON_CLOSE; | ||
2368 | |||
2366 | /* | 2369 | /* |
2367 | * We have to lock the EOF page here, because lock_page() nests | 2370 | * We have to lock the EOF page here, because lock_page() nests |
2368 | * outside journal_start(). | 2371 | * outside journal_start(). |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 6ddaa0a42b24..6ff7b9730234 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -2274,7 +2274,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2274 | struct inode * old_inode, * new_inode; | 2274 | struct inode * old_inode, * new_inode; |
2275 | struct buffer_head * old_bh, * new_bh, * dir_bh; | 2275 | struct buffer_head * old_bh, * new_bh, * dir_bh; |
2276 | struct ext3_dir_entry_2 * old_de, * new_de; | 2276 | struct ext3_dir_entry_2 * old_de, * new_de; |
2277 | int retval; | 2277 | int retval, flush_file = 0; |
2278 | 2278 | ||
2279 | old_bh = new_bh = dir_bh = NULL; | 2279 | old_bh = new_bh = dir_bh = NULL; |
2280 | 2280 | ||
@@ -2410,6 +2410,8 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2410 | ext3_mark_inode_dirty(handle, new_inode); | 2410 | ext3_mark_inode_dirty(handle, new_inode); |
2411 | if (!new_inode->i_nlink) | 2411 | if (!new_inode->i_nlink) |
2412 | ext3_orphan_add(handle, new_inode); | 2412 | ext3_orphan_add(handle, new_inode); |
2413 | if (ext3_should_writeback_data(new_inode)) | ||
2414 | flush_file = 1; | ||
2413 | } | 2415 | } |
2414 | retval = 0; | 2416 | retval = 0; |
2415 | 2417 | ||
@@ -2418,6 +2420,8 @@ end_rename: | |||
2418 | brelse (old_bh); | 2420 | brelse (old_bh); |
2419 | brelse (new_bh); | 2421 | brelse (new_bh); |
2420 | ext3_journal_stop(handle); | 2422 | ext3_journal_stop(handle); |
2423 | if (retval == 0 && flush_file) | ||
2424 | filemap_flush(old_inode->i_mapping); | ||
2421 | return retval; | 2425 | return retval; |
2422 | } | 2426 | } |
2423 | 2427 | ||