xref: /linux/drivers/target/target_core_iblock.h (revision 223981db9bafb80f558162c148f261e2ff043dbe)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef TARGET_CORE_IBLOCK_H
3 #define TARGET_CORE_IBLOCK_H
4 
5 #include <linux/atomic.h>
6 #include <linux/refcount.h>
7 #include <linux/blkdev.h>
8 #include <target/target_core_base.h>
9 
10 #define IBLOCK_VERSION		"4.0"
11 
12 #define IBLOCK_MAX_CDBS		16
13 
14 struct iblock_req {
15 	refcount_t pending;
16 	atomic_t ib_bio_err_cnt;
17 } ____cacheline_aligned;
18 
19 #define IBDF_HAS_UDEV_PATH		0x01
20 
21 #define IBD_PLUGF_PLUGGED		0x01
22 
23 struct iblock_dev_plug {
24 	struct se_dev_plug se_plug;
25 	struct blk_plug blk_plug;
26 	unsigned long flags;
27 };
28 
29 struct iblock_dev {
30 	struct se_device dev;
31 	unsigned char ibd_udev_path[SE_UDEV_PATH_LEN];
32 	u32	ibd_flags;
33 	struct bio_set	ibd_bio_set;
34 	struct block_device *ibd_bd;
35 	struct bdev_handle *ibd_bdev_handle;
36 	bool ibd_readonly;
37 	struct iblock_dev_plug *ibd_plug;
38 } ____cacheline_aligned;
39 
40 #endif /* TARGET_CORE_IBLOCK_H */
41