Re: [PATCH 1/2] SCSI tape fixes (new version): sense descriptor init, bsf->weof, blkno, debugging

2005-03-15 Thread Kai Makisara
On Tue, 15 Mar 2005, James Bottomley wrote:

> On Sat, 2005-03-12 at 19:04 +0200, Kai Makisara wrote:
> > This is an updated version of the patch I sent March 7. The sense descriptor
> > initialization has been made lighter.
> > 
> > The patch at the end of this message applies to 2.6.11-bk7 + st descriptor 
> > sense
> > patch + st auto eof patch (i.e., st patches currently in scsi-misc-2.6). The
> > patch fixes the following problems:
> 
> I'm afraid this doesn't apply.  It looks like I've got an interim patch
> that's crept in somewhere in the tree.
> 
> Could you take a look at scsi-misc-2.6 (or the patches on www.parisc-
> linux/~jejb/scsi_diffs) and see if you can construct a diff between
> where I currently am and where I should be?
> 
The changelog shows that the patch below is included. It is the previous 
version of the patch in the message with this subject.

# ChangeSet
#   2005/03/15 10:37:07-06:00 [EMAIL PROTECTED] 
#   [PATCH] SCSI tape fixes: sense descriptor init, bsf->weof, blkno,

The patch at the end of this message should take you into the point where 
you can directly apply 2/2 etc. (If you think that the patch below is not 
worth the trouble, you can skip that. The other patches are not touching 
verstr and should then apply with small offset.)

Thanks,
Kai

This patch changes the sense descriptor initialization a little faster.

Signed-off-by: Kai Makisara <[EMAIL PROTECTED]>

--- linux-2.6.11-kk1/drivers/scsi/st.c  2005-03-15 20:55:12.0 +0200
+++ linux-2.6.11-bk7-k2/drivers/scsi/st.c   2005-03-12 13:52:30.0 
+0200
@@ -17,7 +17,7 @@
Last modified: 18-JAN-1998 Richard Gooch <[EMAIL PROTECTED]> Devfs support
  */
 
-static char *verstr = "20050307";
+static char *verstr = "20050312";
 
 #include 
 
@@ -268,10 +268,11 @@ static void st_analyze_sense(struct scsi
const u8 *ucp;
const u8 *sense = SRpnt->sr_sense_buffer;
 
-   memset(s, 0, sizeof(struct st_cmdstatus));
s->have_sense = scsi_request_normalize_sense(SRpnt, &s->sense_hdr);
+   s->flags = 0;
 
if (s->have_sense) {
+   s->deferred = 0;
s->remainder_valid =
scsi_get_sense_info_fld(sense, SCSI_SENSE_BUFFERSIZE, 
&s->uremainder64);
switch (sense[0] & 0x7f) {
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] SCSI tape fixes (new version): sense descriptor init, bsf->weof, blkno, debugging

2005-03-15 Thread James Bottomley
On Sat, 2005-03-12 at 19:04 +0200, Kai Makisara wrote:
> This is an updated version of the patch I sent March 7. The sense descriptor
> initialization has been made lighter.
> 
> The patch at the end of this message applies to 2.6.11-bk7 + st descriptor 
> sense
> patch + st auto eof patch (i.e., st patches currently in scsi-misc-2.6). The
> patch fixes the following problems:

I'm afraid this doesn't apply.  It looks like I've got an interim patch
that's crept in somewhere in the tree.

Could you take a look at scsi-misc-2.6 (or the patches on www.parisc-
linux/~jejb/scsi_diffs) and see if you can construct a diff between
where I currently am and where I should be?

Thanks,

James


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] SCSI tape fixes (new version): sense descriptor init, bsf->weof, blkno, debugging

2005-03-12 Thread Kai Makisara
This is an updated version of the patch I sent March 7. The sense descriptor
initialization has been made lighter.

The patch at the end of this message applies to 2.6.11-bk7 + st descriptor sense
patch + st auto eof patch (i.e., st patches currently in scsi-misc-2.6). The
patch fixes the following problems:

- the sense descriptor fields are properly initialized
- BSF and BSFM are added to the commands causing automatic writing of filemark
  if the previous operation was write (tar expects this)
- the block number is set to unknown (-1) if spacing forward ends at BLANK CHECK
- debugging printout of spacing counts fixed to work also with 64-bit systems

Signed-off-by: Kai Makisara <[EMAIL PROTECTED]>

--- linux-2.6.11-bk7-k1/drivers/scsi/st.c   2005-03-12 13:38:32.0 
+0200
+++ linux-2.6.11-bk7-k2/drivers/scsi/st.c   2005-03-12 13:52:30.0 
+0200
@@ -17,7 +17,7 @@
Last modified: 18-JAN-1998 Richard Gooch <[EMAIL PROTECTED]> Devfs support
  */
 
-static char *verstr = "20050213";
+static char *verstr = "20050312";
 
 #include 
 
@@ -269,8 +269,10 @@ static void st_analyze_sense(struct scsi
const u8 *sense = SRpnt->sr_sense_buffer;
 
s->have_sense = scsi_request_normalize_sense(SRpnt, &s->sense_hdr);
+   s->flags = 0;
 
if (s->have_sense) {
+   s->deferred = 0;
s->remainder_valid =
scsi_get_sense_info_fld(sense, SCSI_SENSE_BUFFERSIZE, 
&s->uremainder64);
switch (sense[0] & 0x7f) {
@@ -287,8 +289,6 @@ static void st_analyze_sense(struct scsi
ucp = scsi_sense_desc_find(sense, 
SCSI_SENSE_BUFFERSIZE, 4);
s->flags = ucp ? (ucp[3] & 0xe0) : 0;
break;
-   default:
-   s->flags = 0;
}
}
 }
@@ -306,7 +306,7 @@ static int st_chk_result(struct scsi_tap
if (!result)
return 0;
 
-   cmdstatp = &STp->buffer->cmdstat;
+   cmdstatp = &STp->buffer->cmdstat;
st_analyze_sense(STp->buffer->last_SRpnt, cmdstatp);
 
if (cmdstatp->have_sense)
@@ -2413,6 +2413,22 @@ static int do_load_unload(struct scsi_ta
return retval;
 }
 
+#if DEBUG
+#define ST_DEB_FORWARD  0
+#define ST_DEB_BACKWARD 1
+static void deb_space_print(char *name, int direction, char *units, unsigned 
char *cmd)
+{
+   s32 sc;
+
+   sc = cmd[2] & 0x80 ? 0xff00 : 0;
+   sc |= (cmd[2] << 16) | (cmd[3] << 8) | cmd[4];
+   if (direction)
+   sc = -sc;
+   printk(ST_DEB_MSG "%s: Spacing tape %s over %d %s.\n", name,
+  direction ? "backward" : "forward", sc, units);
+}
+#endif
+
 
 /* Internal ioctl function */
 static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned 
long arg)
@@ -2451,8 +2467,7 @@ static int st_int_ioctl(struct scsi_tape
cmd[2] = (arg >> 16);
cmd[3] = (arg >> 8);
cmd[4] = arg;
-DEBC(printk(ST_DEB_MSG "%s: Spacing tape forward over %d 
filemarks.\n",
-   name, cmd[2] * 65536 + cmd[3] * 256 + cmd[4]));
+DEBC(deb_space_print(name, ST_DEB_FORWARD, "filemarks", cmd);)
if (fileno >= 0)
fileno += arg;
blkno = 0;
@@ -2467,14 +2482,7 @@ static int st_int_ioctl(struct scsi_tape
cmd[2] = (ltmp >> 16);
cmd[3] = (ltmp >> 8);
cmd[4] = ltmp;
-DEBC(
- if (cmd[2] & 0x80)
-   ltmp = 0xff00;
- ltmp = ltmp | (cmd[2] << 16) | (cmd[3] << 8) | cmd[4];
- printk(ST_DEB_MSG
-"%s: Spacing tape backward over %ld filemarks.\n",
-name, (-ltmp));
-   )
+DEBC(deb_space_print(name, ST_DEB_BACKWARD, "filemarks", cmd);)
if (fileno >= 0)
fileno -= arg;
blkno = (-1);   /* We can't know the block number */
@@ -2486,8 +2494,7 @@ static int st_int_ioctl(struct scsi_tape
cmd[2] = (arg >> 16);
cmd[3] = (arg >> 8);
cmd[4] = arg;
-DEBC(printk(ST_DEB_MSG "%s: Spacing tape forward %d 
blocks.\n", name,
-  cmd[2] * 65536 + cmd[3] * 256 + cmd[4]));
+DEBC(deb_space_print(name, ST_DEB_FORWARD, "blocks", cmd);)
if (blkno >= 0)
blkno += arg;
at_sm &= (arg == 0);
@@ -2499,13 +2506,7 @@ static int st_int_ioctl(struct scsi_tape
cmd[2] = (ltmp >> 16);
cmd[3] = (ltmp >> 8);
cmd[4] = ltmp;
-DEBC(
- if (cmd[2] & 0x80)
-  ltmp = 0xff00;
- ltmp = ltmp | (cmd[2] << 16) | (cmd[3] << 8) | cmd[4];
-