summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-08-08 10:08:58 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-08-08 10:08:58 -0400
commitf4468e94c86c2031f447788c4bfe7dfd2fcdc93a (patch)
tree984a0751f69524cada1113d5504875a0fb5cec35 /fs
parent37fa704640059d515cb2c7c6eaa5eb82901b95ac (diff)
downloadop-kernel-dev-f4468e94c86c2031f447788c4bfe7dfd2fcdc93a.zip
op-kernel-dev-f4468e94c86c2031f447788c4bfe7dfd2fcdc93a.tar.gz
Btrfs: Let some locks go during defrag and snapshot dropping
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ctree.h4
-rw-r--r--fs/btrfs/extent-tree.c6
-rw-r--r--fs/btrfs/transaction.c8
3 files changed, 14 insertions, 4 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 42aa203..8b7d015 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -300,9 +300,9 @@ struct btrfs_fs_info {
struct radix_tree_root block_group_data_radix;
struct radix_tree_root extent_map_radix;
- u64 extent_tree_insert[BTRFS_MAX_LEVEL * 3];
+ u64 extent_tree_insert[BTRFS_MAX_LEVEL * 6];
int extent_tree_insert_nr;
- u64 extent_tree_prealloc[BTRFS_MAX_LEVEL * 3];
+ u64 extent_tree_prealloc[BTRFS_MAX_LEVEL * 6];
int extent_tree_prealloc_nr;
u64 generation;
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 26b8d340..f7d76d3 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1018,7 +1018,7 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
if (num_blocks == 0) {
fill_prealloc = 1;
num_blocks = 1;
- total_needed = (min(level + 1, BTRFS_MAX_LEVEL) + 2) * 3;
+ total_needed = (min(level + 1, BTRFS_MAX_LEVEL)) * 6;
}
if (fill_prealloc) {
u64 first;
@@ -1300,6 +1300,8 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
ins->objectid;
ret = update_block_group(trans, root,
ins->objectid, ins->offset, 1, 0, 0);
+ WARN_ON(info->extent_tree_insert_nr >
+ ARRAY_SIZE(info->extent_tree_insert));
BUG_ON(ret);
return 0;
}
@@ -1628,7 +1630,7 @@ int btrfs_drop_snapshot(struct btrfs_trans_handle *trans, struct btrfs_root
if (wret < 0)
ret = wret;
num_walks++;
- if (num_walks > 10) {
+ if (num_walks > 2) {
ret = -EAGAIN;
get_bh(root->node);
break;
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 338a719..88b0752 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -354,6 +354,7 @@ int btrfs_defrag_dirty_roots(struct btrfs_fs_info *info)
mutex_unlock(&info->fs_mutex);
btrfs_btree_balance_dirty(root);
+ cond_resched();
mutex_lock(&info->fs_mutex);
trans = btrfs_start_transaction(tree_root, 1);
@@ -394,6 +395,12 @@ static int drop_dirty_roots(struct btrfs_root *tree_root,
ret = err;
ret = btrfs_end_transaction(trans, tree_root);
BUG_ON(ret);
+ mutex_unlock(&tree_root->fs_info->fs_mutex);
+
+ btrfs_btree_balance_dirty(tree_root);
+ schedule();
+
+ mutex_lock(&tree_root->fs_info->fs_mutex);
}
BUG_ON(ret);
ret = btrfs_del_root(trans, tree_root, &dirty->root->root_key);
@@ -406,6 +413,7 @@ static int drop_dirty_roots(struct btrfs_root *tree_root,
kfree(dirty);
mutex_unlock(&tree_root->fs_info->fs_mutex);
btrfs_btree_balance_dirty(tree_root);
+ schedule();
}
return ret;
}
OpenPOWER on IntegriCloud