xref: /OK3568_Linux_fs/kernel/drivers/md/dm-rq.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Internal header file for device mapper
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Copyright (C) 2016 Red Hat, Inc. All rights reserved.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * This file is released under the LGPL.
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #ifndef DM_RQ_INTERNAL_H
10*4882a593Smuzhiyun #define DM_RQ_INTERNAL_H
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #include <linux/bio.h>
13*4882a593Smuzhiyun #include <linux/kthread.h>
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun #include "dm-stats.h"
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun struct mapped_device;
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun /*
20*4882a593Smuzhiyun  * For request-based dm - the bio clones we allocate are embedded in these
21*4882a593Smuzhiyun  * structs.
22*4882a593Smuzhiyun  *
23*4882a593Smuzhiyun  * We allocate these with bio_alloc_bioset, using the front_pad parameter when
24*4882a593Smuzhiyun  * the bioset is created - this means the bio has to come at the end of the
25*4882a593Smuzhiyun  * struct.
26*4882a593Smuzhiyun  */
27*4882a593Smuzhiyun struct dm_rq_clone_bio_info {
28*4882a593Smuzhiyun 	struct bio *orig;
29*4882a593Smuzhiyun 	struct dm_rq_target_io *tio;
30*4882a593Smuzhiyun 	struct bio clone;
31*4882a593Smuzhiyun };
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun int dm_mq_init_request_queue(struct mapped_device *md, struct dm_table *t);
34*4882a593Smuzhiyun void dm_mq_cleanup_mapped_device(struct mapped_device *md);
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun void dm_start_queue(struct request_queue *q);
37*4882a593Smuzhiyun void dm_stop_queue(struct request_queue *q);
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun void dm_mq_kick_requeue_list(struct mapped_device *md);
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun unsigned dm_get_reserved_rq_based_ios(void);
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun ssize_t dm_attr_rq_based_seq_io_merge_deadline_show(struct mapped_device *md, char *buf);
44*4882a593Smuzhiyun ssize_t dm_attr_rq_based_seq_io_merge_deadline_store(struct mapped_device *md,
45*4882a593Smuzhiyun 						     const char *buf, size_t count);
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun #endif
48