Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Pat LaVarre <p.lavarre@ieee.org>
To: linux-scsi@vger.kernel.org
Subject: Re: zero block writes
Date: 14 Oct 2003 16:43:06 -0600	[thread overview]
Message-ID: <1066171386.3037.9.camel@patehci2> (raw)
In-Reply-To: <1066160907.3501.9.camel@patehci2>

> $
> $ 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".



      parent reply	other threads:[~2003-10-14 22:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=1066171386.3037.9.camel@patehci2 \
    --to=p.lavarre@ieee.org \
    --cc=linux-scsi@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