Two-phase snap copy

A point in time copy of a data set is provided using a two-phase snapshot copy operation. When a write request is received, as part of the first phase, a chunk including the target location of the write request is determined. Using a “copy on first write” technique, the data at the target location is copied to a snap data area in an allocated data area that is the size of the chunk. A first map for the data set is updated to include up to three entries representing a mapping of the segment including the target location. A second map for the snap data area is updated to include a single entry for the copy of the data from the target location. As part of the second phase, the multiple entries in the first map are coalesced into a single entry after the remaining portions of the chunk are copied to the data area in the snap data area.

BACKGROUND OF THE INVENTION

1. Technical Field

This application relates to computer storage devices, and more particularly to the field of transferring data between storage devices.

2. Description of Related Art

Computer systems may include different resources used by one or more host processors. Resources and host processors in a computer system may be interconnected by one or more communication connections. These resources may include, for example, data storage devices such as the Symmetrix™ family of data storage systems manufactured by EMC Corporation. These data storage systems may be coupled to one or more host processors and provide storage services to each host processor. An example data storage system may include one or more data storage devices, such as those of the Symmetrix™ family, that are connected together and may be used to provide common data storage for one or more host processors in a computer system.

Host processor systems may store and retrieve data using a storage device containing a plurality of host interface units, disk drives, and disk interface units. Such storage devices are provided, for example, by EMC Corporation of Hopkinton, Mass. and disclosed in U.S. Pat. No. 5,206,939 to Yanai et al., U.S. Pat. No. 5,778,394 to Galtzur et al., U.S. Pat. No. 5,845,147 to Vishlitzky et al., and U.S. Pat. No. 5,857,208 to Ofek. The host systems access the storage device through a plurality of channels provided therewith. Host systems provide data and access control information through the channels to the storage device and storage device provides data to the host systems also through the channels. The host systems do not address the disk drives of the storage device directly, but rather, access what appears to the host systems as a plurality of logical disk units. The logical disk units may or may not correspond to the actual disk drives. Allowing multiple host systems to access the single storage device unit allows the host systems to share data stored therein.

A host may issue a request to make a point in time copy or “snapshot” of a data set, such as logical disk unit or file. One existing technique includes making a complete physical copy of the data included in the data set. In order to make a complete copy, no further data modification to the data set, such as in connection with a write operation, can be performed prior to copying the data in the data set to the snapshot copy. The foregoing may not be desirable for use in instances where the data set being copied may also be available on-line for use in connection with I/O operations prior to making a complete snapshot copy.

Another way of making a snapshot copy of a data set uses a “copy on first write” technique. In this technique, storage is allocated for use as a snap data area for storing the existing or old data. When a write request is received to modify a storage location in the data set, the existing data at the storage location to be modified is first read and copied into the snap data area. The existing data set is then updated in accordance with the write operation. One problem that may result with this technique is the fragmentation of the snap data area since storage is allocated and used in accordance with each write operation. It may be difficult to use an efficient coalescing technique where multiple snap data area entries associated with consecutively located data portions are combined into a single entry since this may require a large number of I/O operations. Additionally, data structures used in managing the allocation of the snap data area may be complex as a result of large numbers of I/O operations causing large numbers of snap data area entries.

Yet another technique may include initially allocating storage for an entire data volume or data set for which a point in time copy is being made in response to a request for a snapshot copy. However, allocating such large amounts of storage can cause inefficient use of space if snapshots are performed frequently.

Thus, it is desirable, in a number of circumstances, to use a technique for creating a point in time copy or snapshot of a data set that overcomes one or more drawbacks of the existing techniques. It is also desirable to use a technique that is space efficient, reduces fragmentation associated with storage areas and management data structures, and also has a low latency associated with an I/O operation.

SUMMARY OF THE INVENTION

In accordance with another aspect of the invention is a method for creating a point in time copy of a data set comprising: receiving a write request to modify a target location in a segment of said data set; allocating a portion in a data area, said portion being a size of said segment; updating a corresponding target location in said portion of said data area corresponding to said target location in said data set; and copying remaining areas of said segment included in said data set to said portion of said data area as part of a background copy operation while allowing I/O operations to said data set, said remaining areas being areas of said segment excluding said target location.

In accordance with yet another aspect of the invention is a computer program product for creating a point in time copy of a data set comprising code that: receives a write request to modify a target location in a segment of said data set; allocates a portion in a data area, said portion being a size of said segment; updates a corresponding target location in said portion of said data area corresponding to said target location in said data set; and copies remaining areas of said segment included in said data set to said portion of said data area as part of a background copy operation while allowing I/O operations to said data set, said remaining areas being areas of said segment excluding said target location.

DETAILED DESCRIPTION OF EMBODIMENTS

Referring now toFIG. 1, shown is an example of an embodiment of a computer system according to the present invention. The computer system10includes a data storage area12connected to host systems22a-22cthrough communication medium18. In this embodiment of the computer system10, the N hosts22a-22cmay access the data storage area12, for example, in performing input/output (I/O) operations or data requests. The communication medium18may be any one of a variety of networks or other type of communication connections as known to those skilled in the art. The communication medium18may be a network connection, bus, and/or other type of data link, such as a hardwire or other connections known in the art. For example, the communication medium18may be the Internet, an intranet, network or other connection(s) by which the host systems22a-22cmay access and communicate with the data storage area12, and may also communicate with each other and other components included in the computer system10.

Each of the host systems22a-22cand the data storage area12included in the computer system10may be connected to the communication medium18by any one of a variety of connections as may be provided and supported in accordance with the type of communication medium18. The processors included in the host computer systems22a-22cmay be any one of a variety of proprietary or commercially available single or multi-processor system, such as an Intel-based processor, IBM mainframe or other type of commercially available processor able to support incoming and outgoing traffic in accordance with each particular embodiment and application.

It should be noted that the particulars of the hardware and software included in each of the host systems22a-22cand the data storage area12are described herein in more detail, and may vary with each particular embodiment. Each of the host computers22a-22cmay all be located at the same physical site, or, alternatively, may also be located in different physical locations. Examples of the communication medium that may be used to provide the different types of connections between the host computer systems and the data storage area of the computer system10may use a variety of different communication protocols such as SCSI, ESCON, Fibre Channel, or GIGE (Gigabit Ethernet), and the like. Some or all of the connections by which the hosts and data storage area12may be connected to the communication medium18may pass through other communication devices, such as a Connectrix or other switching equipment that may exist such as a phone line, a repeater, a multiplexer or even a satellite.

Each of the host computer systems may perform different types of data operations in accordance with different types of administrative tasks. In the embodiment ofFIG. 1, any one of the host computers22a-22cmay issue a data request to the data storage area12to perform a data operation, such as a read or write operation.

Referring now toFIG. 2, shown is a diagram20illustrating additional detail of one embodiment of the system10ofFIG. 1. The plurality of hosts22a-22care coupled to a data storage system24. The data storage system24may be one of a plurality of data storage systems included in the data storage area12. The data storage system24includes an internal memory26that facilitates operation of the storage system24as described elsewhere herein. The data storage system also includes a plurality of host adaptors (HA's)28a-28cthat handle reading and writing of data between the hosts22a-22cand the storage system24. Although the diagram20shows each of the hosts22a-22ccoupled to each of the HA's28a-28c, it will be appreciated by one of ordinary skill in the art that one or more of the HA's28a-28cmay be coupled to other hosts.

The storage system24may include one or more RDF (Remote Data Facility) adapter units (RA's)32a-32c. The RA's32a-32care coupled to an RDF link34and are similar to the HA's28a-28c, but are used to transfer data between the storage system24and other storage system (not shown) that are also coupled to the RDF link34. The storage system24may also include one or more disks36a-36c, each containing a different portion of data stored on the storage device24. Each of the disks36a-36cmay be coupled to a corresponding disk adapter unit (DA)38a-38cthat provides data to a corresponding one of the disks36a-36cand receives data from a corresponding one of the disks36a-36c. Note that, in some embodiments, it is possible for more than one disk to be serviced by a DA and that it is possible for more than one DA to service a disk.

The logical storage space in the storage system24that corresponds to the disks36a-36cmay be subdivided into a plurality of volumes or logical devices. The logical devices may or may not correspond to the physical storage space of the disks36a-36c. Thus, for example, the disk36amay contain a plurality of logical devices or, alternatively, a single logical device could span both of the disks36a,36b. The hosts22a-22cmay be configured to access any combination of logical devices independent of the location of the logical devices on the disks36a-36c.

One or more internal logical data path(s) exist between the DA's38a-38c, the HA's28a-28c, the RA's32a-32c, and the memory26. In some embodiments, one or more internal busses and/or communication modules may be used. In some embodiments, the memory26may be used to facilitate data transferred between the DA's38a-38c, the HA's28a-28cand the RA's32a-32c. The memory26may contain tasks that are to be performed by one or more of the DA's38a-38c, the HA's28a-28cand the RA's32a-32c, and a cache for data fetched from one or more of the disks36a-36c.

The storage system24may be provided as a stand-alone device coupled to the hosts22a-22cas shown inFIG. 1or, alternatively, the storage device24may be part of a storage area network (SAN) that includes a plurality of other storage devices as well as routers, network connections, etc. The storage device may be coupled to a SAN fabric and/or be part of a SAN fabric.

Referring now toFIG. 3, a diagram50illustrates an embodiment of the storage system24where each of a plurality of directors52a-52care coupled to the memory26. Each of the directors52a-52crepresents one of the HA's28a-28c, RA's32a-32c, or DA's38a-38c. In an embodiment disclosed herein, there may be up to sixteen directors coupled to the memory26. Of course, for other embodiments, there may be a higher or lower maximum number of directors that may be used.

The diagram50also shows an optional communication module (CM)54that provides an alternative communication path between the directors52a-52c. Each of the directors52a-52cmay be coupled to the CM54so that any one of the directors52a-52cmay send a message and/or data to any other one of the directors52a-52cwithout needing to go through the memory26. The CM54may be implemented using conventional MUX/router technology where a sending one of the directors52a-52cprovides an appropriate address to cause a message and/or data to be received by an intended receiving one of the directors52a-52c.

Referring now toFIG. 4A, a diagram100illustrates a plurality of servers102a-102ncoupled to a storage routing infrastructure104, also referred to herein as an intelligent switch. An intelligent switch is comprised of one or more data path computing elements as well as switch-based communications routing hardware. The switch104is coupled to a plurality of storage systems106a-106n. One or more of the storage systems106a-106nmay be like the storage system24described above. Alternatively, it is possible that none of the storage systems106a-106nare like the storage system24described above. The system described herein contemplates an environment where all of the storage systems106a-106nare alike (homogenous) or an environment where some of the storage systems106a-106nare different (heterogeneous). The couplings between the servers102a-102n, the switch104, and the storage systems106a-106nmay be made in any appropriate fashion including (optionally) that one or more of the couplings is through one or more other devices (not shown) and/or through the Internet or some other network, of any size and configuration.

The intelligent switch104may be used to present to one or more of the servers102a-102none or more contiguous logical volumes or devices that correspond to storage on one or more of the storage devices106a-106n. The switch104maps logical storage space presented to the server102to actual storage space on the storage systems106a-106n. The storage space on the storage systems106a-106nfor any contiguous logical volume may or may not be contiguous. In addition, the storage space for any contiguous logical volume may or may not span more than one of the storage systems106a-106n. For any logical volume, each of the servers102a-102nis presented with a contiguous storage space irrespective of the mapping by the switch to the storage systems106a-106n.

The intelligent switch104may allow for dynamic remapping of logical volumes presented to the servers102a-102nduring operation so that the remapping is somewhat transparent to the servers102a-102n. Thus, for example, logical storage space x1-x2may be initially mapped to storage space y1-y2on the storage systems106a-106nand then may be remapped during operation to a different storage space y3-y4on the storage systems106a-106n. This remapping may occur many times. In addition, remapping may cause previously contiguous mapped space on the storage systems106a-106nto become noncontiguous or cause previously noncontiguous mapped space on the storage systems106a-106nto become contiguous. For example, logical storage space x1-x2may be initially mapped to storage space y1-y2on the storage systems106a-106nand may be remapped so that logical storage space x1-x1ais mapped to storage space y3-y4on the storage systems106a-106nwhile logical storage space x1a-x2is remapped to storage space y5-y6on the storage systems106a-106n, where y3-y4is not contiguous to y5-y6. After the remapping, the logical storage space x1-x2appears contiguous to one of more of the servers102a-102neven though the space x1-x2is mapped to noncontiguous spaces on the storage systems106a-106n.

It should be noted that the servers102a-102nmay correspond to one or more of the hosts previously described in connection withFIGS. 1 and 2. Additionally, an embodiment may include a different number of one or more hosts functioning as servers than as shown inFIG. 4A.

Referring now toFIG. 4B, shown is an example150of how the switch may be used in connection with representing the physical storage in accordance with the view point of a particular host. In the example150, included are two maps152and154. Map152may be used in representing the storage devices156a-156cto a first host. Map154may be used in representing the storage devices156a-156cto a second different host. The mapping may be performed using functionality included within an embodiment of the switch such that the hosts can communicate directly with the switch and have the data represented in accordance from the perspective of each host. It should be noted that the components and functionality for representing the physical storage in accordance with the view of a particular host may be extended to other embodiments and variations as will be appreciated by one of ordinary skill in the art, for example, as described in pending U.S. patent application Ser. No. 09/608,521, filed on Jun. 30, 2000, which is incorporated by reference herein. In the example150, each of the maps includes locations identified as A1, A2, and the like. Each of these locations may correspond, for example, to a logical unit or volume, or other element referenced by a host.

Referring now toFIG. 5, an embodiment of the switch104is shown in more detail where each of a plurality of input ports for the switch104has one of a plurality of local processor boards122a-122n. Each of the processor boards122a-122nincludes a respective on-board memory132a-132nfor local data storage thereon. Each of the processor boards122a-122nis coupled to a switch backplane136, that handles routing of data and connections between the input ports and the output ports of the switch104. The switch backplane136may be controlled by a backplane processor board138which includes memory142. In some embodiments, the memory142is local to the processor board138. In other embodiments, the memory142is global and thus accessible to one or more of the processor boards122a-122n.

It should be noted that althoughFIG. 5illustrates a single processor board associated with each port, an embodiment may also include other variations. For example, an embodiment may have multiple ports associated with a single one of processor boards122a-122n.

The switch backplane136acts as a multiplexer that makes connections between the ports according to configuration information provided by the backplane processor board138. In some embodiments, the memory142contains a switching table that controls mappings between input and output ports according to specific addresses provided at the input ports. The switch104may be implemented using off-the-shelf hardware provided by companies such as Brocade and Cisco.

An output port may be associated with each of the data storage systems or other components that may be coupled to the servers via the switch104. In one embodiment, the switch may couple the servers to one or more primary data storage systems, and one or more other data storage systems used to store a snapshot or point in time copy of data sets included in the primary data storage systems.

Referring now toFIG. 6, shown is an example of an embodiment200of components that may be included in a system providing for a point in time copy or snapshot of a data set. It should be noted that the components included in200may be characterized as a more detailed description of components that may be included in an embodiment of the system10previously described in connection withFIG. 1. The components of200include servers102athrough102n, a switch104, a primary storage204and a snap data area storage206. Each of the servers102athrough102nis described elsewhere herein in more detail. Similarly, components within the embodiment of the switch104are also described elsewhere herein.

It should be noted that other components may be included in a system than as shown herein. The particular components and details included inFIG. 6are for the purpose of illustrating the techniques of a snapshot or point in time copy of a data set.

The primary storage204may correspond to one or more data storage systems or devices included therein as described elsewhere herein connected to the switch104. Similarly, the snap data area storage206may correspond to one or more data storage systems or devices included therein as described elsewhere herein. The primary storage204in this example is used for storing the actual data or a primary copy of the data. Data modifications, such as by an application executing on one or more of the servers102a-102n, are performed to the data included in the primary storage. The snap data area storage206in this example is used in connection with storing a snapshot or point in time copy of the primary storage204with respect to a particular point-in-time of the primary storage204. Described in following paragraphs are different techniques that may be used in connection with creating a point in time copy of data from the primary storage in the snap data area's storage.

In operation, each of the servers may perform a write operation to the primary storage204. Each of the write operations is received at the switch104through one of the ports226a-226n. Using a map as stored in the switch104, a server's I/O request is mapped to one of the output ports. It should be noted that maps may be used, as described previously in connection withFIG. 4B, to provide a virtualization or mapping to a server. In other words, metadata may be characterized as describing the relationship between storage elements of the backend storage areas (such as storage areas204and206) and the volumes presented to the front end hosts or servers.

One of the servers may issue a command, for example, requesting creation of a snapshot or point in time copy of a data set of the primary storage204at a first point in time in accordance with the requesting server's map. Subsequent write operations are made with respect to this first point in time copy of the data using the snap data area and a two-phase snap copy technique described in following paragraphs.

In following paragraphs,FIGS. 7 and 8illustrate a first phase of the snap copy technique, andFIG. 9illustrates the second phase of the snap copy technique in one embodiment.

Referring now toFIG. 7, shown is an example of data maps used in connection with creating a snapshot copy of a data set using a snap data area. Included inFIG. 7is a data set map302and a snap data area map304. Maps302and304may be stored and used within the switch as described elsewhere herein in connection with other figures to provide a virtualization or data view point to a particular server. In this example, the data set map302may be used in connection with mapping a data set including A1to a particular data storage device320. Similarly, a snap data area map304in this example may be used in mapping particular entries within the map304to one or more devices322(or portions thereof) of the snap data area.

The map302may be used in mapping a data set included in primary storage. The map304may be used in mapping a snapshot copy of the data set using the snap data area and its associated data storage area. It should be noted that this example only shows data for the data set as residing a single device. However, as will be appreciated by one of ordinary skill in the art, the technique described herein may be used with making a snapshot copy of a data set residing on multiple devices, or portions thereof.

In the technique described in following paragraphs, when there is a write to a portion of a data set, such as within the data set as mapped by the map302, a copy of the old data which is at the target location of the write operation is made within the snap data area prior to writing out the new data associated with the write I/O request. This is performed in connection with the first phase of the snap two phase copy technique.

In this example, data associated with the data set as mapped by data set map302is divided into chunks. When a write request is received, such as a write to a portion of X1, it is determined which chunk includes the target of the write operation request. For example, with a write request to a data area X1, the chunk A1includes the target of the write operation, X1. As will be described in connection with the following steps, the size of the chunk may vary in accordance with an embodiment. Generally, the size of the chunk may be a fixed size, a fixed parameter, a variable parameter, or even a dynamically varied parameter that may be set in any one of a variety of ways in an embodiment. The chunk size may be characterized as moderately large in connection with the size of the data portions that are used in connection with performing an I/O request for a copy on first write associated with a data set in which data is transferred between data storage devices.

It should be noted that a I/O operation, as received from a user on a host or server, may span more than one chunk depending on the address and size of the I/O operation.

Once the particular chunk or chunks which include the target of the write operation is determined, the data stored at the target location of the write request is read from the data storage device. In this example, the data stored at location X1324which is the target of the write operation is read from the data storage device320. A portion of storage within the snap data area is allocated. In this example, storage portions within the snap data area are allocated in an amount equal to the size of a chunk. As part of the first phase of the two phase snap copy operation described herein, the old data, such as the data from area324of the data set device320, is read and written to the snap data area in area326. An entry308is made in the snap data area map304indicating that area X1is located within the snap data area as illustrated inFIG. 7at a particular offset location within the allocated chunk A1copy.

It should be noted that, although not explicitly stated in processing steps described herein, one of ordinary skill in the art will appreciate that any one of a variety of locking mechanisms may be used in connection with performing synchronization techniques as needed when accessing shared resources such as the data set map302, the snap data area map304, the data set device320, and the device(s)322for the snap data area. As such, the particular steps of locking and unlocking shared resources, for example, are not mentioned herein with processing steps in connection with performing the two phase snap copy although they may be performed as needed in accordance with ensuring proper synchronization of shared resources within an embodiment. Additionally, the particular granularity with which a resource is locked may vary in accordance with each embodiment.

Referring now toFIG. 8, shown is an illustration350continuing processing associated with the first phase of the two phase snap copy operation described herein.

Included in the data set map302as part of the first phase of the snap copy operation, three map entries are created in this example as a result of the write operation request. A single map entry306bcorresponds to the mapping for the data area X1associated with the write request operation. Additionally, a map entry306a(front) is associated with the data portion included in the chunk A1which precedes location X1denoted as front in this example. A map entry306cis also created for the data portion denoted following X1(end) which is the object of the write request operation. The new data is then written to area X1324on data set device320. Additionally, the data set map entry306bhas an indicator, such as a bit flag, set to indicate that the data portion associated with the map entry306bhas been modified with respect to a point in time copy. Through the use of this bit flag and the snap data area map304, for example, if a server requests data associated with the point in time copy version of data portion X1, the data set map entry306bhas an indicator of “modified” which directs the I/O request to the snap data area map.

It should be noted that any one of a variety of different techniques may be used in connection with implementation of a modification indicator such as the bit flag described above to identify “dirty” segments. In this embodiment, a data chunk may be characterized as “dirty” (i.e., has been modified such as by a write operation) with respect to the original point in time copy. An embodiment, for example, may store a bit flag with each entry, in a separate data structure such as a bitmap including dirty indicators for all map entries, or using other techniques known to those of ordinary skill in the art.

At this point, a response may be sent back to the client, such as the server or host system, which initiated the write request. The response may indicate the results of the I/O request completing with any additional status information in accordance with the particular write operation request. Also, after the first phase has completed so that the requested I/O for the write operation has been copied to the snap data area, I/O operations to the data set may resume. An embodiment may allow ongoing I/O operations during the first phase as well provided that access to shared resources is synchronized.

It should be noted that in this example, there are three data map entries created in the data set map302for a single write request. Depending on the particular write request and associated target location less than three entries may be created in the map302. As described herein, map entries are created for any portion of a chunk A1preceding location X1and also following X1. In the event that the I/O request has a target location such as X1which is at the beginning or at the ending boundary of a chunk, there may be no preceding (Front) or ending (end) data segment, respectively, as described herein. The foregoing results in using two (or one) map entries, as opposed to the three map entries, illustrated in the particular example350ofFIG. 8.

A second phase of the snap copy operation may be performed while allowing online access to the data set. During the second phase described in following paragraphs, the remaining portions of the chunk to which the write operation has been performed may be copied as part of a background copy operation. With reference to the previous example, the chunk is A1. A portion, X1, of the chunk, A1, was the target of a write operation. As part of the background copy task associated with the second phase of the two phase snap copy operation, any remaining data preceding portion X1(front) and following X1(end) which is also included in the chunk A1is copied to the snap data area.

In connection with the foregoing, a chunk area is initially allocated. Not all portions of the chunk in the snap data area may be immediately used for the storing remaining chunk portions. As described above, a first portion may be initially copied to the snap data are where the first portion is associated with the target write operation. The remaining front and/or end portions of the associated chunk may be copied by a background copy task at a later time as described above. At any point in time, the currently unused portions of the chunk area allocated in the snap data area (e.g., front and/or end portions) may be used for other purposes when not in use for the point in time copy as described herein. The currently unused portions of the chunk area may used for other purposes, and then returned for use in connection with the techniques described herein when the copy task, for example, actually performs the copy of the remaining front and/or end portions. The foregoing may provide for more efficient use of allocated memory and storage in an embodiment.

Referring now toFIG. 9, shown is an illustration of the second phase of the two phase snap copy operation described herein.

Any write operations to the chunk A1are held, for example, in a queue and not allowed to begin in order to allow exclusive access as needed to the data set map302and the associated storage locations on device320. Additionally, an embodiment may ensure that any existing I/Os or writes in progress to A1have been drained and completed prior to continuing with the second phase of the snap copy operation.

In one embodiment, the background copy operation may be characterized as a proactive copy operation where the front-end portions of the chunk are proactively copied in the background after completion of the first phase. The copying of the remaining portions of the chunk is indicated by the associated arrows402a(copy front portion) and402b(copy end portion) inFIG. 9. Once the background copy is complete, the map entry308in the snap data area map304is updated to indicate that the entire chunk A1is now stored in the snap data area. Additionally, data set map302is updated such that the previously associated three map entries in this example are now coalesced into a single map entry306for the entire chunk A1. The modified bit within the entry306is also set to indicate that the A1associated with map entry306has been modified with respect to the point in time copy as maintained by the snap data area map304. In the event that an I/O request is made to access the chunk A1, or any portion thereof, in the point in time copy, the data set map302refers the I/O request, through the use of the modified bit setting, to the snap data area map304to retrieve the appropriate data associated with the point in time copy.

What has been described in connection with the second phase may be characterized as a proactive case. It should be noted that an embodiment may include variations associated with how and when the second phase of the snap copy operation may be performed. For example, an embodiment may perform a variation of the second phase of the snap copy operation that may be characterized as an opportunistic approach. Using the opportunistic approach, additional write operations are allowed to proceed to the data set in accordance with the requests such as those made by an application on the server prior to performing the second phase. After a specified time period, the chunk may be examined to determine how much of the data associated with a particular chunk has already been copied to the snap data area as a result of I/O operations. When a threshold amount of the chunk has been copied as a result of write operations since the first phase has completed, the remaining portions of the chunk may be copied as part of a background copy operation. The specified time period as well as the particular threshold amount of a chunk that is copied prior to performing the background copy operation of remaining portions of a chunk may vary in accordance with each embodiment.

What will now be described in connection withFIGS. 10 and 11are flowcharts summarizing the processing steps just described herein in connection with performing the two phase snap copy operation.

Referring now toFIG. 10, shown is a flowchart500of processing steps that may be performed in one embodiment in connection with the first phase of the two phase snap copy operation. At step502, a write request is received by the switch, such as in connection with performing an I/O operation by an application on a server or host system. At step504, the particular chunk including the target area of the write request is determined. At step506, the existing or old data stored at the data location which is the target of the write operation request is read. At step508, a map entry is created in the snap data area map for the old data. At step509, storage is allocated in the snap data area in portions that are the size of the chunk. At step510, the old data from the target location of the I/O operation is copied to the snap data area within the storage region allocated at step509. At step512, the data set map is updated to have multiple map entries (e.g., one, two or three) corresponding to the target data portion which is the target of the I/O request as well as any preceding and subsequent data portions with respect to the target location of the write request received at step502. The map entries in total associated with step512map the entire chunk including the target storage location associated with the write request received at step502. As described elsewhere herein, it should be noted that step512may include alternately two or three entries depending on the location of the storage address associated with the write request and its location within the chunk. As part of step512processing, the map entry associated with the target location of the write operation has its modified indicator set. At step514, the new data associated with the write request received at step502is copied to the data set completing the I/O operation. At step516, a response is sent to the client, such as the server or host which requested the initial I/O operation received at step502.

Referring now toFIG. 11, shown is a flowchart600of processing steps summarizing the second phase of the two phase snap copy operation described herein. At step604, the background copy operation of the front and end portions for the chunk is performed copying the front and end portions of the chunk of data to the snap data area. It should be noted that an embodiment may use a background copy task that further partitions each of the front and end portions, and copies each partition at various points in time. While each partition is copied, write operations corresponding to the partition are held or buffered and not allowed to commence. The held write operations are allowed to proceed after copying of the associated partition is complete. The background copy task may copy partitions of a size that may vary with each embodiment. At step606, the snap data area map is accordingly updated. At step608, the data set map is accordingly updated to have a single coalesced entry corresponding to the chunk with the modified indicator set.

As described elsewhere herein, it should be noted that additional steps may be performed in an embodiment prior to performing a second phase of the snap copy operation, such as, for example, in connection with the opportunistic approach described above. In connection with the opportunistic approach, the processing associated with flowchart600may be triggered or signaled when a particular threshold percentage of a data segment is written to with respect to a point in time copy.

It should be noted that the size of the actual chunk as well as other parameters used in processing steps herein may vary in accordance with each embodiment. For example, in one embodiment, I/O operations associated with the snap copy on first write may be performed in portions which may be, for example, 64K bytes. Independent of the size of a target of a write operation, data may be transferred from devices in these 64K byte portions. Accordingly, an embodiment may choose a chunk size which is a multiple of the 64K byte size. In one embodiment, the size of the chunk may be tuned in accordance with a system's performance such as, for example, the frequency of I/O operations, the size of the maps, and the like.

In accordance with the opportunistic approach, the particular data that is actually background copied depends on the amount of data that has been transferred to the snap data area already as a result of performing write operations. Associated with the opportunistic approach and the second phase of the snap copy operation, a background copy operation may be performed when the map is a threshold percentage or amount full based on the subsequent writes performed since a point in time copy request has been issued.

It should be noted that the processing steps associated with the two phase snap copy operation may be performed by code included within the switch in an embodiment. The code may include, for example, machine executable instructions which are stored within the switch104and may be executed by one or more processors also included within the switch104. In one embodiment, the processing steps ofFIGS. 11 and 12may be performed using instructions stored within hardware and/or software within the switch104.

It should be noted, however, that although particular embodiments have been described herein such as in connection with using a switched fabric environment with the switch104, the techniques described herein may also be used in connection with other embodiments as will be appreciated by one of ordinary skill in the art.

The foregoing describes an embodiment using a two-phase snap copy operation in which the original version is copied to the snap data area and then the original is overwritten. The techniques described herein may also be used in connection with a two-phase snap copy operation in which the new write data or updated version of a data set is stored in the snap data area and the original source location is maintained as the point in time copy. Subsequent writes occur to the snap data area in this alternate embodiment.

Using the foregoing techniques, described is an embodiment which provides for an efficient allocation of storage within the snap data area as well as minimizing fragmentation of maps used in managing the snap data area and data set. The foregoing performs a two phase copy technique which efficiently provides for returning a response to a requesting host or server making a write request and subsequently copying remaining portions of data associated with a chunk. The foregoing describes a unique allocation of tasks and division of labor into two phases which provides for a sufficiently low latency I/O request response to a server system. Additionally, in connection with performing the copy on write as part of the first phase, when a write request is received on one of the input ports of the switch, the current value of the data prior to applying the data modification for the write request is copied into the snap data area. In order to have a snapshot copy of the data using the techniques described herein, prior to performing a write operation to a portion of data includes first performing a read of the data and copying the data to the snap data area prior to performing the write operation. In effect, a set of write operations are inserted into the processing when performing a write request where the read operation reads the old data from the primary storage, stores it in the snap data area, and subsequently writes out the modified data to the physical storage in accordance with the write request received. Using this technique, the amount of storage required for a snapshot copy may be minimized in that an entire copy of the primary storage is not required to be maintained. The two phases of the copy technique described herein provide benefits. First, the technique efficiently manages map resources in the embodiment described herein using an intelligent switch or other storage routing infrastructure. This makes using multiple snapshots more readily feasible in this particular embodiment.

While the invention has been disclosed in connection with various embodiments, modifications thereon will be readily apparent to those skilled in the art. Accordingly, the spirit and scope of the invention is set forth in the following claims.