commit af7cfa8329579377ed5d41c0ab3637cf92d8123a tree 9d7b2d14b969e2e4dc694c210806bb74ab81556a parent d9f547cff97e1f199dbcc8e211b496491c84dfb4 author FUJITA Tomonori 1150310606 +0900 committer James Bottomley 1150756637 -0500 [SCSI] target: update for cmnd field removal Kill the tgt code touching data_cmnd, sc->buffer, and sc->bufflen. Signed-off-by: FUJITA Tomonori Signed-off-by: Mike Christie Signed-off-by: James Bottomley -------------------------- commit d9f547cff97e1f199dbcc8e211b496491c84dfb4 tree 31f53e0084404dce04570d1b52f53462c5c00ead parent 0df298d180556450cbe5edf12c1e890f6ac6ea97 author James Bottomley 1149172436 -0500 committer James Bottomley 1149172436 -0500 [SCSI] add lost file drivers/scsi/ibmvscsi/ibmvstgt.c This got dropped from the commit because I had to redo the patch, and git doesn't track files that exist in the tree but not in the repo. Signed-off-by: James Bottomley -------------------------- commit 0df298d180556450cbe5edf12c1e890f6ac6ea97 tree 3f0aabe8f1c18ed46f9f692d7bd3dc544775f6c7 parent c4864e32e2c96300d329e08543e815d634d7799e author James Bottomley 1148175206 -0500 committer James Bottomley 1148175206 -0500 [SCSI] scsi tgt: correct Scsi_Host definition Fix simple compile error Signed-off-by: James Bottomley -------------------------- commit c4864e32e2c96300d329e08543e815d634d7799e tree 8e060c99fe555d1577f6b76e0bd3519acf5ae57b parent 42733440aaf7ad0cff23c1bc53242eef35e058d9 author FUJITA Tomonori 1146293977 +0900 committer James Bottomley 1148140277 -0500 [SCSI] scsi tgt: ibmvstgt driver This is IBM Virtual SCSI target driver for tgt. This patch dependents on the previous patch to convert the ibmvscsi driver to use include/scsi/srp.h. The driver is based on the original ibmvscsis driver: http://lkml.org/lkml/2005/10/17/99 Signed-off-by: FUJITA Tomonori Signed-off-by: Mike Christie Signed-off-by: James Bottomley -------------------------- commit 42733440aaf7ad0cff23c1bc53242eef35e058d9 tree 97f2fe9aec293971526f695c232abb445d1c334d parent 051efd8717e4a7d049fe091e9dacd65ab11ac40b author FUJITA Tomonori 1146293969 +0900 committer James Bottomley 1148140040 -0500 [SCSI] scsi tgt: libsrp libsrp provides helper functions for SRP target drivers. The next step would be to add initiator support to merge the two SRP initiator drivers (ibmvscsi and ib_srp) in mainline. Some SRP target drivers would be out of drivers/scsi/ so I added an entry for libsrp in drivers/scsi/Kconfig, though I'm not sure about it. Signed-off-by: FUJITA Tomonori Signed-off-by: Mike Christie Signed-off-by: James Bottomley -------------------------- commit 051efd8717e4a7d049fe091e9dacd65ab11ac40b tree 3b8e14dcff6b22119ccbdb8653bf235c3abe8cf8 parent b6ad18a75d90adc18c4e724e2b74e33a63b3495e author FUJITA Tomonori 1144633755 +0900 committer James Bottomley 1144959973 -0500 [SCSI] scsi tgt: add NET dependence to Kconfig > From: "Jun'ichi Nomura" : scsi_tgt_if.c depends on CONFIG_NET for using netlink. So it would be nice if the Kconfig entry checks it. Signed-off-by: FUJITA Tomonori Signed-off-by: Mike Christie Signed-off-by: James Bottomley -------------------------- commit b6ad18a75d90adc18c4e724e2b74e33a63b3495e tree c0942440f81bf18c53a2de6e51456bf59c4d238a parent 1b407894be6586a33b96a8a3f7a6ae0807041b92 author FUJITA Tomonori 1144633755 +0900 committer James Bottomley 1144959958 -0500 [SCSI] scsi tgt: add task management function support This patch addes task management function support to tgt. - add callback to task management function to scsi_host_template structure. It is used notify LLDs of the completion of a TMF request. - this patch doesn't use a single queue for TMF requests and SCSI commands yet. We'll work on it later on. - when LLDs queue scsi commands to tgt (scsi_tgt_queue_command), they need to specify unique 'tag' for each command for ABORT_TASK. - when tgt aborts a command, it calls eh_abort_handler in scsi_host_template structure. Would be better to add tgt_eh_abort_handler for LLDs support target and initiator modes at the same time? tgt TMF works in the followings: - When LLDs queue scsi commands to tgt (scsi_tgt_queue_command), they need to specify unique 'tag' for each command. - LLDs call 'int scsi_tgt_tsk_mgmt_request(struct Scsi_Host *host, int, u64 tag, struct scsi_lun *lun, void *data)'. - int (* tsk_mgmt_response)(u64 data, int result) is added to scsi_host_template. When an initiator sends a task management request, the LLD calls scsi_tgt_tsk_mgmt_request. the LLD can use whatever it wants for the data arg. The data arg is used later as the arg in the tsk_mgmt_response callback. tgt core just sends the task management request to user space (by using TGT_KEVENT_TSK_MGMT_REQ). In the case of ABORT_TASK, tgtd finds a single command to abort and sends TGT_UEVENT_CMD_RSP and TGT_UEVENT_TSK_MGMT_RSP events. tgt core calls eh_abort_handler for TGT_UEVENT_CMD_RSP and then tsk_mgmt_response for TGT_UEVENT_TSK_MGMT_RSP. If tgtd fails to find a command to abort, it sends only TGT_UEVENT_TSK_MGMT_RSP event (no TGT_UEVENT_CMD_RSP event). In the case of the rests task management function (like ABORT_TASK_SET), tgt needs to abort multiple commands. Thus, tgtd finds multiple commands to abort and sends multiple TGT_UEVENT_CMD_RSP events and a single TGT_UEVENT_TSK_MGMT_RSP event. tgt core calls eh_abort_handler multiple times and tsk_mgmt_response once. eh_abort_handler enables LLDs to safely free resource related with a command to abort. Signed-off-by: FUJITA Tomonori Signed-off-by: Mike Christie Signed-off-by: James Bottomley -------------------------- commit 1b407894be6586a33b96a8a3f7a6ae0807041b92 tree 6b0a4a7805bf5d6a2a975078847cf0924271aa89 parent ff6a475b45c87196a11e14063a08546f5d3aca20 author FUJITA Tomonori 1144633755 +0900 committer James Bottomley 1144959945 -0500 [SCSI] scsi tgt: replace the elevator code tgt uses the elevator code to send SCSI commands to the user-space daemon (q->request_fn sends netlink packets including commands). This patch replaces the elevator code with a simple list. This is mainly because tgt also needs to send TMF requests to the user-space daemon (the daemon does all the SCSI state machine stuff). tgt must send SCSI commands and TMF requests in an exact order so that it would be preferable to use a single queue (per host) for both. To uses the elevator code for TMF requests, tgt needs to allocate request structures for them. That's wasteful because request structures is useless for TMF requests, which don't perform any I/Os. We basically have a netdev queue of events to send to userspace so by using the request_queue and netdev queue we are basically double queueing and wasting resources and it is affecting performance We like to use shared memory stuff between kernel and user spaces instead of netlink in the future. These queues would go away. Signed-off-by: FUJITA Tomonori Signed-off-by: Mike Christie Signed-off-by: James Bottomley -------------------------- commit ff6a475b45c87196a11e14063a08546f5d3aca20 tree f4c6bda3a38ef09aabf4ffbfe38b2b2e09530471 parent ee190a69e69d21b09e914955aad8ecb21a063c3d author FUJITA Tomonori 1144633754 +0900 committer James Bottomley 1144959929 -0500 [SCSI] scsi tgt: remove blk_queue_end_tag Remove blk_queue_end_tag() in scsi_host_put_command() because tgt doesn't use the elevator code. Signed-off-by: FUJITA Tomonori Signed-off-by: Mike Christie Signed-off-by: James Bottomley -------------------------- commit ee190a69e69d21b09e914955aad8ecb21a063c3d tree b2c5533e6513568a7dd3cef378fd347df33e43a9 parent aa7a9d141599cf31e9a3ca9cd2a17d7b69779a18 author FUJITA Tomonori 1144633754 +0900 committer James Bottomley 1144959910 -0500 [SCSI] scsi tgt: fix double lock in scsi_uspace_request_fn Fix double lock in scsi_uspace_request_fn. Signed-off-by: FUJITA Tomonori Signed-off-by: Mike Christie Signed-off-by: James Bottomley -------------------------- commit aa7a9d141599cf31e9a3ca9cd2a17d7b69779a18 tree 37f5402f9ea68d6acfa1315d261fd3dd4f561e48 parent e0cbd21b79c80ab30a0121aeeec30b95936b85a3 author FUJITA Tomonori 1144633754 +0900 committer James Bottomley 1144959888 -0500 [SCSI] scsi tgt: kernel/user interface changes Simplify the tgt kernel/user interface. - merge the tgt command structure with the the event structure for simplicity. - add a new event type for task management. - remove some of unused event types. - send task attributes to user-space daemon. Signed-off-by: FUJITA Tomonori Signed-off-by: Mike Christie Signed-off-by: James Bottomley -------------------------- commit e0cbd21b79c80ab30a0121aeeec30b95936b85a3 tree a266e3f6ee7b1bff77c8a65d4a109dc2e25db029 parent 1361c1dc6b969b9f954b27bb04f3182a330ec687 author FUJITA Tomonori 1144633754 +0900 committer James Bottomley 1144959632 -0500 [SCSI] block layer: use blk_rq_bio_prep in init_request_from_bio Patch to use blk_rq_bio_prep in init_request_from_bio. And remove blk_rq_bio_prep's flags copying. The first three bits have not been the same for some time so that has been broken. The user of blk_rq_bio_prep will setup the request flags so if it wanted failfast or to be a barrier it will set the correct flag itself. Signed-off-by: FUJITA Tomonori Signed-off-by: Mike Christie Signed-off-by: James Bottomley -------------------------- commit 1361c1dc6b969b9f954b27bb04f3182a330ec687 tree 9233c0c85f0d6682355e2a077d4522a07757ddb6 parent 469765a95699713c891a439e5766b5fe9a8d1e4d author FUJITA Tomonori 1144633754 +0900 committer James Bottomley 1144959613 -0500 [SCSI] scsi tgt: use the original bio_map_user interface Return to the original bio_map_user interface. Signed-off-by: FUJITA Tomonori Signed-off-by: Mike Christie Signed-off-by: James Bottomley -------------------------- commit 469765a95699713c891a439e5766b5fe9a8d1e4d tree 46619d273f1e0586997ac3e7b608727004b91055 parent 2507d72d882fcd01bee1db4cf33c9250af8091a1 author FUJITA Tomonori 1144633753 +0900 committer James Bottomley 1144959596 -0500 [SCSI] block layer: add partial mappings support to bio_map_user This is the updated patch for partial mappings support. - bio_map_user_iov always allows partial mappings. - The two users (blk_rq_map_user and blk_rq_map_user_iov) will fails if the bio is partially mapped. - Added a length argument to blk_rq_map_user_iov in order to avoid including sg.h in ll_rw_blk.c for struct sg_iovec. This is a resend: http://marc.theaimsgroup.com/?l=linux-scsi&m=114086655400806&w=2 Signed-off-by: FUJITA Tomonori Signed-off-by: Mike Christie Signed-off-by: James Bottomley -------------------------- commit 2507d72d882fcd01bee1db4cf33c9250af8091a1 tree 45f072d0dce8f6f8a268722569dbc08b98232573 parent fb9fe0de7bac3f121ab27879450a9e3b150fb760 author FUJITA Tomonori 1144633753 +0900 committer James Bottomley 1144959571 -0500 [SCSI] block layer: revoke the original patch to add partial mappings support For target mode we could end up with the case where we get very large request from the initiator. The request could be so large that we cannot transfer all the data in one operation. For example the HBA's segment or max_sector limits might limit us to a 1 MB transfer. To send a 5 MB command then we need to transfer the command chunk by chunk. To do this, tgt core will map in as much data as possible into a bio, send this off, then when that transfer is completed we send off another request/bio. To be able to pack as much data into a bio as possible we need bio_map_user to support partially mapped bios. Following the comments from Jens on the original patch: http://marc.theaimsgroup.com/?l=linux-scsi&m=114012008928530&w=2 This patch will revoke changes by the original patch. Signed-off-by: FUJITA Tomonori Signed-off-by: Mike Christie Signed-off-by: James Bottomley -------------------------- commit fb9fe0de7bac3f121ab27879450a9e3b150fb760 tree eb8a19d629a749cdb2aa6fb1149fbd111fc780ae parent e046a8bcb393ab0cad254b37a23fc7452bc1c878 author Mike Christie 1140119627 -0600 committer James Bottomley 1141567885 -0600 [SCSI] scsi-ml: Makefile and Kconfig changes for stgt Makefile and Kconfig stuff. Signed-off-by: Mike Christie Signed-off-by: FUJITA Tomonori Signed-off-by: James Bottomley -------------------------- commit e046a8bcb393ab0cad254b37a23fc7452bc1c878 tree da1fa04d4550d50f2fbcc3ee46cced5386d48642 parent 23dc00aa854892679800d84327e82f5abdbd2bcf author Mike Christie 1140119624 -0600 committer James Bottomley 1141567867 -0600 [SCSI] scsi tgt: scsi target netlink interface This patch implments a netlink interface for the scsi tgt framework. I was not sure if code using the netlink interface had to get reviewed by the netdev guys. I am ccing them on this patch and providing a basic review of why/how we want to use netlink. I did not think the netdev people wanted to see the scsi and block layer code, so I am just sending the netlink interface part of this patchset to netdev. I can resend the other parts if needed. The scsi tgt framework, adds support for scsi target mode cards. So instead of using the scsi card in your box as a initiator/host you can use it as a target/server. The reason for the netlink use is becuase the target normally receives a interrupt indicating that a command or event is ready to be processed. The scsi card's driver will then call a scsi lib function which eventually calls scsi_tgt_uspace_send (in this patch below) to tell userspace to begin to process the request (userspace contains the state model). Later userspace will call back into the kernel by sending a netlink msg, and instruct the scsi driver what to do next. When the scsi driver is done executing the operation, it will send a netlink message back to userspace to indicate the success or failure of the operation (using scsi_tgt_uspace_send_status in the patch below). Signed-off-by: Mike Christie Signed-off-by: FUJITA Tomonori Signed-off-by: James Bottomley -------------------------- commit 23dc00aa854892679800d84327e82f5abdbd2bcf tree 812ac5ec496fa42713e11e20943e247eed6cbca2 parent e1b0867bb5841aa02171f72fc04b5b04a0023d32 author Mike Christie 1140119622 -0600 committer James Bottomley 1141567853 -0600 [SCSI] scsi tgt: scsi target lib functionality The core scsi target lib functions. TODO: - mv md/dm-bio-list.h to linux/bio-list.h so md and us do not have to do that weird include. - convert scsi_tgt_cmd's work struct to James's execute code. And try to kill our scsi_tgt_cmd. - add host state checking. We do refcouting so hotplug is partially supported, but we need to add state checking to make it easier on the LLD. - make it so the request_queue can be used to pass around these target messages better (see todo in code), or maybe just remove request_queue usage all together and use our own linked_list or something else. We currently use the queue for tag numbers so if we remove the request_queue we will have to add some sort of host tag list like was suggested for iscsi. We also use the queue to store the HBA limits and build proper sized bios and reqeusts so we would need a shell queue like what dm uses. - eh handling (still in the process of working on proper state model in userspace). - must remove our request->flags hack Signed-off-by: Mike Christie Signed-off-by: FUJITA Tomonori Signed-off-by: James Bottomley -------------------------- commit e1b0867bb5841aa02171f72fc04b5b04a0023d32 tree f18bd4941302b61b603948fa4cdcad4b3ae331b5 parent a3fd43d6d640686a7d74152743aa4915b7416e92 author Mike Christie 1140119620 -0600 committer James Bottomley 1141567837 -0600 [SCSI] block layer: add partial mappings support to bio_map_user For target mode we could end up with the case where we get very large request from the initiator. The request could be so large that we cannot transfer all the data in one operation. For example the HBA's segment or max_sector limits might limit us to a 1 MB transfer. To send a 5 MB command then we need to transfer the command chunk by chunk. To do this, tgt core will map in as much data as possible into a bio, send this off, then when that transfer is completed we send off another request/bio. To be able to pack as much data into a bio as possible we need bio_map_user to support partially mapped bios. The attached patch just adds a new argument to the those functions and if set will not return a failure if the bio is partially mapped. Signed-off-by: Mike Christie Signed-off-by: FUJITA Tomonori Signed-off-by: James Bottomley -------------------------- commit a3fd43d6d640686a7d74152743aa4915b7416e92 tree 49a22ff0d40242b8dbd55a0b2d40a70e1d452536 parent f933212dee6729448f4bbfd8d3f7a110156b1511 author Mike Christie 1140119617 -0600 committer James Bottomley 1141567821 -0600 [SCSI] block layer: kill length alignment test in bin_map_user The tgt project is mapping in bios using bio_map_user. The current targets do not need their len to be aligned with a queue limit so this check is causing some problems. Note: pointers passed into the kernel are properly aligned by usersapace tgt code so the uaddr check in bio_map_user is ok. The major user, blk_bio_map_user checks for the len before mapping so it is not affected by this patch. And the semi-newly added user blk_rq_map_user_iov has been failing out when the len is not aligned properly so maybe people have been good and not sending misaligned lens or that path is not used very often and this change will not be very dangerous. st and sg do not check the length and we have not seen any problem reports from those wider used paths so this patch should be fairly safe - for mm and wider testing at least. Signed-off-by: Mike Christie Signed-off-by: FUJITA Tomonori Signed-off-by: James Bottomley -------------------------- commit f933212dee6729448f4bbfd8d3f7a110156b1511 tree b423e81a4d683a86eb3a203badb24db189ec8a9b parent 501f74f29498543c27f4f9697f5c1e980dd2de0d author Mike Christie 1140119615 -0600 committer James Bottomley 1141567801 -0600 [SCSI] scsi-ml: export scsi-ml functions needed by tgt_scsi_lib and its LLDs This patch contains the needed changes to the scsi-ml to support targets. Note, per the last review we moved almost all the fields we added to the scsi_cmnd to our internal data structure which we are going to try and kill off when we can replace it with support from other parts of the kernel. The one field we left on was the offset variable. This is needed to handle the case where the target gets request that is so large that it cannot execute it in one dma operation. So max_secotors or a segment limit may limit the size of the transfer. In this case our tgt core code will break up the command into managable transfers and send them to the LLD one at a time. The offset is then used to tell the LLD where in the command we are at. Is there another field on the scsi_cmd for that? Signed-off-by: Mike Christie Signed-off-by: FUJITA Tomonori Signed-off-by: James Bottomley --------------------------