From: Boaz Harrosh <bharrosh@panasas.com>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: stgt-devel <stgt@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Mike Christie <michaelc@cs.wisc.edu>,
James Bottomley <James.Bottomley@suse.de>,
Douglas Gilbert <dgilbert@interlog.com>
Subject: Re: [PATCH 2/2] [tgt]: Add support for SG_IO CDB passthrough in scsi_cmd_perform()
Date: Sun, 30 May 2010 12:02:35 +0300 [thread overview]
Message-ID: <4C0229AB.1090506@panasas.com> (raw)
In-Reply-To: <1274159589-6095-1-git-send-email-nab@linux-iscsi.org>
On 05/18/2010 08:13 AM, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
>
> This patch changes usr/scsi.c:scsi_cmd_perform() to first check to see if
> the struct backingstore_template->bs_passthrough=1 for SG_IO, then
> check for a valid struct device_type_template->cmd_passthrough()
> function pointer to determine if the device supports SG_IO.
>
> This patch then updates the device_type in usr/sb.c to enable the functionality
> for TYPE_DISK.
>
> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
> ---
> usr/sbc.c | 1 +
> usr/scsi.c | 11 +++++++++++
> usr/tgtd.h | 1 +
> 3 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/usr/sbc.c b/usr/sbc.c
> index a048d53..d53f7f9 100644
> --- a/usr/sbc.c
> +++ b/usr/sbc.c
> @@ -269,6 +269,7 @@ static struct device_type_template sbc_template = {
> .lu_online = spc_lu_online,
> .lu_offline = spc_lu_offline,
> .lu_exit = spc_lu_exit,
> + .cmd_passthrough = sbc_rw,
> .ops = {
> {spc_test_unit,},
> {spc_illegal_op,},
> diff --git a/usr/scsi.c b/usr/scsi.c
> index cef231b..1db786e 100644
> --- a/usr/scsi.c
> +++ b/usr/scsi.c
> @@ -242,6 +242,17 @@ int scsi_cmd_perform(int host_no, struct scsi_cmd *cmd)
>
> if (spc_access_check(cmd))
> return SAM_STAT_RESERVATION_CONFLICT;
> + /*
> + * Use dev_type_template->cmd_passthrough() for usr/bs_sg.c devices
> + */
> + if (cmd->dev->bst->bs_passthrough) {
> + if (!(cmd->dev->dev_type_template.cmd_passthrough)) {
> + eprintf("cmd->dev->dev_type_template.cmd_passthrough()"
> + " is NULL!\n");
> + return SAM_STAT_CHECK_CONDITION;
> + }
> + return cmd->dev->dev_type_template.cmd_passthrough(host_no, cmd);
> + }
>
Can't you just perform this check once somewhere and set cmd_perform to the
new cmd_passthrough? why check for every command?
This is not accepted it is the hot path.
> return cmd->dev->dev_type_template.ops[op].cmd_perform(host_no, cmd);
> }
> diff --git a/usr/tgtd.h b/usr/tgtd.h
> index 4f26a29..f8ee47f 100644
> --- a/usr/tgtd.h
> +++ b/usr/tgtd.h
> @@ -108,6 +108,7 @@ struct device_type_template {
> int (*lu_config)(struct scsi_lu *lu, char *args);
> int (*lu_online)(struct scsi_lu *lu);
> int (*lu_offline)(struct scsi_lu *lu);
> + int (*cmd_passthrough)(int, struct scsi_cmd *);
>
Actually you can do more:
If you leave the checking and decisions to the target driver
then you don't need to touch this file. Just let the device_type
decide which vector to set once it knows what target is used.
(Like start with a vector that check and sets the vector to
the passthrough or the regular path, on first IO)
> struct device_type_operations ops[256];
>
Boaz
next prev parent reply other threads:[~2010-05-30 9:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-18 5:13 [PATCH 2/2] [tgt]: Add support for SG_IO CDB passthrough in scsi_cmd_perform() Nicholas A. Bellinger
2010-05-30 9:02 ` Boaz Harrosh [this message]
2010-05-31 2:20 ` Nicholas A. Bellinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C0229AB.1090506@panasas.com \
--to=bharrosh@panasas.com \
--cc=James.Bottomley@suse.de \
--cc=dgilbert@interlog.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
--cc=nab@linux-iscsi.org \
--cc=stgt@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.