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>,
linux-kernel <linux-kernel@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 3/3] [tgt]: Add BSG v4 backstore support to usr/bs_sg.c
Date: Mon, 07 Jun 2010 12:27:37 +0300 [thread overview]
Message-ID: <4C0CBB89.9000209@panasas.com> (raw)
In-Reply-To: <1275901324.26888.56.camel@haakon2.linux-iscsi.org>
On 06/07/2010 12:02 PM, Nicholas A. Bellinger wrote:
> On Mon, 2010-06-07 at 11:40 +0300, Boaz Harrosh wrote:
>> On 06/07/2010 06:50 AM, Nicholas A. Bellinger wrote:
>>> From: Nicholas Bellinger <nab@linux-iscsi.org>
>>>
>>> This patch adds initial support for the block layer implementation of the sg v4 interface
>>> (BSG) -> STGT with a new struct backingstore_template bsg_bst sharing code with the
>>> original sg_bst. It adds for new function bs_bsg_cmd_submit() for incoming write I/O
>>> and bs_bsg_cmd_complete() for polling read I/O using include/linux/bsg.h:struct sg_io_v4.
>>>
>>> This patch also splits up bs_sg_open() to support both BSG and SG looking for the
>>> path "/dev/bsg" in bs_sg_open(), and getting max_queue using SG_GET_COMMAND_Q and
>>> calling SG_SET_RESERVED_SIZE (following the original bs_sg code in init_sg_device)
>>>
>>> Also chk_bsg_device() currently using a hardcoded 254 major as def for BSG does not
>>> appear in include/linux/major.h just yet..
>>>
>>> So far this has been tested with STGT/iSCSI <-> BSG <-> TCM_Loop SPC-4 iSCSI Target
>>> Port emulation and is able to mkfs, fsck and mount a filesystem from a TCM/IBLOCK
>>> Linux LVM kernel level backstore
>>>
>>> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
>>> ---
>>> usr/bs_sg.c | 178 +++++++++++++++++++++++++++++++++++++++++++++++++++---
>>> usr/scsi_cmnd.h | 7 ++
>>> 2 files changed, 175 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/usr/bs_sg.c b/usr/bs_sg.c
>>> index 23676ef..d071714 100644
>>> --- a/usr/bs_sg.c
>>> +++ b/usr/bs_sg.c
>
> <SNIP>
>
>>> +
>>> +static int bs_bsg_cmd_submit(struct scsi_cmd *cmd)
>>> +{
>>> + struct scsi_lu *dev = cmd->dev;
>>> + int fd = dev->fd;
>>> + struct sg_io_v4 *io_hdr = &cmd->cmd_bsg_hdr;
>>> + int err = 0;
>>> + /*
>>> + * Following linux/include/linux/bsg.h
>>> + */
>>> + /* [i] 'Q' to differentiate from v3 */
>>> + io_hdr->guard = 'Q';
>>> + io_hdr->protocol = BSG_PROTOCOL_SCSI;
>>> + io_hdr->subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD;
>>> + io_hdr->request_len = cmd->scb_len;
>>> + io_hdr->request = (unsigned long )cmd->scb;
>>> +
>>> + if (scsi_get_data_dir(cmd) == DATA_WRITE) {
>>
>> Why the if? both sides are fully bidi just remove the ifs
>> and: OUT <= OUT, IN <= IN
>>
>
> Whoops, thanks for pointing this one out (again). Tested with
> unidirection commands and included into my local tgt.git/pass that I
> will send along to Tomo-san..
>
> Btw, I still need to sort out BIDI support for TCM_Loop at some point in
> the not too distant future. What would be a good way to generate BIDI
> traffic into STGT or a local SCSI LLD..?
>
> Best,
>
> --nab
>
scsi_debug has some emulation for XOR commands, does that help?
Boaz
next prev parent reply other threads:[~2010-06-07 9:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-07 3:50 [PATCH 3/3] [tgt]: Add BSG v4 backstore support to usr/bs_sg.c Nicholas A. Bellinger
2010-06-07 8:40 ` Boaz Harrosh
2010-06-07 9:02 ` Nicholas A. Bellinger
2010-06-07 9:27 ` Boaz Harrosh [this message]
2010-06-07 9:37 ` Nicholas A. Bellinger
2010-06-07 10:35 ` Boaz Harrosh
2010-06-07 11:07 ` Nicholas A. Bellinger
2010-06-07 11:24 ` Boaz Harrosh
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=4C0CBB89.9000209@panasas.com \
--to=bharrosh@panasas.com \
--cc=James.Bottomley@suse.de \
--cc=dgilbert@interlog.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).