WRITE_AND_VERIFY doubt

Flavio Junior billpp at gmail.com
Fri May 8 15:59:12 PDT 2009


Formatted message: <a href="http://www.t10.org/cgi-bin/ac.pl?t=r&f=r0905088_f.htm">HTML-formatted message</a>

On Fri, May 8, 2009 at 1:40 PM, Knight, Frederick <
Frederick.Knight at netapp.com> wrote:
>  Why don't you just look at the read only bit?  Does the IBM ds4700 not
> report the read only bit for a read only device?  It's the WP bit in the
> mode page header.  Just use MODE SENSE on your favorite mode page to check
> it.
>
Yes Frederick, this seems to work, at least with some good code, as
sg3_utils can show:
* Querying to a secundary device:
[root at cerebro src]# sg_modes /dev/sdb
    IBM       VirtualDisk	0916   peripheral_type: disk [0x0]
mode sense (10):  Fixed format, current;  Sense key: Data Protect
 Additional sense: Write protected
[root at cerebro src]# echo $?
99
* Querying to a primary device:
[root at cerebro src]# sg_modes /dev/sdf
    IBM       VirtualDisk	0916   peripheral_type: disk [0x0]
Mode parameter header from MODE SENSE(10):
  Mode data length=242, medium type=0x00, WP=0, DpoFua=1, longlba=0
  Block descriptor length=8
> Direct access device block descriptors:
   Density code=0x0
 00	00 00 00 00 00 00 02 00
[root at cerebro src]# echo $?
0
The problem now is write something to handle with mode page. I'm looking at
sg3_modes.c code but this is a bit complex to me.
Does you have something more easy/clear to help me? The
"SCSI-Programming-HOWTO" is not helping so much.
Thanks again.
--
Flávio do Carmo Júnior
Florianopolis/SC, Brasil
>
> And no, there isn't any "reserved" space you can write to and be safe.
> Another choice would be ORWRITE (and don't "or" in any bits), or XDWRITE
> (and don't "xor" in any bits).  These would all be ways to "write" without
> changing the data in the LBA (although it is possible the device could
> optimize the write step into nothingness).
>
>     Fred Knight
>
>  ------------------------------
> *From:* Flavio Junior [mailto:billpp at gmail.com]
> *Sent:* Friday, May 08, 2009 11:52 AM
> *To:* t10 at t10.org
> *Subject:* WRITE_AND_VERIFY doubt
>
> Hi folks, afternoon.
>
> I've a tad doubt when writing a simple code to sends a WRITE_AND_VERIFY
> (0x2E) command to a scsi device.
>
> I need to do it to decide if this is a primary (and read-write) storage or
> a secundary (and read-only) storage (ibm ds4700), and adjust my I/O
> MultiPath priority accordingly, and i need to run it periodically to check
> if the roles change.
>
> My doubt is, is there a area that I cant safety use this command without
> risk to corrupt the data on disk? I'm not a really developer, just make
some
> researches and read some codes to assembly my own, here is the code:
> http://pastebin.com/m22b06f04
>
>
> O course, if there is a way more elegant to get this info I'll appreciate
> if someone says me. :)
>
>
> Really thanks in advance and some sorries for english and dumb question.
>
>
> --
>
> Flávio do Carmo Jùnior
> Florianopolis/SC, Brazil
>



More information about the T10 mailing list