Method, device and computer program product for writing data
By using indicators to write directly to the target storage area during data copying, the problems of low write performance and short source storage area life in traditional methods are solved, and more efficient data copying and longer storage area life are achieved.
Patent Information
- Application Number
- CN202210684044.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-01-18
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2038-01-18
AI Technical Summary
Traditional data copying methods require writing data to the source storage area and the target storage area simultaneously during copying, resulting in poor write performance and reducing the service life of the source storage area.
By setting an indicator during data copying, the data to be written is written directly to the target storage area without writing to the source storage area, the indicator is updated to identify that the data is written by the write request during copying.
Improves write performance during data copying and extends the service life of the source storage area.
Smart Images

Figure CN115098021B_ABST
Abstract
Description
[0001] Divisional Application Instructions
[0002] This application is a divisional application of the invention patent application with the application date of January 18, 2018, the Chinese national application number 201810049266.3, and the invention name “Method, device and computer program product for writing data”. Technical Field
[0003] Embodiments of the present disclosure generally relate to the field of data storage, and more particularly to methods, devices, and computer program products for writing data. Background Art
[0004] Data copy refers to copying data from one storage area to another storage area, which is usually used for data transfer or backup. Generally speaking, the data copy operation has a basic operation unit, also known as the copy granularity. For example, the storage area is divided into multiple storage blocks of the same size, and the size of each storage block can be regarded as the granularity of data copy. During data copy, for each copy operation, the data in one storage block, such as one data block, is copied.
[0005] Redundant Array of Independent Disks (RAID) is a data backup technology that can combine multiple independent physical disks in different ways to form a disk array (i.e., logical disk), thereby providing higher storage performance and higher reliability than a single disk. In order to recover data when a disk in the RAID fails, a parity information block (such as RAID 5) or multiple parity information blocks (such as RAID 6) are usually set in the RAID. Summary of the invention
[0006] Embodiments of the present disclosure provide a method, an apparatus, and a computer program product for writing data.
[0007] In one aspect of the present disclosure, a method for writing data is provided. The method includes: receiving a write request for a first storage block in the source storage area during copying of first data from a source storage area to a target storage area; writing second data associated with the write request in a second storage block in the target storage area, wherein the second storage block corresponds to the first storage block; and updating an indicator associated with the first storage block, wherein the indicator indicates that the second data is written by the write request during the copying.
[0008] In another aspect of the present disclosure, a device for writing data is provided. The device includes a processing unit and a memory, wherein the memory is coupled to the processing unit and stores instructions. The instructions perform the following actions when executed by the processing unit: during the copying of first data from a source storage area to a target storage area, receiving a write request for a first storage block in the source storage area; writing second data associated with the write request in a second storage block in the target storage area, wherein the second storage block corresponds to the first storage block; and updating an indicator associated with the first storage block, wherein the indicator indicates that the second data is written by the write request during the copying.
[0009] In yet another aspect of the present disclosure, a computer program product is provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, which, when executed, cause a computer to perform a method or process according to an embodiment of the present disclosure.
[0010] This summary is provided to introduce a selection of concepts in a simplified form, which are further described in the detailed description below. This summary is not intended to identify key features or essential features of the disclosure, nor is it intended to limit the scope of the various embodiments of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The above and other objects, features and advantages of the present disclosure will become more apparent through a more detailed description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, wherein like reference numerals generally represent like elements throughout the exemplary embodiments of the present disclosure.
[0012] Figure 1 A schematic diagram showing an example environment for writing data during copying according to an embodiment of the present disclosure;
[0013] Figure 2 A flow chart of a method for writing data during copying according to an embodiment of the present disclosure is shown;
[0014] Figure 3 A schematic diagram showing an example environment for writing data before a checkpoint according to an embodiment of the present disclosure;
[0015] Figure 4 A schematic diagram showing an example environment for writing data after a checkpoint according to an embodiment of the present disclosure;
[0016] Figure 5 A flow chart of a method for reading data during copying according to an embodiment of the present disclosure is shown;
[0017] Figure 6A flowchart of a method for handling failures during copying according to an embodiment of the present disclosure is shown;
[0018] Figure 7 A schematic diagram showing an exemplary architecture of a mapped RAID according to an embodiment of the present disclosure;
[0019] Figure 8 A schematic diagram showing reconstruction of a failed disk in a mapped RAID according to an embodiment of the present disclosure; and
[0020] Fig. 9 A schematic block diagram of a device that can be used to implement an embodiment of the present disclosure is shown. Specific embodiments
[0021] The preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some specific embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0022] As used herein, the term "including" and its variations mean open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "based at least in part on". The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one other embodiment". The terms "first", "second", etc. may refer to different or identical objects unless explicitly indicated to be different. The term "storage area" means a non-volatile memory that permanently stores data, such as a disk. Examples of disks include, but are not limited to, hard disk drives (HDDs), optical disk drives, and solid-state disks (SSDs).
[0023] Traditionally, during data copying, when a write request for data is received, the checkpoint of the copy (i.e., the progress of the copy operation) is usually not considered. Therefore, the traditional method will write data to both the source storage area and the target storage area. For a read request, if the data in the storage block before the checkpoint is to be read, it can be read from the source storage area or the target storage area; and if the data in the storage block after the checkpoint is to be read, it can only be read from the source storage area. However, since the traditional method needs to write data to both the source storage area and the target storage area, it needs to write double data and spend more time, thereby affecting the write performance of the storage system. In addition, since the data needs to be written to the source storage area, too much writing will reduce the service life of the source storage area.
[0024] The embodiment of the present disclosure proposes a scheme for writing data during copying. According to the embodiment of the present disclosure, by setting an indicator indicating whether a storage block receives a write request during data copying, the data to be written can be directly written to the target storage area without being written to the source storage area. Therefore, the embodiment of the present disclosure can not only improve the write performance during data copying, but also extend the service life of the source storage area.
[0025] In addition, the embodiments of the present disclosure can effectively perform data writing during copying by comparing the storage block location of the data to be written and the checkpoint. At the same time, the embodiments of the present disclosure provide a fault handling method during copying, which can handle the failure of the processor and the storage area, thereby ensuring the correctness and integrity of the data. In addition, since there is a large demand for data copying in the mapping RAID, the method of the embodiments of the present disclosure is suitable for the scenarios of disk replacement and disk addition in the mapping RAID, thereby improving the performance of the mapping RAID.
[0026] The following references Figures 1 to 9 It should be understood that these exemplary embodiments are provided only to enable those skilled in the art to better understand and implement the embodiments of the present disclosure, and are not intended to limit the scope of the present disclosure in any way.
[0027] Figure 1 FIG. 1 is a schematic diagram of an example environment 100 for writing data during copying according to an embodiment of the present disclosure. Figure 1 As shown, the environment 100 includes a source storage area 110 and a target storage area 120. The source storage area 110 and the target storage area 120 can be various persistent data storage devices, such as hard disk drives (HDDs), solid state drives (SSDs), etc. The source storage area 110 and the target storage area 120 are usually divided into storage blocks of multiple sizes, and the size of each storage block can be the same, thereby forming the basic copy unit of the storage area, that is, the granularity. For each copy operation, the data in a storage block can be copied. Figure 1 As shown, the source storage area 110 includes storage blocks 111, 112, 113, 114, 115, 116, etc., and the target storage area 120 includes storage blocks 121, 122, 123, 124, 125, 126, etc.
[0028] like Figure 1As shown, the environment 100 also includes an indicator set 130, which includes a plurality of indicators 131, 132, 133, 134, 135, 136, etc., each indicator being used to indicate whether the corresponding storage block receives a write request during the copy. For example, the indicator 132 is used to indicate whether the storage block 112 in the source storage area 110 receives a write request during the copy. In some embodiments, for example, an indicator value of 0 indicates that no write request is received during the copy, and an indicator value of 1 indicates that a write request is received during the copy. It should be understood that although 0 and 1 are used as exemplary forms of indicator values, other values or representations are also possible. As shown in FIG. Figure 1 As shown, the indicator set 130 can be represented as {000000 ...}, which can also be called a write IO bitmap. In some embodiments, the indicator set 130 can be stored only in the cache, without being stored in the disk, and can be deleted after the copy operation is completed. By using indicators, the source storage area can keep the original data, while the target storage area can keep the newer data.
[0029] As shown in the environment 100, data is being copied from the source storage area 110 to the target storage area 120. As shown by the arrow 140, the data in the storage block 113 is currently being copied, that is, the data in the storage block 113 is copied to the storage block 123. At this time, the checkpoint 150 can be at the end of the storage block 130, which indicates the progress of the copy, that is, the position where the next copy operation will start, and the checkpoint 150 will move forward as the copy proceeds. Since the storage blocks in the source storage area 110 and the storage blocks in the target storage area 120 have a correspondence, the indicators in the indicator set 130 can also be mapped to the corresponding storage blocks in the target storage area 120 when indicating the storage blocks in the source storage area 110.
[0030] In some embodiments, copy metadata may also be stored at the end of a storage area (e.g., a disk area) to indicate whether the data in each storage block has been copied. For example, 1 may be used to indicate that the copy of a storage block has been completed, and 0 may be used to indicate that the copy of the storage block has not been completed. It should be understood that since the copy metadata is stored in the disk area, it can be stored persistently.
[0031] During the data copying from the source storage area to the target storage area, write requests and read requests for the source storage area may continue to be received. According to an embodiment of the present disclosure, by setting an indicator indicating whether the storage block receives a write request during the data copying, the data to be written for the source storage area will be directly written to the target storage area, and will not be written to the source storage area. Therefore, the embodiment of the present disclosure can reduce the data writing time during the data copying, and can also extend the service life of the source storage area.
[0032] Figure 2 A flow chart of a method 200 for writing data during copying according to an embodiment of the present disclosure is shown. For example, the method 200 may be performed by a processor in a storage system. At 202, during the copying of first data from a source storage area to a target storage area, a write request for a first storage block in the source storage area is received. For example, during the copying of data from a source storage area 110 (source disk) to a target storage area 120 (target disk) in a RAID, a write request for storage block 112 is received. Generally speaking, when a source storage area (such as a source disk) is to be replaced with a target storage area or a target storage area (such as a target disk) is to be added in a RAID, it is usually necessary to perform a data copy from the source storage area to the target storage area.
[0033] In some embodiments, data can be copied using a mirroring reconstruction method, that is, reading data from a source storage area and reconstructing the data on a target storage area. In addition, during the copying process, the copy metadata and copy checkpoints can be updated accordingly, and the copy operation is marked as completed after all copies are completed. In some embodiments, a lock can be set for a write operation so that two or more write operations cannot be performed on the same storage block.
[0034] At 204, second data associated with the write request is written in a second storage block of the target storage area, wherein the second storage block corresponds to the first storage block. For example, when a write request for the storage block 112 in the source storage area 110 is received, the data to be written is directly written to the storage block 122 in the target storage area 120 without writing the write data to the storage block 112. It should be understood that the second storage block may be a destination storage block to which the data in the first storage block is to be copied.
[0035] In some embodiments, the data to be written may be written based on the checkpoint 150 and the location of the storage block targeted by the write request. For example, depending on the range of the storage blocks involved in the data to be written, the data to be written may be written directly to the target storage area, or the data of the corresponding storage block may be read from the source storage area and the original data may be updated with the data to be written, and then the updated data may be written in the target storage area, as described below. Figure 3 and Figure 4 An example implementation of writing data based on checkpoints is described.
[0036] At 206, an indicator associated with the first storage block is updated, wherein the indicator indicates that the second data is written by the write request during the copying period. For example, while or after the second data is written in the second storage block 122, the indicator of the storage block 112 may be updated, for example, its indicator value is changed from 0 to 1 to indicate that the storage block 112 received the write request during the copying period. In some embodiments, the indicators in the indicator set 130 may be synchronized in the caches of multiple processors, and the status of the write request is returned after the synchronization of the indicators is completed.
[0037] In some embodiments, the basic unit size of the written data may be equal to the size of each storage block (i.e., the basic unit of the copied data), in which case one storage block corresponds to one indicator. Alternatively, the basic unit size of the written data may be smaller than the size of each storage block, for example, it may be half (e.g., 512KB) of the size of each storage block (e.g., 1MB), in which case one storage block may correspond to two indicators, for example, the first indicator is used to indicate whether the first half of the storage block receives a write request during the copy, and the second indicator is used to indicate whether the second half of the storage block receives a write request during the copy.
[0038] It should be understood that although the method 200 may be described with reference to RAID, the method 200 may be applied to various data copying scenarios, not limited to RAID. Therefore, according to an embodiment of the present disclosure, during the data copying between two storage areas, the data to be written for the source storage area will be directly written to the target storage area, and an indicator is used to indicate whether a certain storage block receives a write request during the copying, thereby improving the write performance during the data copying and extending the service life of the source storage area.
[0039] Figure 3 FIG. 3 is a schematic diagram of an example environment 300 for writing data before a checkpoint according to an embodiment of the present disclosure. Figure 1 Compared with the environment 100, Figure 3 In the environment 300, a write request for the storage block 112 is being received. Since the location of the storage block 112 is before the checkpoint 150, the data blocks therein have been copied to the storage block 122 in the corresponding target storage area 120. Therefore, according to the embodiment of the present disclosure, the data to be written (the data associated with the write request) is directly written to the storage block 122, and the value in the corresponding indicator 132 is updated, for example, the value of the indicator 132 is updated from 0 to 1.
[0040] It should be understood that Figure 3In the environment 300, even if the data to be written only involves a part of the storage block 112, since the storage block 122 already includes all the original data, it is still only necessary to write the data to be written directly into the storage block 122 to replace a part of it. In some embodiments, if the write request involves multiple storage blocks before the checkpoint 150, it is necessary to update multiple indicators associated with the multiple storage blocks, and synchronize the updated indicators to the cache of the peer processor. In this way, the write operation to the storage block in the source storage area can be avoided.
[0041] Figure 4 FIG. 4 is a schematic diagram of an example environment 400 for writing data after a checkpoint according to an embodiment of the present disclosure. Figure 3 Compared to the described environment 300, Figure 4 The storage block involved in the write request received in the environment 400 is after the checkpoint. Figure 4 As shown, as the copying progresses, the position of the checkpoint 150 moves from after the storage block 113 to after the storage block 114, indicating that the data block in the storage block 113 has been copied, and the data in the storage block 114 is currently being copied to the storage block 124.
[0042] Continue to refer Figure 4 For example, at a certain moment, a write request for storage block 115 is received in environment 400. Since the location of storage block 115 is after checkpoint 150, the data in storage block 115 has not yet been copied to storage block 125. At this time, data needs to be written according to the range involved in the data to be written. This is because the granularity of data copy in the storage system is a single data block.
[0043] In some embodiments, when the data to be written involves the entire storage block 115, the data to be written can be directly written into the storage block 125. In some embodiments, when the data to be written involves only a portion of the storage block 115 (i.e., the data associated with the write request does not match the size of the individual storage block), the storage block 115 is read from the source storage area 110, the data at the corresponding position in the storage block 115 is updated with the data to be written to generate updated data, and then the updated data is written into the storage block 125. In other words, since the checkpoint is before the storage block 115, there is no data in the storage block 125. If only the data to be written is written into the storage block 125, it only occupies a portion of the storage block 125 instead of the entirety, and the data copy is based on the storage block granularity, so in the subsequent copy process, when the data block in the storage block 115 is copied to the storage block 125, the data previously written into the storage block 125 will be overwritten. Therefore, when the data to be written involves only a portion of the storage block 115, the data in the storage block needs to be read from the source storage area.
[0044] According to an embodiment of the present disclosure, the data in the storage block 115 is updated with the data to be written, and then the updated data is written to the storage block 125, thereby simultaneously implementing the copy of the storage block 115 and the writing of data to the storage block 115. In addition, after the copy, update, and write operations are completed, the copy metadata of the storage block 115 can be marked as copied, and the indicator 135 can be updated to indicate that a write request has been received.
[0045] Figure 5 1 shows a flow chart of a method 500 for reading data during copying according to an embodiment of the present disclosure. For example, the method 500 may be executed by a processor in a storage system. It should be understood that the method 500 may be executed in reference to Figure 2 The method 500 described above may be executed before or after the method 200 described above, or may be executed simultaneously with the method 200. Since an indicator is used to indicate whether each storage block receives a write request during the copying period, the operation of the read request for the source storage area also changes accordingly. It should be understood that the method 500 is a method for reading data during the copying period, and before the copying starts, the data can be directly read from the source storage area; after the copying is completed, the data can be directly read from the target storage area.
[0046] At 502, during the copying process, a read request for a source storage area is received. At 504, it is determined whether the read request involves multiple storage blocks (i.e., whether it crosses the boundary of an individual storage block). At 506, if the read request does not involve multiple storage blocks, i.e., only involves a single storage block or a portion thereof, it can be determined based on the indicator whether there is data to be read in the target storage area (i.e., data associated with the read request). In some embodiments, if there is data to be read in the target storage area, the data can be read from the target storage area; otherwise, the data can be read from the source storage area. For example, referring to Figure 3 In the described environment 300 , if a read request for a storage block 112 is received, data should be read from the corresponding storage block 122 in the target storage area 120 because the indicator indicates that the target storage area 120 includes newly written data while the source storage area 110 only has original data.
[0047] If the read request involves multiple storage blocks, it can be determined whether the target storage area has data to be read at 508. If the target storage area does not have data to be read, then data is read from the source storage area at 510. If the target storage area has data to be read, then it is determined at 512 whether the target storage area has the entire data to be read or only a portion of the data to be read.
[0048] If the target storage area only has a portion of the data to be read, then at 514, a portion of the data is read from the target storage area, and at 516, the remaining data is read from the source storage area. Figure 4 In the described example, if a request for both storage blocks 115 and 116 is received, it can be determined based on the checkpoint, the copy metadata, and the indicator that only a portion of the data to be read exists in the target storage area, that is, only the corresponding data in storage block 115 exists, but not the corresponding data in storage block 116. Therefore, according to an embodiment of the present disclosure, data in storage block 125 can be read from target storage area 120, while data in storage block 116 can be read from source storage area 110. If the target storage area has the entirety of the data to be read, then at 518, the data can be directly read from the target storage area.
[0049] According to an embodiment of the present disclosure, for each individual storage block, if its indicator indicates that there is a write request during the copying period, the data is directly read from the target storage area. If the indicator of the individual storage block indicates that there is no write request during the copying period, it is determined whether the storage block is before or after the checkpoint. If it is before the checkpoint, the data is read from the source storage area; if it is after the checkpoint, the data is read from the target storage area. Therefore, in an embodiment of the present disclosure, when a read request is received during the data copying period, different reading methods can be used based on the number of storage blocks involved in the read request, the location of the storage blocks involved, and the checkpoint. Therefore, even if only the data during the copying period is written to the target storage area, it is still possible to ensure that the data is effectively read, thereby improving the IO performance of the storage system.
[0050] Figure 6 600 is a flowchart of a method 600 for handling failures during copying according to an embodiment of the present disclosure. For example, the method 600 may be executed by a processor in a storage system. The method 600 may be executed in reference to Figure 2 The described method 200 is performed before or after, or simultaneously with the method 200. In an active-active storage system, there are usually two processors, which form an active-active mode, that is, both processors can perform control operations.
[0051] At 602, a copy operation is performed by a first processor (also referred to as "primary memory"), and during the copy, an indicator is synchronized between the first processor and a second processor (also referred to as "secondary memory"), so that the indicator can be synchronized between the two processors in real time. In some embodiments, the indicator is only stored in the cache of the processor and is not stored in a persistent storage device (e.g., a disk). At 604, it is determined whether the first processor fails during the copy. If the first processor does not fail during the copy, the copy operation is continued by the first processor at 606, and the indicator is deleted after the copy is completed.
[0052] If the first processor fails during the copying process, then at 608, it is further determined whether the second processor also fails during the copying process. If the second processor does not fail, then at 610, the second processor takes over the control operation of the first processor. For example, the second processor can continue to perform the copying operation from the checkpoint, and the second processor can process the read request for the source storage area based on the copy metadata and the indicator. If the second processor also fails during the copying process, then at 612, after restarting the two processors, a flag for the write request is obtained, wherein the flag indicates whether there is a write request during the copying process, and since the flag is stored in the disk, the state of the flag will not be lost in the case where both the first processor and the second processor fail.
[0053] Next, at 614, it is determined whether there is a write request during the copying period based on the flag. If the flag indicates that there is no write request during the copying period, it means that the data to be copied has not been modified during the copying period, then at 616, the indicator can be initialized and the copying operation can be continued from the checkpoint, for example, the copying operation can be continued after the first processor or the second processor is restarted and resumes normal operation. If the flag indicates that there is a write request during the copying period, it means that the data to be copied has been modified during the copying period, but since the indicator is lost, it cannot be determined which storage block or blocks in which the data has been modified, therefore, at 618, the copying operation can be abandoned and the data can be rebuilt on the target storage area, so as to ensure the correctness and reliability of the data through a recovery mechanism such as RAID.
[0054] In addition, the embodiments of the present disclosure also provide a solution for handling storage area (e.g., disk) failure during copying. In some embodiments, during copying, if the source storage area (e.g., source storage area 110) fails (e.g., is removed, damaged, etc.), it is necessary to rebuild the data that has not been copied on the target storage area based on the copy metadata, and for other parts, the target storage area already has those data through the copy operation, so it does not need to be rebuilt, thereby improving the reconstruction speed. In some embodiments, if the target storage area (e.g., target storage area 120) fails during copying, since the source storage area does not have the data written during the copying, it is necessary to rebuild the written data determined according to the indicator on the source storage area. In this way, in the case of a processor or storage area (e.g., disk) failure, the failure can be effectively handled, thereby ensuring the integrity and accuracy of the data. In some embodiments, if both the source storage area and the target storage area fail, a third storage area can be used, and the data is rebuilt on the third storage area.
[0055] In some embodiments, the method of the embodiment of the present disclosure can be used in a mapped RAID. The term "mapped RAID" refers to a RAID that can use multiple disks in the RAID to rebuild a failed disk in parallel. For example, in a mapped RAID, when a target storage area is used to replace a source storage area or to increase a target storage area, a data copy from the source storage area to the target storage area can be initiated. Figure 7 and Figure 8 Schematic diagrams of exemplary architectures 700 and 800 of mapped RAIDs according to embodiments of the present disclosure are shown.
[0056] refer to Figure 7 , which illustrates an example of RAID 5 using "4D+1P" on N disks, where N is greater than 5. Mapped RAID can be composed of more disks than traditional RAID, and each disk can be considered as a collection of continuous, non-overlapping, fixed-size extents. Figure 7 As shown, the mapping RAID includes N disks, which are represented as disks D0, D1, D2, D3...D(N-1), and each disk is divided into multiple disk areas of equal size. Figure 7 In the illustrated mapping RAID, disk areas A1, A2, A3, A4, and A5 form a RAID stripe (also referred to as a RAID zone) for storing data, wherein A1-A4 may be data storage blocks, and A5 may be a parity information block. In addition, disk areas B1, B2, B3, B4, and B5 form another RAID stripe, and disk areas C1, C2, C3, C4, and C5 form yet another RAID stripe.
[0057] like Figure 7 As shown in FIG. 1 , if a RAID stripe needs to be created, 5 extents can be randomly selected from 5 different disks. Therefore, the data and check information will eventually be distributed to the consumed extents in all disks (in Figure 1 In addition, some disk areas can be reserved on each disk as hot free disk areas (in Figure 1 704 in the figure), instead of reserving the entire disk as a hot spare disk like in the traditional RAID 5. When a disk fails, a disk area on another disk can be randomly selected as a replacement for each disk area on the failed disk.
[0058] like Figure 8 As shown, when disk D4 fails, for each consumed extent on disk D4 (in Figure 8 As shown in 702, for example, disk areas A4 and C3) can randomly select a hot free disk area on other disks (in Figure 8704 in the figure) as an alternative. For example, extent A4 is rebuilt and written to a free extent in disk D3, while extent C3 is rebuilt and written to a free extent in disk D(N-1). The limitation on extent selection is that each RAID stripe must always span 5 different disks. Therefore, using the mapping RAID technology, multiple or even all disks in the RAID may be used in the reconstruction process of the failed disk. In addition, since there is no single hot idle disk and the reconstruction and writing of multiple extents can be performed in parallel, the reconstruction speed of the RAID will be greatly increased.
[0059] The inventor of the present application has found that mapped RAID has more copy requirements than traditional non-mapped RAID. For example, if a disk in the mapped RAID is about to be scrapped (marked as end-of-life EOL), the data needs to be moved to a normal disk before the disk is scrapped. This is called a proactive (PACO) copy scenario. For another example, if the data in the mapped RAID is unevenly distributed, it is necessary to add a new disk in the mapped RAID to balance the load. This is called a shuffle copy scenario.
[0060] In a mapped RAID, a mirror reconstruction algorithm is usually used to implement data copying. The source storage area and the target storage area form a mirror pair, which uses a mirror library to move data from the source storage area to the target storage area. In some embodiments, in a mapped RAID, a mapping table can be used to represent each stripe. Optionally, a column representing the copy target can be added to the mapping table. If this column is empty, it means that there is no copy operation. If the column has information about the storage area (such as the disk area) of the copy target, it means that a data copy operation needs to be performed. It should be noted that there are multiple stripes in a mapped RAID, and each stripe can have its own copy operation. Generally speaking, the copy operations of different stripes will not be performed at the same time; on the contrary, when the copy operation of one stripe is completed, the copy operation of another stripe will start.
[0061] Since the demand for data copying in mapping RAID is relatively large, the method of the embodiment of the present disclosure is particularly suitable for the scenarios of disk replacement and disk addition in mapping RAID, thereby improving the IO performance of mapping RAID. For example, in the scenario of active copy of disk replacement, the source storage area is marked as terminated, and the method of the embodiment of the present disclosure can extend the life of the source storage area by reducing the write to the source storage area. For another example, in the reorganized copy scenario of disk addition, the embodiment of the present disclosure can also reduce the write to the source storage area and reduce the wear of the source storage area. In addition, since the embodiment of the present disclosure only needs to write to the target storage area and does not need to write to the source storage area, it can also reduce the execution time of data writing.
[0062] Fig. 9A schematic block diagram of a device 900 that can be used to implement an embodiment of the present disclosure is shown. As shown, the device 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 902 or loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The CPU 901, ROM 902, and RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0063] A number of components in the device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0064] The various methods or processes described above may be performed by the processing unit 901. For example, in some embodiments, the methods may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the CPU 901, one or more steps or actions in the methods 200, 500, and 600 described above may be performed.
[0065] In some embodiments, the methods 200, 500, and 600 described above may be implemented as a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present disclosure.
[0066] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0067] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0068] The computer program instructions for performing the disclosed operation may be assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, and conventional procedural programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, executed as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., utilizing an Internet service provider to connect via the Internet). In certain embodiments, by utilizing the state information of a computer-readable program instruction to customize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit may execute a computer-readable program instruction, thereby realizing various aspects of the present disclosure.
[0069] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0070] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0071] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the equipment, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each block in the flow chart or block diagram can represent a part of a module, a program segment or an instruction, and a part of the module, a program segment or an instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the blocks can also occur in a sequence different from that marked in the accompanying drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flow chart, and the combination of the blocks in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0072] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for writing data, comprising: During the copying of the first data from the source storage area to the target storage area, receiving a write request for a first storage block in the source storage area; Writing second data associated with the write request into a second storage block of the target storage area, the second storage block corresponding to the first storage block; as well as updating an indicator associated with the first storage block, the indicator indicating that the second data was written by the write request during the copying; In response to receiving a read request for a plurality of storage blocks in the source storage area during the copying, determining whether the target storage area includes third data related to the read request based on a plurality of indicators associated with the plurality of storage blocks; as well as In response to the target storage area including a portion of the third data: reading the portion of the third data from the target storage area; as well as The other part of the third data is read from the source storage area.
2. A device for writing data, comprising: Processing unit; as well as A memory coupled to the processing unit and storing instructions, which when executed by the processing unit perform the following actions: During the copying of the first data from the source storage area to the target storage area, receiving a write request for a first storage block in the source storage area; Writing second data associated with the write request into a second storage block of the target storage area, the second storage block corresponding to the first storage block; as well as updating an indicator associated with the first storage block, the indicator indicating that the second data was written by the write request during the copying; In response to receiving a read request for a plurality of storage blocks in the source storage area during the copying, determining whether the target storage area includes third data related to the read request based on a plurality of indicators associated with the plurality of storage blocks; as well as In response to the target storage area including a portion of the third data: reading the portion of the third data from the target storage area; as well as The other part of the third data is read from the source storage area.
Citation Information
Patent Citations
Method and device for managing network storage system
CN102147713A
Method for recording chip use state information, imaging box chip and imaging box
CN102765256A