diff options
-rw-r--r-- | fs/btrfs/ctree.h | 4 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 10 | ||||
-rw-r--r-- | fs/btrfs/qgroup.c | 17 |
3 files changed, 16 insertions, 15 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index c07b67f6f924..7b50def3f206 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1648,9 +1648,9 @@ struct btrfs_fs_info { | |||
1648 | /* qgroup rescan items */ | 1648 | /* qgroup rescan items */ |
1649 | struct mutex qgroup_rescan_lock; /* protects the progress item */ | 1649 | struct mutex qgroup_rescan_lock; /* protects the progress item */ |
1650 | struct btrfs_key qgroup_rescan_progress; | 1650 | struct btrfs_key qgroup_rescan_progress; |
1651 | struct btrfs_workers qgroup_rescan_workers; | 1651 | struct btrfs_workqueue_struct *qgroup_rescan_workers; |
1652 | struct completion qgroup_rescan_completion; | 1652 | struct completion qgroup_rescan_completion; |
1653 | struct btrfs_work qgroup_rescan_work; | 1653 | struct btrfs_work_struct qgroup_rescan_work; |
1654 | 1654 | ||
1655 | /* filesystem state */ | 1655 | /* filesystem state */ |
1656 | unsigned long fs_state; | 1656 | unsigned long fs_state; |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index f5da1fd23ee9..9aaf9c309b54 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2010,7 +2010,7 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info) | |||
2010 | btrfs_destroy_workqueue(fs_info->caching_workers); | 2010 | btrfs_destroy_workqueue(fs_info->caching_workers); |
2011 | btrfs_destroy_workqueue(fs_info->readahead_workers); | 2011 | btrfs_destroy_workqueue(fs_info->readahead_workers); |
2012 | btrfs_destroy_workqueue(fs_info->flush_workers); | 2012 | btrfs_destroy_workqueue(fs_info->flush_workers); |
2013 | btrfs_stop_workers(&fs_info->qgroup_rescan_workers); | 2013 | btrfs_destroy_workqueue(fs_info->qgroup_rescan_workers); |
2014 | } | 2014 | } |
2015 | 2015 | ||
2016 | static void free_root_extent_buffers(struct btrfs_root *root) | 2016 | static void free_root_extent_buffers(struct btrfs_root *root) |
@@ -2523,15 +2523,14 @@ int open_ctree(struct super_block *sb, | |||
2523 | btrfs_alloc_workqueue("delayed-meta", flags, max_active, 0); | 2523 | btrfs_alloc_workqueue("delayed-meta", flags, max_active, 0); |
2524 | fs_info->readahead_workers = | 2524 | fs_info->readahead_workers = |
2525 | btrfs_alloc_workqueue("readahead", flags, max_active, 2); | 2525 | btrfs_alloc_workqueue("readahead", flags, max_active, 2); |
2526 | btrfs_init_workers(&fs_info->qgroup_rescan_workers, "qgroup-rescan", 1, | 2526 | fs_info->qgroup_rescan_workers = |
2527 | &fs_info->generic_worker); | 2527 | btrfs_alloc_workqueue("qgroup-rescan", flags, 1, 0); |
2528 | 2528 | ||
2529 | /* | 2529 | /* |
2530 | * btrfs_start_workers can really only fail because of ENOMEM so just | 2530 | * btrfs_start_workers can really only fail because of ENOMEM so just |
2531 | * return -ENOMEM if any of these fail. | 2531 | * return -ENOMEM if any of these fail. |
2532 | */ | 2532 | */ |
2533 | ret = btrfs_start_workers(&fs_info->generic_worker); | 2533 | ret = btrfs_start_workers(&fs_info->generic_worker); |
2534 | ret |= btrfs_start_workers(&fs_info->qgroup_rescan_workers); | ||
2535 | if (ret) { | 2534 | if (ret) { |
2536 | err = -ENOMEM; | 2535 | err = -ENOMEM; |
2537 | goto fail_sb_buffer; | 2536 | goto fail_sb_buffer; |
@@ -2543,7 +2542,8 @@ int open_ctree(struct super_block *sb, | |||
2543 | fs_info->endio_write_workers && fs_info->endio_raid56_workers && | 2542 | fs_info->endio_write_workers && fs_info->endio_raid56_workers && |
2544 | fs_info->endio_freespace_worker && fs_info->rmw_workers && | 2543 | fs_info->endio_freespace_worker && fs_info->rmw_workers && |
2545 | fs_info->caching_workers && fs_info->readahead_workers && | 2544 | fs_info->caching_workers && fs_info->readahead_workers && |
2546 | fs_info->fixup_workers && fs_info->delayed_workers)) { | 2545 | fs_info->fixup_workers && fs_info->delayed_workers && |
2546 | fs_info->qgroup_rescan_workers)) { | ||
2547 | err = -ENOMEM; | 2547 | err = -ENOMEM; |
2548 | goto fail_sb_buffer; | 2548 | goto fail_sb_buffer; |
2549 | } | 2549 | } |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 472302a2d745..38617cc2fdd5 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -1509,8 +1509,8 @@ int btrfs_run_qgroups(struct btrfs_trans_handle *trans, | |||
1509 | ret = qgroup_rescan_init(fs_info, 0, 1); | 1509 | ret = qgroup_rescan_init(fs_info, 0, 1); |
1510 | if (!ret) { | 1510 | if (!ret) { |
1511 | qgroup_rescan_zero_tracking(fs_info); | 1511 | qgroup_rescan_zero_tracking(fs_info); |
1512 | btrfs_queue_worker(&fs_info->qgroup_rescan_workers, | 1512 | btrfs_queue_work(fs_info->qgroup_rescan_workers, |
1513 | &fs_info->qgroup_rescan_work); | 1513 | &fs_info->qgroup_rescan_work); |
1514 | } | 1514 | } |
1515 | ret = 0; | 1515 | ret = 0; |
1516 | } | 1516 | } |
@@ -1984,7 +1984,7 @@ out: | |||
1984 | return ret; | 1984 | return ret; |
1985 | } | 1985 | } |
1986 | 1986 | ||
1987 | static void btrfs_qgroup_rescan_worker(struct btrfs_work *work) | 1987 | static void btrfs_qgroup_rescan_worker(struct btrfs_work_struct *work) |
1988 | { | 1988 | { |
1989 | struct btrfs_fs_info *fs_info = container_of(work, struct btrfs_fs_info, | 1989 | struct btrfs_fs_info *fs_info = container_of(work, struct btrfs_fs_info, |
1990 | qgroup_rescan_work); | 1990 | qgroup_rescan_work); |
@@ -2095,7 +2095,8 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid, | |||
2095 | 2095 | ||
2096 | memset(&fs_info->qgroup_rescan_work, 0, | 2096 | memset(&fs_info->qgroup_rescan_work, 0, |
2097 | sizeof(fs_info->qgroup_rescan_work)); | 2097 | sizeof(fs_info->qgroup_rescan_work)); |
2098 | fs_info->qgroup_rescan_work.func = btrfs_qgroup_rescan_worker; | 2098 | btrfs_init_work(&fs_info->qgroup_rescan_work, |
2099 | btrfs_qgroup_rescan_worker, NULL, NULL); | ||
2099 | 2100 | ||
2100 | if (ret) { | 2101 | if (ret) { |
2101 | err: | 2102 | err: |
@@ -2158,8 +2159,8 @@ btrfs_qgroup_rescan(struct btrfs_fs_info *fs_info) | |||
2158 | 2159 | ||
2159 | qgroup_rescan_zero_tracking(fs_info); | 2160 | qgroup_rescan_zero_tracking(fs_info); |
2160 | 2161 | ||
2161 | btrfs_queue_worker(&fs_info->qgroup_rescan_workers, | 2162 | btrfs_queue_work(fs_info->qgroup_rescan_workers, |
2162 | &fs_info->qgroup_rescan_work); | 2163 | &fs_info->qgroup_rescan_work); |
2163 | 2164 | ||
2164 | return 0; | 2165 | return 0; |
2165 | } | 2166 | } |
@@ -2190,6 +2191,6 @@ void | |||
2190 | btrfs_qgroup_rescan_resume(struct btrfs_fs_info *fs_info) | 2191 | btrfs_qgroup_rescan_resume(struct btrfs_fs_info *fs_info) |
2191 | { | 2192 | { |
2192 | if (fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN) | 2193 | if (fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN) |
2193 | btrfs_queue_worker(&fs_info->qgroup_rescan_workers, | 2194 | btrfs_queue_work(fs_info->qgroup_rescan_workers, |
2194 | &fs_info->qgroup_rescan_work); | 2195 | &fs_info->qgroup_rescan_work); |
2195 | } | 2196 | } |