summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
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);