aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-25 08:51:48 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:02 -0400
commit81d7ed29ff6bdec903c36c26b386e16c014993b2 (patch)
tree561f6d5b85c9af14acc97ec45b6ce6622c3ec3f4 /fs/btrfs/transaction.c
parentbce4eae9864e6b6ebde5d7f05576ff0a6c3724d0 (diff)
Btrfs: Throttle file_write when data=ordered is flushing the inode
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 1ed179c020a..c85cb48d95e 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -512,8 +512,11 @@ int btrfs_write_ordered_inodes(struct btrfs_trans_handle *trans,
mutex_unlock(&root->fs_info->trans_mutex);
mutex_unlock(&root->fs_info->fs_mutex);
- if (S_ISREG(inode->i_mode))
+ if (S_ISREG(inode->i_mode)) {
+ atomic_inc(&BTRFS_I(inode)->ordered_writeback);
filemap_fdatawrite(inode->i_mapping);
+ atomic_dec(&BTRFS_I(inode)->ordered_writeback);
+ }
iput(inode);
mutex_lock(&root->fs_info->fs_mutex);
@@ -530,8 +533,11 @@ int btrfs_write_ordered_inodes(struct btrfs_trans_handle *trans,
mutex_unlock(&root->fs_info->trans_mutex);
mutex_unlock(&root->fs_info->fs_mutex);
- if (S_ISREG(inode->i_mode))
+ if (S_ISREG(inode->i_mode)) {
+ atomic_inc(&BTRFS_I(inode)->ordered_writeback);
filemap_write_and_wait(inode->i_mapping);
+ atomic_dec(&BTRFS_I(inode)->ordered_writeback);
+ }
atomic_dec(&inode->i_count);
iput(inode);