diff options
Diffstat (limited to 'src/kernel/xloop_main.h')
-rw-r--r-- | src/kernel/xloop_main.h | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/src/kernel/xloop_main.h b/src/kernel/xloop_main.h index 97c2654..360f3e5 100644 --- a/src/kernel/xloop_main.h +++ b/src/kernel/xloop_main.h @@ -1,4 +1,3 @@ -/* SPDX-License-Identifier: GPL-2.0 */ /* * loop_main.h * @@ -15,7 +14,6 @@ #include <linux/blk-mq.h> #include <linux/spinlock.h> #include <linux/mutex.h> -#include <linux/kthread.h> #include "uapi_xloop.h" #ifdef CONFIG_DEBUG_FS #include <linux/debugfs.h> @@ -28,6 +26,7 @@ enum { Xlo_unbound, Xlo_bound, Xlo_rundown, + Xlo_deleting, }; struct xloop_func_table; @@ -38,36 +37,41 @@ struct xloop_device { loff_t xlo_offset; loff_t xlo_sizelimit; int xlo_flags; - int (*transfer)(struct xloop_device *xlo, int cmd, struct page *raw_page, - unsigned int raw_off, struct page *xloop_page, unsigned int xloop_off, - int size, sector_t real_block); + int (*transfer)(struct xloop_device *xlo, int cmd, struct page *raw_page, unsigned raw_off, struct page *xloop_page, unsigned xloop_off, int size, sector_t real_block); char xlo_file_name[XLO_NAME_SIZE]; char xlo_crypt_name[XLO_NAME_SIZE]; char xlo_encrypt_key[XLO_KEY_SIZE]; int xlo_encrypt_key_size; struct xloop_func_table *xlo_encryption; __u32 xlo_init[2]; - kuid_t xlo_key_owner; /* Who set the key */ - int (*ioctl)(struct xloop_device *xlo, int cmd, unsigned long arg); + kuid_t xlo_key_owner; /* Who set the key */ + int (*ioctl)(struct xloop_device *xlo, int cmd, unsigned long arg); struct xloop_file_fmt *xlo_fmt; struct file *xlo_backing_file; struct block_device *xlo_device; - void *key_data; + void *key_data; gfp_t old_gfp_mask; spinlock_t xlo_lock; int xlo_state; - struct kthread_worker worker; - struct task_struct *worker_task; + spinlock_t xlo_work_lock; + struct workqueue_struct *workqueue; + struct work_struct rootcg_work; + struct list_head rootcg_cmd_list; + struct list_head idle_worker_list; + struct rb_root worker_tree; + struct timer_list timer; bool use_dio; bool sysfs_inited; struct request_queue *xlo_queue; struct blk_mq_tag_set tag_set; struct gendisk *xlo_disk; + struct mutex xlo_mutex; + bool idr_visible; #ifdef CONFIG_DEBUG_FS struct dentry *xlo_dbgfs_dir; @@ -75,30 +79,30 @@ struct xloop_device { }; struct xloop_cmd { - struct kthread_work work; - bool use_aio; /* use AIO interface to handle I/O */ - atomic_t ref; /* only for aio */ + struct list_head list_entry; + bool use_aio; /* use AIO interface to handle I/O */ + atomic_t ref; /* only for aio */ long ret; struct kiocb iocb; struct bio_vec *bvec; - struct cgroup_subsys_state *css; + struct cgroup_subsys_state *blkcg_css; + struct cgroup_subsys_state *memcg_css; }; /* Support for loadable transfer modules */ struct xloop_func_table { - int number; /* filter type */ - int (*transfer)(struct xloop_device *xlo, int cmd, struct page *raw_page, unsigned int raw_off, - struct page *xloop_page, unsigned int xloop_off, int size, sector_t real_block); - int (*init)(struct xloop_device *xlo, const struct xloop_info64 *info); + int number; /* filter type */ + int (*transfer)(struct xloop_device *xlo, int cmd, struct page *raw_page, unsigned raw_off, struct page *xloop_page, unsigned xloop_off, int size, sector_t real_block); + int (*init)(struct xloop_device *xlo, const struct xloop_info64 *); /* release is called from xloop_unregister_transfer or clr_fd */ - int (*release)(struct xloop_device *xlo); + int (*release)(struct xloop_device *xlo); int (*ioctl)(struct xloop_device *xlo, int cmd, unsigned long arg); struct module *owner; -}; +}; extern inline struct device *xloop_device_to_dev(struct xloop_device *xlo); int xloop_register_transfer(struct xloop_func_table *funcs); -int xloop_unregister_transfer(int number); +int xloop_unregister_transfer(int number); #endif |