11.9.2.1 bufinfo_t

The bufinfo_t structure is the abstraction that describes an I/O request. The buffer that corresponds to an I/O request is pointed to by args[0] in the start, done, wait-start, and wait-done probes. Detailed information about this data structure can be found in /usr/lib64/dtrace/version/io.d. The definition of bufinfo_t is as follows:

typedef struct bufinfo {
  int b_flags;         /* flags */
  size_t b_bcount;     /* number of bytes */
  caddr_t b_addr;      /* buffer address */
  uint64_t b_blkno;    /* expanded block # on device */
  uint64_t b_lblkno;   /* logical block # on device */
  size_t b_resid;      /* not supported */
  size_t b_bufsize;    /* size of allocated buffer */
  caddr_t b_iodone;    /* I/O completion routine */
  int b_error;         /* not supported */
  dev_t b_edev;        /* extended device */
} bufinfo_t;
Note

DTrace translates the members of bufinfo_t from the buffer_head or bio for the Oracle Linux I/O request structure, depending on the kernel version.

b_flags indicates the state of the I/O buffer, and consists of a bitwise-or of different state values. The following table describes the values for the supported states.

Table 11.11 b_flags Values

b_flags

Value

Description

B_ASYNC

0x000400

Indicates that the I/O request is asynchronous and is not waited upon. The wait-start and wait-done probes do not fire for asynchronous I/O requests.

Note

Some I/Os directed to be asynchronous might not set B_ASYNC. The asynchronous I/O subsystem could implement the asynchronous request by having a separate worker thread perform a synchronous I/O operation.

B_PAGEIO

0x000010

Indicates that the buffer is being used in a paged I/O request.

B_PHYS

0x000020

Indicates that the buffer is being used for physical (direct) I/O to a user data area.

B_READ

0x000040

Indicates that data is to be read from the peripheral device into main memory.

B_WRITE

0x000100

Indicates that the data is to be transferred from main memory to the peripheral device.


b_bcount: Is the number of bytes to be transferred as part of the I/O request.

b_addr: Is the virtual address of the I/O request, when known.

b_blkno: Identifies which block on the device is to be accessed.

b_lblkno: Identifies which logical block on the device is to be accessed. The mapping from a logical block to a physical block (such as the cylinder, track, and so on) is defined by the device.

b_bufsize: Contains the size of the allocated buffer.

b_iodone: Identifies a specific routine in the kernel that is called when the I/O is complete.

b_edev: Contains the major and minor device numbers of the device accessed. You can use the D subroutines getmajor and getminor to extract the major and minor device numbers from the b_edev field.