aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2012-01-12 19:10:12 -0500
committerChris Mason <chris.mason@oracle.com>2012-01-16 15:28:54 -0500
commit7ad85bb76a61801362701b77c5cee5aa09f35369 (patch)
treee03f4ced4f7c84e9828e4f4a4cbe894369300800 /fs
parentc126dea771be1b3c370c0ffc4a09e6a82d492a49 (diff)
Btrfs: do not use btrfs_end_transaction_throttle everywhere
A user reported a problem where things like open with O_CREAT would take up to 30 seconds when he had nfs activity on the same mount. This is because all of our quick metadata operations, like create, symlink etc all do btrfs_end_transaction_throttle, which if the transaction is blocked will wait for the commit to complete before it returns. This adds a ridiculous amount of latency and isn't really needed. The normal btrfs_end_transaction will mark the transaction as blocked and wake the transaction kthread up if it thinks the transaction needs to end (this being in the running out of global reserve space scenario), and this is all that is really needed since we've already done everything we're going to do, we just need to return. This should help people with the latency they were seeing when using synchronous heavy workloads. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c18
-rw-r--r--fs/btrfs/xattr.c2
2 files changed, 10 insertions, 10 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index acc4ff39ca4e..5f8ba210c0aa 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2845,7 +2845,7 @@ static void __unlink_end_trans(struct btrfs_trans_handle *trans,
2845 BUG_ON(!root->fs_info->enospc_unlink); 2845 BUG_ON(!root->fs_info->enospc_unlink);
2846 root->fs_info->enospc_unlink = 0; 2846 root->fs_info->enospc_unlink = 0;
2847 } 2847 }
2848 btrfs_end_transaction_throttle(trans, root); 2848 btrfs_end_transaction(trans, root);
2849} 2849}
2850 2850
2851static int btrfs_unlink(struct inode *dir, struct dentry *dentry) 2851static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
@@ -3434,7 +3434,7 @@ static int btrfs_setsize(struct inode *inode, loff_t newsize)
3434 i_size_write(inode, newsize); 3434 i_size_write(inode, newsize);
3435 btrfs_ordered_update_i_size(inode, i_size_read(inode), NULL); 3435 btrfs_ordered_update_i_size(inode, i_size_read(inode), NULL);
3436 ret = btrfs_update_inode(trans, root, inode); 3436 ret = btrfs_update_inode(trans, root, inode);
3437 btrfs_end_transaction_throttle(trans, root); 3437 btrfs_end_transaction(trans, root);
3438 } else { 3438 } else {
3439 3439
3440 /* 3440 /*
@@ -4655,7 +4655,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
4655 } 4655 }
4656out_unlock: 4656out_unlock:
4657 nr = trans->blocks_used; 4657 nr = trans->blocks_used;
4658 btrfs_end_transaction_throttle(trans, root); 4658 btrfs_end_transaction(trans, root);
4659 btrfs_btree_balance_dirty(root, nr); 4659 btrfs_btree_balance_dirty(root, nr);
4660 if (drop_inode) { 4660 if (drop_inode) {
4661 inode_dec_link_count(inode); 4661 inode_dec_link_count(inode);
@@ -4723,7 +4723,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
4723 } 4723 }
4724out_unlock: 4724out_unlock:
4725 nr = trans->blocks_used; 4725 nr = trans->blocks_used;
4726 btrfs_end_transaction_throttle(trans, root); 4726 btrfs_end_transaction(trans, root);
4727 if (drop_inode) { 4727 if (drop_inode) {
4728 inode_dec_link_count(inode); 4728 inode_dec_link_count(inode);
4729 iput(inode); 4729 iput(inode);
@@ -4782,7 +4782,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
4782 } 4782 }
4783 4783
4784 nr = trans->blocks_used; 4784 nr = trans->blocks_used;
4785 btrfs_end_transaction_throttle(trans, root); 4785 btrfs_end_transaction(trans, root);
4786fail: 4786fail:
4787 if (drop_inode) { 4787 if (drop_inode) {
4788 inode_dec_link_count(inode); 4788 inode_dec_link_count(inode);
@@ -4848,7 +4848,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
4848 4848
4849out_fail: 4849out_fail:
4850 nr = trans->blocks_used; 4850 nr = trans->blocks_used;
4851 btrfs_end_transaction_throttle(trans, root); 4851 btrfs_end_transaction(trans, root);
4852 if (drop_on_err) 4852 if (drop_on_err)
4853 iput(inode); 4853 iput(inode);
4854 btrfs_btree_balance_dirty(root, nr); 4854 btrfs_btree_balance_dirty(root, nr);
@@ -6668,7 +6668,7 @@ end_trans:
6668 err = ret; 6668 err = ret;
6669 6669
6670 nr = trans->blocks_used; 6670 nr = trans->blocks_used;
6671 ret = btrfs_end_transaction_throttle(trans, root); 6671 ret = btrfs_end_transaction(trans, root);
6672 btrfs_btree_balance_dirty(root, nr); 6672 btrfs_btree_balance_dirty(root, nr);
6673 } 6673 }
6674 6674
@@ -7075,7 +7075,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
7075 btrfs_end_log_trans(root); 7075 btrfs_end_log_trans(root);
7076 } 7076 }
7077out_fail: 7077out_fail:
7078 btrfs_end_transaction_throttle(trans, root); 7078 btrfs_end_transaction(trans, root);
7079out_notrans: 7079out_notrans:
7080 if (old_ino == BTRFS_FIRST_FREE_OBJECTID) 7080 if (old_ino == BTRFS_FIRST_FREE_OBJECTID)
7081 up_read(&root->fs_info->subvol_sem); 7081 up_read(&root->fs_info->subvol_sem);
@@ -7247,7 +7247,7 @@ out_unlock:
7247 if (!err) 7247 if (!err)
7248 d_instantiate(dentry, inode); 7248 d_instantiate(dentry, inode);
7249 nr = trans->blocks_used; 7249 nr = trans->blocks_used;
7250 btrfs_end_transaction_throttle(trans, root); 7250 btrfs_end_transaction(trans, root);
7251 if (drop_inode) { 7251 if (drop_inode) {
7252 inode_dec_link_count(inode); 7252 inode_dec_link_count(inode);
7253 iput(inode); 7253 iput(inode);
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 3848b04e310e..e7a5659087e6 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -200,7 +200,7 @@ int __btrfs_setxattr(struct btrfs_trans_handle *trans,
200 ret = btrfs_update_inode(trans, root, inode); 200 ret = btrfs_update_inode(trans, root, inode);
201 BUG_ON(ret); 201 BUG_ON(ret);
202out: 202out:
203 btrfs_end_transaction_throttle(trans, root); 203 btrfs_end_transaction(trans, root);
204 return ret; 204 return ret;
205} 205}
206 206