All of lore.kernel.org
 help / color / mirror / Atom feed
* zero block writes
@ 2003-10-14 19:48 Pat LaVarre
  2003-10-14 22:34 ` Douglas Gilbert
  2003-10-14 22:43 ` Pat LaVarre
  0 siblings, 2 replies; 6+ messages in thread
From: Pat LaVarre @ 2003-10-14 19:48 UTC (permalink / raw)
  To: linux-scsi

$
$ sg_dd of=/dev/sg0 if=/dev/null bs=2k count=1
0+0 records in
0+0 records out
$

cdb trace tells me this sg utils idiom assaults the device with a zero
block write, specifically:

...
usb-storage: Command WRITE_10 (10 bytes)
usb-storage:  2a 00 00 00 00 00 00 00 00 00
usb-storage: Bulk command S 0x43425355 T 0x1e Trg 0 LUN 0 L 0 F 0 CL 10
...

I wonder if any of you find this sg utils factoid ineffably interesting,
as I do?

I know I have a personal history of pain with the scsi folk who dispute
the t10 claim that the cdb x 0A 00:00:00 00 00 means write out x100
blocks rather than zero and/or while yet that the cdb x 2A 00
00:00:00:00 00 00:00 00 does mean write out zero blocks.

I know I explicitly wrote code into a revision, at a time beyond the
original release of pldd, to discard writes of zero bytes quietly,
rather than passing them thru to the device.

I know such pass thru's trip over such unit attentions as x 6 29 reset.

Pat LaVarre



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: zero block writes
  2003-10-14 19:48 zero block writes Pat LaVarre
@ 2003-10-14 22:34 ` Douglas Gilbert
  2003-10-14 23:18   ` Pat LaVarre
  2003-10-20 22:46   ` Pat LaVarre
  2003-10-14 22:43 ` Pat LaVarre
  1 sibling, 2 replies; 6+ messages in thread
From: Douglas Gilbert @ 2003-10-14 22:34 UTC (permalink / raw)
  To: Pat LaVarre; +Cc: linux-scsi

Pat LaVarre wrote:
> $
> $ sg_dd of=/dev/sg0 if=/dev/null bs=2k count=1
> 0+0 records in
> 0+0 records out
> $
> 
> cdb trace tells me this sg utils idiom assaults the device with a zero
> block write, specifically:
> 
> ...
> usb-storage: Command WRITE_10 (10 bytes)
> usb-storage:  2a 00 00 00 00 00 00 00 00 00
> usb-storage: Bulk command S 0x43425355 T 0x1e Trg 0 LUN 0 L 0 F 0 CL 10
> ...
> 
> I wonder if any of you find this sg utils factoid ineffably interesting,
> as I do?

Pat,
I find some bugs "interesting". BTW if "if=/dev/zero"
is used the result is more sane :-)

Also when I tested this on scsi_debug, it complained
about getting a NULL data buffer pointer.

> I know I have a personal history of pain with the scsi folk who dispute
> the t10 claim that the cdb x 0A 00:00:00 00 00 means write out x100
> blocks rather than zero and/or while yet that the cdb x 2A 00
> 00:00:00:00 00 00:00 00 does mean write out zero blocks.
> 
> I know I explicitly wrote code into a revision, at a time beyond the
> original release of pldd, to discard writes of zero bytes quietly,
> rather than passing them thru to the device.
> 
> I know such pass thru's trip over such unit attentions as x 6 29 reset.

A new beta (1.05) should be out tomorrow that fixes this
(I just put one up about 1 hour ago).

Doug Gilbert



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: zero block writes
  2003-10-14 19:48 zero block writes Pat LaVarre
  2003-10-14 22:34 ` Douglas Gilbert
@ 2003-10-14 22:43 ` Pat LaVarre
  1 sibling, 0 replies; 6+ messages in thread
From: Pat LaVarre @ 2003-10-14 22:43 UTC (permalink / raw)
  To: linux-scsi

> $
> $ sg_dd of=/dev/sg0 if=/dev/null bs=2k count=1
> 0+0 records in
> 0+0 records out
> $
> ...
> usb-storage:  2a 00 00 00 00 00 00 00 00 00

Kindly offline I'm told I neglected to emphasise, that example of an sg
utils sg_dd if=/dev/null command line differs only subtly from the
perhaps more familiar:

sg_dd of=/dev/sg0 if=/dev/zero bs=2k count=1

Copying from /dev/zero by design writes lots of zeroed bytes.

Copying from /dev/null via sg_dd doesn't neglect to write, in fact it
does write, it just tries to write nothing at a specific address.

Consider, for example:

sg_dd of=/dev/sg0 if=/dev/zero bs=2k seek=259 count=1

That changes the cdb trace so that the starting address passed thru as
cdb bytes[2:3:4:5] become x 00:00:01:03 rather than x 00:00:00:00:

x 2A 00 00 00 01 03 00 00 01 00

Pat LaVarre

P.S. Yes indeed I did stumble into this to-me-surprising fact via the
bonehead newbie error of typing "null" where I meant  "zero".



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: zero block writes
  2003-10-14 22:34 ` Douglas Gilbert
@ 2003-10-14 23:18   ` Pat LaVarre
  2003-10-20 17:55     ` Pat LaVarre
  2003-10-20 22:46   ` Pat LaVarre
  1 sibling, 1 reply; 6+ messages in thread
From: Pat LaVarre @ 2003-10-14 23:18 UTC (permalink / raw)
  To: dougg; +Cc: linux-scsi

> Also when I tested this on scsi_debug, it complained
> about getting a NULL data buffer pointer.

CONFIG_SCSI_DEBUG option of .config was new to me, thanks.

> > $ sg_dd of=/dev/sg0 if=/dev/null bs=2k count=1
> > ...
> > usb-storage: Command WRITE_10 (10 bytes)
> ...
> bugs ...

Is this a bug?

Because CONFIG_SCSI_DEBUG complains of NULL pointers?

What patch do you like?  No command at all?  A zeroed command with no
NULL pointers?

I vote for the patch of no command at all because for me sg_dd exists to
let me read and write fragments longer than I can conveniently in the
single cdb of a single SG_IO.  For me sg_dd doesn't exist to pass thru
creative variations of SG_IO.  Ditto for you?

I'm guessing I have a clue what round means near hear because to get
that clue I reinvented the sg_dd wheel myself.  In my pldd I included a
-v option to give me a cdb trace without reconfiguring the kernel to run
slow, so there I noticed this issue more quickly.

> A new beta (1.05) ... tomorrow ...
> one up about 1 hour ago).

Highly responsive, thank you.

I do enjoy perusing the links to the sg home page i.e.
http://www.google.com/search?q=link:www.torque.net/sg/

A google mystery of this moment is why google doesn't yet know that the
page where I discuss my reinvented sg_dd indeed does link to sg utils,

I can prove Google has my page cached.  The search:
http://www.google.com/search?q=LaVarre+pldd
finds:
http://members.aol.com/plscsi/tools/pldd/

Yet seemingly Google hasn't yet parsed all the links from pldd.

Pat LaVarre



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: zero block writes
  2003-10-14 23:18   ` Pat LaVarre
@ 2003-10-20 17:55     ` Pat LaVarre
  0 siblings, 0 replies; 6+ messages in thread
From: Pat LaVarre @ 2003-10-20 17:55 UTC (permalink / raw)
  To: dougg; +Cc: linux-scsi

> > From: dougg@torque.net ...
> >
> > Also when I tested this on scsi_debug, it complained
> > about getting a NULL data buffer pointer.
> 
> CONFIG_SCSI_DEBUG option of .config ...

I continue to see "scsi_debug" here might mean CONFIG_SCSI_DEBUG.  But
in review later also I noticed the keyword "scsi_debug" appears nearby
in Google in the context:

Linux too has virtual SCSI devices.

For Linux 2.4:
http://www.torque.net/sg/sdebug.html

For Linux 2.6 since 2003 Oct 8:
http://www.torque.net/sg/sdebug26.html

Whether it is the virtual scsi_debug device or the CONFIG_SCSI_DEBUG
that complains of NULL data buffer pointers for us, I do not yet know.

Pat LaVarre



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: zero block writes
  2003-10-14 22:34 ` Douglas Gilbert
  2003-10-14 23:18   ` Pat LaVarre
@ 2003-10-20 22:46   ` Pat LaVarre
  1 sibling, 0 replies; 6+ messages in thread
From: Pat LaVarre @ 2003-10-20 22:46 UTC (permalink / raw)
  To: dougg; +Cc: linux-scsi

> > $ sg_dd of=/dev/sg0 if=/dev/null bs=2k count=1
> > 0+0 records in
> > 0+0 records out
> > $
> > 
> > cdb trace tells me this sg utils idiom assaults the device with a zero
> > block write, specifically:
> > ...
> > usb-storage: Command WRITE_10 (10 bytes)
> > usb-storage:  2a 00 00 00 00 00 00 00 00 00
> > ...
>
> A new beta (1.05) should be out tomorrow that fixes this
> (I just put one up about 1 hour ago).

Looks good, thank you.  Again I tried contrasting:

sg_dd of=/dev/sg0 if=/dev/zero bs=2k count=1
sg_dd of=/dev/sg0 if=/dev/null bs=2k count=1

I'm pleased to report the sg3_utils-1.05.tar.gz I fetched today passes
cdb's thru drivers/usb/storage/usb.usb_stor_show_command only from
/dev/zero, not from /dev/null.

Pat LaVarre



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-10-20 22:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-14 19:48 zero block writes Pat LaVarre
2003-10-14 22:34 ` Douglas Gilbert
2003-10-14 23:18   ` Pat LaVarre
2003-10-20 17:55     ` Pat LaVarre
2003-10-20 22:46   ` Pat LaVarre
2003-10-14 22:43 ` Pat LaVarre

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.