Lines Matching full:work

29 	/* List head pointing to ordered work list */
55 struct btrfs_fs_info * __pure btrfs_work_owner(const struct btrfs_work *work)
57 return work->wq->fs_info;
163 * Hook for threshold which will be called before executing the work,
213 struct btrfs_work *work;
222 work = list_first_entry(list, struct btrfs_work, ordered_list);
223 if (!test_bit(WORK_DONE_BIT, &work->flags))
229 * updates from ordinary work function.
235 * we leave the work item on the list as a barrier so
236 * that later work items that are done don't have their
239 if (test_and_set_bit(WORK_ORDER_DONE_BIT, &work->flags))
241 trace_btrfs_ordered_sched(work);
243 work->ordered_func(work, false);
247 list_del(&work->ordered_list);
250 if (work == self) {
252 * This is the work item that the worker is currently
256 * of work items. I.e., if a work item with the same
257 * address and work function is queued twice, the second
259 * work item may be freed and recycled with the same
260 * work function; the workqueue code assumes that the
261 * original work item cannot depend on the recycled work
264 * Note that different types of Btrfs work can depend on
265 * each other, and one type of work on one Btrfs
266 * filesystem may even depend on the same type of work
268 * Therefore, we must not allow the current work item to
278 work->ordered_func(work, true);
279 /* NB: work must not be dereferenced past this point. */
280 trace_btrfs_all_work_done(wq->fs_info, work);
294 struct btrfs_work *work = container_of(normal_work, struct btrfs_work,
296 struct btrfs_workqueue *wq = work->wq;
300 * We should not touch things inside work in the following cases:
301 * 1) after work->func() if it has no ordered_func(..., true) to free
302 * Since the struct is freed in work->func().
304 * The work may be freed in other threads almost instantly.
307 if (work->ordered_func)
310 trace_btrfs_work_sched(work);
312 work->func(work);
315 * Ensures all memory accesses done in the work function are
317 * which is going to executed the ordered work sees them.
321 set_bit(WORK_DONE_BIT, &work->flags);
322 run_ordered_work(wq, work);
324 /* NB: work must not be dereferenced past this point. */
325 trace_btrfs_all_work_done(wq->fs_info, work);
329 void btrfs_init_work(struct btrfs_work *work, btrfs_func_t func,
332 work->func = func;
333 work->ordered_func = ordered_func;
334 INIT_WORK(&work->normal_work, btrfs_work_helper);
335 INIT_LIST_HEAD(&work->ordered_list);
336 work->flags = 0;
339 void btrfs_queue_work(struct btrfs_workqueue *wq, struct btrfs_work *work)
343 work->wq = wq;
345 if (work->ordered_func) {
347 list_add_tail(&work->ordered_list, &wq->ordered_list);
350 trace_btrfs_work_queued(work);
351 queue_work(wq->normal_wq, &work->normal_work);