Method for recovering data, electronic device and computer program product

By using cache types in the cache to distinguish memory blocks and performing data recovery after user confirmation, the problem of lack of flexibility in data recovery tools in the prior art is solved, and higher memory and space efficiency and better user experience are achieved.

CN119645720APending Publication Date: 2025-03-18DELL PROD LP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311206273.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-18
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

Existing data recovery tools lack flexibility in handling user equipment failures and cannot distinguish the recovery requirements of important and non-important data when resources are insufficient, resulting in automatic recovery that may affect the normal use of the device.

Method used

By using cache types in the cache to distinguish memory blocks, data recovery is performed only after user confirmation, and memory and space efficiency are optimized through sparse and intensive cache strategies.

Benefits of technology

It realizes data recovery after user confirmation, improves the memory and space efficiency of the cache, and provides better user experience and flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645720A_ABST
    Figure CN119645720A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a method for recovering data, electronic equipment and a computer program product. The method may include determining at least one storage block to be recovered by a target recovery request in response to the target recovery request for the user equipment. The method further includes acquiring a cache type of the at least one memory block in the cache. The method further includes determining a plurality of cache regions from a plurality of regions constituting the at least one memory block based on a cache type of the at least one memory block. The method further includes updating the recovery data in the plurality of cache regions into the cache, and in response to a recovery confirmation operation, recovering data of the at least one memory block in the user equipment based on the recovery data cached in the updated cache. According to the method, the data can be recovered after confirmation of the user by using the buffer for recovering the data, the memory and space efficiency in the buffer can be improved to the maximum extent, and better user experience is provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of computer technology, and more particularly to a method for recovering data, an electronic device, a computer-readable storage medium, and a computer program product. Background Art

[0002] In the file system, data recovery tools are an important component. When the user device encounters failures such as crashes and blue screens, data recovery tools can modify and recover the data in the user device to avoid data loss. In the daily work of the file system, data recovery is a more commonly used function, so how to achieve data recovery through better methods is an important research field at present.

[0003] Currently, data recovery can usually be achieved through data backup methods. For example, in order to avoid accidental data loss, the file system usually creates a backup copy of important data (such as volumes, files, etc.), and restores the data through the backup copy when a failure occurs. Summary of the invention

[0004] According to an example embodiment of the present disclosure, a technical solution for recovering data is provided, which can restore the data after user confirmation by using a cache for recovering data, and can maximize the memory and space efficiency in the cache to provide a better user experience.

[0005] In a first aspect of the present disclosure, a method for recovering data is provided, which may include, in response to a target recovery request for a user device, determining at least one storage block to be recovered by the target recovery request. The at least one storage block is composed of a plurality of storage areas. The method also includes obtaining a cache type of the at least one storage block in a cache. The cache type of the at least one storage block is based on the number of recovery areas indicated by the cache for the at least one storage block. The method also includes determining a plurality of cache areas from a plurality of areas constituting the at least one storage block based on the cache type of the at least one storage block. The method also includes updating the recovery data in the plurality of cache areas into the cache, and in response to a recovery confirmation operation, recovering the data of the at least one storage block in the user device based on the recovery data cached in the updated cache.

[0006] In a second aspect of the present disclosure, an electronic device is provided. The electronic device includes: a processor, and a memory coupled to the processor, the memory having instructions stored therein, the instructions causing the electronic device to perform operations when executed by the electronic device, and the operations may include determining at least one storage block to be restored by the target recovery request in response to a target recovery request for a user device. The at least one storage block is composed of multiple storage areas. The method also includes obtaining a cache type of at least one storage block in a cache. The cache type of at least one storage block is based on the number of recovery areas indicated by the cache for at least one storage block. The method also includes determining multiple cache areas from multiple areas constituting at least one storage block based on the cache type of at least one storage block. The method also includes updating the recovery data in the multiple cache areas to the cache, and in response to a recovery confirmation operation, restoring the data of at least one storage block in the user device based on the recovery data cached in the updated cache.

[0007] In a third aspect of the present disclosure, there is provided a computer program product, which is tangibly stored on a computer-readable medium and comprises computer-executable instructions which, when executed, cause a computer to perform the method according to the first aspect of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:

[0009] Figure 1 An architectural diagram of a data recovery system according to some embodiments of the present disclosure is shown;

[0010] Figure 2 shows a situation where there are multiple storage units according to some embodiments of the present disclosure;

[0011] Figure 3 The existence ratio according to some embodiments of the present disclosure is shown. Figure 2 More storage units in the case;

[0012] Figure 4 Some embodiments of the present disclosure are shown Figure 3 The Btree-like structure is suitable for dense storage blocks;

[0013] Figure 5 A conversion process of a storage block type according to some embodiments of the present disclosure is shown;

[0014] Figure 6 and Figure 7The execution flow of executing the memory priority strategy and the swap priority strategy respectively during the modification process according to some embodiments of the present disclosure is shown respectively;

[0015] Figure 8 and Fig. 9 The execution flow of executing the memory priority strategy and the swap priority strategy respectively during the reading process according to some embodiments of the present disclosure is shown respectively;

[0016] Fig.10 A flowchart showing a method for recovering data according to some embodiments of the present disclosure; and

[0017] Fig.11 A schematic structural diagram of a device that can be used to implement an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0018] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain 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 construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0019] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0020] In traditional file systems, recovery tools are usually one-way, which means that once any error is found, the recovery tool will start to modify and repair the data in the user's device. However, this recovery method is not flexible enough and does not take into account whether the user really needs to perform these recovery operations. For example, when resources are insufficient, the user may not need to recover unimportant file data. At this time, the automatic recovery of the recovery tool may affect the normal use of the user's device. Therefore, a more flexible and low-cost data recovery method is currently needed to meet user needs.

[0021] The present disclosure proposes a method for recovering data, an electronic device, and a computer program product. The method for recovering data includes, in response to a target recovery request for a user device, determining at least one storage block to be recovered by the target recovery request. The at least one storage block is composed of a plurality of storage areas. The method also includes obtaining a cache type of the at least one storage block in a buffer. The cache type of the at least one storage block is based on the number of recovery areas indicated by the buffer for the at least one storage block. The method also includes, based on the cache type of the at least one storage block, determining a plurality of cache areas from a plurality of areas constituting the at least one storage block. The method also includes updating the recovery data in the plurality of cache areas to the buffer, and in response to a recovery confirmation operation, recovering the data of the at least one storage block in the user device based on the recovery data cached in the updated buffer. The scheme of the embodiment of the present disclosure can recover the data after the user confirms by using a buffer for recovering data, and can maximize the memory and space efficiency in the buffer, and provide a better user experience.

[0022] Reference below Figure 1 The method proposed in the present disclosure is described. Figure 1 , an exemplary framework of a data recovery system (also referred to as a recovery system) 100 is shown. The recovery system 100 includes a user device 102, a cache 104, and an independent logical unit (LUN) 106 associated with the cache 104. The cache 104 is used to cache data to be recovered to the user device 102 (also referred to as recovery data), and the LUN 106 is used as a backup storage for the cache 104. When there is too much data in the cache 104, the cache 104 can store the newly added recovery data in the LUN 106 for throttling. When the user performs an operation to confirm the recovery (also referred to as a recovery confirmation operation), the cache can restore the cached data therein to the user device 102. The present disclosure does not limit the types of the user device 100, the cache 104, and the LUN 106. For example, the user device 100 can be a mobile phone, a computer, a wearable device, etc., and the cache 104 can be a secondary cache L2, a tertiary cache L3, etc.

[0023] In the cache 104, there are a hash lookup table 108, a sparse least recently used (LRU) queue 110, a dense LRU queue 112, a switching LRU queue 114, and an information block queue 116. The sparse LRU queue 110, the dense LRU queue 112, and the switching LRU queue 114 are used to cache the recovery data of different storage blocks in the user device, and the hash lookup table 108 is used to search for the corresponding storage blocks in the sparse LRU queue 110, the dense LRU queue 112, and the switching LRU queue 114 according to the hash when reading and modifying the recovery data in the cache. In some embodiments, the size of each storage block can be 4K.

[0024] First, the sparse LRU queue 110, the dense LRU queue 112, and the exchange LRU queue 114 are described for easy understanding. Figure 1 In the example, the storage block in the user device can be divided into a sparse storage block and a dense storage block based on the situation of the recovery data cached in the buffer 104, so as to cache the recovery data according to different cache modes. For example, in some embodiments, the storage block can be divided into a plurality of storage areas, and then the type of the storage block (also referred to as the cache type) can be divided into a sparse type and a dense type based on how many storage areas the recovery data of the storage block in the buffer 104 exists in, that is, the type of the storage block is divided based on the number of areas that the storage block needs to recover (also referred to as the number of recovery areas). For example, in some examples, if the number of areas that need to be recovered is less than a predetermined threshold (for example, the predetermined threshold can be 384), it means that there are fewer storage areas that need to be recovered in the storage block, and it can be divided into a sparse type at this time, and if the number of areas that need to be recovered is greater than or equal to the predetermined threshold, it means that there are more storage areas that need to be recovered in the storage block, and it can be divided into a dense type at this time. Through the division method in this embodiment, it can be judged whether the storage block needs to recover more areas, so as to adopt a corresponding cache strategy to cache the recovery data. In some embodiments, each area can be in units of 8 bytes.

[0025] In some embodiments, the difference in caching strategy between sparse storage blocks and dense storage blocks may be that after the target recovery request modifies the storage block, the recovery data corresponding to which storage areas (also referred to as cache areas) in the storage block are cached in the cache 104. It can be understood that the recovery data corresponding to multiple storage areas in the modified storage block may include both the data sent after the target recovery request is processed and before the processing and the unchanged data. For ease of understanding, a specific example is given for exemplary explanation. Assuming that the storage block includes two storage areas A and B, if the data in storage area A is damaged during the working process, the target recovery request will recover storage area A to obtain the recovery data of the storage block, and the recovery data includes the changed data of storage area A and the unchanged data of storage area B. In this example, the difference in caching strategy between sparse storage blocks and dense storage blocks may be that the data of which storage area A and B in the cache recovery data.

[0026] In some embodiments, for sparse storage blocks, the cache strategy may be to cache only the changed data in the recovery area (i.e., to use the recovered area in the multiple storage areas constituting the storage block as the cache area). For dense storage blocks, the cache strategy may be to cache the recovered data in all areas (i.e., to use the multiple storage areas constituting the storage block as the cache area). Thus, for sparse storage blocks with fewer areas to be recovered, only the sent changed data may be cached without caching the data in all storage areas, thereby improving the space efficiency of the cache 104, and when actually recovering the user device, for the sparse storage blocks, there is no need to repeatedly recover the data that has not been processed by the target recovery request, thereby improving the recovery efficiency.

[0027] refer to Figure 1 118, 118 in shows the information associated with the sparse storage block and the dense storage block in the buffer 104, which includes a content pointer (contentPtr), a bitmap pointer (bitmapPtr), a hash link (hashLink) and an LRU link (auxLink). The content pointer is used to index the recovery data of the storage block. The bitmap pointer can be used to identify the type of the storage block. For example, in some embodiments, the bitmap pointer of the sparse storage block can be a pointer to the corresponding bitmap 120, and the dense storage block does not need a bitmap, so its bitmap pointer can be an indicator indicating a dense type (also referred to as a first indicator), such as a one-digit number. The purpose of the bitmap 120 is explained below. The hash link can be used as an identifier of the storage block to search based on the hash lookup table when reading and modifying. The LRU link can also be used as an identifier of the storage block to determine each storage block when the user submits a recovery confirmation.

[0028] Continue to refer Figure 1 For a sparse storage block, the change data of each restored area can be stored in the form of an entry 122, and the entry 122 is composed of the position index (index) of the corresponding area in the sparse storage block and the content (content) of the restored data. Different entries can be stored in groups according to the storage unit CB 124. In some embodiments, if each storage area is 8 bytes and the position index is 2 bytes, the capacity of each storage unit 124 can be 64 bytes, which is used to store 6 entries, that is, each storage unit 124 can be used to store the change data of 6 restored areas. For example, in some embodiments, the storage unit 124 can store the entries 122 in sequence according to the order in which the restored data is modified. When the number of entries 122 exceeds the maximum number of entries that can be stored (also known as the pointer threshold condition), that is, the number of modified areas exceeds the maximum number of entries that can be stored, the system 100 can generate a new storage unit 124 to store the entries corresponding to the remaining modified areas. The advantage of the storage unit 124 having a capacity of 64 bytes is that 64 bytes is the minimum number of operating bytes in most systems, so it can avoid competition when the system processes the storage unit.

[0029] refer to Figure 2 , Figure 2 1 shows the case where there are multiple storage units 124. In this embodiment, if there are multiple storage units 124, the system 100 can generate an intermediate pointer (midPtr) 202 pointing to each storage unit 124 for indexing, wherein multiple intermediate pointers 202 can point to different storage units 124, and the intermediate pointers 202 are indexed by content pointers. When reading or rewriting entries, the correct storage unit 124 can be reached based on these intermediate pointers.

[0030] refer to Figure 3 , Figure 3 The existence ratio is shown in Figure 2 In this embodiment, if the number of storage units 124 exceeds the upper limit of the number that can be indexed by the intermediate pointer in a container (for example, a container includes 8 intermediate pointers, and the number of storage units 124 is greater than 8), the index can be further refined. For example, in some embodiments, Figure 3 A Btree-like structure is provided in which the intermediate pointer 302 in the second-level container serves as an intermediary between the intermediate pointer 304 in the first-level container and the storage unit 124 , thereby indexing a large number of storage units 124 .

[0031] refer to Figure 4 , Figure 4 Shows Figure 3The Btree-like structure is applicable to the case of dense storage blocks. The recovered data in the dense storage block can also be stored in the storage unit 402. The difference from the sparse storage block is that the storage unit 402 no longer only stores the changed data, but stores the data in all the storage areas constituting the dense storage block in sequence. For example, when the storage unit 402 is the first storage unit corresponding to the dense storage block, used to store 64 bytes of data, and each storage area is 8 bytes, it can store the data from the first storage area to the eighth storage area in the dense storage block, that is, the first byte to the 64th byte, regardless of whether the data is changed data. In some embodiments, the storage unit 402 may also have an intermediate pointer for indexing. For details, please refer to the above description of Figure 2 and Figure 3 The description is not repeated here.

[0032] Next, the bitmap 120 is described. The bitmap 120 is used to indicate which storage areas of the sparse storage block have changed data, that is, the recovery data in which storage areas of the sparse storage block is cached in the buffer, and indicates the positions of these storage areas, and each indicated storage area can represent one bit in the bitmap 120. During the reading process, the bitmap 120 can be used as a bloom filter to quickly display whether there is changed data in the area requested to be read. During the modification process, the bitmap 120 can be used as an arbitrator to indicate the modified area that needs to be rewritten or newly added. In addition, the bitmap 120 can also provide the number of modified areas of the sparse storage block to determine the required number of intermediate pointers for subsequent allocation.

[0033] Next, the switching type is explained. The switching type can be converted from the sparse type or the dense type after the recovery data is stored in the LUN 106 when there is a lot of data in the cache 104. For example, in some embodiments, if the newly added recovery data corresponds to a sparse storage block, and after the addition, the recovery data cached in the cache 104 exceeds the throttling threshold (for example, 80% of the maximum cache data volume of the cache 104), in order to ensure the performance of the cache 104, the sparse storage block can be converted to a switching storage block, and the data to be cached is determined according to the dense cache strategy, and the data is cached in the LUN 106.

[0034] return Figure 1Reference 126 shows information associated with a swap storage block in the buffer 104, which includes a block pointer (blockPtr), a bitmap pointer (bitmapPtr), a hash link (hashLink), and an LRU link (auxLink). The block pointer is used to index a block in the LUN 106 that caches corresponding recovery data. The bitmap pointer can be used to identify the type of storage block. For example, in some embodiments, since a swap storage block does not require a bitmap, its bitmap pointer can be an indicator indicating the swap type (also referred to as a second indicator). For example, in some embodiments, the bitmap pointer of the swap storage block can be a single-digit number different from the first indicator described above. The hash link can be used as an identifier of the storage block to search based on a hash lookup table when reading and modifying, and the indicator of the swap storage block can be queued together with the hash link. The LRU link can also be used as an identifier of the storage block to determine each storage block when the user submits a recovery confirmation.

[0035] The information block queue 116 includes a plurality of information storage blocks, and the information storage blocks are used to indicate free storage space in the LUN 106. The information associated with the information storage blocks in the buffer 104 is similar to the information associated with the exchange type storage blocks in the buffer 104, and also includes a block pointer (blockPtr), a bitmap pointer (bitmapPtr), a hash link (hashLink) and an LRU link (auxLink). In some embodiments, the block pointer in the information is used to indicate the free storage space block in the LUN 106, and the bitmap pointer can be used to identify the type of the storage block. For example, in some embodiments, since the information storage block does not need a bitmap, its bitmap pointer can be an indicator indicating the information storage block. In some embodiments, the indicator of the information storage block can be the same as the indicator of the exchange type storage block, but the indicator of the information storage block is not queued together with the hash link. When the system 100 confirms that the indicator is the second indicator, it can distinguish between the exchange type storage block and the information storage block according to whether the hash link is a queue. It should be noted that the storage block in the user device in the cache will only be one of the sparse type, dense type and exchange type, and the information storage block is only used to indicate the free storage space information of LUN 106, which is equivalent to an independent storage block in the cache 104. The role of the information storage block is mainly reflected in the conversion process of the storage block type.

[0036] from Figure 1-Figure 4 As can be seen from the description, the method provided by the present disclosure performs caching based on the changed data when the number of recovery areas is small, and only the changed data is retained in the cache 104, so that the memory utilization rate is high. In addition, all memories are organized according to the memory units of the cache line, so that the system 100 does not have memory fragmentation, does not need to maintain multiple private pools, and does not need to waste a large amount of memory for each reservation.

[0037] refer to Figure 5 , Figure 5 , the conversion process of the storage block type is shown in FIG. 5 . For a sparse storage block, it can be converted to a dense storage block when the modified area exceeds a predetermined threshold during the modification 502, and can be converted to a switch storage block in response to the total amount of data in the cache after caching exceeding the throttling threshold during the process of recovering data in the cache 504. During the conversion process, the system 100 determines an information storage block according to the order of the information block LRU 116, and caches the recovered data to the LUN 106 according to the method described above based on the LUN free storage space block indicated by the information storage block, so as to make the LUN dense and achieve the highest utilization rate. For a dense storage block, it can be converted to a switch storage block in response to the total amount of data in the cache after caching exceeding the throttling threshold during the process of recovering data in the cache 506. During the conversion process, the system 100 determines an information storage block according to the order of the information block LRU 116, and caches the recovered data to the LUN 106 based on the LUN free storage space block indicated by the information storage block, so as to make the LUN dense and achieve the highest utilization rate. For the exchangeable storage block, it can obtain the cached recovery data from LUN 106 during the reading 508 process to restore it into a readable dense storage block. At the same time, since LUN 106 has a free storage space block after the conversion, the system 100 will generate an information storage block indicating the storage space block.

[0038] In some embodiments, since the data of the exchangeable storage block is cached in LUN 106, although the data overflow problem in buffer 104 can be avoided, it will take more time and resources when the exchangeable storage block is read, modified, etc., so the system 100 can judge whether it is necessary to convert the sparse storage block and / or the dense storage block into the exchangeable storage block according to different conversion strategies in different situations. In some embodiments, the conversion strategy can be a memory priority strategy or an exchange priority strategy. When memory resources are sufficient, the system 100 can execute the memory priority strategy, take performance as a high priority, and try to avoid exchange. And when memory resources are limited, the system 100 can execute the exchange priority strategy to try to avoid memory allocation.

[0039] refer to Figure 6 and Figure 7 , Figure 6 and Figure 7 The following diagrams respectively show the execution flow of the memory priority strategy and the swap priority strategy executed by the system 100 during the modification process. Figure 6, under the memory priority strategy, after the system 100 repairs the data of the storage block, it first searches 602 the hash table. If it can hit, it means that the recovery data of the storage block has been cached in the buffer 104, and the block type of the storage block can be identified 604 at this time. In some embodiments, the block type of the storage block can be determined based on the bitmap pointer information. If it does not hit, the recovery data of the storage block can be cached 606 in the buffer 104 according to the sparse type and end. If the block type of the storage block is identified as sparse, it can be checked 608 whether the recovery data of the corresponding storage area has been cached in the bitmap. If it exists, it can be directly rewritten 610. If not, it can be judged 612 whether the number of entries meets the pointer condition. If it does not meet, a new entry is added 614, and if it meets, the sparse type is extended 616, for example, an intermediate pointer can be generated. If the newly added recovery data causes the number of modified storage areas in the storage block to reach a predetermined threshold, the storage block can be converted to a dense type 618 and end. If, after identification, the block type of the storage block is dense and exchange type 620, then rewriting 610 can be performed directly.

[0040] refer to Figure 7 , under the exchange priority strategy, after the system 100 repairs the data of the storage block, it first searches 702 the hash table. If it can hit, it means that the recovery data of the storage block has been cached in the cache 104. At this time, the block type of the storage block can be identified 704. In some embodiments, the block type of the storage block can be determined based on the bitmap pointer information. If it does not hit, the recovery data of the storage block can be cached in the cache 104 as a sparse type 706 and the process ends. If the block type of the storage block is identified as a sparse type, it can be checked 708 whether the recovery data of the corresponding storage area has been cached in the bitmap. If it exists, it can be directly overwritten 710. If not, it can be determined 712 whether the number of entries meets the pointer condition. If it does not meet the condition, a new entry 714 is added. If it meets the condition, it is added together with the corresponding entry. Figure 6 If the block type of the storage block is different, the sparse type is converted to the exchange type 716. If the block type of the storage block is dense after the identification, it can be directly rewritten 710. If the block type of the storage block is exchange type after the identification, the newly added recovery data is exchanged and written 718 to LUN 106. It should be noted that although Figure 6 and Figure 7 Not shown in , but if the hash misses, some memory is still needed to mark this fix in the hash as present. So there can be a throttling mechanism to flush some dense / sparse storage blocks (following dense / sparse LRU) to swap and get some free memory.

[0041] refer to Figure 8 and Fig. 9 , Figure 8 and Fig. 9 The execution flow of the system 100 executing the memory priority strategy and the swap priority strategy during the reading process is shown respectively. Figure 8 , under the memory priority strategy, first search 802 the hash table, if it can hit, it means that the recovery data of the storage block has been cached in the buffer 104, and the block type of the storage block can be identified 804 at this time. In some embodiments, the block type of the storage block can be determined based on the bitmap pointer information. And if it does not hit, then the reading of the storage block can be stopped. If the block type of the storage block is identified as sparse, then the bitmap can be checked 806, and the above-mentioned filter can be played based on the bitmap to quickly display whether the requested read area has changed (if no read area is shown in the bitmap, the read interface may return the result "none"). If the block type of the storage block is identified as intensive and exchange type 808, then these storage blocks can be directly read.

[0042] refer to Fig. 9 , under the exchange priority strategy, first search 902 hash table, if can hit, then explain that the recovery data of this storage block has been cached in buffer memory 104, at this moment can identify 904 the block type of this storage block.In certain embodiments, can determine the block type of storage block based on bitmap pointer information.And if miss, then can stop reading this storage block.If the block type of storage block identified is sparse type, then can check 906 bitmap, based on bitmap to play the role of above-mentioned filter, quickly show whether the requested read area has change.If the block type of storage block identified is intensive type, then can directly read these storage blocks. If the block type of the storage block is identified as the exchange type, then unlike the modification process, the dense LRU and sparse LRU can be processed first 908, 910 (this process can be called age), for example, the sparse storage blocks and dense storage blocks are converted to exchange types, and the number of free storage units CB is checked 912. When the number of free storage units CB in the cache 104 reaches a certain value, it is determined that enough CBs have been collected for reading the exchange type storage block, and then the storage block is read according to the dense type 914.

[0043] When the user confirms the recovery, that is, executes the commit operation, it is only necessary to refresh the dense LRU, sparse LRU and exchange LRU to the user device respectively in the order guided by the LRU. Since the LRU is structured by core, the load between the cores is natively balanced when processing the refresh work. In addition, in the present disclosure, the LRU operation is executed online simultaneously with the modification and read interfaces. The program will identify the LRU transmission source and destination and convert them at the end of each interface. Although the LRU is structured by core, the operation still needs to keep the LRU locked because the age operation may involve LRU operations across cores. Therefore, the lock sequence of dense LRU, sparse LRU, and exchange LRU can be followed to prevent deadlock.

[0044] For ease of understanding, Fig.10 A method for recovering data is also provided. At block 1002, in response to a target recovery request for a user device, at least one storage block to be recovered by the target recovery request is determined. The at least one storage block is composed of a plurality of storage areas. In some embodiments, each storage block may be 4K and each storage area may be 8 bytes.

[0045] At block 1004, a cache type of at least one storage block in a buffer is obtained. The cache type of the at least one storage block is based on the number of recovery areas indicated by the buffer for the at least one storage block. In some embodiments, the cache type can be determined based on a bitmap pointer. For example, when the bitmap pointer is a pointer to a bitmap, the storage block can be determined to be sparse, when the bitmap pointer is an indicator corresponding to a dense type, the storage block can be determined to be dense, and when the bitmap pointer is an indicator corresponding to a swap type, the storage block can be determined to be swap. In some embodiments, the cache type of the buffer can be used to indicate how many storage areas the recovery data in the buffer exists in, that is, the number of areas that need to be recovered for the storage block. For example, in some examples, if the number of areas that need to be recovered is less than a predetermined threshold (for example, the predetermined threshold can be 384), it means that there are fewer storage areas that need to be recovered in the storage block, and at this time it can be divided into a sparse storage block in the sparse LRU110, and if the number of areas that need to be recovered is greater than or equal to the predetermined threshold, it means that there are more storage areas that need to be recovered in the storage block, and at this time it can be divided into a dense storage block in the dense LRU 112. By this division method, it can be determined whether a storage block needs to restore more areas, so as to adopt a corresponding cache strategy to cache the restored data. In some embodiments, the cache type can also be a swap type.

[0046] At block 1006, based on the cache type of at least one storage block, multiple cache areas are determined from multiple areas constituting at least one storage block. And at block 1008, the recovery data in the multiple cache areas are updated to the cache. In some embodiments, if the cache type is sparse, only the recovery area can be determined as the cache area, that is, the data in the recovery area that has changed compared with before the recovery is cached in the cache 104. If the cache type is dense, only all the storage areas constituting the storage block can be determined as the cache area, that is, regardless of whether they are modified during the recovery, all these data are cached in the cache 104. If the cache type is exchange type, the cache strategy is similar to the dense type, except that the cached recovery data needs to be cached in the LUN 106. In some embodiments, the cache 104 may include an information storage block for indicating free storage space in the LUN. When the amount of updated recovery data exceeds the throttling threshold of the cache 104, the cache 104 can obtain information indicating free storage space required in the cache type conversion process through the information storage block, and convert the sparse storage block and / or dense storage block into the exchange type.

[0047] In some embodiments, there is a position bitmap associated with at least one storage block in the cache, and the position bitmap is used to indicate the position of the recovery area of ​​at least one storage block in at least one storage block. When updating, the bitmap can also be used to indicate whether the cache area is a recovery area. If it is, the corresponding entry in the storage unit 124 can be directly rewritten. If not, it is necessary to add an entry for the cache area in the storage unit 124. In some embodiments, the entry includes the position index index of the corresponding cache area in the storage block and the recovery data content content of the corresponding cache area. For the case of adding, in some embodiments, if the number of recovery areas indicated for at least one storage block cache before adding reaches the pointer threshold condition, it means that the number of current storage units 124 is large, and it is necessary to generate an intermediate pointer for indexing different storage units. In some embodiments, if the number of recovery areas after the update is large, for example, greater than or equal to the predetermined threshold for identifying the cache type, and the cache type of the storage block is sparse, it means that the number of areas that need to be restored after the update is large, and the cache type of the storage block can be converted to dense.

[0048] At block 1010, in response to the recovery confirmation operation, data of at least one storage block in the user device is restored based on the recovery data cached in the updated buffer. If it is determined that the user has performed the recovery confirmation operation, the dense LRU, the sparse LRU, and the swap LRU can be refreshed to the user device in the order directed by the LRU to complete the data recovery. Fig.10The provided method can restore after user confirmation, and can maximize the memory and space efficiency in the cache, providing a better user experience.

[0049] According to the various embodiments of the present disclosure described above and their combined embodiments, the efficiency of configuring the functional state can be improved. Figures 1 to 10 The implementation method shown in the figure is only for reference. Figures 1 to 10 The architecture or process illustrated in the figure may have other different forms, and may also include more or fewer functional modules and / or units. These modules and / or units may be partially or fully implemented as hardware modules, software modules, firmware modules or any combination thereof, and the embodiments of the present disclosure are not limited to this.

[0050] It is to be understood that the specific names and / or protocols of the various components in the system described herein are only to help those skilled in the art to better understand the concept of the present disclosure, and are not intended to limit the scope of the present disclosure in any way. Moreover, in other embodiments, more or better components may be included, and alternative components with the same or similar functions may also be included.

[0051] Fig.11 1 shows a schematic structural diagram of an example device 1100 that can be used to implement some embodiments of the present disclosure. The device 1100 can be implemented as a server or a PC, etc. The embodiments of the present disclosure do not limit the specific implementation type of the device 1100. Fig.11 As shown, the device 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 1102 or loaded from a storage unit 1108 to a random access memory (RAM) 1103. In the RAM 1103, various programs and data required for the operation of the device 1100 can also be stored. The CPU 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.

[0052] A number of components in the device 1100 are connected to the I / O interface 1105, including: an input unit 1106, such as a keyboard, a mouse, etc.; an output unit 1107, such as various types of displays, speakers, etc.; a storage unit 1108, such as a disk, an optical disk, etc.; and a communication unit 1109, such as a network card, an update modem, a wireless communication transceiver, etc. The communication unit 1109 allows the device 1100 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0053] The processing unit 1101 can execute the various methods and / or processes described above, for example Fig.10 For example, in some embodiments, the method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1108. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1100 via the ROM 1102 and / or the communication unit 1109. When the computer program is loaded into the RAM 1103 and executed by the CPU 1101, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the CPU 1101 may be configured to perform the method in any other suitable manner (e.g., by means of firmware, etc.).

[0054] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip systems (SOCs), load programmable logic devices (CPLDs), and the like.

[0055] In some embodiments, the methods and processes 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.

[0056] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0057] 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 transmission, wireless transmission, 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.

[0058] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent 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. The computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server.

[0059] 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 a computer or other programmable data processing device, a device for realizing the functions / actions specified in one or more boxes in the flow chart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions make the computer, programmable data processing device and / or other equipment work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for realizing various aspects of the functions / actions specified in one or more boxes in the flow chart and / or block diagram. Computer-readable program instructions can also be loaded onto a computer, other programmable data processing device, or other device, so that a series of operating steps are performed on the computer, other programmable data processing device or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable data processing device, or other device realize the functions / actions specified in one or more boxes in the flow chart and / or block diagram.

[0060] In the information disclosed herein, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0061] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the equipment, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each frame in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the frame can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous frames can actually be executed substantially in parallel, and they can also be executed in the opposite order sometimes, depending on the functions involved. It should also be noted that each frame in the block diagram and / or flow chart, and the combination of frames 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.

[0062] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain desired results. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the information of a separate embodiment can also be implemented in a single implementation in combination. On the contrary, the various features described in the information of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination mode.

[0063] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

[0064] 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 restorations and modifications will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice 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 recovering data, comprising: In response to a target recovery request for a user device, determining at least one storage block to be recovered by the target recovery request, wherein the at least one storage block is composed of a plurality of storage areas; Obtaining a cache type of the at least one storage block in a cache, wherein the cache type of the at least one storage block is based on a number of recovery regions indicated by the cache for the at least one storage block; Based on the cache type of the at least one storage block, determining a plurality of cache areas from a plurality of areas constituting the at least one storage block; updating the recovery data in the plurality of cache areas into the cache; as well as In response to the restoration confirmation operation, the data of the at least one storage block in the user equipment is restored based on the restoration data cached in the buffer after the update.

2. The method according to claim 1, wherein the cache type of the at least one storage block is at least one of a sparse type and a dense type, the sparse type indicates that the number of recovery areas indicated by the cache for the at least one storage block is less than a predetermined threshold, and the dense type indicates that the number of recovery areas indicated by the cache for the at least one storage block is greater than or equal to the predetermined threshold.

3. The method according to claim 2, wherein determining the plurality of cache areas from a plurality of storage areas constituting the at least one storage block comprises: In response to the cache type of the at least one storage block being the sparse type, a plurality of cache areas to be restored by the target restoration request are determined from a plurality of storage areas constituting the at least one storage block.

4. The method according to claim 3, wherein there is a location bitmap associated with the at least one storage block in the cache, and the location bitmap is used to indicate the location of the recovery area of ​​the at least one storage block in the at least one storage block.

5. The method according to claim 4, wherein updating the recovery data of the plurality of cache areas into the cache memory comprises: querying a location bitmap associated with the at least one storage block to determine whether the plurality of cache areas are recovery areas; In response to the plurality of cache areas being recovery areas, overwriting the recovery data of the plurality of cache areas already in the cache with the target recovery request after the recovery data of the plurality of cache areas is recovered; or In response to the multiple cache areas not being recovery areas, the recovery data after the target recovery request recovers the multiple cache areas is added to the cache area by area.

6. The method according to claim 5, further comprising: In response to the plurality of cache areas not being recovery areas, updating the number of recovery areas of the at least one storage block with the number of areas of the plurality of cache areas; as well as In response to the updated number of recovery areas being greater than or equal to the predetermined threshold, the cache type of the at least one storage block is converted from the sparse type to the dense type.

7. The method according to claim 5, further comprising: In response to the number of recovery areas indicated by the cache for the at least one storage block before the addition reaching a pointer threshold condition, a first intermediate pointer for indexing the multiple cache areas and a second intermediate pointer for indexing the recovery area corresponding to the number of recovery areas are generated after the addition. 8 . The method according to claim 3 , wherein the restoration data of each cache area is associated with a location index of each cache area in the at least one storage block.

9. The method according to claim 2, wherein determining the plurality of cache areas from the plurality of storage areas constituting the at least one storage block further comprises: In response to the cache type of the at least one storage block being the intensive type, a plurality of storage areas constituting the at least one storage block are determined as a plurality of cache areas of the at least one storage block.

10. The method according to claim 1, wherein the cache type of the storage block can also be a swap type, and the method further comprises: In response to the updated total value of the data volume exceeding the throttling threshold of the cache, converting the cache type of the at least one storage block to the exchange type; as well as The restoration data in the plurality of regions constituting the at least one storage block are cached in an independent logic unit associated with the cache.

11. The method according to claim 10, wherein the buffer further comprises an information storage block for indicating free storage space in the independent logical unit.

12. The method according to claim 1, wherein the type of the at least one storage block is one of sparse type, dense type and exchange type, and obtaining the cache type of the at least one storage block comprises: In response to the presence of a location bitmap associated with the at least one storage block in the cache, determining that the cache type of the at least one storage block is the sparse type; In response to the absence of a location bitmap associated with the at least one storage block in the cache and the presence of a first indicator associated with the at least one storage block in the cache, determining that the cache type of the at least one storage block is the intensive type; or In response to the absence of a location bitmap associated with the at least one storage block in the cache and the presence of a second indicator associated with the at least one storage block in the cache, determining that the cache type of the at least one storage block is the swap type.

13. An electronic device comprising: processor; as well as A memory coupled to the processor, the memory having instructions stored therein, the instructions causing the electronic device to perform operations when executed by the processor, the operations comprising: In response to a target recovery request for a user device, determining at least one storage block to be recovered by the target recovery request, wherein the at least one storage block is composed of a plurality of storage areas; Obtaining a cache type of the at least one storage block in a cache, wherein the cache type of the at least one storage block is based on a number of recovery regions indicated by the cache for the at least one storage block; Based on the cache type of the at least one storage block, determining a plurality of cache areas from a plurality of areas constituting the at least one storage block; updating the recovery data in the plurality of cache areas into the cache; and In response to the restoration confirmation operation, the data of the at least one storage block in the user equipment is restored based on the restoration data cached in the buffer after the update.

14. An electronic device according to claim 13, wherein the cache type of the at least one storage block is at least one of a sparse type and a dense type, the sparse type indicates that the number of recovery areas indicated by the cache for the at least one storage block is less than a predetermined threshold, and the dense type indicates that the number of recovery areas indicated by the cache for the at least one storage block is greater than or equal to the predetermined threshold.

15. The electronic device according to claim 14, wherein determining the plurality of cache areas from a plurality of storage areas constituting the at least one storage block comprises: In response to the cache type of the at least one storage block being the sparse type, a plurality of cache areas to be restored by the target restoration request are determined from a plurality of storage areas constituting the at least one storage block.

16. The electronic device according to claim 15, wherein there is a location bitmap associated with the at least one storage block in the cache, and the location bitmap is used to indicate the location of the recovery area of ​​the at least one storage block in the at least one storage block.

17. The electronic device according to claim 16, wherein updating the recovery data of the plurality of cache areas into the cache memory comprises: querying a location bitmap associated with the at least one storage block to determine whether the plurality of cache areas are recovery areas; In response to the plurality of cache areas being recovery areas, overwriting the recovery data of the plurality of cache areas already in the cache with the target recovery request after the recovery data of the plurality of cache areas is recovered; or In response to the multiple cache areas not being recovery areas, the recovery data after the target recovery request recovers the multiple cache areas is added to the cache area by area.

18. The electronic device of claim 17, the operations further comprising: In response to the plurality of cache areas not being recovery areas, updating the number of recovery areas of the at least one storage block with the number of areas of the plurality of cache areas; as well as In response to the updated number of recovery areas being greater than or equal to the predetermined threshold, the cache type of the at least one storage block is converted from the sparse type to the dense type.

19. The electronic device of claim 17, the operations further comprising: In response to the number of recovery areas indicated by the cache for the at least one storage block before the addition reaching a pointer threshold condition, a first intermediate pointer for indexing the multiple cache areas and a second intermediate pointer for indexing the recovery area corresponding to the number of recovery areas are generated after the addition.

20. A computer program product tangibly stored on a computer-readable storage medium and comprising computer-executable instructions which, when executed, cause a computer to: In response to a target recovery request for a user device, determining at least one storage block to be recovered by the target recovery request, wherein the at least one storage block is composed of a plurality of storage areas; Obtaining a cache type of the at least one storage block in a cache, wherein the cache type of the at least one storage block is based on a number of recovery regions indicated by the cache for the at least one storage block; Based on the cache type of the at least one storage block, determining a plurality of cache areas from a plurality of areas constituting the at least one storage block; updating the recovery data in the plurality of cache areas into the cache; as well as In response to the restoration confirmation operation, the data of the at least one storage block in the user equipment is restored based on the restoration data cached in the buffer after the update.