diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-09-11 19:07:25 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-09-11 19:07:25 -0400 |
commit | 83ebade34bc1a90d0c3f77b87b940f336d075fda (patch) | |
tree | 99b6366c52e6bec88119ae995399c985fc61e900 /fs/btrfs/disk-io.c | |
parent | 74fca6a42863ffacaf7ba6f1936a9f228950f657 (diff) | |
parent | 93c82d575055f1bd0277acae6f966bebafd80dd5 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index e83be2e4602c..253da7e01ab3 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -123,15 +123,15 @@ static struct extent_map *btree_get_extent(struct inode *inode, | |||
123 | struct extent_map *em; | 123 | struct extent_map *em; |
124 | int ret; | 124 | int ret; |
125 | 125 | ||
126 | spin_lock(&em_tree->lock); | 126 | read_lock(&em_tree->lock); |
127 | em = lookup_extent_mapping(em_tree, start, len); | 127 | em = lookup_extent_mapping(em_tree, start, len); |
128 | if (em) { | 128 | if (em) { |
129 | em->bdev = | 129 | em->bdev = |
130 | BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev; | 130 | BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev; |
131 | spin_unlock(&em_tree->lock); | 131 | read_unlock(&em_tree->lock); |
132 | goto out; | 132 | goto out; |
133 | } | 133 | } |
134 | spin_unlock(&em_tree->lock); | 134 | read_unlock(&em_tree->lock); |
135 | 135 | ||
136 | em = alloc_extent_map(GFP_NOFS); | 136 | em = alloc_extent_map(GFP_NOFS); |
137 | if (!em) { | 137 | if (!em) { |
@@ -144,7 +144,7 @@ static struct extent_map *btree_get_extent(struct inode *inode, | |||
144 | em->block_start = 0; | 144 | em->block_start = 0; |
145 | em->bdev = BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev; | 145 | em->bdev = BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev; |
146 | 146 | ||
147 | spin_lock(&em_tree->lock); | 147 | write_lock(&em_tree->lock); |
148 | ret = add_extent_mapping(em_tree, em); | 148 | ret = add_extent_mapping(em_tree, em); |
149 | if (ret == -EEXIST) { | 149 | if (ret == -EEXIST) { |
150 | u64 failed_start = em->start; | 150 | u64 failed_start = em->start; |
@@ -163,7 +163,7 @@ static struct extent_map *btree_get_extent(struct inode *inode, | |||
163 | free_extent_map(em); | 163 | free_extent_map(em); |
164 | em = NULL; | 164 | em = NULL; |
165 | } | 165 | } |
166 | spin_unlock(&em_tree->lock); | 166 | write_unlock(&em_tree->lock); |
167 | 167 | ||
168 | if (ret) | 168 | if (ret) |
169 | em = ERR_PTR(ret); | 169 | em = ERR_PTR(ret); |
@@ -1325,9 +1325,9 @@ static void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) | |||
1325 | offset = page_offset(page); | 1325 | offset = page_offset(page); |
1326 | 1326 | ||
1327 | em_tree = &BTRFS_I(inode)->extent_tree; | 1327 | em_tree = &BTRFS_I(inode)->extent_tree; |
1328 | spin_lock(&em_tree->lock); | 1328 | read_lock(&em_tree->lock); |
1329 | em = lookup_extent_mapping(em_tree, offset, PAGE_CACHE_SIZE); | 1329 | em = lookup_extent_mapping(em_tree, offset, PAGE_CACHE_SIZE); |
1330 | spin_unlock(&em_tree->lock); | 1330 | read_unlock(&em_tree->lock); |
1331 | if (!em) { | 1331 | if (!em) { |
1332 | __unplug_io_fn(bdi, page); | 1332 | __unplug_io_fn(bdi, page); |
1333 | return; | 1333 | return; |
@@ -1698,7 +1698,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1698 | err = -EINVAL; | 1698 | err = -EINVAL; |
1699 | goto fail_iput; | 1699 | goto fail_iput; |
1700 | } | 1700 | } |
1701 | 1701 | printk("thread pool is %d\n", fs_info->thread_pool_size); | |
1702 | /* | 1702 | /* |
1703 | * we need to start all the end_io workers up front because the | 1703 | * we need to start all the end_io workers up front because the |
1704 | * queue work function gets called at interrupt time, and so it | 1704 | * queue work function gets called at interrupt time, and so it |
@@ -1743,20 +1743,22 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1743 | fs_info->endio_workers.idle_thresh = 4; | 1743 | fs_info->endio_workers.idle_thresh = 4; |
1744 | fs_info->endio_meta_workers.idle_thresh = 4; | 1744 | fs_info->endio_meta_workers.idle_thresh = 4; |
1745 | 1745 | ||
1746 | fs_info->endio_write_workers.idle_thresh = 64; | 1746 | fs_info->endio_write_workers.idle_thresh = 2; |
1747 | fs_info->endio_meta_write_workers.idle_thresh = 64; | 1747 | fs_info->endio_meta_write_workers.idle_thresh = 2; |
1748 | |||
1749 | fs_info->endio_workers.atomic_worker_start = 1; | ||
1750 | fs_info->endio_meta_workers.atomic_worker_start = 1; | ||
1751 | fs_info->endio_write_workers.atomic_worker_start = 1; | ||
1752 | fs_info->endio_meta_write_workers.atomic_worker_start = 1; | ||
1748 | 1753 | ||
1749 | btrfs_start_workers(&fs_info->workers, 1); | 1754 | btrfs_start_workers(&fs_info->workers, 1); |
1750 | btrfs_start_workers(&fs_info->submit_workers, 1); | 1755 | btrfs_start_workers(&fs_info->submit_workers, 1); |
1751 | btrfs_start_workers(&fs_info->delalloc_workers, 1); | 1756 | btrfs_start_workers(&fs_info->delalloc_workers, 1); |
1752 | btrfs_start_workers(&fs_info->fixup_workers, 1); | 1757 | btrfs_start_workers(&fs_info->fixup_workers, 1); |
1753 | btrfs_start_workers(&fs_info->endio_workers, fs_info->thread_pool_size); | 1758 | btrfs_start_workers(&fs_info->endio_workers, 1); |
1754 | btrfs_start_workers(&fs_info->endio_meta_workers, | 1759 | btrfs_start_workers(&fs_info->endio_meta_workers, 1); |
1755 | fs_info->thread_pool_size); | 1760 | btrfs_start_workers(&fs_info->endio_meta_write_workers, 1); |
1756 | btrfs_start_workers(&fs_info->endio_meta_write_workers, | 1761 | btrfs_start_workers(&fs_info->endio_write_workers, 1); |
1757 | fs_info->thread_pool_size); | ||
1758 | btrfs_start_workers(&fs_info->endio_write_workers, | ||
1759 | fs_info->thread_pool_size); | ||
1760 | 1762 | ||
1761 | fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super); | 1763 | fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super); |
1762 | fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages, | 1764 | fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages, |