Abstract:
A method and apparatus for transferring data between two storage media, and is used in an illustrative embodiment to transfer data between two storage media in a shadow set, the storage media being accessible to one or more host processors. The method of the preferred embodiment includes the steps of: A. receiving a command from one of the host processors, the command specifying data to be transferred from a first storage medium to a second storage medium; B. transferring the data specified in the command received from the host from the first storage medium to the second storage medium in a series of subtransfers, each of the subtransfers transferring a portion of the data; and C. processing one or more I/O requests to the shadow set received from one or more host processors by, for each received I/O request: a. implementing the I/O request if the I/O request does not involve a section of the shadow set currently involved in one of the subtransfers; and b. stalling the I/O request if the I/O request involves a section of said shadow set currently involved in one of the subtransfers, and implementing the I/O request when the subtransfer has completed.

Description:
This is a continuation of application Ser. No. 07/374,253, filed Jun. 30, 1989, now abandoned. 
    
    
     RELATED APPLICATIONS 
     This application is related to the following pending applications, all of which are filed concurrently herewith, and each of which is incorporated herein by reference: U.S. patent application Ser. No. 07/374,490, in the name of Scott H. Davis, William L. Goleman and David W. Thiel, and entitled Digital Data Management System; U.S. patent application Ser. No. 07/374,528, in the name of Scott H. Davis, William L. Goleman and David W. Thiel, and entitled Transferring Data In A Digital Data Processing System; and U.S. patent application Ser. No. 07/374,251, in the name of Scott H. Davis, William L. Goleman, David W. Thiel, Robert G. Bean and James A Zahrobsky, and entitled Data Storage Device for a Digital Data Processing System. 
     BACKGROUND OF THE INVENTION 
     This invention relates to a system for transmitting data between two storage devices associated with a digital data processing system. The preferred embodiment is described in connection with a system for establishing and maintaining one or more duplicate or &#34;shadow&#34; copies of stored data to thereby improve the availability of the stored data. 
     A typical digital computer system includes one or more mass storage subsystems for storing data (which may include program instructions) to be processed. In typical mass storage subsystems, the data is actually stored on disks. Disks are divided into a plurality of tracks, at selected radial distances from the center, and sectors, defining particular angular regions across each track, with each track and set of one or more sectors comprising a block, in which data is stored. 
     Since stored data may be unintentionally corrupted or destroyed, systems have been developed that create multiple copies of stored data, usually on separate storage devices, so that if the data on one of the devices or disks is damaged, it can be recovered from one or more of the remaining copies. Such multiple copies are known as the shadow set. In a shadow set, typically data that is stored in particular blocks on one member of the shadow set is the same as data stored in corresponding blocks on the other members of the shadow set. It is usually desirable to permit multiple host processors to simultaneously access (i.e., in parallel) the shadow set for read and write type requests (&#34;I/O&#34; requests). 
     A new storage device or &#34;new member&#34; is occasionally added to the shadow set. For example, it may be desirable to increase the number of shadow set members to improve the data availability or it may be necessary to replace a shadow set member that is or has been damaged. Because all shadow set members contain the same data, when adding a new member, all of the data stored on the active members must be copied to the new member. 
     SUMMARY OF THE INVENTION 
     The invention generally features a method and apparatus for transferring data between two storage media, and is used in an illustrative embodiment to transfer data between two storage media in a shadow set, the storage media being accessible to one or more host processors. The method of the preferred embodiment includes the steps of: A. receiving a command from one of the host processors, the command specifying data to be transferred from a first storage medium to a second storage medium; B. transferring the data specified in the command received from the host from the first storage medium to the second storage medium in a series of subtransfers, each of the subtransfers transferring a portion of the data; and C. processing one or more I/O requests to the shadow set received from one or more host processors by, for each received I/O request: a. implementing the I/O request if the I/O request does not involve a section of the shadow set currently involved in one of the subtransfers; and b. stalling the I/O request if the I/O request involves a section of said shadow set currently involved in one of the subtransfers, and implementing the I/O request when the subtransfer has completed. 
     In the preferred embodiment, a subtransfer that has not yet begun is stalled if it involves a section of the shadow set which is currently involved in an I/O request, the subtransfer being implemented when the I/O request has completed. Each of the hosts will transmit I/O requests to the shadow set first to the storage medium from which the data in the subtransfers is obtained (i.e., the &#34;source&#34;), and then to the storage medium to which the subtransfer is directed (i.e., the &#34;target&#34;), after the I/O request to the source has completed. The command received from the host processor is received by a processor that supports the target. The processor that supports the target transmits commands to a processor that supports the source, the commands controlling the subtransfers of data from the source to the target. 
     The invention allows data to be transferred between two storage media, such as storage media in a shadow set of storage media in an efficient manner that does not significantly interfere with I/O requests. 
    
    
     Other advantages and features of the invention will be apparent from the following detailed description of the invention and the appended claims. 
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     Drawings 
     We first briefly describe the drawings. 
     FIG. 1 is a shadow set storage system according to the present invention. 
     FIGS. 2A, 2B, 3A, 3B, 4A and 4B illustrate data structures employed by the invention. 
     FIG. 5 is a flow chart illustrating a preferred embodiment of a method of copying data according to the invention. 
    
    
     STRUCTURE AND OPERATION 
     Referring to FIG. 1, a system in accordance with the invention includes a plurality of hosts 9, each of which includes a processor 10, memory 12 (including buffer storage) and a communications interface 14. The hosts 9 are each directly connected through interface 14 and a communications medium 16 (e.g., by a virtual circuit) to two or more storage subsystems, illustrated generally at 17 (two are shown in FIG. 1). 
     Each storage subsystem includes a disk controller 18, that controls I/O requests to one or more disks 20, two of which are shown in each subsystem. Disk controller 18 includes a buffer 22, a processor 24 and memory 26 (e.g., volatile memory). Processor 24 receives I/O requests from hosts 9 and controls I/O requests to each of its disks 20. Buffer 22 temporarily stores data received in connection with a write command before the data is written to a disk 20. Buffer 22 also stores data read from a disk 20 before the data is transmitted to the host in response to a read command. 
     Each host 9 will store, in its memory 12, a table that includes information about the system that the hosts 9 need to perform many operations. For example, hosts 9 will perform read and write operations to storage subsystems 17 and must know which storage subsystems are available for use, what disks are stored in the subsystems, etc. As will be described in greater detail below, the hosts 9 will slightly alter the procedure for read and write operations if data is being transferred from one shadow set member to another. Therefore, the table will store status information regarding any ongoing operations. The table also contains other standard information. 
     While each storage subsystem may include multiple disks 20, the members of the shadow set are chosen to include disks in different storage subsystems 17. Therefore, a host may directly access each member of the shadow set, through its interface 14 and over communication medium 16, without requiring it to access two shadow set members through the same disk controller 18. This will avoid a &#34;central point of failure&#34; in the event of a failure of one of the disk controllers 18. In other words, if members of a shadow set have a common disk controller 18, and if that controller 18 malfunctions, the hosts will not be able to successfully perform any read and write operations. In the preferred system, the shadow set members are &#34;distributed&#34;, so that the failure of one device (e.g., one disk controller 18) will not inhibit read and write operations because they can be performed using another shadow set member accessed through another disk controller. 
     When data is written to the shadow set by a host, the host issues a command whose format is illustrated in FIG. 2A. The command includes a &#34;command reference number&#34; field that uniquely identifies the command, and a &#34;unit number&#34; field that identifies the unit (e.g. the disk 20) to which data is to be written to or read from within each shadow set disk. The &#34;opcode&#34; field identifies to the disk controller that the operation is a write operation. The &#34;byte count&#34; field specifies the total number of bytes of data to be written and the &#34;logical block number&#34; field identifies the starting location on the disk. The &#34;buffer descriptor&#34; identifies a section of host memory 12 that contains the data to be written. The &#34;modifier&#34; field is used to identify options associated with specific commands. 
     The format of a read command is illustrated in FIG. 2B, and includes fields that are similar to the write command fields. For a read command, the buffer descriptor contains the location in host memory 12 to which the data read from the disk is to be stored. 
     Once a host transmits a read or write command, it is received by the disk controller 18 that supports the disk identified in the &#34;unit number&#34; field. For a write command, the disk controller will implement the write to its disk 20 and return an &#34;end message&#34; to the originating host, the format of the write command end message being illustrated in FIG. 3A. The end message includes a status field that informs the host whether or not the command completed successfully. If the write failed the status field can include error information, depending on the nature of the failure. 
     For a read command, the disk controller will read the requested data from its disk and transmit the data to memory 12 of the originating host. After the data has been transferred, an end message is generated by the disk controller and sent to the originating host, the format of the read command end message being illustrated in FIG. 3B. The read command end message is similar to the end message for the write command. 
     One of the system&#39;s host processors will control operations for adding a new disk to the shadow set. The system can select any host processor to execute the operation. For example, the host processor with the best transmission path (e.g., the fastest path) to the shadow set may be chosen. 
     The host controlling the addition of the new disk to the shadow set will select a currently active disk 20 to serve as a &#34;source,&#34; with all of the data on the source being copied to the new disk or &#34;target.&#34; A connection, such as a virtual circuit, is established between the storage subsystems that support the source and the target disks, and the data is transferred directly from the source storage subsystem to the target subsystem. 
     To begin the data transfer, a host sends a command to the disk controller supporting the target disk specifying the identity of the source and the address of the data to be transferred. The target disk then establishes a connection with the disk controller supporting the source and instructs the source&#39;s disk controller to transmit the data from the source. 
     A host implements the direct transfer using a &#34;Copy Data&#34; command. This command permits quantities of data to be copied from one disk device to another without host intervention. A disk controller may support two different types of copy operations; local and remote. A local copy operation involves the transfer of data between two disks that are both physically connected to the storage subsystem in which the disk controller that received the command is located (i.e., both disks are supported by the same disk controller). A remote copy operation involves the transfer of data between disks in different storage subsystems. Both storage subsystems in a remote copy operation must be connected to the same communications medium, i.e., they must be able to communicate with each other. As noted above, it is preferable to have the disks of the shadow set in different storage subsystems, so remote copy operations are used in the preferred system. 
     We will first describe the commands used to perform the direct copy operation and will then explain how a direct copy operation is implemented using the commands. 
     As noted above, to begin the operation, a host sends a &#34;Copy Data&#34; command to the disk controller that supports the target disk. The command message format for this command is illustrated in FIG. 4A. 
     The &#34;unit number&#34; field identifies the target unit--i.e., the specific disk 20 to which data is to be copied. The &#34;logical block count&#34; field identifies the total number of logical blocks to be copied from the source disk to the target disk. 
     The &#34;src unit number&#34; field identifies the source unit--i.e., the disk from which data is to be copied. The &#34;source lbn&#34; field identifies the logical block number (position) on the source disk&#39;s volume at which the copy operation is to start. If this value does not actually reflect a block on the source disk, the disk controller rejects the command as an invalid command. 
     The &#34;destination lbn&#34; field identifies the logical block number (position) on the destination or target disk&#39;s volume at which the copy operation is to start. If this value does not actually represent a block on the target disk, the disk controller rejects the command as an invalid command. 
     The &#34;source unit identifier&#34; field specifies a unique identifier assigned to the source disk that is obtained from the source disk by the host before the host issues any cop data commands. The target disk controller compares the value of this field against the &#34;unit identifier&#34; it obtains directly from the source disk. If the values do not match exactly, the controller rejects the command as an invalid command. 
     The &#34;source unit&#39;s storage subsystem port address&#34; identifies the communication protocol port address of the storage subsystem to which the source disk is physically connected. The information encoded in this field is the port address formatted as required by the particular communications protocol being used. The target disk controller ignores this field if either of the following conditions exist: 
     1. The target disk controller does not provide remote copy support--i.e., only local copy is supported; or 
     2. The target disk controller supports remote copy operations but the &#34;Local Source Unit&#34; modifier (explained below) is set. (I.e., the field is ignored as unnecessary if the source disk is local.) 
     For a remote disk copy operation, the target disk controller rejects the command as an invalid command if the content of the source disk&#39;s storage subsystem port address field: 
     1. Is not formatted correctly for the communications protocol being used; or 
     2. Identifies the subsystem in which the target disk is located. (I.e., a remote copy operation cannot identify a local disk as the source.) 
     The &#34;source unit&#39;s storage subsystem system address&#34; is the communications protocol system address of the storage subsystem to which the source disk is physically connected. The information encoded in this field is the system address value formatted as required by the communication protocol being used. Like the port address field described above, the target disk controller ignores this field if either the target disk controller does not provide remote copy support, or if the Local Source Unit modifier is set. If the content of this field is not formatted correctly for the communications protocol being used, the controller rejects the command as invalid. 
     There are a number of possible modifiers that may be specified in the &#34;modifiers&#34; field. An &#34;establish communications path&#34; modifier, if set, will instruct the target disk controller to establish a communication path to the source disk through the source disk controller. 
     The target disk controller rejects the Copy Data command as an invalid command if either of the following conditions exist: 
     1. The &#34;establish communications paths&#34; modifier is clear and the required communications paths have not been established. 
     2. The &#34;establish communications paths&#34; modifier is set and communications paths previously established on behalf of the issuing host are still intact. 
     For a disk controller that supports remote copy, the setting of a &#34;Local Source Unit&#34; modifier indicates that the source disk is a disk connected to the same disk controller as the target disk. Hosts clear this modifier to indicate that the source disk is located in another storage subsystem. This modifier is ignored by controllers that only support local copy operations. 
     The setting of the &#34;Retain Communications Paths&#34; modifier determines whether the disk controller should retain the communications paths after the copy operation has been aborted, completed, or terminated. If this modifier is set, the communications paths are retained. A host may therefore issue subsequent Copy Data commands without incurring the overhead associated with establishing the communications paths. If this modifier is clear, the target controller performs the operations necessary to disconnect the communications paths upon completion of the request. 
     The end message format for the Copy Data command is illustrated in FIG. 4(b). The end message is returned to the host that issued the Copy Data command by the target disk controller after the Copy Data command is executed. 
     There are several possible flags that may be used in the &#34;flags&#34; field of the Copy Data end message including a &#34;Communications Paths Retained&#34; flag. The setting of this flag indicates whether the communications paths have been retained. If this end flag is set, the communications paths have been retained. If this flag is clear, the communications paths have been disconnected. 
     The &#34;logical block count&#34; field gives the number of logical blocks successfully copied from the source disk to the target disk. If an unrecoverable error occurs, the target controller sets this value equal to the number of logical blocks beginning with the &#34;destination lbn&#34; that were successfully copied to the target disk prior to the occurrence of the unrecoverable error. If no unrecoverable errors occur during the copy operation, the disk controller sets this value equal to the exact &#34;logical block count&#34; that was specified in the command message. 
     The &#34;subcommand status&#34; field contains information related to the failure of a subcommand issued by the disk controller to the source disk or the target disk. The contents of this field are undefined unless this command was terminated due to an error. If the command was terminated due to an error, the &#34;Destination&#34; (i.e., target) or &#34;Source&#34; bit flag (contained in the status field) identifies which device encountered the condition or error. In cases where multiple conditions or errors have occurred, either on one or both devices, the controller only records and reports the first condition or error detected, all others being discarded. 
     The purpose of the &#34;subcommand status&#34; field is to provide hosts with information to aid in recovering from failures that occur during the copy operation. 
     Now that the commands and data structures used in performing the copy operation have been described, the method of copying data from a source to a target will be explained, with reference to the flowchart of FIG. 5. The host controlling the copy operation first issues a Copy Data command to the target disk controller, specifying the disks that are to act as the source and target, the starting logical block numbers on the source and target, and the quantity of data to be copied from the source to the target (step 1). The target disk controller receives the command (step 2), and determines if the Establish Communications Paths modifier is set (step 3). If the Establish Communication Paths modifier is set, the target disk controller proceeds to establish the required paths (step 4). If the source disk is located in the same storage subsystem as the target, the target controller uses internal connections to both the source and target disks. If the source disk is located in a remote subsystem, the target controller performs the communications protocol dependent operations necessary to establish a connection with the source disk&#39;s disk controller. 
     The target disk controller then initializes a logical cluster counter that identifies clusters of data in the source, beginning with the first clustor to be transferred (step 5). As explained below, the logical cluster counter is incremented to identify consecutive clusters to be transferred to the target and a last logical cluster number identifies the last cluster to be transferred. 
     The target controller next issues a Read command (see FIG. 2B) to the source disk to obtain a cluster of data identified by the logical cluster counter from the source (step 6). 
     Once the data is obtained from the source, the target controller issues a Write command to the target disk to copy the source data. 
     Steps 6-10 are repeated until the copy operation is aborted, completed, or terminated. 
     The target disk controller is described above as issuing read and write commands to the source and target disks of the type shown in FIG. 2. It should be noted that the disk controller is expressly permitted to perform any equivalent internal operation for the target disk and a local source disk to reduce processing overhead. Standard commands must be used in all transactions dealing with a remote source disk and its disk controller. However, if an internal operation is substituted for standard commands, the following rules are followed: 
     A. The result of the internal operation shall be identical to that of the standard command. 
     B. If the internal operation results in an error, the end message error fields are set as if a standard command had been issued. 
     The disk controller shall execute the Copy Data command in a manner that guarantees that logical blocks are copied to the proper place in the target disk, beginning with the logical block number specified in the &#34;destination lbn&#34; field of the Copy Data command message. 
     In order to permit write operations to the shadow set continue during the execution of a Copy Data command, some operations are performed by the target disk controller as &#34;sequential operations&#34; while others are performed as &#34;non-sequential.&#34; A sequential operation to a disk is one that must be performed without any other operations being performed simultaneously. When a sequential command is received, the disk controller will complete all outstanding operations to the disk, and will inhibit new operations. When all outstanding operations have executed, the sequential operation is carried out to its completion. Once the sequential operation is completed, other operations may resume. Non-sequential commands may occur in parallel, and may be reordered to increase efficiency. 
     The target disk controller executes most commands relating to a Copy Data command as non sequential commands--i.e., in relation to all other commands addressed to the target disk, the subcommands the target disk controller issues to the target disk as part of the Copy Data Command may be reordered to optimize performance, and may be interleaved with other non sequential commands. 
     The only exception to the non-sequential execution just described is that access to the disk controller&#39;s &#34;immediate target&#34; on the target disk is controlled. The disk controller&#39;s immediate target is the range of logical blocks on the target disk that the disk controller is about to act upon or is currently acting upon. To be more specific the &#34;immediate target&#34; is the range of logical blocks specified in: 
     A. a Read subcommand used to obtain a cluster of source data, or 
     B. a Write subcommand used to copy the resultant data to the target disk. 
     Access to the disk controller&#39;s &#34;immediate target&#34; on the target disk is controlled according to the following rules: 
     a. If a command (such as a write) that specifies a range of logical blocks that is within or overlaps the disk controller&#39;s &#34;immediate target&#34; is currently in progress, the disk controller postpones issuing any subcommands that affect the &#34;immediate target&#34; until the command in progress completes, terminates, or is aborted. 
     b. If a command that specifies a range of logical blocks that is within or overlaps the disk controller&#39;s &#34;immediate target&#34; is received while the disk controller action on the &#34;immediate target&#34; is postponed (as described in &#34;a&#34; above), the disk controller postpones the execution of the command received until the subcommands that affect the &#34;immediate target&#34; have been initiated and have then completed or terminated. 
     c. If a command that specifies a range of logical blocks that is within or overlaps the disk controller&#39;s &#34;immediate target&#34; is received while the subcommands that affect the &#34;immediate target&#34; are currently in progress, the disk controller postpones the execution of the command (i.e., stalls the command) until the subcommands that affect the &#34;immediate target&#34; have been completed or terminated. 
     The effect of these rules is to treat access to the disk controller&#39;s &#34;immediate target&#34; as sequential operations. In order to postpone I/O operations as discussed above, the disk controller will store the I/O requests in a queue in an available memory, such as buffer 22. When the subtransfer for that section of the shadow set is complete, the controller accesses the queue and implements the I/O requests. 
     As described above, the purpose for providing the &#34;immediate target&#34; access behavior described above is to allow hosts to perform write operations on the target disk in a manner that guarantees that while a Copy Data command is in progress all data written to logical blocks on the target disk will be identical to those contained on the source disk. To fulfill that guarantee, hosts shall ensure that write operations addressed to the source disk that specify a range of logical blocks that is within or overlaps the range of logical blocks specified in a Copy Data command are issued and completed before the equivalent operation is issued to the target disk. This is required since, if a host issues write commands to both the target and source in parallel, the write to the target could execute before the write to the source. If this occurred and the system then performed a subtransfer to the same location on the target disk, while stalling the write to the source disk, obsolete data would be transferred from the source to the target (i.e., the data on the source is obsolete because the write to the source has not yet executed. This potential corruption of data is avoided by requiring the hosts to first complete writes to the source before issuing writes to the target. 
     As explained above, each host stores a table that lists data that the host needs to operate properly in the system. For example, each table will include information regarding the disks that make up the shadow set, etc. The table also stores status information that informs the host whether or not a new member is being added to the shadow set. Therefore, before a host executes an I/O request to the shadow set it will check the status field in its table, and if the host determines that a new member is being added, the host will implement the special procedures discussed above for avoiding possible data corruption. The table is kept current by requiring hosts that begin the process of adding a new member, to send a message to every other host in the system informing each host of the operation. A host that is controlling the addition of the new member will not begin the data transfer to the new member until it receives a confirmation from each host that each host has updated its table to reflect the new status of the system. Similarly, a host controlling the addition of a new member will send a message to each host when the new member has been added, and has data that is consistent with the shadow set. Upon receiving this message, hosts will resume the normal practice of issuing I/O requests in parallel. 
     Note that the result of a read operation issued to the target disk that specifies a range of logical blocks that is within or overlaps the range of logical blocks specified in a Copy Data command is unpredictable because data may not yet have been copied to the section of the target specified in the read command. Hosts should therefore rely solely on the contents of the source disk (or another active shadow set member) for read operations.