[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Files Reference


lvdd Special File

Purpose

Provides access to the logical volume device driver.

Description

The logical volume device driver provides character (raw) access to logical volumes. The Logical Volume Manager associates a major number with each volume group and a minor number with each logical volume in a volume group.

Logical volume special file names can be assigned by the administrator of the system. However, /dev/lv1, /dev/lv2 and /dev/rlv1, /dev/rlv2 are the names conventionally chosen.

When performing character I/O, each request must start on a logical block boundary of the logical volume. The logical block size is 512 bytes. This means that for character I/O to a logical volume device, the offset supplied to the lseek subroutine must specify a multiple of 512 bytes. In addition, the number of bytes to be read or written, supplied to the read or write subroutine, must be a multiple of 512 bytes.

Note: I/O requests should not be sent to the block special file interface when the logical volume is mounted. When a logical volume is mounted (that is, the block special file is opened by the file system), any I/O requests from the user made to that logical volume should be made only through the character special file.

Usage Considerations

Attention: Data corruption, loss of data, or loss of system integrity (system crashes) will occur if devices supporting paging, logical volumes, or mounted file systems are accessed using block special files. Block special files are provided for logical volumes and disk devices on the operating system and are solely for system use in managing file systems, paging devices and logical volumes. They should not be used for other purposes. Additional information concerning the use of special files may be obtained in "Understanding I/O Access through Special Files" in AIX 5L Version 5.1 Kernel Extensions and Device Support Programming Concepts.

open and close Subroutines

No special considerations.

Extension Word Specification for the readx and writex Subroutines

The ext parameter for the readx and writex extended I/O subroutines indicates specific physical or logical operations, or both. The upper 4 bits of the ext parameter are reserved for internal LVDD use. The value of the ext parameter is defined by logically ORing values from the following list, as defined in the /usr/include/sys/lvdd.h file:

WRITEV Perform physical write verification on this request. This operation can be used only with the writex subroutine.
RORELOC For this request, perform relocation on existing relocated defects only. Newly detected defects should not be relocated.
MWC_RCV_OP Mirror-write-consistency recovery operation. This option is used by the recovery software to make consistent all mirrors with writes outstanding at the time of the crash.
NOMWC Inhibit mirror-write-consistency recovery for this request only. This operation can only be used with the writex subroutine.
AVOID_C1, AVOID_C2, AVOID_C3 For this request, avoid the specified mirror. This operation can only be used with the readx subroutine.
RESYNC_OP For this request, synchronize the specified logical track group (LTG). This operation can only be used with the readx subroutine and must be the only operation. When synchronizing a striped logical volume, the data returned is not usable by the application because the logical track group is not read on a striped basis.
LV_READ_BACKUP Read only the mirror copy that is designated as the backup mirror copy.
LV_WRITE_BACKUP Write only the mirror copy that is designated as the backup mirror copy.
LV_READ_ONLY_C1 Read only copy one of the data.
LV_READ_ONLY_C2 Read only copy two of the data.
LV_READ_ONLY_C3 Read only copy three of the data.
LV_READ_STALE_C1 Read only copy one of the data even if it is stale.
LV_READ_STALE_C2 Read only copy two of the data even if it is stale.
LV_READ_STALE_C3 Read only copy three of the data even if it is stale.

There are some restrictions when using this operation. To synchronize a whole logical partition (LP), a series of readx subroutines using the RESYNC_OP operation must be done. The series must start with the first logical track group (LTG) in the partition and proceed sequentially to the last LTG. Any deviation from this will result in an error. The length provided to each readx operation must be exactly 128KB (the LTG size).

Normal I/O can be done concurrently anywhere in the logical partition while the RESYNC_OP is in progress. If an error is returned, the series must be restarted from the first LTG. An error is returned only if resynchronization fails for every stale physical partition copy of any logical partition. Therefore, stale physical partitions are still possible at the end of synchronizing an LP.

Normal I/O operations do not need to supply the ext parameter and can use the read and write subroutines.

IOCINFO ioctl Operation

The IOCINFO ioctl operation returns the devinfo structure, as defined in the /usr/include/sys/devinfo.h file. The values returned in this structure are defined as follows for requests to the logical volume device driver:

devtype Equal to DD_DISK (as defined in the devinfo.h file)
flags Equal to DF_RAND
devsubtype Equal to DS_LV
bytpsec Bytes per block for the logical volume
secptrk Number of blocks per logical track group
trkpcyl Number of logical track groups per partition
numblks Number of logical blocks in the logical volume

XLATE ioctl Operation

The XLATE ioctl operation translates a logical address (logical block number and mirror number) to a physical address (physical device and physical block number on that device). The caller supplies the logical block number and mirror number in the xlate_arg structure, as defined in the /usr/include/sys/lvdd.h file. This structure contains the following fields:

lbn Logical block number to translate
mirror The number of the copy for which to return a pbn (physical block number on disk). Possible values are:
1 Copy 1 (primary)
2 Copy 2 (secondary)
3 Copy 3 (tertiary)
p_devt Physical dev_t (major/minor number of the disk)
pbn Physical block number on disk

XLATE64 ioctl Operation

The XLATE64 ioctl operation functions the same as the XLATE operation except that it uses the xlate_arg64 structure, in which the logical and physical block numbers and the device (major/minor) number fields are 64-bit wide.

PBUFCNT ioctl Operation

The PBUFCNT ioctl operation increases the size of the physical buffer header, pbuf, pool that is used by LVM for logical-to-physical request translation. The size of this pool is determined by the number of active disks in the system, although the pool is shared for request to all disks.

The PBUFCNT ioctl operation can be issued to any active volume group special file, for example /dev/VolGrpName. The parameter passed to this ioctl is a pointer to an unsigned integer that contains the pbufs-per-disk value. The valid range is 16 - 128. The default value is 16. This value can only be increased and is reset to the default at IPL. The size of the pbuf pool is not reduced when the number of active disks in the system is decreased.

The PBUFCNT ioctl operation returns the following:

EINVAL Indicates an invalid parameter value. The value is larger than the maximum allowed, or smaller than or equal to the current value.
EFAULT Indicates that the copy in of the parameter failed.
LVDD_ERROR An error occurred in allocating space for additional buffer headers.
LVDD_SUCCESS Indicates a successful ioctl operation.

LV_INFO ioctl Operation

The LV_INFO ioctl operation returns information about the logical volume in question. This ioctl operation only applies to AIX 4.2.1 and later.

The caller supplies the logical volume special file in the system open call and the information is returned via the lv_info structure, as defined in the /usr/include/sys/lvdd.h file. This structure contains the following fields:

vg_id Volume group ID of which the logical volume is a member
major_num Major number of logical volume
minor_num Minor number of the logical volume
max_lps Maximum number of logical partitions allowed for this logical volume
current_lps Current size of the lofical volume in terms of logical partitions
mirror_policy Specifies the type of mirroring, if the logical volume is mirrored. Valid values are parallel, sequential, striped, and striped_parallel.
permissions Specifies whether the logical volume is read only or read-write
bb_relocation Specifies whether bad block relocation is activated for the logical volume
write_verify Specifies whether the write verify command for writes to the logical volume is enforced
num_blocks Number of 512 byte blocks that make up the logical volume. This value does not include mirrored logical volumes
mwcc Specifies which mirrored write consistency check algorithm is set, if it is active.

MWCC_NON_ACTIVE
mwcc disabled for this logical volume

MWCC_ACTIVE_MODE
ACTIVE mwcc algorithm set for this logical volume

MWCC_PASSIVE_MODE
PASSIVE mwcc algorithm set for this logical volume

MWCC_PASSIVE_RECOVERY
logical mirrors undergoing PASSIVE mwcc recovery after system interruption
mirr_able Specifies whether the logical volume is capable of being mirrored
num_mirrors Number of mirror copies for this logical volume
striping_width Number of drives across which this logical volume is striped
stripe_exp Stripe block exponent value
backup_mirror Backup mirror mask will be zero indicating there is not a backup copy active.

AVOID_C1
For the first copy

AVOID_C2
For the second copy

AVOID_C3
For the third copy.

The LV_INFO ioctl operation returns the following:

EFAULT Indicates that the copy of the parameter failed.

LVM ioctl Operations Used to Modify Single Logical Volumes

LV_QRYBKPCOPY Query for designated backup mirror copy.
LV_SETBKPCOPY Designate backup mirror copy.
LV_FSETBKPCOPY Force new designation for backup mirror copy. Used when there are stale partitions on either the active mirror or backup mirror.
SET_SYNC_ON_RD Causes the logical volume to go into MWCC_PASSIVE_RECOVERY mode. All reads from one mirror copy will cause non-read mirror copies to undergo a sync write.
CLR_SYNC_ON_RD Clears the MWCC_PASSIVE_RECOVERY mode of the logical volume, if it exists. This clear should not be exercised if mirror consistency is not guaranteed.

LV_INFO64 ioctl Operation

The LV_INFO64 ioctl operation functions the same as the LV_INFO operation except that it uses the lv_info64 structure, in which the major_num and minor_num fields are 32-bit wide each and the num_blocks field is 64-bit wide.

Error Codes

In addition to the possible general errors returned by the ioctl subroutine, the following errors can also be returned from specific ioctl operation types.

ENXIO The logical volume does not exist. (This error type is relevant to the IOCINFO, XLATE ioctl, and XLATE64 operations.)
ENXIO The logical block number is larger than the logical volume size. (This error type is relevant only to the XLATE ioctl and XLATE64 ioctl operations.)
ENXIO The copy (mirror) number is less than 1 or greater than the number of actual copies. (This error type is relevant only to the XLATE ioctl and XLATE64 ioctl operations.)
ENXIO No physical partition has been allocated to this copy (mirror). (This error type is relevant only to the XLATE ioctl and XLATE64 ioctl operations.)

Implementation Specifics

The lvdd special file is part of Base Operating System (BOS) Runtime.

Related Information

The close subroutine, ioctl subroutine, lseek subroutine, open subroutine, read subroutine, write subroutine.

Chapter 3. Special Files .

Logical Volume Storage Overview in AIX 5L Version 5.1 System Management Concepts: Operating System and Devices.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]