[stgt] [PATCH] Handle ILI bit via sg backing store
Mark Harvey
markh794 at gmail.com
Fri Apr 8 23:53:30 CEST 2011
Oops. Sorry, I need to update this. I'll resend with correction of:
s/Illegal/Incorrect/g
Just re-read the SPC-4 and discovered the wording was 'Incorrect' not 'Illegal'.
Thanks
Mark
On Sat, Apr 9, 2011 at 5:49 AM, Mark Harvey <markh794 at gmail.com> wrote:
> From f5bb9b9e7fb635693435de3b23b528f669493731 Mon Sep 17 00:00:00 2001
> From: Mark Harvey<markh794 at gmail.com>
> Date: Sat, 9 Apr 2011 05:46:29 +1000
> Subject: Handle Illegal Length Indicator in sg backing store
>
> If ILI sense bit set, return available data.
>
> Signed-off-by: Mark Harvey<markh794 at gmail.com>
> ---
> usr/bs_sg.c | 10 ++++++++--
> 1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/usr/bs_sg.c b/usr/bs_sg.c
> index 69cce9b..6455210 100644
> --- a/usr/bs_sg.c
> +++ b/usr/bs_sg.c
> @@ -247,6 +247,7 @@ static void bs_sg_cmd_complete(int fd, int events, void
> *data)
> struct sg_io_hdr io_hdr;
> struct scsi_cmd *cmd;
> int err;
> + unsigned resid;
>
> memset(&io_hdr, 0, sizeof(io_hdr));
> io_hdr.interface_id = 'S';
> @@ -261,9 +262,14 @@ static void bs_sg_cmd_complete(int fd, int events, void
> *data)
> scsi_set_out_resid(cmd, io_hdr.resid);
> scsi_set_in_resid(cmd, io_hdr.resid);
> } else {
> + if (io_hdr.sbp[2] == 0x20) /* Illegal Length Indicator set
> */
> + resid = io_hdr.dxfer_len - io_hdr.resid;
> + else
> + resid = 0;
> +
> cmd->sense_len = io_hdr.sb_len_wr;
> - scsi_set_out_resid_by_actual(cmd, 0);
> - scsi_set_in_resid_by_actual(cmd, 0);
> + scsi_set_out_resid_by_actual(cmd, resid);
> + scsi_set_in_resid_by_actual(cmd, resid);
> }
>
> cmd->scsi_cmd_done(cmd, io_hdr.status);
> --
> 1.7.0.4
>
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list