Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ scsi_disk(7) — HP-UX 9.05

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

scsi(7)

disk(7)

mediainit(1M)

mknod(1M)

scsi_disk(7)

NAME

scsi_disk − SCSI direct access (disk) device driver

DESCRIPTION

This section describes the interface for access of SCSI disk, CD-ROM and optical disk devices through the character special device driver. 

SCSI direct access devices store a sequence of data blocks.  Each direct access device has a specific device size consisting of a number of data blocks and a logical block size.  All data blocks have the same logical block size.  Since I/O operations must have a size that is an integral number of blocks, one logical block size is the smallest possible I/O quantity.  The device block size can be determined through use of the DIOC_DESCRIBE and SIOC_CAPACITY ioctls (see disk(7) and scsi(7)). A direct access device that is not ready for use, whether due to no media installed or another reason, is interpreted to mean the device has zero size. An open() call to such a device succeeds, but subsequent read() and write() calls fail. 

To improve performance, many SCSI disk devices have caches.  These caches can be used for both read and write operations.  Read cache use, called “read ahead”, causes the disk drive to read data in anticipation of read requests.  Read ahead is only apparent to users in the increased performance that it produces.  Write cache use is called “immediate reporting”.  Immediate reporting increases I/O performance by reporting a completed write status before the data being written is actually committed to media.  If the subsequent physical write operation fails to successfully complete, data may be lost.  Physical write failures due to media defects are largely eliminated by use of automatic sparing in disk drives.  Power failure between immediate reporting and media commit can result in cached data being lost.  However, the period of time between these events is typically relatively small, making such losses unlikely.  The SIOC_GET_IR ioctl can be used to determine if immediate-reporting functionality is currently being used by the device.  The value “1” indicates immediate reporting is enabled.  The value zero indicates immediate reporting is disabled.  The SIOC_SET_IR ioctl can be used to enable or disable immediate reporting.  A zero value disables immediate reporting.  The value “1” enables immediate reporting. 

Most SCSI removable media disk devices support “prevent” and “allow” media-removal commands.  To avoid data corruption and data accessibility problems, media removal is prevented for the entire duration a removable media disk device is open.  Because media removal is not supported, the SIOC_MEDIUM_CHANGED ioctl is not supported. 

The header file <sys/scsi.h> has useful information for direct access device control.  The following is included from <sys/scsi.h>:

/* ioctl support for SCSI disk devices */
#define SIOC_GET_IR        _IOR(’S’, 14, int)
#define SIOC_SET_IR        _IOW(’S’, 15, int)

DEPENDENCIES

Series 300, 400, and 700

The SIOC_FORMAT ioctl reformats the entire media surface.  Exclusive access to the device, obtained through use of the DIOC_EXCLUSIVE ioctl (see disk(7)), is required prior to reformatting to ensure that other applications are not affected. The fmt_optn field can be used to select the desired media geometry.  Only one media geometry is supported on most devices.  The value zero should be used for these devices.  The value zero can also be used to select the default geometry on devices that support multiple media geometries.  The interleave field can be used to specify sector interleaving.  The value zero specifies that an appropriate default interleave should be used. 

The following series-specific information is included from <sys/scsi.h>:

#define SIOC_FORMAT        _IOW(’S’, 6, struct sioc_format)
struct sioc_format {
        short    fmt_optn;
        short    interleave;
};

Series 800

The SIOC_FORMAT ioctl reformats the entire media surface.  Exclusive access to the device, obtained through use of the DIOC_EXCLUSIVE ioctl (see disk(7)), is required prior to reformatting to ensure that other applications are not affected. The integer value of the SIOC_FORMAT ioctl is used to specify a sector interleave.  The value zero specifies that an appropriate default interleave should be used. 

The following series specific information is included from <sys/scsi.h>:

#define SIOC_FORMAT       _IOW(’S’, 6, int)

Optical Disk Devices

The SIOC_VERIFY_WRITES ioctl controls the write mode.  Normally written data is assumed to be correctly stored on the media.  Verify-writes mode causes verification of written data to ensure that data has been correctly written.  Verification can substantially reduce write performance and is not generally needed.  The SIOC_VERIFY_WRITES ioctl can be used to enable or disable write verification.  A zero value disables write verification.  The value “1” enables write verification.  Although write verification is primarily intended for optical media, some systems may support write verification on normal disk devices. 

The SIOC_VERIFY ioctl verifies that a media area contains valid data (has been correctly written).  A media area verified in this manner should not cause I/O errors when reading is attempted.  The media area to be verified is specified via the start_lba and block_cnt fields.  Although verification is primarily intended for optical media, some systems may support verify operations on normal disk devices. 

The SIOC_WRITE_WOE ioctl controls the write mode used for magneto-optical disk devices.  Normally magneto-optical write operations require two physical head passes.  The first pass erases the media area to be written.  The second pass actually writes the data.  Write-without-erase mode dramatically increases write performance by skipping the first (erase media area) pass.  To ensure that the correct data results, it is essential that write-without-erase operations be performed only on media that is known to be blank (previously erased or never used).  The SIOC_WRITE_WOE ioctl can be used to enable or disable write-without-erase.  A zero value disables write-without-erase.  The value “1” enables write-without-erase. 

The SIOC_ERASE ioctl allows media areas to be explicitly erased.  The media area to be erased is specified via the start_lba and block_cnt fields.  Media areas erased in this manner can be written using write-without-erase mode.  Note that an erased media area is different from a media area written with some data values (e.g. zeros).  An erased media area should not be read.  Attempting to read an erased media area generally results in an I/O error. 

The SIOC_VERIFY_BLANK ioctl verifies that a media area has been erased and is suitable for being written using write-without-erase mode.  The media area to be verified is specified via the start_lba and block_cnt fields. 

The following optical disk device specific information is included from <sys/scsi.h>:

#define SIOC_WRITE_WOE                  _IOW(’S’, 17, int)
#define SIOC_VERIFY_WRITES              _IOW(’S’, 18, int)
#define SIOC_ERASE                      _IOW(’S’, 19, struct scsi_erase)
#define SIOC_VERIFY_BLANK               _IOW(’S’, 20, struct scsi_verify)
#define SIOC_VERIFY                     _IOW(’S’, 21, struct scsi_verify)
/* structure for SIOC_ERASE ioctl */
struct scsi_erase {
        unsigned int    start_lba;
        unsigned short  block_cnt;
};
/* structure for SIOC_VERIFY_BLANK and SIOC_VERIFY ioctls */
struct scsi_verify {
        unsigned int    start_lba;
        unsigned short  block_cnt;
};

WARNINGS

Although disk devices have historically had small (typically 512 byte) block sizes, some disk devices (such as optical disks and disk arrays) have relatively large block sizes.  Applications using direct raw disk access should use the DIOC_DESCRIBE or SIOC_CAPACITY ioctls to determine the appropriate minimum I/O size. 

Media removal and insertion while a disk device is open is unsupported and unpredictable.  Circumventing prevention of media removal should not be attempted.  Device capacity changes resulting from subsequent media changes may not be recognized. 

Often larger I/O operation sizes are expected to be more efficient.  However, SCSI disk I/O operations that are large relative to the device’s cache can result in insufficient cache space for the device to maintain full-media-speed data transfer rates.  This can result in decreased I/O performance relative to smaller I/O sizes. 

SEE ALSO

scsi(7), disk(7), mediainit(1M), mknod(1M). 

Hewlett-Packard Company  —  HP-UX Release 9.0: August 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026