|
@@ -435,11 +435,8 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
|
|
case Opt_thread_pool:
|
|
case Opt_thread_pool:
|
|
intarg = 0;
|
|
intarg = 0;
|
|
match_int(&args[0], &intarg);
|
|
match_int(&args[0], &intarg);
|
|
- if (intarg) {
|
|
|
|
|
|
+ if (intarg)
|
|
info->thread_pool_size = intarg;
|
|
info->thread_pool_size = intarg;
|
|
- printk(KERN_INFO "btrfs: thread pool %d\n",
|
|
|
|
- info->thread_pool_size);
|
|
|
|
- }
|
|
|
|
break;
|
|
break;
|
|
case Opt_max_inline:
|
|
case Opt_max_inline:
|
|
num = match_strdup(&args[0]);
|
|
num = match_strdup(&args[0]);
|
|
@@ -1118,6 +1115,40 @@ error_fs_info:
|
|
return ERR_PTR(error);
|
|
return ERR_PTR(error);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void btrfs_set_max_workers(struct btrfs_workers *workers, int new_limit)
|
|
|
|
+{
|
|
|
|
+ spin_lock_irq(&workers->lock);
|
|
|
|
+ workers->max_workers = new_limit;
|
|
|
|
+ spin_unlock_irq(&workers->lock);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info,
|
|
|
|
+ int new_pool_size, int old_pool_size)
|
|
|
|
+{
|
|
|
|
+ if (new_pool_size == old_pool_size)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ fs_info->thread_pool_size = new_pool_size;
|
|
|
|
+
|
|
|
|
+ printk(KERN_INFO "btrfs: resize thread pool %d -> %d\n",
|
|
|
|
+ old_pool_size, new_pool_size);
|
|
|
|
+
|
|
|
|
+ btrfs_set_max_workers(&fs_info->generic_worker, new_pool_size);
|
|
|
|
+ btrfs_set_max_workers(&fs_info->workers, new_pool_size);
|
|
|
|
+ btrfs_set_max_workers(&fs_info->delalloc_workers, new_pool_size);
|
|
|
|
+ btrfs_set_max_workers(&fs_info->submit_workers, new_pool_size);
|
|
|
|
+ btrfs_set_max_workers(&fs_info->caching_workers, new_pool_size);
|
|
|
|
+ btrfs_set_max_workers(&fs_info->fixup_workers, new_pool_size);
|
|
|
|
+ btrfs_set_max_workers(&fs_info->endio_workers, new_pool_size);
|
|
|
|
+ btrfs_set_max_workers(&fs_info->endio_meta_workers, new_pool_size);
|
|
|
|
+ btrfs_set_max_workers(&fs_info->endio_meta_write_workers, new_pool_size);
|
|
|
|
+ btrfs_set_max_workers(&fs_info->endio_write_workers, new_pool_size);
|
|
|
|
+ btrfs_set_max_workers(&fs_info->endio_freespace_worker, new_pool_size);
|
|
|
|
+ btrfs_set_max_workers(&fs_info->delayed_workers, new_pool_size);
|
|
|
|
+ btrfs_set_max_workers(&fs_info->readahead_workers, new_pool_size);
|
|
|
|
+ btrfs_set_max_workers(&fs_info->scrub_workers, new_pool_size);
|
|
|
|
+}
|
|
|
|
+
|
|
static int btrfs_remount(struct super_block *sb, int *flags, char *data)
|
|
static int btrfs_remount(struct super_block *sb, int *flags, char *data)
|
|
{
|
|
{
|
|
struct btrfs_fs_info *fs_info = btrfs_sb(sb);
|
|
struct btrfs_fs_info *fs_info = btrfs_sb(sb);
|
|
@@ -1137,6 +1168,9 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
|
|
goto restore;
|
|
goto restore;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ btrfs_resize_thread_pool(fs_info,
|
|
|
|
+ fs_info->thread_pool_size, old_thread_pool_size);
|
|
|
|
+
|
|
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
|
|
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
@@ -1180,7 +1214,8 @@ restore:
|
|
fs_info->compress_type = old_compress_type;
|
|
fs_info->compress_type = old_compress_type;
|
|
fs_info->max_inline = old_max_inline;
|
|
fs_info->max_inline = old_max_inline;
|
|
fs_info->alloc_start = old_alloc_start;
|
|
fs_info->alloc_start = old_alloc_start;
|
|
- fs_info->thread_pool_size = old_thread_pool_size;
|
|
|
|
|
|
+ btrfs_resize_thread_pool(fs_info,
|
|
|
|
+ old_thread_pool_size, fs_info->thread_pool_size);
|
|
fs_info->metadata_ratio = old_metadata_ratio;
|
|
fs_info->metadata_ratio = old_metadata_ratio;
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|