Skip to content

Commit d458b05

Browse files
Qu WenruoJosef Bacik
authored andcommitted
btrfs: Cleanup the "_struct" suffix in btrfs_workequeue
Since the "_struct" suffix is mainly used for distinguish the differnt btrfs_work between the original and the newly created one, there is no need using the suffix since all btrfs_workers are changed into btrfs_workqueue. Also this patch fixed some codes whose code style is changed due to the too long "_struct" suffix. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Tested-by: David Sterba <dsterba@suse.cz> Signed-off-by: Josef Bacik <jbacik@fb.com>
1 parent a046e9c commit d458b05

15 files changed

Lines changed: 116 additions & 120 deletions

‎fs/btrfs/async-thread.c‎

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#define NO_THRESHOLD (-1)
3333
#define DFT_THRESHOLD (32)
3434

35-
struct __btrfs_workqueue_struct {
35+
struct __btrfs_workqueue {
3636
struct workqueue_struct *normal_wq;
3737
/* List head pointing to ordered work list */
3838
struct list_head ordered_list;
@@ -49,15 +49,15 @@ struct __btrfs_workqueue_struct {
4949
spinlock_t thres_lock;
5050
};
5151

52-
struct btrfs_workqueue_struct {
53-
struct __btrfs_workqueue_struct *normal;
54-
struct __btrfs_workqueue_struct *high;
52+
struct btrfs_workqueue {
53+
struct __btrfs_workqueue *normal;
54+
struct __btrfs_workqueue *high;
5555
};
5656

57-
static inline struct __btrfs_workqueue_struct
57+
static inline struct __btrfs_workqueue
5858
*__btrfs_alloc_workqueue(char *name, int flags, int max_active, int thresh)
5959
{
60-
struct __btrfs_workqueue_struct *ret = kzalloc(sizeof(*ret), GFP_NOFS);
60+
struct __btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_NOFS);
6161

6262
if (unlikely(!ret))
6363
return NULL;
@@ -95,14 +95,14 @@ static inline struct __btrfs_workqueue_struct
9595
}
9696

9797
static inline void
98-
__btrfs_destroy_workqueue(struct __btrfs_workqueue_struct *wq);
98+
__btrfs_destroy_workqueue(struct __btrfs_workqueue *wq);
9999

100-
struct btrfs_workqueue_struct *btrfs_alloc_workqueue(char *name,
101-
int flags,
102-
int max_active,
103-
int thresh)
100+
struct btrfs_workqueue *btrfs_alloc_workqueue(char *name,
101+
int flags,
102+
int max_active,
103+
int thresh)
104104
{
105-
struct btrfs_workqueue_struct *ret = kzalloc(sizeof(*ret), GFP_NOFS);
105+
struct btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_NOFS);
106106

107107
if (unlikely(!ret))
108108
return NULL;
@@ -131,7 +131,7 @@ struct btrfs_workqueue_struct *btrfs_alloc_workqueue(char *name,
131131
* This hook WILL be called in IRQ handler context,
132132
* so workqueue_set_max_active MUST NOT be called in this hook
133133
*/
134-
static inline void thresh_queue_hook(struct __btrfs_workqueue_struct *wq)
134+
static inline void thresh_queue_hook(struct __btrfs_workqueue *wq)
135135
{
136136
if (wq->thresh == NO_THRESHOLD)
137137
return;
@@ -143,7 +143,7 @@ static inline void thresh_queue_hook(struct __btrfs_workqueue_struct *wq)
143143
* This hook is called in kthread content.
144144
* So workqueue_set_max_active is called here.
145145
*/
146-
static inline void thresh_exec_hook(struct __btrfs_workqueue_struct *wq)
146+
static inline void thresh_exec_hook(struct __btrfs_workqueue *wq)
147147
{
148148
int new_max_active;
149149
long pending;
@@ -186,18 +186,18 @@ static inline void thresh_exec_hook(struct __btrfs_workqueue_struct *wq)
186186
}
187187
}
188188

189-
static void run_ordered_work(struct __btrfs_workqueue_struct *wq)
189+
static void run_ordered_work(struct __btrfs_workqueue *wq)
190190
{
191191
struct list_head *list = &wq->ordered_list;
192-
struct btrfs_work_struct *work;
192+
struct btrfs_work *work;
193193
spinlock_t *lock = &wq->list_lock;
194194
unsigned long flags;
195195

196196
while (1) {
197197
spin_lock_irqsave(lock, flags);
198198
if (list_empty(list))
199199
break;
200-
work = list_entry(list->next, struct btrfs_work_struct,
200+
work = list_entry(list->next, struct btrfs_work,
201201
ordered_list);
202202
if (!test_bit(WORK_DONE_BIT, &work->flags))
203203
break;
@@ -229,11 +229,11 @@ static void run_ordered_work(struct __btrfs_workqueue_struct *wq)
229229

230230
static void normal_work_helper(struct work_struct *arg)
231231
{
232-
struct btrfs_work_struct *work;
233-
struct __btrfs_workqueue_struct *wq;
232+
struct btrfs_work *work;
233+
struct __btrfs_workqueue *wq;
234234
int need_order = 0;
235235

236-
work = container_of(arg, struct btrfs_work_struct, normal_work);
236+
work = container_of(arg, struct btrfs_work, normal_work);
237237
/*
238238
* We should not touch things inside work in the following cases:
239239
* 1) after work->func() if it has no ordered_free
@@ -254,10 +254,10 @@ static void normal_work_helper(struct work_struct *arg)
254254
}
255255
}
256256

257-
void btrfs_init_work(struct btrfs_work_struct *work,
258-
void (*func)(struct btrfs_work_struct *),
259-
void (*ordered_func)(struct btrfs_work_struct *),
260-
void (*ordered_free)(struct btrfs_work_struct *))
257+
void btrfs_init_work(struct btrfs_work *work,
258+
void (*func)(struct btrfs_work *),
259+
void (*ordered_func)(struct btrfs_work *),
260+
void (*ordered_free)(struct btrfs_work *))
261261
{
262262
work->func = func;
263263
work->ordered_func = ordered_func;
@@ -267,8 +267,8 @@ void btrfs_init_work(struct btrfs_work_struct *work,
267267
work->flags = 0;
268268
}
269269

270-
static inline void __btrfs_queue_work(struct __btrfs_workqueue_struct *wq,
271-
struct btrfs_work_struct *work)
270+
static inline void __btrfs_queue_work(struct __btrfs_workqueue *wq,
271+
struct btrfs_work *work)
272272
{
273273
unsigned long flags;
274274

@@ -282,10 +282,10 @@ static inline void __btrfs_queue_work(struct __btrfs_workqueue_struct *wq,
282282
queue_work(wq->normal_wq, &work->normal_work);
283283
}
284284

285-
void btrfs_queue_work(struct btrfs_workqueue_struct *wq,
286-
struct btrfs_work_struct *work)
285+
void btrfs_queue_work(struct btrfs_workqueue *wq,
286+
struct btrfs_work *work)
287287
{
288-
struct __btrfs_workqueue_struct *dest_wq;
288+
struct __btrfs_workqueue *dest_wq;
289289

290290
if (test_bit(WORK_HIGH_PRIO_BIT, &work->flags) && wq->high)
291291
dest_wq = wq->high;
@@ -295,13 +295,13 @@ void btrfs_queue_work(struct btrfs_workqueue_struct *wq,
295295
}
296296

297297
static inline void
298-
__btrfs_destroy_workqueue(struct __btrfs_workqueue_struct *wq)
298+
__btrfs_destroy_workqueue(struct __btrfs_workqueue *wq)
299299
{
300300
destroy_workqueue(wq->normal_wq);
301301
kfree(wq);
302302
}
303303

304-
void btrfs_destroy_workqueue(struct btrfs_workqueue_struct *wq)
304+
void btrfs_destroy_workqueue(struct btrfs_workqueue *wq)
305305
{
306306
if (!wq)
307307
return;
@@ -310,14 +310,14 @@ void btrfs_destroy_workqueue(struct btrfs_workqueue_struct *wq)
310310
__btrfs_destroy_workqueue(wq->normal);
311311
}
312312

313-
void btrfs_workqueue_set_max(struct btrfs_workqueue_struct *wq, int max)
313+
void btrfs_workqueue_set_max(struct btrfs_workqueue *wq, int max)
314314
{
315315
wq->normal->max_active = max;
316316
if (wq->high)
317317
wq->high->max_active = max;
318318
}
319319

320-
void btrfs_set_work_high_priority(struct btrfs_work_struct *work)
320+
void btrfs_set_work_high_priority(struct btrfs_work *work)
321321
{
322322
set_bit(WORK_HIGH_PRIO_BIT, &work->flags);
323323
}

‎fs/btrfs/async-thread.h‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,33 @@
2020
#ifndef __BTRFS_ASYNC_THREAD_
2121
#define __BTRFS_ASYNC_THREAD_
2222

23-
struct btrfs_workqueue_struct;
23+
struct btrfs_workqueue;
2424
/* Internal use only */
25-
struct __btrfs_workqueue_struct;
25+
struct __btrfs_workqueue;
2626

27-
struct btrfs_work_struct {
28-
void (*func)(struct btrfs_work_struct *arg);
29-
void (*ordered_func)(struct btrfs_work_struct *arg);
30-
void (*ordered_free)(struct btrfs_work_struct *arg);
27+
struct btrfs_work {
28+
void (*func)(struct btrfs_work *arg);
29+
void (*ordered_func)(struct btrfs_work *arg);
30+
void (*ordered_free)(struct btrfs_work *arg);
3131

3232
/* Don't touch things below */
3333
struct work_struct normal_work;
3434
struct list_head ordered_list;
35-
struct __btrfs_workqueue_struct *wq;
35+
struct __btrfs_workqueue *wq;
3636
unsigned long flags;
3737
};
3838

39-
struct btrfs_workqueue_struct *btrfs_alloc_workqueue(char *name,
39+
struct btrfs_workqueue *btrfs_alloc_workqueue(char *name,
4040
int flags,
4141
int max_active,
4242
int thresh);
43-
void btrfs_init_work(struct btrfs_work_struct *work,
44-
void (*func)(struct btrfs_work_struct *),
45-
void (*ordered_func)(struct btrfs_work_struct *),
46-
void (*ordered_free)(struct btrfs_work_struct *));
47-
void btrfs_queue_work(struct btrfs_workqueue_struct *wq,
48-
struct btrfs_work_struct *work);
49-
void btrfs_destroy_workqueue(struct btrfs_workqueue_struct *wq);
50-
void btrfs_workqueue_set_max(struct btrfs_workqueue_struct *wq, int max);
51-
void btrfs_set_work_high_priority(struct btrfs_work_struct *work);
43+
void btrfs_init_work(struct btrfs_work *work,
44+
void (*func)(struct btrfs_work *),
45+
void (*ordered_func)(struct btrfs_work *),
46+
void (*ordered_free)(struct btrfs_work *));
47+
void btrfs_queue_work(struct btrfs_workqueue *wq,
48+
struct btrfs_work *work);
49+
void btrfs_destroy_workqueue(struct btrfs_workqueue *wq);
50+
void btrfs_workqueue_set_max(struct btrfs_workqueue *wq, int max);
51+
void btrfs_set_work_high_priority(struct btrfs_work *work);
5252
#endif

‎fs/btrfs/ctree.h‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ struct btrfs_caching_control {
12211221
struct list_head list;
12221222
struct mutex mutex;
12231223
wait_queue_head_t wait;
1224-
struct btrfs_work_struct work;
1224+
struct btrfs_work work;
12251225
struct btrfs_block_group_cache *block_group;
12261226
u64 progress;
12271227
atomic_t count;
@@ -1504,27 +1504,27 @@ struct btrfs_fs_info {
15041504
* A third pool does submit_bio to avoid deadlocking with the other
15051505
* two
15061506
*/
1507-
struct btrfs_workqueue_struct *workers;
1508-
struct btrfs_workqueue_struct *delalloc_workers;
1509-
struct btrfs_workqueue_struct *flush_workers;
1510-
struct btrfs_workqueue_struct *endio_workers;
1511-
struct btrfs_workqueue_struct *endio_meta_workers;
1512-
struct btrfs_workqueue_struct *endio_raid56_workers;
1513-
struct btrfs_workqueue_struct *rmw_workers;
1514-
struct btrfs_workqueue_struct *endio_meta_write_workers;
1515-
struct btrfs_workqueue_struct *endio_write_workers;
1516-
struct btrfs_workqueue_struct *endio_freespace_worker;
1517-
struct btrfs_workqueue_struct *submit_workers;
1518-
struct btrfs_workqueue_struct *caching_workers;
1519-
struct btrfs_workqueue_struct *readahead_workers;
1507+
struct btrfs_workqueue *workers;
1508+
struct btrfs_workqueue *delalloc_workers;
1509+
struct btrfs_workqueue *flush_workers;
1510+
struct btrfs_workqueue *endio_workers;
1511+
struct btrfs_workqueue *endio_meta_workers;
1512+
struct btrfs_workqueue *endio_raid56_workers;
1513+
struct btrfs_workqueue *rmw_workers;
1514+
struct btrfs_workqueue *endio_meta_write_workers;
1515+
struct btrfs_workqueue *endio_write_workers;
1516+
struct btrfs_workqueue *endio_freespace_worker;
1517+
struct btrfs_workqueue *submit_workers;
1518+
struct btrfs_workqueue *caching_workers;
1519+
struct btrfs_workqueue *readahead_workers;
15201520

15211521
/*
15221522
* fixup workers take dirty pages that didn't properly go through
15231523
* the cow mechanism and make them safe to write. It happens
15241524
* for the sys_munmap function call path
15251525
*/
1526-
struct btrfs_workqueue_struct *fixup_workers;
1527-
struct btrfs_workqueue_struct *delayed_workers;
1526+
struct btrfs_workqueue *fixup_workers;
1527+
struct btrfs_workqueue *delayed_workers;
15281528
struct task_struct *transaction_kthread;
15291529
struct task_struct *cleaner_kthread;
15301530
int thread_pool_size;
@@ -1604,9 +1604,9 @@ struct btrfs_fs_info {
16041604
atomic_t scrub_cancel_req;
16051605
wait_queue_head_t scrub_pause_wait;
16061606
int scrub_workers_refcnt;
1607-
struct btrfs_workqueue_struct *scrub_workers;
1608-
struct btrfs_workqueue_struct *scrub_wr_completion_workers;
1609-
struct btrfs_workqueue_struct *scrub_nocow_workers;
1607+
struct btrfs_workqueue *scrub_workers;
1608+
struct btrfs_workqueue *scrub_wr_completion_workers;
1609+
struct btrfs_workqueue *scrub_nocow_workers;
16101610

16111611
#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
16121612
u32 check_integrity_print_mask;
@@ -1647,9 +1647,9 @@ struct btrfs_fs_info {
16471647
/* qgroup rescan items */
16481648
struct mutex qgroup_rescan_lock; /* protects the progress item */
16491649
struct btrfs_key qgroup_rescan_progress;
1650-
struct btrfs_workqueue_struct *qgroup_rescan_workers;
1650+
struct btrfs_workqueue *qgroup_rescan_workers;
16511651
struct completion qgroup_rescan_completion;
1652-
struct btrfs_work_struct qgroup_rescan_work;
1652+
struct btrfs_work qgroup_rescan_work;
16531653

16541654
/* filesystem state */
16551655
unsigned long fs_state;
@@ -3680,7 +3680,7 @@ struct btrfs_delalloc_work {
36803680
int delay_iput;
36813681
struct completion completion;
36823682
struct list_head list;
3683-
struct btrfs_work_struct work;
3683+
struct btrfs_work work;
36843684
};
36853685

36863686
struct btrfs_delalloc_work *btrfs_alloc_delalloc_work(struct inode *inode,

‎fs/btrfs/delayed-inode.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,10 +1318,10 @@ void btrfs_remove_delayed_node(struct inode *inode)
13181318
struct btrfs_async_delayed_work {
13191319
struct btrfs_delayed_root *delayed_root;
13201320
int nr;
1321-
struct btrfs_work_struct work;
1321+
struct btrfs_work work;
13221322
};
13231323

1324-
static void btrfs_async_run_delayed_root(struct btrfs_work_struct *work)
1324+
static void btrfs_async_run_delayed_root(struct btrfs_work *work)
13251325
{
13261326
struct btrfs_async_delayed_work *async_work;
13271327
struct btrfs_delayed_root *delayed_root;

‎fs/btrfs/disk-io.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
#endif
5656

5757
static struct extent_io_ops btree_extent_io_ops;
58-
static void end_workqueue_fn(struct btrfs_work_struct *work);
58+
static void end_workqueue_fn(struct btrfs_work *work);
5959
static void free_fs_root(struct btrfs_root *root);
6060
static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
6161
int read_only);
@@ -86,7 +86,7 @@ struct end_io_wq {
8686
int error;
8787
int metadata;
8888
struct list_head list;
89-
struct btrfs_work_struct work;
89+
struct btrfs_work work;
9090
};
9191

9292
/*
@@ -108,7 +108,7 @@ struct async_submit_bio {
108108
* can't tell us where in the file the bio should go
109109
*/
110110
u64 bio_offset;
111-
struct btrfs_work_struct work;
111+
struct btrfs_work work;
112112
int error;
113113
};
114114

@@ -742,7 +742,7 @@ unsigned long btrfs_async_submit_limit(struct btrfs_fs_info *info)
742742
return 256 * limit;
743743
}
744744

745-
static void run_one_async_start(struct btrfs_work_struct *work)
745+
static void run_one_async_start(struct btrfs_work *work)
746746
{
747747
struct async_submit_bio *async;
748748
int ret;
@@ -755,7 +755,7 @@ static void run_one_async_start(struct btrfs_work_struct *work)
755755
async->error = ret;
756756
}
757757

758-
static void run_one_async_done(struct btrfs_work_struct *work)
758+
static void run_one_async_done(struct btrfs_work *work)
759759
{
760760
struct btrfs_fs_info *fs_info;
761761
struct async_submit_bio *async;
@@ -782,7 +782,7 @@ static void run_one_async_done(struct btrfs_work_struct *work)
782782
async->bio_offset);
783783
}
784784

785-
static void run_one_async_free(struct btrfs_work_struct *work)
785+
static void run_one_async_free(struct btrfs_work *work)
786786
{
787787
struct async_submit_bio *async;
788788

@@ -1668,7 +1668,7 @@ static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi)
16681668
* called by the kthread helper functions to finally call the bio end_io
16691669
* functions. This is where read checksum verification actually happens
16701670
*/
1671-
static void end_workqueue_fn(struct btrfs_work_struct *work)
1671+
static void end_workqueue_fn(struct btrfs_work *work)
16721672
{
16731673
struct bio *bio;
16741674
struct end_io_wq *end_io_wq;

0 commit comments

Comments
 (0)