Lines Matching refs: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,
214 struct btrfs_work *work;
223 work = list_entry(list->next, struct btrfs_work,
225 if (!test_bit(WORK_DONE_BIT, &work->flags))
231 * updates from ordinary work function.
237 * we leave the work item on the list as a barrier so
238 * that later work items that are done don't have their
241 if (test_and_set_bit(WORK_ORDER_DONE_BIT, &work->flags))
243 trace_btrfs_ordered_sched(work);
245 work->ordered_func(work, false);
249 list_del(&work->ordered_list);
252 if (work == self) {
254 * This is the work item that the worker is currently
258 * of work items. I.e., if a work item with the same
259 * address and work function is queued twice, the second
261 * work item may be freed and recycled with the same
262 * work function; the workqueue code assumes that the
263 * original work item cannot depend on the recycled work
266 * Note that different types of Btrfs work can depend on
267 * each other, and one type of work on one Btrfs
268 * filesystem may even depend on the same type of work
270 * Therefore, we must not allow the current work item to
280 work->ordered_func(work, true);
281 /* NB: work must not be dereferenced past this point. */
282 trace_btrfs_all_work_done(wq->fs_info, work);
296 struct btrfs_work *work = container_of(normal_work, struct btrfs_work,
298 struct btrfs_workqueue *wq = work->wq;
302 * We should not touch things inside work in the following cases:
303 * 1) after work->func() if it has no ordered_func(..., true) to free
304 * Since the struct is freed in work->func().
306 * The work may be freed in other threads almost instantly.
309 if (work->ordered_func)
312 trace_btrfs_work_sched(work);
314 work->func(work);
317 * Ensures all memory accesses done in the work function are
319 * which is going to executed the ordered work sees them.
323 set_bit(WORK_DONE_BIT, &work->flags);
324 run_ordered_work(wq, work);
326 /* NB: work must not be dereferenced past this point. */
327 trace_btrfs_all_work_done(wq->fs_info, work);
331 void btrfs_init_work(struct btrfs_work *work, btrfs_func_t func,
334 work->func = func;
335 work->ordered_func = ordered_func;
336 INIT_WORK(&work->normal_work, btrfs_work_helper);
337 INIT_LIST_HEAD(&work->ordered_list);
338 work->flags = 0;
341 void btrfs_queue_work(struct btrfs_workqueue *wq, struct btrfs_work *work)
345 work->wq = wq;
347 if (work->ordered_func) {
349 list_add_tail(&work->ordered_list, &wq->ordered_list);
352 trace_btrfs_work_queued(work);
353 queue_work(wq->normal_wq, &work->normal_work);