Btrfs: Limit the number of async bio submission kthreads to the number of devices
authorChris Mason <chris.mason@oracle.com>
Fri, 15 Aug 2008 19:34:14 +0000 (15:34 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:04:06 +0000 (11:04 -0400)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/disk-io.c

index 56c54a41dbbb3bd917463c94db87c73f5463b8c1..99bd9f9b9eed68d3d4d9553fa3f1c6d20d726833 100644 (file)
@@ -1348,7 +1348,9 @@ struct btrfs_root *open_ctree(struct super_block *sb,
         * cannot dynamically grow.
         */
        btrfs_init_workers(&fs_info->workers, fs_info->thread_pool_size);
-       btrfs_init_workers(&fs_info->submit_workers, fs_info->thread_pool_size);
+       btrfs_init_workers(&fs_info->submit_workers,
+                          min_t(u64, fs_devices->num_devices,
+                          fs_info->thread_pool_size));
 
        /* a higher idle thresh on the submit workers makes it much more
         * likely that bios will be send down in a sane order to the