diff options
author | Josef Bacik <josef@redhat.com> | 2009-10-07 20:44:34 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-10-08 15:21:23 -0400 |
commit | e3ccfa989752c083ceb23c823a84f7ce3a081e61 (patch) | |
tree | 197558cbee7b773b8270cd861f882a37beacd2ed /fs/btrfs/disk-io.c | |
parent | 32c00aff718bb54a214b39146bdd9ac01511cd25 (diff) |
Btrfs: async delalloc flushing under space pressure
This patch moves the delalloc flushing that occurs when we are under space
pressure off to a async thread pool. This helps since we only free up
metadata space when we actually insert the extent item, which means it takes
quite a while for space to be free'ed up if we wait on all ordered extents.
However, if space is freed up due to inline extents being inserted, we can
wake people who are waiting up early, and they can finish their work.
Signed-off-by: Josef Bacik <jbacik@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.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 9903f042765d..ac8927bdc33d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1762,6 +1762,9 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1762 | min_t(u64, fs_devices->num_devices, | 1762 | min_t(u64, fs_devices->num_devices, |
1763 | fs_info->thread_pool_size), | 1763 | fs_info->thread_pool_size), |
1764 | &fs_info->generic_worker); | 1764 | &fs_info->generic_worker); |
1765 | btrfs_init_workers(&fs_info->enospc_workers, "enospc", | ||
1766 | fs_info->thread_pool_size, | ||
1767 | &fs_info->generic_worker); | ||
1765 | 1768 | ||
1766 | /* a higher idle thresh on the submit workers makes it much more | 1769 | /* a higher idle thresh on the submit workers makes it much more |
1767 | * likely that bios will be send down in a sane order to the | 1770 | * likely that bios will be send down in a sane order to the |
@@ -1809,6 +1812,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1809 | btrfs_start_workers(&fs_info->endio_meta_workers, 1); | 1812 | btrfs_start_workers(&fs_info->endio_meta_workers, 1); |
1810 | btrfs_start_workers(&fs_info->endio_meta_write_workers, 1); | 1813 | btrfs_start_workers(&fs_info->endio_meta_write_workers, 1); |
1811 | btrfs_start_workers(&fs_info->endio_write_workers, 1); | 1814 | btrfs_start_workers(&fs_info->endio_write_workers, 1); |
1815 | btrfs_start_workers(&fs_info->enospc_workers, 1); | ||
1812 | 1816 | ||
1813 | fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super); | 1817 | fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super); |
1814 | fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages, | 1818 | fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages, |
@@ -2023,6 +2027,7 @@ fail_sb_buffer: | |||
2023 | btrfs_stop_workers(&fs_info->endio_meta_write_workers); | 2027 | btrfs_stop_workers(&fs_info->endio_meta_write_workers); |
2024 | btrfs_stop_workers(&fs_info->endio_write_workers); | 2028 | btrfs_stop_workers(&fs_info->endio_write_workers); |
2025 | btrfs_stop_workers(&fs_info->submit_workers); | 2029 | btrfs_stop_workers(&fs_info->submit_workers); |
2030 | btrfs_stop_workers(&fs_info->enospc_workers); | ||
2026 | fail_iput: | 2031 | fail_iput: |
2027 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); | 2032 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); |
2028 | iput(fs_info->btree_inode); | 2033 | iput(fs_info->btree_inode); |
@@ -2449,6 +2454,7 @@ int close_ctree(struct btrfs_root *root) | |||
2449 | btrfs_stop_workers(&fs_info->endio_meta_write_workers); | 2454 | btrfs_stop_workers(&fs_info->endio_meta_write_workers); |
2450 | btrfs_stop_workers(&fs_info->endio_write_workers); | 2455 | btrfs_stop_workers(&fs_info->endio_write_workers); |
2451 | btrfs_stop_workers(&fs_info->submit_workers); | 2456 | btrfs_stop_workers(&fs_info->submit_workers); |
2457 | btrfs_stop_workers(&fs_info->enospc_workers); | ||
2452 | 2458 | ||
2453 | btrfs_close_devices(fs_info->fs_devices); | 2459 | btrfs_close_devices(fs_info->fs_devices); |
2454 | btrfs_mapping_tree_free(&fs_info->mapping_tree); | 2460 | btrfs_mapping_tree_free(&fs_info->mapping_tree); |