Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) 2007 Oracle.  All rights reserved.
0004  * Copyright (C) 2014 Fujitsu.  All rights reserved.
0005  */
0006 
0007 #ifndef BTRFS_ASYNC_THREAD_H
0008 #define BTRFS_ASYNC_THREAD_H
0009 
0010 #include <linux/workqueue.h>
0011 
0012 struct btrfs_fs_info;
0013 struct btrfs_workqueue;
0014 struct btrfs_work;
0015 typedef void (*btrfs_func_t)(struct btrfs_work *arg);
0016 
0017 struct btrfs_work {
0018     btrfs_func_t func;
0019     btrfs_func_t ordered_func;
0020     btrfs_func_t ordered_free;
0021 
0022     /* Don't touch things below */
0023     struct work_struct normal_work;
0024     struct list_head ordered_list;
0025     struct btrfs_workqueue *wq;
0026     unsigned long flags;
0027 };
0028 
0029 struct btrfs_workqueue *btrfs_alloc_workqueue(struct btrfs_fs_info *fs_info,
0030                           const char *name,
0031                           unsigned int flags,
0032                           int limit_active,
0033                           int thresh);
0034 void btrfs_init_work(struct btrfs_work *work, btrfs_func_t func,
0035              btrfs_func_t ordered_func, btrfs_func_t ordered_free);
0036 void btrfs_queue_work(struct btrfs_workqueue *wq,
0037               struct btrfs_work *work);
0038 void btrfs_destroy_workqueue(struct btrfs_workqueue *wq);
0039 void btrfs_workqueue_set_max(struct btrfs_workqueue *wq, int max);
0040 struct btrfs_fs_info * __pure btrfs_work_owner(const struct btrfs_work *work);
0041 struct btrfs_fs_info * __pure btrfs_workqueue_owner(const struct btrfs_workqueue *wq);
0042 bool btrfs_workqueue_normal_congested(const struct btrfs_workqueue *wq);
0043 void btrfs_flush_workqueue(struct btrfs_workqueue *wq);
0044 
0045 #endif