aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fs-writeback.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r--fs/fs-writeback.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 1d1088f48bc2..af92100a7411 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -75,12 +75,33 @@ static inline bool bdi_work_on_stack(struct bdi_work *work)
75 return test_bit(WS_ONSTACK_B, &work->state); 75 return test_bit(WS_ONSTACK_B, &work->state);
76} 76}
77 77
78static inline void bdi_work_init(struct bdi_work *work, 78static inline void __bdi_work_init(struct bdi_work *work,
79 struct wb_writeback_args *args) 79 struct wb_writeback_args *args,
80 int on_stack)
80{ 81{
81 INIT_RCU_HEAD(&work->rcu_head);
82 work->args = *args; 82 work->args = *args;
83 work->state = WS_USED; 83 work->state = WS_USED;
84 if (on_stack) {
85 work->state |= WS_ONSTACK;
86 init_rcu_head_on_stack(&work->rcu_head);
87 }
88}
89
90static inline void bdi_work_init(struct bdi_work *work,
91 struct wb_writeback_args *args)
92{
93 __bdi_work_init(work, args, false);
94}
95
96static inline void bdi_work_init_on_stack(struct bdi_work *work,
97 struct wb_writeback_args *args)
98{
99 __bdi_work_init(work, args, true);
100}
101
102static inline void bdi_destroy_work_on_stack(struct bdi_work *work)
103{
104 destroy_rcu_head_on_stack(&work->rcu_head);
84} 105}
85 106
86/** 107/**
@@ -233,11 +254,11 @@ static void bdi_sync_writeback(struct backing_dev_info *bdi,
233 }; 254 };
234 struct bdi_work work; 255 struct bdi_work work;
235 256
236 bdi_work_init(&work, &args); 257 bdi_work_init_on_stack(&work, &args);
237 work.state |= WS_ONSTACK;
238 258
239 bdi_queue_work(bdi, &work); 259 bdi_queue_work(bdi, &work);
240 bdi_wait_on_work_clear(&work); 260 bdi_wait_on_work_clear(&work);
261 bdi_destroy_work_on_stack(&work);
241} 262}
242 263
243/** 264/**