diff options
author | Chris Mason <clm@fb.com> | 2014-05-22 19:18:52 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-06-09 20:20:58 -0400 |
commit | a79b7d4b3e8118f265dcb4bdf9a572c392f02708 (patch) | |
tree | a7b4792e01ea5a44467f053e1822d4240e70edc6 /fs/btrfs/disk-io.c | |
parent | 40f765805f082ed679c55bf6ab60212e55fb6fc1 (diff) |
Btrfs: async delayed refs
Delayed extent operations are triggered during transaction commits.
The goal is to queue up a healthly batch of changes to the extent
allocation tree and run through them in bulk.
This farms them off to async helper threads. The goal is to have the
bulk of the delayed operations being done in the background, but this is
also important to limit our stack footprint.
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 0c0fa78ef452..8bb4aa19898f 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2069,6 +2069,7 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info) | |||
2069 | btrfs_destroy_workqueue(fs_info->readahead_workers); | 2069 | btrfs_destroy_workqueue(fs_info->readahead_workers); |
2070 | btrfs_destroy_workqueue(fs_info->flush_workers); | 2070 | btrfs_destroy_workqueue(fs_info->flush_workers); |
2071 | btrfs_destroy_workqueue(fs_info->qgroup_rescan_workers); | 2071 | btrfs_destroy_workqueue(fs_info->qgroup_rescan_workers); |
2072 | btrfs_destroy_workqueue(fs_info->extent_workers); | ||
2072 | } | 2073 | } |
2073 | 2074 | ||
2074 | static void free_root_extent_buffers(struct btrfs_root *root) | 2075 | static void free_root_extent_buffers(struct btrfs_root *root) |
@@ -2586,6 +2587,10 @@ int open_ctree(struct super_block *sb, | |||
2586 | btrfs_alloc_workqueue("readahead", flags, max_active, 2); | 2587 | btrfs_alloc_workqueue("readahead", flags, max_active, 2); |
2587 | fs_info->qgroup_rescan_workers = | 2588 | fs_info->qgroup_rescan_workers = |
2588 | btrfs_alloc_workqueue("qgroup-rescan", flags, 1, 0); | 2589 | btrfs_alloc_workqueue("qgroup-rescan", flags, 1, 0); |
2590 | fs_info->extent_workers = | ||
2591 | btrfs_alloc_workqueue("extent-refs", flags, | ||
2592 | min_t(u64, fs_devices->num_devices, | ||
2593 | max_active), 8); | ||
2589 | 2594 | ||
2590 | if (!(fs_info->workers && fs_info->delalloc_workers && | 2595 | if (!(fs_info->workers && fs_info->delalloc_workers && |
2591 | fs_info->submit_workers && fs_info->flush_workers && | 2596 | fs_info->submit_workers && fs_info->flush_workers && |
@@ -2595,6 +2600,7 @@ int open_ctree(struct super_block *sb, | |||
2595 | fs_info->endio_freespace_worker && fs_info->rmw_workers && | 2600 | fs_info->endio_freespace_worker && fs_info->rmw_workers && |
2596 | fs_info->caching_workers && fs_info->readahead_workers && | 2601 | fs_info->caching_workers && fs_info->readahead_workers && |
2597 | fs_info->fixup_workers && fs_info->delayed_workers && | 2602 | fs_info->fixup_workers && fs_info->delayed_workers && |
2603 | fs_info->fixup_workers && fs_info->extent_workers && | ||
2598 | fs_info->qgroup_rescan_workers)) { | 2604 | fs_info->qgroup_rescan_workers)) { |
2599 | err = -ENOMEM; | 2605 | err = -ENOMEM; |
2600 | goto fail_sb_buffer; | 2606 | goto fail_sb_buffer; |