^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2007 Oracle. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2014 Fujitsu. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef BTRFS_ASYNC_THREAD_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define BTRFS_ASYNC_THREAD_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) struct btrfs_fs_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct btrfs_workqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /* Internal use only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct __btrfs_workqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct btrfs_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) typedef void (*btrfs_func_t)(struct btrfs_work *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) typedef void (*btrfs_work_func_t)(struct work_struct *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct btrfs_work {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) btrfs_func_t func;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) btrfs_func_t ordered_func;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) btrfs_func_t ordered_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /* Don't touch things below */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct work_struct normal_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct list_head ordered_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct __btrfs_workqueue *wq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct btrfs_workqueue *btrfs_alloc_workqueue(struct btrfs_fs_info *fs_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) unsigned int flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) int limit_active,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int thresh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) void btrfs_init_work(struct btrfs_work *work, btrfs_func_t func,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) btrfs_func_t ordered_func, btrfs_func_t ordered_free);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) void btrfs_queue_work(struct btrfs_workqueue *wq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct btrfs_work *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) void btrfs_destroy_workqueue(struct btrfs_workqueue *wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) void btrfs_workqueue_set_max(struct btrfs_workqueue *wq, int max);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) void btrfs_set_work_high_priority(struct btrfs_work *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct btrfs_fs_info * __pure btrfs_work_owner(const struct btrfs_work *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct btrfs_fs_info * __pure btrfs_workqueue_owner(const struct __btrfs_workqueue *wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) bool btrfs_workqueue_normal_congested(const struct btrfs_workqueue *wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void btrfs_flush_workqueue(struct btrfs_workqueue *wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #endif