Skip to content

Commit c66ac9d

Browse files
Nicholas BellingerJames Bottomley
authored andcommitted
[SCSI] target: Add LIO target core v4.0.0-rc6
LIO target is a full featured in-kernel target framework with the following feature set: High-performance, non-blocking, multithreaded architecture with SIMD support. Advanced SCSI feature set: * Persistent Reservations (PRs) * Asymmetric Logical Unit Assignment (ALUA) * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S) * Full Error Recovery (ERL=0,1,2) * Active/active task migration and session continuation (ERL=2) * Thin LUN provisioning (UNMAP and WRITE_SAMExx) Multiprotocol target plugins Storage media independence: * Virtualization of all storage media; transparent mapping of IO to LUNs * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc. Standards compliance: * Full compliance with IETF (RFC 3720) * Full implementation of SPC-4 PRs and ALUA Significant code cleanups done by Christoph Hellwig. [jejb: fix up for new block bdev exclusive interface. Minor fixes from Randy Dunlap and Dan Carpenter.] Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
1 parent f4013c3 commit c66ac9d

44 files changed

Lines changed: 30521 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/target/tcm_mod_builder.py‎

Lines changed: 1094 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
>>>>>>>>>> The TCM v4 fabric module script generator <<<<<<<<<<
2+
3+
Greetings all,
4+
5+
This document is intended to be a mini-HOWTO for using the tcm_mod_builder.py
6+
script to generate a brand new functional TCM v4 fabric .ko module of your very own,
7+
that once built can be immediately be loaded to start access the new TCM/ConfigFS
8+
fabric skeleton, by simply using:
9+
10+
modprobe $TCM_NEW_MOD
11+
mkdir -p /sys/kernel/config/target/$TCM_NEW_MOD
12+
13+
This script will create a new drivers/target/$TCM_NEW_MOD/, and will do the following
14+
15+
*) Generate new API callers for drivers/target/target_core_fabric_configs.c logic
16+
->make_nodeacl(), ->drop_nodeacl(), ->make_tpg(), ->drop_tpg()
17+
->make_wwn(), ->drop_wwn(). These are created into $TCM_NEW_MOD/$TCM_NEW_MOD_configfs.c
18+
*) Generate basic infrastructure for loading/unloading LKMs and TCM/ConfigFS fabric module
19+
using a skeleton struct target_core_fabric_ops API template.
20+
*) Based on user defined T10 Proto_Ident for the new fabric module being built,
21+
the TransportID / Initiator and Target WWPN related handlers for
22+
SPC-3 persistent reservation are automatically generated in $TCM_NEW_MOD/$TCM_NEW_MOD_fabric.c
23+
using drivers/target/target_core_fabric_lib.c logic.
24+
*) NOP API calls for all other Data I/O path and fabric dependent attribute logic
25+
in $TCM_NEW_MOD/$TCM_NEW_MOD_fabric.c
26+
27+
tcm_mod_builder.py depends upon the mandatory '-p $PROTO_IDENT' and '-m
28+
$FABRIC_MOD_name' parameters, and actually running the script looks like:
29+
30+
target:/mnt/sdb/lio-core-2.6.git/Documentation/target# python tcm_mod_builder.py -p iSCSI -m tcm_nab5000
31+
tcm_dir: /mnt/sdb/lio-core-2.6.git/Documentation/target/../../
32+
Set fabric_mod_name: tcm_nab5000
33+
Set fabric_mod_dir:
34+
/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000
35+
Using proto_ident: iSCSI
36+
Creating fabric_mod_dir:
37+
/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000
38+
Writing file:
39+
/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_base.h
40+
Using tcm_mod_scan_fabric_ops:
41+
/mnt/sdb/lio-core-2.6.git/Documentation/target/../../include/target/target_core_fabric_ops.h
42+
Writing file:
43+
/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_fabric.c
44+
Writing file:
45+
/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_fabric.h
46+
Writing file:
47+
/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_configfs.c
48+
Writing file:
49+
/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/Kbuild
50+
Writing file:
51+
/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/Kconfig
52+
Would you like to add tcm_nab5000to drivers/target/Kbuild..? [yes,no]: yes
53+
Would you like to add tcm_nab5000to drivers/target/Kconfig..? [yes,no]: yes
54+
55+
At the end of tcm_mod_builder.py. the script will ask to add the following
56+
line to drivers/target/Kbuild:
57+
58+
obj-$(CONFIG_TCM_NAB5000) += tcm_nab5000/
59+
60+
and the same for drivers/target/Kconfig:
61+
62+
source "drivers/target/tcm_nab5000/Kconfig"
63+
64+
*) Run 'make menuconfig' and select the new CONFIG_TCM_NAB5000 item:
65+
66+
<M> TCM_NAB5000 fabric module
67+
68+
*) Build using 'make modules', once completed you will have:
69+
70+
target:/mnt/sdb/lio-core-2.6.git# ls -la drivers/target/tcm_nab5000/
71+
total 1348
72+
drwxr-xr-x 2 root root 4096 2010-10-05 03:23 .
73+
drwxr-xr-x 9 root root 4096 2010-10-05 03:22 ..
74+
-rw-r--r-- 1 root root 282 2010-10-05 03:22 Kbuild
75+
-rw-r--r-- 1 root root 171 2010-10-05 03:22 Kconfig
76+
-rw-r--r-- 1 root root 49 2010-10-05 03:23 modules.order
77+
-rw-r--r-- 1 root root 738 2010-10-05 03:22 tcm_nab5000_base.h
78+
-rw-r--r-- 1 root root 9096 2010-10-05 03:22 tcm_nab5000_configfs.c
79+
-rw-r--r-- 1 root root 191200 2010-10-05 03:23 tcm_nab5000_configfs.o
80+
-rw-r--r-- 1 root root 40504 2010-10-05 03:23 .tcm_nab5000_configfs.o.cmd
81+
-rw-r--r-- 1 root root 5414 2010-10-05 03:22 tcm_nab5000_fabric.c
82+
-rw-r--r-- 1 root root 2016 2010-10-05 03:22 tcm_nab5000_fabric.h
83+
-rw-r--r-- 1 root root 190932 2010-10-05 03:23 tcm_nab5000_fabric.o
84+
-rw-r--r-- 1 root root 40713 2010-10-05 03:23 .tcm_nab5000_fabric.o.cmd
85+
-rw-r--r-- 1 root root 401861 2010-10-05 03:23 tcm_nab5000.ko
86+
-rw-r--r-- 1 root root 265 2010-10-05 03:23 .tcm_nab5000.ko.cmd
87+
-rw-r--r-- 1 root root 459 2010-10-05 03:23 tcm_nab5000.mod.c
88+
-rw-r--r-- 1 root root 23896 2010-10-05 03:23 tcm_nab5000.mod.o
89+
-rw-r--r-- 1 root root 22655 2010-10-05 03:23 .tcm_nab5000.mod.o.cmd
90+
-rw-r--r-- 1 root root 379022 2010-10-05 03:23 tcm_nab5000.o
91+
-rw-r--r-- 1 root root 211 2010-10-05 03:23 .tcm_nab5000.o.cmd
92+
93+
*) Load the new module, create a lun_0 configfs group, and add new TCM Core
94+
IBLOCK backstore symlink to port:
95+
96+
target:/mnt/sdb/lio-core-2.6.git# insmod drivers/target/tcm_nab5000.ko
97+
target:/mnt/sdb/lio-core-2.6.git# mkdir -p /sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0
98+
target:/mnt/sdb/lio-core-2.6.git# cd /sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0/
99+
target:/sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0# ln -s /sys/kernel/config/target/core/iblock_0/lvm_test0 nab5000_port
100+
101+
target:/sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0# cd -
102+
target:/mnt/sdb/lio-core-2.6.git# tree /sys/kernel/config/target/nab5000/
103+
/sys/kernel/config/target/nab5000/
104+
|-- discovery_auth
105+
|-- iqn.foo
106+
| `-- tpgt_1
107+
| |-- acls
108+
| |-- attrib
109+
| |-- lun
110+
| | `-- lun_0
111+
| | |-- alua_tg_pt_gp
112+
| | |-- alua_tg_pt_offline
113+
| | |-- alua_tg_pt_status
114+
| | |-- alua_tg_pt_write_md
115+
| | `-- nab5000_port -> ../../../../../../target/core/iblock_0/lvm_test0
116+
| |-- np
117+
| `-- param
118+
`-- version
119+
120+
target:/mnt/sdb/lio-core-2.6.git# lsmod
121+
Module Size Used by
122+
tcm_nab5000 3935 4
123+
iscsi_target_mod 193211 0
124+
target_core_stgt 8090 0
125+
target_core_pscsi 11122 1
126+
target_core_file 9172 2
127+
target_core_iblock 9280 1
128+
target_core_mod 228575 31
129+
tcm_nab5000,iscsi_target_mod,target_core_stgt,target_core_pscsi,target_core_file,target_core_iblock
130+
libfc 73681 0
131+
scsi_debug 56265 0
132+
scsi_tgt 8666 1 target_core_stgt
133+
configfs 20644 2 target_core_mod
134+
135+
----------------------------------------------------------------------
136+
137+
Future TODO items:
138+
139+
*) Add more T10 proto_idents
140+
*) Make tcm_mod_dump_fabric_ops() smarter and generate function pointer
141+
defs directly from include/target/target_core_fabric_ops.h:struct target_core_fabric_ops
142+
structure members.
143+
144+
October 5th, 2010
145+
Nicholas A. Bellinger <nab@linux-iscsi.org>

‎drivers/Kconfig‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ source "drivers/ata/Kconfig"
2626

2727
source "drivers/md/Kconfig"
2828

29+
source "drivers/target/Kconfig"
30+
2931
source "drivers/message/fusion/Kconfig"
3032

3133
source "drivers/firewire/Kconfig"

‎drivers/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ obj-y += macintosh/
4646
obj-$(CONFIG_IDE) += ide/
4747
obj-$(CONFIG_SCSI) += scsi/
4848
obj-$(CONFIG_ATA) += ata/
49+
obj-$(CONFIG_TARGET_CORE) += target/
4950
obj-$(CONFIG_MTD) += mtd/
5051
obj-$(CONFIG_SPI) += spi/
5152
obj-y += net/

‎drivers/target/Kconfig‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
menuconfig TARGET_CORE
3+
tristate "Generic Target Core Mod (TCM) and ConfigFS Infrastructure"
4+
depends on SCSI && BLOCK
5+
select CONFIGFS_FS
6+
default n
7+
help
8+
Say Y or M here to enable the TCM Storage Engine and ConfigFS enabled
9+
control path for target_core_mod. This includes built-in TCM RAMDISK
10+
subsystem logic for virtual LUN 0 access
11+
12+
if TARGET_CORE
13+
14+
config TCM_IBLOCK
15+
tristate "TCM/IBLOCK Subsystem Plugin for Linux/BLOCK"
16+
help
17+
Say Y here to enable the TCM/IBLOCK subsystem plugin for non-buffered
18+
access to Linux/Block devices using BIO
19+
20+
config TCM_FILEIO
21+
tristate "TCM/FILEIO Subsystem Plugin for Linux/VFS"
22+
help
23+
Say Y here to enable the TCM/FILEIO subsystem plugin for buffered
24+
access to Linux/VFS struct file or struct block_device
25+
26+
config TCM_PSCSI
27+
tristate "TCM/pSCSI Subsystem Plugin for Linux/SCSI"
28+
help
29+
Say Y here to enable the TCM/pSCSI subsystem plugin for non-buffered
30+
passthrough access to Linux/SCSI device
31+
32+
endif

‎drivers/target/Makefile‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
EXTRA_CFLAGS += -I$(srctree)/drivers/target/ -I$(srctree)/drivers/scsi/
2+
3+
target_core_mod-y := target_core_configfs.o \
4+
target_core_device.o \
5+
target_core_fabric_configfs.o \
6+
target_core_fabric_lib.o \
7+
target_core_hba.o \
8+
target_core_pr.o \
9+
target_core_alua.o \
10+
target_core_scdb.o \
11+
target_core_tmr.o \
12+
target_core_tpg.o \
13+
target_core_transport.o \
14+
target_core_cdb.o \
15+
target_core_ua.o \
16+
target_core_rd.o \
17+
target_core_mib.o
18+
19+
obj-$(CONFIG_TARGET_CORE) += target_core_mod.o
20+
21+
# Subsystem modules
22+
obj-$(CONFIG_TCM_IBLOCK) += target_core_iblock.o
23+
obj-$(CONFIG_TCM_FILEIO) += target_core_file.o
24+
obj-$(CONFIG_TCM_PSCSI) += target_core_pscsi.o

0 commit comments

Comments
 (0)