[stgt] [PATCH] Handle ILI bit via sg backing store

Mark Harvey mark_harvey at symantec.com
Sat Apr 9 06:43:12 CEST 2011


Apologies for the attachment.. Outlook just does its own thing no matter what I want.

Basically same patch as before, but replaced Illegal with Invalid.

Cheers
Mark


$ git diff
diff --git a/usr/bs_sg.c b/usr/bs_sg.c
index 69cce9b..a1be14b 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 *dat
        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,15 @@ static void bs_sg_cmd_complete(int fd, int events, void *da
                scsi_set_out_resid(cmd, io_hdr.resid);
                scsi_set_in_resid(cmd, io_hdr.resid);
        } else {
+               /* NO SENSE | ILI (Invalid Length Indicator) set */
+               if (io_hdr.sbp[2] == 0x20)
+                       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);


-----Original Message-----
From: Mark Harvey [mailto:markh794 at gmail.com] 
Sent: Saturday, April 09, 2011 5:50 AM
To: stgt at vger.kernel.org
Cc: Mark Harvey
Subject: [PATCH] Handle ILI bit via sg backing store

 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



-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Handle-ILI-sense-bit-via-sg-backing-store.patch
Type: application/octet-stream
Size: 1334 bytes
Desc: 0001-Handle-ILI-sense-bit-via-sg-backing-store.patch
URL: <http://lists.wpkg.org/pipermail/stgt/attachments/20110408/26950ec5/attachment-0002.obj>


More information about the stgt mailing list