aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2009-03-13 10:17:05 -0400
committerChris Mason <chris.mason@oracle.com>2009-03-24 16:14:26 -0400
commitc3e69d58e86c3917ae4e9e31b4acf490a7cafe60 (patch)
treebd4f1e62446a208bdae26f0c36d67e3afbc1cd1d /fs/btrfs/disk-io.c
parent1887be66dcc3140a81d1299958a41fc0eedfa64f (diff)
Btrfs: process the delayed reference queue in clusters
The delayed reference queue maintains pending operations that need to be done to the extent allocation tree. These are processed by finding records in the tree that are not currently being processed one at a time. This is slow because it uses lots of time searching through the rbtree and because it creates lock contention on the extent allocation tree when lots of different procs are running delayed refs at the same time. This commit changes things to grab a cluster of refs for processing, using a cursor into the rbtree as the starting point of the next search. This way we walk smoothly through the rbtree. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c17
1 files changed, 0 insertions, 17 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4f43e227a297..1f1d89b18818 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1458,7 +1458,6 @@ static int transaction_kthread(void *arg)
1458 struct btrfs_root *root = arg; 1458 struct btrfs_root *root = arg;
1459 struct btrfs_trans_handle *trans; 1459 struct btrfs_trans_handle *trans;
1460 struct btrfs_transaction *cur; 1460 struct btrfs_transaction *cur;
1461 struct btrfs_fs_info *info = root->fs_info;
1462 unsigned long now; 1461 unsigned long now;
1463 unsigned long delay; 1462 unsigned long delay;
1464 int ret; 1463 int ret;
@@ -1481,24 +1480,8 @@ static int transaction_kthread(void *arg)
1481 1480
1482 now = get_seconds(); 1481 now = get_seconds();
1483 if (now < cur->start_time || now - cur->start_time < 30) { 1482 if (now < cur->start_time || now - cur->start_time < 30) {
1484 unsigned long num_delayed;
1485 num_delayed = cur->delayed_refs.num_entries;
1486 mutex_unlock(&root->fs_info->trans_mutex); 1483 mutex_unlock(&root->fs_info->trans_mutex);
1487 delay = HZ * 5; 1484 delay = HZ * 5;
1488
1489 /*
1490 * we may have been woken up early to start
1491 * processing the delayed extent ref updates
1492 * If so, run some of them and then loop around again
1493 * to see if we need to force a commit
1494 */
1495 if (num_delayed > 64) {
1496 mutex_unlock(&info->transaction_kthread_mutex);
1497 trans = btrfs_start_transaction(root, 1);
1498 btrfs_run_delayed_refs(trans, root, 256);
1499 btrfs_end_transaction(trans, root);
1500 continue;
1501 }
1502 goto sleep; 1485 goto sleep;
1503 } 1486 }
1504 mutex_unlock(&root->fs_info->trans_mutex); 1487 mutex_unlock(&root->fs_info->trans_mutex);