Commit 632dd772fcbde2ba37c0e8983bd38ef4a1eac906
1 parent
8c51032f97
Exists in
master
and in
7 other branches
btrfs: reinitialize scrub workers
Scrub starts the workers each time a scrub starts and stops them after it finished. This patch adds an initialization for the workers before each start, otherwise the workers behave strangely. Signed-off-by: Arne Jansen <sensille@gmx.net>
Showing 2 changed files with 5 additions and 3 deletions Side-by-side Diff
fs/btrfs/disk-io.c
... | ... | @@ -1668,8 +1668,6 @@ |
1668 | 1668 | init_waitqueue_head(&fs_info->scrub_pause_wait); |
1669 | 1669 | init_rwsem(&fs_info->scrub_super_lock); |
1670 | 1670 | fs_info->scrub_workers_refcnt = 0; |
1671 | - btrfs_init_workers(&fs_info->scrub_workers, "scrub", | |
1672 | - fs_info->thread_pool_size, &fs_info->generic_worker); | |
1673 | 1671 | |
1674 | 1672 | sb->s_blocksize = 4096; |
1675 | 1673 | sb->s_blocksize_bits = blksize_bits(4096); |
fs/btrfs/scrub.c
... | ... | @@ -1166,8 +1166,12 @@ |
1166 | 1166 | struct btrfs_fs_info *fs_info = root->fs_info; |
1167 | 1167 | |
1168 | 1168 | mutex_lock(&fs_info->scrub_lock); |
1169 | - if (fs_info->scrub_workers_refcnt == 0) | |
1169 | + if (fs_info->scrub_workers_refcnt == 0) { | |
1170 | + btrfs_init_workers(&fs_info->scrub_workers, "scrub", | |
1171 | + fs_info->thread_pool_size, &fs_info->generic_worker); | |
1172 | + fs_info->scrub_workers.idle_thresh = 4; | |
1170 | 1173 | btrfs_start_workers(&fs_info->scrub_workers, 1); |
1174 | + } | |
1171 | 1175 | ++fs_info->scrub_workers_refcnt; |
1172 | 1176 | mutex_unlock(&fs_info->scrub_lock); |
1173 | 1177 |