Skip to content

Commit d2c9ad4

Browse files
Guoqing Jiangliu-song-6
authored andcommitted
raid5: remove worker_cnt_per_group argument from alloc_thread_groups
We can use "cnt" directly to update conf->worker_cnt_per_group if alloc_thread_groups returns 0. Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com> Signed-off-by: Song Liu <songliubraving@fb.com>
1 parent f591df3 commit d2c9ad4

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

‎drivers/md/raid5.c‎

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6598,7 +6598,6 @@ raid5_show_group_thread_cnt(struct mddev *mddev, char *page)
65986598

65996599
static int alloc_thread_groups(struct r5conf *conf, int cnt,
66006600
int *group_cnt,
6601-
int *worker_cnt_per_group,
66026601
struct r5worker_group **worker_groups);
66036602
static ssize_t
66046603
raid5_store_group_thread_cnt(struct mddev *mddev, const char *page, size_t len)
@@ -6607,7 +6606,7 @@ raid5_store_group_thread_cnt(struct mddev *mddev, const char *page, size_t len)
66076606
unsigned int new;
66086607
int err;
66096608
struct r5worker_group *new_groups, *old_groups;
6610-
int group_cnt, worker_cnt_per_group;
6609+
int group_cnt;
66116610

66126611
if (len >= PAGE_SIZE)
66136612
return -EINVAL;
@@ -6630,13 +6629,11 @@ raid5_store_group_thread_cnt(struct mddev *mddev, const char *page, size_t len)
66306629
if (old_groups)
66316630
flush_workqueue(raid5_wq);
66326631

6633-
err = alloc_thread_groups(conf, new,
6634-
&group_cnt, &worker_cnt_per_group,
6635-
&new_groups);
6632+
err = alloc_thread_groups(conf, new, &group_cnt, &new_groups);
66366633
if (!err) {
66376634
spin_lock_irq(&conf->device_lock);
66386635
conf->group_cnt = group_cnt;
6639-
conf->worker_cnt_per_group = worker_cnt_per_group;
6636+
conf->worker_cnt_per_group = new;
66406637
conf->worker_groups = new_groups;
66416638
spin_unlock_irq(&conf->device_lock);
66426639

@@ -6672,16 +6669,13 @@ static struct attribute_group raid5_attrs_group = {
66726669
.attrs = raid5_attrs,
66736670
};
66746671

6675-
static int alloc_thread_groups(struct r5conf *conf, int cnt,
6676-
int *group_cnt,
6677-
int *worker_cnt_per_group,
6672+
static int alloc_thread_groups(struct r5conf *conf, int cnt, int *group_cnt,
66786673
struct r5worker_group **worker_groups)
66796674
{
66806675
int i, j, k;
66816676
ssize_t size;
66826677
struct r5worker *workers;
66836678

6684-
*worker_cnt_per_group = cnt;
66856679
if (cnt == 0) {
66866680
*group_cnt = 0;
66876681
*worker_groups = NULL;
@@ -6882,7 +6876,7 @@ static struct r5conf *setup_conf(struct mddev *mddev)
68826876
struct disk_info *disk;
68836877
char pers_name[6];
68846878
int i;
6885-
int group_cnt, worker_cnt_per_group;
6879+
int group_cnt;
68866880
struct r5worker_group *new_group;
68876881
int ret;
68886882

@@ -6928,10 +6922,9 @@ static struct r5conf *setup_conf(struct mddev *mddev)
69286922
for (i = 0; i < PENDING_IO_MAX; i++)
69296923
list_add(&conf->pending_data[i].sibling, &conf->free_list);
69306924
/* Don't enable multi-threading by default*/
6931-
if (!alloc_thread_groups(conf, 0, &group_cnt, &worker_cnt_per_group,
6932-
&new_group)) {
6925+
if (!alloc_thread_groups(conf, 0, &group_cnt, &new_group)) {
69336926
conf->group_cnt = group_cnt;
6934-
conf->worker_cnt_per_group = worker_cnt_per_group;
6927+
conf->worker_cnt_per_group = 0;
69356928
conf->worker_groups = new_group;
69366929
} else
69376930
goto abort;

0 commit comments

Comments
 (0)