aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2012-10-16 07:33:38 -0400
committerJosef Bacik <jbacik@fusionio.com>2012-12-11 13:31:31 -0500
commit08e007d2e57744472a9424735a368ffe6d625597 (patch)
tree84227c096c05bc4c5430190f0f550b094d3bf2b7 /fs/btrfs/inode.c
parent561c294d4cfb30c4acfa0a243448fc55af730d87 (diff)
Btrfs: improve the noflush reservation
In some places(such as: evicting inode), we just can not flush the reserved space of delalloc, flushing the delayed directory index and delayed inode is OK, but we don't try to flush those things and just go back when there is no enough space to be reserved. This patch fixes this problem. We defined 3 types of the flush operations: NO_FLUSH, FLUSH_LIMIT and FLUSH_ALL. If we can in the transaction, we should not flush anything, or the deadlock would happen, so use NO_FLUSH. If we flushing the reserved space of delalloc would cause deadlock, use FLUSH_LIMIT. In the other cases, FLUSH_ALL is used, and we will flush all things. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 95542a1b3dfc..db3dd4ed057f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3829,7 +3829,8 @@ void btrfs_evict_inode(struct inode *inode)
3829 * inode item when doing the truncate. 3829 * inode item when doing the truncate.
3830 */ 3830 */
3831 while (1) { 3831 while (1) {
3832 ret = btrfs_block_rsv_refill_noflush(root, rsv, min_size); 3832 ret = btrfs_block_rsv_refill(root, rsv, min_size,
3833 BTRFS_RESERVE_FLUSH_LIMIT);
3833 3834
3834 /* 3835 /*
3835 * Try and steal from the global reserve since we will 3836 * Try and steal from the global reserve since we will
@@ -3847,7 +3848,7 @@ void btrfs_evict_inode(struct inode *inode)
3847 goto no_delete; 3848 goto no_delete;
3848 } 3849 }
3849 3850
3850 trans = btrfs_start_transaction_noflush(root, 1); 3851 trans = btrfs_start_transaction_lflush(root, 1);
3851 if (IS_ERR(trans)) { 3852 if (IS_ERR(trans)) {
3852 btrfs_orphan_del(NULL, inode); 3853 btrfs_orphan_del(NULL, inode);
3853 btrfs_free_block_rsv(root, rsv); 3854 btrfs_free_block_rsv(root, rsv);