• Keine Ergebnisse gefunden

DCU-4 DISK READ-AHEAD

Im Dokument Internal Reference Manual (Seite 101-105)

Step lOP Description

20. MIOP ACOM releases Buffer Memory space for the DAL and any Local Memory space

3.2.6 DCU-4 DISK READ-AHEAD

Each disk control block (DCB) has a Read-ahead Control Table assigned to it at initialization time. These tables are used on both disk reads and writes to anticipate subsequent I/O requests.

Each entry in a Read-ahead Control Table represents one sector of data and contains information used to identify and locate that sector. The number of entries in each Read-ahead Control Table is determined by the

$APTEXT constants RA$NUM (single-device units) and RA$NUMS

(striped-device units). Entries in the Read-ahead Control Table are described by the RA@ definitions (see the IDS Table Descriptions Internal Reference Manual, publication SM-0007).

The Read-ahead Control Table is treated as a circular list and has associated with it the following pointers located in the DCB:

Pointer DB@INF

DB@UNF

DB@IN

DB@OUT

DB@RAK

DB@RAF

Description

Pointer to the first entry in the table; remains constant from initialization.

Pointer to the last entry in the table; remains constant from initialization.

Pointer to the next entry to be read into (reading if from disk to Buffer Memory; writing if from the target memory to Buffer Memory).

Pointer to the next entry to be used to satisfy a request

Count of number of entries in the Read-ahead Control Table; remains constant from initialization.

Count of number of entries containing read-ahead data

3.2.6.1 Disk read

Upon completion of a disk read request, the read interrupt routine checks for additional I/O requests for the current channel. If there are none, read-ahead control is initiated. Read-ahead control anticipates that the next I/O request for the current channel will be a read for sectors

contiguous to the one just read.

Two cases in which read-ahead is not initiated and the channel is idled until the next 1/0 request is received areas follows:

• When a seek is required to position to the next sequential sector

• When no local disk buffers are available The read-ahead sequence is as follows:

1. Read complete. No requests pending (DB@MDL=O). Initialize Read-ahead Control Table:

DB@RAF=O

DB@IN=DB@OUT=DB@INF

2. Compute disk address of next sector to be read and store in the entry pointed to by DB@IN (RA@CYL, RA@HED, and RA@SEC).

3. Allocate a local disk buffer and store the address in the read-ahead entry (RA@LOC).

4. Set disk activity in DCB (DB@FLG) to read-ahead (function code is 4) and initiate read.

3.2.6.1.1 Interrupt occurs due to read-ahead - Read-aheads are terminated if any of the following conditions are found:

• Read-ahead abort is set in the DCB (bit 215 in DB@FLG).

• An error is detected in the read-ahead just completed.

• No more entries are available in the Read-ahead Control Table (DB@RAF=DB@RAK).

• No local disk buffers are available.

• A seek is required to position to the next sequential sector.

The following sequence applies to an interrupt due to a read-ahead:

1. Set data location in entry pointed to by DB@IN to Local Memory (RA@DAT=I). Increment count of read-ahead entries in use (DB@RAF+l). Advance DB@IN to next entry.

-2. Compute next sequential disk address and store in the entry pointed to by DB@IN (RA@CYL, RA@HED, and RA@SEC). Allocate a local disk buffer and store the address in the read-ahead entry (RA@LOC). Initiate read.

3. Activate Disk Demon to move read-ahead sector just completed to Buffer Memory.

3.2.6.1.2 Disk Demon read-ahead process - The Disk Demon read-ahead process follows:

1. Allocate Buffer Memory buffer and save address in the entry pointed to by DB@IN (RA@BMO/BM1).

2. Transfer data from Local Memory buffer (RA@LOC) to Buffer

Memory. Set data location to Buffer Memory (RA@DAT=2). Release Local Memory buffer.

3.2.6.1.3 1/0 request received during read-ahead - If the lID request received specifies a write, the Read-ahead Abort flag is set (215 in DB@FLG), causing read-aheads to terminate after the current read completes.

If the 1/0 request received specifies a read, a check is made to see whether the first sector ocf the request matches either data previously read-ahead or the sector currently being read.

ACOM checks to see if the first sector of the request matches any of the sectors previously read-ahead. If there is a match, ACOM makes sure that the pointer DB@OUT gets set to the matching entry.

ACOM then calls the DBUD routine to prepare E-DALs for the request. As each E-DAL is built, a check is made to see whether the sector for which the E-DAL is being built matches the sector in the read-ahead entry pointed to by DB@OUT. If there is a match, the memory location of the data is moved from the read-ahead entry to the E-DAL. The E-DAL is then placed on the done queue (DB@DNQ) for processing by the Disk Demon. The DB@OUT pointer is then advanced to the next read-ahead entry and the read-ahead count (DB@RAF) is decremented.

This process continues until all of the read-ahead data has been used.

If the read-ahead count (DB@DRAF) is 0 and read-ahead is in progress (DB@FLG=4), a check is made to see if the sector for which the E-DAL is being built is the same as that being read. If they are the same, the information from the read-ahead entry pointed to by DB@IN is moved to the E-DAL, the Disk Activity flag is set to read (DB@FLG=l), and the E-DAL is put on the executable queue (DB@EDL). This process is referred to as a read-ahead steal, because the active read-ahead is redirected into the normal read flow.

3.2.6.2 Disk write

Read-ahead during a disk write (sometimes referred to as write-behind) involves moving sectors of data from the target memory to Buffer Memory, where i t is held until the disk is positioned to where the data is to be written. A response is' sent after the last sector of data (for a given

request) has been moved out of the target memory. The read-ahead allows overlap of current and previous request processing; that is, overlap of the preparing of data to be written with the writing of data to disk.

Read-ahead during a disk write always attempts to keep the Read-ahead Control Table full. As each write request is satisfied and a new one received, data is moved to Buffer Memory, as long as entries are

available in the Read-ahead Control Table. As each sector is moved from Buffer Memory to Local Memory to disk, the next sequential sector of the most recent request is moved from the target memory to Buffer Memory to take its place.

3.2.6.2.1 Disk Demon: Read-ahead input - The sequence that applies to Disk Demon read-ahead input follows:

1. Check to see whether there is any more room in the Read-ahead Control Table (DB@RAF=DB@RAK). If no room exists, the sequence ends here.

2. Check each M-DAL queued (DB@MDL) beginning with the first for a sector waiting to be moved. (DA@WBH # DA@TOT). If none exist, the sequence ends here.

3. Transfer sector from the target memory to Buffer Memory. Save Buffer Memory address of the entry in the Read-ahead Control Table that is pointed to by DB@IN (RA@BMO/BM1). Save the disk address of the sector in the entry (RA@CYL, RA@HED, and RA@SEC).

4. Advance DB@IN to the next entry. Increment read-ahead count (DB@RAF). Increment next read-ahead/write-behind sector in the M-DAL (DA@WBH).

5. If the last sector for the request has been moved (DA@WBH=DA@TOT), send a response to the mainframe.

3.2.6.2.2 Disk Demon: Read-ahead output - The sequence that applies to Disk Demon read-ahead output follows:

1. Call the Kernel DBUD routine to build the next E-DAL.

2. DBUD checks to see if the read-ahead entry pointed to by DB@OUT matches the sector for which the E-DAL is being built.

3. The Buffer Memory address is moved from the entry (RA@BMO and RA@BM1) to the E-DAL (DA@BMO and DA@BM1). The data location is set to Buffer Memory in the E-DAL (DA@DAT=2). DB@OUT is advanced to the next entry and the read-ahead count is decremented

(DB@RAF).

4. Disk Demon allocates a local buffer, detects that data is in Buffer Memory rather than target memory (DA@DAT=2), and transfers data from Buffer Memory to Local Memory in preparation for a write to disk.

Im Dokument Internal Reference Manual (Seite 101-105)