aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2012-11-09 10:53:21 -0500
committerChris Mason <chris.mason@fusionio.com>2012-12-16 20:46:27 -0500
commit6c760c072403f446ff829ec9e89568943a3c2ef2 (patch)
treec751a0aeb81809401df1fd87a36376034ef53a87 /fs/btrfs/inode.c
parent5124e00ec5b0be56155a11aec416fcc5125339f1 (diff)
Btrfs: do not call file_update_time in aio_write
This starts a transaction and dirties the inode everytime we call it, which is super expensive if you have a write heavy workload. We will be updating the inode when the IO completes and we reserve the space for the inode update when we reserve space for the write, so there is no chance of loss of information or enospc issues. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 355a297e7988..1673dbdf1f76 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1922,22 +1922,20 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
1922 1922
1923 if (test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) { 1923 if (test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) {
1924 BUG_ON(!list_empty(&ordered_extent->list)); /* Logic error */ 1924 BUG_ON(!list_empty(&ordered_extent->list)); /* Logic error */
1925 ret = btrfs_ordered_update_i_size(inode, 0, ordered_extent); 1925 btrfs_ordered_update_i_size(inode, 0, ordered_extent);
1926 if (!ret) { 1926 if (nolock)
1927 if (nolock) 1927 trans = btrfs_join_transaction_nolock(root);
1928 trans = btrfs_join_transaction_nolock(root); 1928 else
1929 else 1929 trans = btrfs_join_transaction(root);
1930 trans = btrfs_join_transaction(root); 1930 if (IS_ERR(trans)) {
1931 if (IS_ERR(trans)) { 1931 ret = PTR_ERR(trans);
1932 ret = PTR_ERR(trans); 1932 trans = NULL;
1933 trans = NULL; 1933 goto out;
1934 goto out;
1935 }
1936 trans->block_rsv = &root->fs_info->delalloc_block_rsv;
1937 ret = btrfs_update_inode_fallback(trans, root, inode);
1938 if (ret) /* -ENOMEM or corruption */
1939 btrfs_abort_transaction(trans, root, ret);
1940 } 1934 }
1935 trans->block_rsv = &root->fs_info->delalloc_block_rsv;
1936 ret = btrfs_update_inode_fallback(trans, root, inode);
1937 if (ret) /* -ENOMEM or corruption */
1938 btrfs_abort_transaction(trans, root, ret);
1941 goto out; 1939 goto out;
1942 } 1940 }
1943 1941
@@ -1986,15 +1984,11 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
1986 add_pending_csums(trans, inode, ordered_extent->file_offset, 1984 add_pending_csums(trans, inode, ordered_extent->file_offset,
1987 &ordered_extent->list); 1985 &ordered_extent->list);
1988 1986
1989 ret = btrfs_ordered_update_i_size(inode, 0, ordered_extent); 1987 btrfs_ordered_update_i_size(inode, 0, ordered_extent);
1990 if (!ret || !test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) { 1988 ret = btrfs_update_inode_fallback(trans, root, inode);
1991 ret = btrfs_update_inode_fallback(trans, root, inode); 1989 if (ret) { /* -ENOMEM or corruption */
1992 if (ret) { /* -ENOMEM or corruption */ 1990 btrfs_abort_transaction(trans, root, ret);
1993 btrfs_abort_transaction(trans, root, ret); 1991 goto out_unlock;
1994 goto out_unlock;
1995 }
1996 } else {
1997 btrfs_set_inode_last_trans(trans, inode);
1998 } 1992 }
1999 ret = 0; 1993 ret = 0;
2000out_unlock: 1994out_unlock: