scst: add forwarding pass-through mode

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6805 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2016-02-18 01:27:39 +00:00
parent e8575e85c3
commit e50babee18
6 changed files with 72 additions and 0 deletions
+9
View File
@@ -353,6 +353,15 @@ in/out in Makefile and scst.h:
functionality is working only if dif_mode doesn't contain dev_store
and dif_type is 1.
- CONFIG_SCST_FORWARD_MODE_PASS_THROUGH - if defined, the pass-through
subsystem starts working in the forwarding mode, where reservation
commands processed locally and not passed to the backend SCSI device,
while COMPARE AND WRITE, EXTENDED COPY and RECEIVE COPY RESULTS
commands, which normally processed locally by the SCST core, not
processed locally, but passed to the backend device. Intended to be
used to implement NON-OPTIMIZED ALUA state together with "forwarding"
target attribute on the remote node. Disabled by default for safety.
HIGHMEM kernel configurations are fully supported, but not recommended
for performance reasons, except for scst_user, where they are not
supported, because this module deals with user supplied memory on a
+9
View File
@@ -243,6 +243,15 @@ your favorite kernel configuration Makefile target, e.g. "make xconfig":
functionality is working only if dif_mode doesn't contain dev_store
and dif_type is 1.
- CONFIG_SCST_FORWARD_MODE_PASS_THROUGH - if defined, the pass-through
subsystem starts working in the forwarding mode, where reservation
commands processed locally and not passed to the backend SCSI device,
while COMPARE AND WRITE, EXTENDED COPY and RECEIVE COPY RESULTS
commands, which normally processed locally by the SCST core, not
processed locally, but passed to the backend device. Intended to be
used to implement NON-OPTIMIZED ALUA state together with "forwarding"
target attribute on the remote node. Disabled by default for safety.
HIGHMEM kernel configurations are fully supported, but not recommended
for performance reasons.
+1
View File
@@ -29,6 +29,7 @@
/** See README for description of those conditional defines **/
#define CONFIG_SCST_DIF_INJECT_CORRUPTED_TAGS
/* #define CONFIG_SCST_FORWARD_MODE_PASS_THROUGH */
#include <linux/types.h>
#ifndef INSIDE_KERNEL_TREE
+32
View File
@@ -268,6 +268,20 @@ static int disk_parse(struct scst_cmd *cmd)
goto out;
}
#ifdef CONFIG_SCST_FORWARD_MODE_PASS_THROUGH
if (unlikely(cmd->op_flags & SCST_LOCAL_CMD)) {
switch (cmd->cdb[0]) {
case COMPARE_AND_WRITE:
case EXTENDED_COPY:
case RECEIVE_COPY_RESULTS:
TRACE_DBG("Clearing LOCAL CMD flag for cmd %p "
"(op %s)", cmd, cmd->op_name);
cmd->op_flags &= ~SCST_LOCAL_CMD;
break;
}
}
#endif
cmd->retries = SCST_PASSTHROUGH_RETRIES;
out:
return res;
@@ -398,6 +412,24 @@ static int disk_exec(struct scst_cmd *cmd)
TRACE_ENTRY();
#ifdef CONFIG_SCST_FORWARD_MODE_PASS_THROUGH
if (unlikely(cmd->op_flags & SCST_LOCAL_CMD)) {
switch (cmd->cdb[0]) {
case RESERVE:
case RESERVE_10:
case RELEASE:
case RELEASE_10:
TRACE_DBG("Skipping LOCAL cmd %p (op %s)",
cmd, cmd->op_name);
goto out_done;
case PERSISTENT_RESERVE_IN:
case PERSISTENT_RESERVE_OUT:
sBUG();
break;
}
}
#endif
/*
* For PC requests we are going to submit max_hw_sectors used instead
* of max_sectors.
+19
View File
@@ -1178,6 +1178,17 @@ static int scst_register_device(struct scsi_device *scsidp)
dev->scsi_dev = scsidp;
#ifdef CONFIG_SCST_FORWARD_MODE_PASS_THROUGH
res = scst_pr_set_file_name(dev, NULL, "%s/%s", SCST_PR_DIR,
dev->virt_name);
if (res != 0)
goto out_free_dev;
res = scst_pr_init_dev(dev);
if (res != 0)
goto out_free_dev;
#endif
list_add_tail(&dev->dev_list_entry, &scst_dev_list);
#ifdef CONFIG_SCST_PROC
@@ -1225,6 +1236,10 @@ out_del_locked:
list_del_init(&dev->dev_list_entry);
#endif
#ifdef CONFIG_SCST_FORWARD_MODE_PASS_THROUGH
scst_pr_clear_dev(dev);
#endif
out_free_dev:
scst_free_device(dev);
@@ -1284,6 +1299,10 @@ static void scst_unregister_device(struct scsi_device *scsidp)
list_del_init(&dev->dev_list_entry);
#ifdef CONFIG_SCST_FORWARD_MODE_PASS_THROUGH
scst_pr_clear_dev(dev);
#endif
scst_dg_dev_remove_by_dev(dev);
scst_assign_dev_handler(dev, &scst_null_devtype);
+2
View File
@@ -2959,6 +2959,7 @@ static int scst_persistent_reserve_in_local(struct scst_cmd *cmd)
goto out_done;
}
#ifndef CONFIG_SCST_FORWARD_MODE_PASS_THROUGH
if (dev->scsi_dev != NULL) {
PRINT_WARNING("PR commands for pass-through devices not "
"supported (device %s)", dev->virt_name);
@@ -2966,6 +2967,7 @@ static int scst_persistent_reserve_in_local(struct scst_cmd *cmd)
SCST_LOAD_SENSE(scst_sense_invalid_opcode));
goto out_done;
}
#endif
buffer_size = scst_get_buf_full_sense(cmd, &buffer);
if (unlikely(buffer_size <= 0))