18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2007 Oracle. All rights reserved. 48c2ecf20Sopenharmony_ci * Copyright (C) 2014 Fujitsu. All rights reserved. 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef BTRFS_ASYNC_THREAD_H 88c2ecf20Sopenharmony_ci#define BTRFS_ASYNC_THREAD_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/workqueue.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_cistruct btrfs_fs_info; 138c2ecf20Sopenharmony_cistruct btrfs_workqueue; 148c2ecf20Sopenharmony_ci/* Internal use only */ 158c2ecf20Sopenharmony_cistruct __btrfs_workqueue; 168c2ecf20Sopenharmony_cistruct btrfs_work; 178c2ecf20Sopenharmony_citypedef void (*btrfs_func_t)(struct btrfs_work *arg); 188c2ecf20Sopenharmony_citypedef void (*btrfs_work_func_t)(struct work_struct *arg); 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_cistruct btrfs_work { 218c2ecf20Sopenharmony_ci btrfs_func_t func; 228c2ecf20Sopenharmony_ci btrfs_func_t ordered_func; 238c2ecf20Sopenharmony_ci btrfs_func_t ordered_free; 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci /* Don't touch things below */ 268c2ecf20Sopenharmony_ci struct work_struct normal_work; 278c2ecf20Sopenharmony_ci struct list_head ordered_list; 288c2ecf20Sopenharmony_ci struct __btrfs_workqueue *wq; 298c2ecf20Sopenharmony_ci unsigned long flags; 308c2ecf20Sopenharmony_ci}; 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_cistruct btrfs_workqueue *btrfs_alloc_workqueue(struct btrfs_fs_info *fs_info, 338c2ecf20Sopenharmony_ci const char *name, 348c2ecf20Sopenharmony_ci unsigned int flags, 358c2ecf20Sopenharmony_ci int limit_active, 368c2ecf20Sopenharmony_ci int thresh); 378c2ecf20Sopenharmony_civoid btrfs_init_work(struct btrfs_work *work, btrfs_func_t func, 388c2ecf20Sopenharmony_ci btrfs_func_t ordered_func, btrfs_func_t ordered_free); 398c2ecf20Sopenharmony_civoid btrfs_queue_work(struct btrfs_workqueue *wq, 408c2ecf20Sopenharmony_ci struct btrfs_work *work); 418c2ecf20Sopenharmony_civoid btrfs_destroy_workqueue(struct btrfs_workqueue *wq); 428c2ecf20Sopenharmony_civoid btrfs_workqueue_set_max(struct btrfs_workqueue *wq, int max); 438c2ecf20Sopenharmony_civoid btrfs_set_work_high_priority(struct btrfs_work *work); 448c2ecf20Sopenharmony_cistruct btrfs_fs_info * __pure btrfs_work_owner(const struct btrfs_work *work); 458c2ecf20Sopenharmony_cistruct btrfs_fs_info * __pure btrfs_workqueue_owner(const struct __btrfs_workqueue *wq); 468c2ecf20Sopenharmony_cibool btrfs_workqueue_normal_congested(const struct btrfs_workqueue *wq); 478c2ecf20Sopenharmony_civoid btrfs_flush_workqueue(struct btrfs_workqueue *wq); 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#endif 50