forked from portworx/px-fuse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpxd_bio.h
58 lines (46 loc) · 1.58 KB
/
pxd_bio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef _PXD_BIO_H_
#define _PXD_BIO_H_
struct pxd_device;
struct fuse_req;
#ifdef __PX_FASTPATH__
int __fastpath_init(void);
void __fastpath_cleanup(void);
#ifdef __PXD_BIO_MAKEREQ__
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
blk_qc_t pxd_bio_make_request_entryfn(struct bio *bio);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
blk_qc_t pxd_bio_make_request_entryfn(struct request_queue *q, struct bio *bio);
#define BLK_QC_RETVAL BLK_QC_T_NONE
#else
void pxd_bio_make_request_entryfn(struct request_queue *q, struct bio *bio);
#define BLK_QC_RETVAL
#endif
#endif
void __pxd_abortfailQ(struct pxd_device *pxd_dev);
void pxd_suspend_io(struct pxd_device *pxd_dev);
void pxd_resume_io(struct pxd_device *pxd_dev);
#ifdef __PXD_BIO_BLKMQ__
// io entry point
void fp_handle_io(struct work_struct *work);
// structure is exported only so, it can be embedded within fuse_context.
// Treat it as private outside fastpath
struct fp_root_context {
#define FP_ROOT_MAGIC (0xbaadf00du)
unsigned int magic;
struct work_struct work; // for discard handling
struct bio *bio; // consolidated bio
struct fp_clone_context *clones; // linked clones
struct list_head wait; // wait for resources
atomic_t nactive; // num of clones requests currently active
};
static inline void fp_root_context_init(struct fp_root_context *fproot) {
fproot->magic = FP_ROOT_MAGIC;
fproot->bio = NULL;
fproot->clones = NULL;
atomic_set(&fproot->nactive, 0);
INIT_LIST_HEAD(&fproot->wait);
INIT_WORK(&fproot->work, fp_handle_io);
}
#endif
#endif /* __PX_FASTPATH__ */
#endif /* _PXD_BIO_H_ */