Storage and recovery method and device, equipment and medium

By updating the reference information of the physical block address according to the data type and write operation type in the flash storage system and performing recycling, the problem of double the amount of metadata and high maintenance costs caused by reverse index in the prior art is solved, and more efficient storage read and write performance is achieved.

CN119718210APending Publication Date: 2025-03-28INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411998447.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

Existing flash memory systems identify invalid physical block addresses (PBAs) by establishing a reverse index of the physical to logical map (PL) of logic to physical map (LP), resulting in double the amount of metadata, high memory usage and maintenance costs, affecting the read and write performance of storage.

Method used

By determining the data type and write operation type of the front-end data, updating the reference information of the physical block address, and performing the recycling of the physical block address based on the reference information, the need to additional maintenance of the PL tree is avoided and the amount of metadata and memory usage is reduced.

Benefits of technology

It reduces memory usage and maintenance costs, improves storage read and write performance, and solves the problems of large amount of data and high maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718210A_ABST
    Figure CN119718210A_ABST
Patent Text Reader

Abstract

The invention discloses a storage recovery method and device, equipment and a medium, and relates to the technical field of flash memory storage. According to the scheme, a new invalid PBA recognition and recovery scheme is provided, specifically, the data type of the front-end data and the write operation type of the logic block address are determined, and then the reference information of the physical block address is updated according to the data type and the write operation type; and finally, recovering the physical block address according to the reference information of the physical block address. Therefore, the scheme is different from a common reverse indexing mode, ineffective identification and garbage collection of the physical block address are realized by determining the reference information of the physical block address, and a PL tree does not need to be additionally maintained, so that the metadata amount is reduced, the memory occupancy rate and the maintenance cost are reduced, and the storage read-write performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of flash memory storage technology, and in particular to a storage recovery method, device, equipment and medium. Background Art

[0002] In flash storage systems, append writes are performed by treating all physical block addresses (PBA) in the storage pool as a whole and maintaining them in a bitmap, allocating addresses in sequence to achieve wear leveling and alleviate life issues. When all PBAs are used, valid PBAs are often discrete, and it is necessary to serialize discrete PBAs and reuse invalid PBAs through garbage collection. In a deduplication environment, garbage collection identifies invalid PBAs by establishing a logical to physical mapping (LP) reverse index physical to logical mapping (PL). The PL tree stores a one-to-many mapping relationship between each PBA and the logical block address (LBA). PBAs without corresponding LBAs are invalid and can be recycled.

[0003] However, after the reverse index relationship is established, the metadata needs to be maintained not only in the LP tree but also in the PL tree. Since the two are reverse indexes of each other, the data volume of the two trees is basically the same, which results in the doubling of metadata volume, memory usage and maintenance overhead. This may cause the metadata to be unable to be fully cached in the memory, causing a large number of disk reads, affecting read and write performance.

[0004] In view of the above, how to solve the problem that the current process of identifying and recycling invalid PBAs by establishing a reverse index PL of LP has a large amount of data, high memory occupancy and maintenance costs, and affects storage read and write performance is an urgent problem to be solved by technical personnel in this field. Summary of the invention

[0005] The purpose of the present invention is to provide a storage recovery method, device, equipment and medium to solve the problem that the current process of identifying and recovering invalid PBA by establishing a reverse index PL of LP has a large amount of data, high memory occupancy and maintenance cost, and affects the storage read and write performance.

[0006] In order to solve the above technical problems, the present invention provides a storage recovery method, which is applied to a storage pool; the method comprises:

[0007] When receiving the front-end data transmitted by the host, the front-end data is written into the corresponding logical block address, and the physical block address corresponding to the front-end data is determined;

[0008] Determine the data type of the front-end data and the type of write operation to the logical block address;

[0009] Update the reference information of the physical block address according to the data type and write operation type;

[0010] The physical block address is recycled according to the reference information of the physical block address.

[0011] On the one hand, determine the data type of the front-end data, including:

[0012] Start the deduplication function and obtain the hash-to-physical mapping tree;

[0013] Determine the hash value of the front-end data;

[0014] The data type is determined based on the hash value of the hash-to-physical mapping tree and the front-end data.

[0015] On the other hand, the data type is determined based on the hash value of the hash-to-physical mapping tree and the front-end data, including:

[0016] Find the physical block address corresponding to the hash value based on the hash-to-physical mapping tree;

[0017] Determine whether the physical block address corresponding to the hash value can be found in the hash-to-physical mapping tree;

[0018] If it is confirmed that the physical block address corresponding to the hash value is found in the hash-to-physical mapping tree, then the data in the physical block address corresponding to the hash value is read;

[0019] Compare the data in the physical block address corresponding to the hash value with the front-end data for consistency;

[0020] Determine whether the data in the physical block address corresponding to the hash value is the same as the front-end data;

[0021] If it is confirmed that the data in the physical block address corresponding to the hash value is the same as the front-end data, then the front-end data is confirmed to be deduplicated data;

[0022] If it is confirmed that the data in the physical block address corresponding to the hash value is different from the front-end data, it is confirmed that the front-end data is not deduplicated data;

[0023] If it is confirmed that the physical block address corresponding to the hash value is not found in the hash-to-physical mapping tree, it is confirmed that the front-end data is the first deduplicated data.

[0024] On the other hand, the reference information of the physical block address is updated according to the data type and the write operation type, including:

[0025] When the write operation type is not an overwrite write operation and the data type is not deduplication data, the first update strategy is executed to update the reference count;

[0026] When the write operation type is not an overwrite write operation, the data type is deduplicated data and it is the first deduplicated data, the first update strategy is executed to update the reference count;

[0027] When the write operation type is not an overwrite write operation, and the data type is deduplicated data and it is not the first deduplicated data, the second update strategy is executed to update the reference count;

[0028] When the write operation type is an overwrite write operation and the data type is not deduplication data, the third update strategy is executed to update the reference count;

[0029] When the write operation type is an overwrite write operation and the data type is deduplicated data, the fourth update strategy is executed to update the reference count.

[0030] On the other hand, executing the first update strategy to update the number of references includes:

[0031] The front-end data is written into the corresponding physical block address through the append write mechanism;

[0032] Update the usage flag of the physical block address to used, and set the reference count of the physical block address to 1;

[0033] Correspondingly, executing the second update strategy to update the number of references includes:

[0034] Determine the physical block address corresponding to the hash value of the front-end data as the physical block address corresponding to the front-end data;

[0035] Increase the number of references to the physical block address by 1;

[0036] Correspondingly, the third update strategy is executed to update the number of references, including:

[0037] Obtain a logical-to-physical mapping tree, and search for a previous physical block address corresponding to the logical block address according to the logical-to-physical mapping tree;

[0038] Write the front-end data to the corresponding physical block address and clear the reference count of the front physical block address to zero;

[0039] Correspondingly, the fourth update strategy is executed to update the number of references, including:

[0040] Obtain a logical-to-physical mapping tree, and search for a previous physical block address corresponding to the logical block address according to the logical-to-physical mapping tree;

[0041] Write the front-end data to the corresponding physical block address and reduce the number of references to the front physical block address by 1.

[0042] On the other hand, the physical block address is recycled according to the reference information of the physical block address, including:

[0043] Determine whether the number of references to the physical block address is 0;

[0044] If the reference count is confirmed to be 0, garbage collection of the physical block address is performed.

[0045] On the other hand, it also includes:

[0046] Maintain reference information of each physical block address through a bitmap;

[0047] The bitmap includes reference information and usage marks corresponding to multiple physical block addresses.

[0048] In order to solve the above technical problems, the present invention also provides a storage recovery device, which is applied to a storage pool; the device comprises:

[0049] A writing module, used for writing the front-end data into the corresponding logical block address and determining the physical block address corresponding to the front-end data when receiving the front-end data transmitted by the host;

[0050] A determination module, used to determine the data type of the front-end data and the type of write operation to the logical block address;

[0051] An update module, used to update reference information of a physical block address according to a data type and a write operation type;

[0052] The recycling module is used to recycle the physical block address according to the reference information of the physical block address.

[0053] In order to solve the above technical problems, the present invention further provides a storage recovery device, comprising:

[0054] Memory for storing computer programs;

[0055] A processor is used to implement the steps of the above storage recovery method when executing a computer program.

[0056] In order to solve the above technical problem, the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above storage recovery method are implemented.

[0057] The storage recovery method provided by the present invention is applied to a storage pool; specifically, when receiving front-end data transmitted by a host, the front-end data is written into a corresponding logical block address, and a physical block address corresponding to the front-end data is determined; the data type of the front-end data and the write operation type to the logical block address are determined; the reference information of the physical block address is updated according to the data type and the write operation type; and the physical block address is recovered according to the reference information of the physical block address.

[0058] The beneficial effect of the present invention is that a new invalid PBA identification and recycling scheme is provided, which specifically determines the data type of the front-end data and the write operation type of the logical block address, and then updates the reference information of the physical block address according to the data type and the write operation type, and finally executes the recycling of the physical block address according to the reference information of the physical block address. It can be seen that the scheme is different from the common reverse indexing method, but realizes the invalid identification and garbage collection of the physical block address by determining the reference information of the physical block address, without the need for additional maintenance of the PL tree, thereby reducing the amount of metadata, reducing the memory occupancy rate and maintenance cost, and improving the storage read and write performance.

[0059] In addition, the present invention also provides a storage recovery device, equipment and medium, with the same effects as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0061] Figure 1 A flowchart of a storage recovery method provided by an embodiment of the present invention;

[0062] Figure 2 A schematic diagram of a storage recovery device provided by an embodiment of the present invention;

[0063] Figure 3 A schematic diagram of a storage recovery device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0064] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0065] The core of the present invention is to provide a storage recovery method, device, equipment and medium to solve the problem that the current process of identifying and recovering invalid PBA by establishing a reverse index PL of LP has a large amount of data, high memory occupancy and maintenance cost, and affects the storage read and write performance.

[0066] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0067] In order to solve the limited number of flash memory erase and write times and achieve wear leveling, the industry mostly adopts the append write method. Unlike the overwrite write of mechanical hard disks, the flash memory storage system regards all PBA addresses as a whole, maintains them as a bitmap, and allocates addresses in sequence. Even if data is written to the same LBA, a new PBA address is allocated, which greatly alleviates the life problem. However, after all PBAs are used, the valid PBAs are often discrete, and it is necessary to use garbage collection to serialize the discrete PBAs and reuse invalid PBAs. In a deduplication environment, garbage collection identifies invalid PBAs by establishing an LP reverse index PL. The PL tree saves a one-to-many mapping relationship between each PBA and LBA. PBAs without corresponding LBAs are invalid and can be recycled.

[0068] However, the introduction of the PL tree doubles the amount of metadata, and the memory usage and maintenance overhead also doubles, which may cause the metadata to be unable to be fully cached in the memory, causing a large number of disk reads and affecting the read performance. At the same time, originally only LP was required to be flushed, and now PL flushing is added, and the write performance is also affected. Although the reverse index PL tree helps garbage collection to identify invalid PBAs, the problem of doubling the amount of metadata it brings cannot be ignored. Therefore, in order to solve the above problems, the present invention provides a storage recovery method, which is specifically applied to the storage pool of a flash storage system.

[0069] Figure 1 A flow chart of a storage recovery method provided by an embodiment of the present invention. Figure 1 As shown, the method includes:

[0070] S10: When receiving the front-end data transmitted by the host, writing the front-end data into the corresponding logical block address, and determining the physical block address corresponding to the front-end data;

[0071] Specifically, the front-end data transmitted by the host is first monitored. When the front-end data transmitted by the host is received, the front-end data needs to be written to the corresponding LBA. It should be noted that the front-end data will be pre-assigned to the LBA before storage; there is a mapping relationship between the LBA and the PBA. Therefore, after the front-end data is written to the corresponding LBA, the PBA corresponding to the front-end data can be determined according to the LBA.

[0072] In this embodiment, there is no limitation on the specific method for determining the LBA corresponding to the front-end data, and there is no limitation on the specific method for determining the corresponding PBA based on the LBA, which depends on the specific implementation situation.

[0073] S11: Determine the data type of the front-end data and the write operation type to the logical block address.

[0074] Furthermore, the data type of the front-end data and the write operation type of the front-end data to the LBA are determined.

[0075] It should be noted that in this embodiment, the main focus is on whether the data type of the front-end data is deduplicated data. Deduplicated data refers to data that has been processed by data deduplication technology. Data deduplication technology can also be called deduplication function, which reduces the demand for storage space by identifying and deleting duplicate data blocks in the data set. Deduplicated data only retains one copy of each unique data block and replaces other duplicate copies with a reference to the copy. As the result of deduplication processing, deduplicated data has the advantages of saving storage space and improving storage efficiency.

[0076] In addition, in this embodiment, there is no restriction on the specific write operation type of the front-end data to the LBA, such as append write, overwrite write, sequential write or random write, etc., depending on the specific implementation situation.

[0077] S12: Update reference information of the physical block address according to the data type and the write operation type.

[0078] Further, the reference information of the PBA is updated according to the data type and the write operation type. It is worth noting that in this embodiment, a variable, namely, the reference information, is added to the information of the PBA in advance to mark the situation where the PBA is referenced. In this embodiment, there is no restriction on the specific type of the reference information, such as the reference frequency, the number of references, or the reference time, which depends on the specific implementation situation.

[0079] It should be noted that the specific process of updating the reference information of the PBA according to the data type and the write operation type is not limited in this embodiment, and it depends on the specific implementation situation. In addition, in order to better maintain the reference information of the PBA, the reference information of each PBA can be maintained specifically through a bitmap. It can be understood that the bitmap is a data structure that maintains the information of each PBA, and generally includes the usage mark of each PBA; and in this embodiment, the bitmap specifically includes the reference information and usage marks corresponding to multiple PBAs. Since the deduplication rate of the PBA is subject to an upper limit, the space occupied by the newly added reference information in the bitmap is 1 byte or 2 bytes.

[0080] S13: Reclaiming the physical block address according to the reference information of the physical block address.

[0081] Finally, the PBA is recycled according to the reference information of the PBA. It should be noted that the specific process of recycling the PBA according to the reference information of the PBA is not limited in this embodiment, for example, when the reference frequency of the PBA is lower than a threshold, the PBA is garbage collected, when the number of references of the PBA is lower than a threshold, the PBA is garbage collected, or when the reference time of the PBA is not within a preset period, the PBA is garbage collected, depending on the specific implementation situation.

[0082] In this embodiment, a new invalid PBA identification and recycling scheme is provided, which specifically determines the data type of the front-end data and the write operation type of the logical block address, and then updates the reference information of the physical block address according to the data type and the write operation type, and finally executes the recycling of the physical block address according to the reference information of the physical block address. It can be seen that this scheme is different from the common reverse indexing method, but realizes the invalid identification and garbage collection of the physical block address by determining the reference information of the physical block address, without the need to maintain the PL tree additionally, thereby reducing the amount of metadata, reducing the memory occupancy rate and maintenance cost, and improving the storage read and write performance.

[0083] Based on the above embodiments, in some embodiments, determining the data type of the front-end data includes:

[0084] S111: Start the deduplication function and obtain the hash to physical mapping tree;

[0085] S112: Determine the hash value of the front-end data;

[0086] S113: Determine the data type according to the hash value of the hash-to-physical mapping tree and the front-end data.

[0087] In the specific implementation, in order to determine the data type of the front-end data, the deduplication function is first started, and the Hash to Physics Mapping (HP) tree is obtained. It should be noted that the HP tree is a structure generated after the deduplication function is turned on to store the mapping relationship between the hash value of the front-end data and the corresponding PBA. Specifically, in the SSD, in order to manage the dynamic mapping relationship between the front-end data and the PBA, a hash function is used to calculate the hash value of the front-end data, and a mapping relationship is established between the hash value and the PBA. This HP mapping relationship allows the system to quickly find the corresponding PBA through the hash value of the front-end data, thereby achieving efficient access and management of the data.

[0088] Therefore, in this embodiment, the hash value of the front-end data is determined, and the data in the PBA corresponding to the front-end data can be determined according to the HP tree and the hash value of the front-end data, so that the data type of the front-end data is determined according to the data consistency relationship between the front-end data and the data in the corresponding PBA. The specific process is as follows:

[0089] The data type is determined based on the hash value of the hash-to-physical mapping tree and the front-end data, including:

[0090] S114: searching for a physical block address corresponding to the hash value based on the hash-to-physical mapping tree;

[0091] S115: Determine whether the physical block address corresponding to the hash value can be found in the hash-to-physical mapping tree; if so, proceed to step S116; if not, proceed to step S121;

[0092] S116: Read the data in the physical block address corresponding to the hash value;

[0093] S117: Compare the data in the physical block address corresponding to the hash value with the front-end data for consistency;

[0094] S118: Determine whether the data in the physical block address corresponding to the hash value is the same as the front-end data; if so, proceed to step S119; if not, proceed to step S120;

[0095] S119: confirm that the front-end data is deduplicated data;

[0096] S120: Confirm that the front-end data is not deduplicated data.

[0097] S121: Confirm that the front-end data is the first deduplicated data.

[0098] Specifically, the PBA corresponding to the hash value of the front-end data is searched based on the HP tree; and it is determined whether the PBA corresponding to the hash value can be found in the HP tree. If it is confirmed that the PBA corresponding to the hash value is found in the HP tree, the data in the PBA corresponding to the hash value is read, and the data in the PBA corresponding to the hash value is compared with the front-end data for consistency, to determine whether the data in the PBA corresponding to the hash value is the same as the front-end data.

[0099] If the data in the PBA corresponding to the hash value is confirmed to be the same as the front-end data, it means that the front-end data has been stored in the corresponding PBA, and the front-end data is confirmed to be deduplicated data. If the data in the PBA corresponding to the hash value is confirmed to be different from the front-end data, it means that the front-end data is not stored in the corresponding PBA, and the front-end data is confirmed to be not deduplicated data.

[0100] If it is confirmed that the PBA corresponding to the hash value is not found in the HP tree, it means that the front-end data has never been stored in any PBA before. Since the deduplication function is currently enabled, the front-end data is confirmed to be the first deduplicated data.

[0101] In summary, by enabling the deduplication function, the data type of the front-end data is determined according to the hash value of the front-end data and the hash-to-physical mapping tree, so that garbage collection of the corresponding PBA can be performed later according to the data type of the front-end data.

[0102] Based on the above embodiments, in some embodiments, updating the reference information of the physical block address according to the data type and the write operation type includes:

[0103] S122: When the write operation type is not an overwrite write operation and the data type is not deduplication data, the first update strategy is executed to update the reference count;

[0104] S123: When the write operation type is not an overwrite write operation, and the data type is deduplicated data and it is the first deduplicated data, execute the first update strategy to update the reference count;

[0105] S123: When the write operation type is not an overwrite write operation, and the data type is deduplicated data and it is not the first deduplicated data, the second update strategy is executed to update the reference count;

[0106] S124: When the write operation type is an overwrite write operation and the data type is not deduplication data, the third update strategy is executed to update the reference count;

[0107] S125: When the write operation type is an overwrite write operation and the data type is deduplicated data, the fourth update strategy is executed to update the reference count.

[0108] In this embodiment, the reference information of the PBA is specifically the number of references. It is understandable that the initial number of references of the PBA is 0. It should also be noted that in order to determine the number of references of the PBA, the type of write operation of the front-end data to the LBA considered in this embodiment is specifically whether it is an overwrite write operation. Specifically, the overwrite has a significant impact on the garbage collection of the PBA: since the overwrite does not generate invalid data, its garbage collection frequency is low and the overhead is small, it will not cause a write amplification effect, the storage space utilization rate is high, and the system performance is stable.

[0109] Therefore, in a specific embodiment, when the write operation type is not an overwrite write operation, and the data type is not deduplicated data, the first update strategy is executed to update the reference count; when the write operation type is not an overwrite write operation, the data type is deduplicated data and it is the first deduplicated data, the first update strategy is executed to update the reference count; when the write operation type is not an overwrite write operation, the data type is deduplicated data and it is not the first deduplicated data, the second update strategy is executed to update the reference count; when the write operation type is an overwrite write operation, and the data type is not deduplicated data, the third update strategy is executed to update the reference count; when the write operation type is an overwrite write operation, and the data type is deduplicated data, the fourth update strategy is executed to update the reference count. The following is a detailed description of the four update strategies:

[0110] (I) Executing the first update strategy to update the number of citations, including:

[0111] S126: writing the front-end data into the corresponding physical block address through the append writing mechanism;

[0112] S127: Update the usage flag of the physical block address to used, and set the reference count of the physical block address to 1.

[0113] Specifically, when the write operation type is not an overwrite write operation and the data type is not deduplicated data, or when the write operation type is not an overwrite write operation and the data type is deduplicated data and it is the first deduplicated data, the front-end data needs to be directly written into the corresponding PBA. Specifically, the front-end data is written into the corresponding PBA through the append write mechanism. The PBA is a new PBA and the corresponding reference count is 0. Therefore, after the front-end data is written into the corresponding PBA, the use mark of the PBA is updated to used, and the reference count is set to 1.

[0114] (II) Executing the second update strategy to update the number of citations, including:

[0115] S128 determines the physical block address corresponding to the hash value of the front-end data as the physical block address corresponding to the front-end data;

[0116] S129: Increase the number of references to the physical block address by 1.

[0117] Specifically, when the write operation type is not an overwrite write operation, and the data type is deduplicated data and is not the first deduplicated data, it means that the front-end data already exists in a certain PBA. Specifically based on the HP tree, the PBA corresponding to the hash value of the front-end data is determined as the PBA currently corresponding to the front-end data, and the number of references to the PBA is increased by 1.

[0118] (III) Executing the third update strategy to update the number of citations, including:

[0119] S130: Obtain a logical-to-physical mapping tree, and search for a former physical block address corresponding to the logical block address according to the logical-to-physical mapping tree;

[0120] S131: Write the front-end data into the corresponding physical block address, and clear the reference count of the front physical block address to zero.

[0121] Specifically, when the write operation type is an overwrite write operation and the data type is not deduplication data, the front-end data needs to be directly written into the corresponding PBA, specifically, the PBA is written in an append write manner.

[0122] It should be noted that, because the append write method is adopted, when writing data to the same LBA multiple times, a new PBA will be allocated and the LP tree will be updated each time. The previous PBA corresponding to the previous LBA will become an invalid PBA after the writing is successful. Therefore, the previous PBA must be obtained before updating the LP tree, otherwise the corresponding previous PBA cannot be determined according to the LBA after the LP tree is updated.

[0123] Specifically, the LP tree is obtained, and the previous PBA corresponding to the LBA is searched according to the LP tree; the front-end data is written into the corresponding PBA, and the number of references of the previous PBA is cleared. On the other hand, the information of the previous PBA is processed after the writing is successful, which can prevent the situation where the previous PBA is processed first but the front-end data is not written successfully.

[0124] (IV) Executing the fourth update strategy to update the number of citations, including:

[0125] S132: Obtain a logical-to-physical mapping tree, and search for a former physical block address corresponding to the logical block address according to the logical-to-physical mapping tree;

[0126] S133: Write the front data into the corresponding physical block address, and reduce the number of references of the front physical block address by 1.

[0127] When the write operation type is an overwrite write operation and the data type is deduplication data, the previous PBA corresponding to the LBA corresponding to the front-end data will become an invalid PBA after the write is successful. Therefore, each time data is written, the LP tree is obtained and the previous PBA corresponding to the LBA is searched according to the LP tree; finally, the front-end data is written to the corresponding PBA, and the number of references to the previous PBA address is reduced by 1.

[0128] In summary, the update of the number of citations of PBA is achieved through four update strategies.

[0129] Based on the above embodiments, in some embodiments, the physical block address is recycled according to the reference information of the physical block address, including:

[0130] S134: Determine whether the reference count of the physical block address is 0; if so, proceed to step S135;

[0131] S135: Execute garbage collection on the physical block address.

[0132] During the garbage collection process, unlike the reverse index mechanism which needs to query the LP tree and the PL tree, especially the need to query the same PBA of the PL tree multiple times, this scheme can directly perform garbage collection based on the reference information of the PBA contained in the bitmap.

[0133] Specifically, it is determined whether the number of references of the PBA is 0. If it is confirmed that the number of references of the PBA is 0, it is considered that the current PBA has become an invalid PBA and garbage collection of the PBA needs to be performed, otherwise the PBA is not garbage collected. The recycled PBA can be reallocated for use.

[0134] In addition, in some embodiments, data in the PBA can be migrated. Specifically, according to the reference count of the PBA, the valid data corresponding to the PBA that is still in use is migrated. For example, the frequent use of the append write method will cause the valid PBA to become very discrete. When there is only one PBA in a preset number of consecutive PBAs that is used, and there is only one PBA in a preset number of consecutive PBAs that is not used, in order to eliminate this phenomenon, it is necessary to migrate the data of the used PBA to the unused PBA, and then recycle the PBA before the data migration. In this way, the continuity of the valid PBA can be guaranteed, and the storage efficiency and storage stability can be improved.

[0135] On the other hand, for the migration of data corresponding to the PBA, the data in the original PBA can be rewritten in the destination PBA, and the mapping relationship of the LP can be changed to the new PBA.

[0136] In the above embodiments, the storage recovery method is described in detail. The present invention also provides a corresponding embodiment of the storage recovery device.

[0137] Figure 2 A schematic diagram of a storage recovery device provided by an embodiment of the present invention. The device is applied to a storage pool; Figure 2 As shown, the device comprises:

[0138] The writing module 10 is used to write the front-end data into the corresponding logical block address when receiving the front-end data transmitted by the host, and determine the physical block address corresponding to the front-end data.

[0139] The determination module 11 is used to determine the data type of the front-end data and the type of write operation to the logical block address.

[0140] The updating module 12 is used to update the reference information of the physical block address according to the data type and the write operation type.

[0141] The recycling module 13 is used to recycle the physical block address according to the reference information of the physical block address.

[0142] In some embodiments, the determination module 11 includes:

[0143] The first acquisition submodule is used to start the deduplication function and obtain the hash to physical mapping tree;

[0144] A first determination submodule is used to determine the hash value of the front-end data;

[0145] The second determination submodule is used to determine the data type according to the hash value of the hash-to-physical mapping tree and the front-end data.

[0146] In some embodiments, the second determining submodule includes:

[0147] A first search submodule, used for searching the physical block address corresponding to the hash value based on the hash-to-physical mapping tree;

[0148] The first judgment submodule is used to judge whether the physical block address corresponding to the hash value can be found in the hash-to-physical mapping tree; if so, the reading submodule is triggered; if not, the front-end data is confirmed to be the first deduplicated data;

[0149] The reading submodule is used to read the data in the physical block address corresponding to the hash value;

[0150] A comparison submodule is used to compare the data in the physical block address corresponding to the hash value with the front-end data for consistency;

[0151] The second judgment submodule is used to judge whether the data in the physical block address corresponding to the hash value is the same as the front-end data; if so, confirm that the front-end data is deduplicated data; if not, confirm that the front-end data is not deduplicated data.

[0152] In some embodiments, the update module 12 includes:

[0153] A first execution submodule is used to execute the first update strategy to update the number of references when the write operation type is not an overwrite write operation and the data type is not deduplicated data; when the write operation type is not an overwrite write operation, the data type is deduplicated data and it is the first deduplicated data, execute the first update strategy to update the number of references;

[0154] A second execution submodule is used to execute a second update strategy to update the number of references when the write operation type is not an overwrite write operation and the data type is deduplicated data and it is not the first deduplicated data;

[0155] A third execution submodule, configured to execute a third update strategy to update the number of references when the write operation type is an overwrite write operation and the data type is not deduplication data;

[0156] The fourth execution submodule is used to execute a fourth update strategy to update the number of references when the write operation type is an overwrite write operation and the data type is deduplication data.

[0157] In some embodiments, the first execution submodule is specifically used to write the front-end data to the corresponding physical block address through an append write mechanism; update the use mark of the physical block address to used, and set the reference count of the physical block address to 1;

[0158] The second execution submodule is specifically used to determine the physical block address corresponding to the hash value of the front-end data as the physical block address corresponding to the front-end data; and increase the number of references to the physical block address by 1;

[0159] The third execution submodule is specifically used to obtain the logical-to-physical mapping tree, and find the previous physical block address corresponding to the logical block address according to the logical-to-physical mapping tree; write the front-end data to the corresponding physical block address, and clear the number of references of the previous physical block address;

[0160] The fourth execution submodule is specifically used to obtain the logical-to-physical mapping tree, and search for the previous physical block address corresponding to the logical block address according to the logical-to-physical mapping tree; write the front-end data to the corresponding physical block address, and reduce the number of references of the previous physical block address by 1.

[0161] In some embodiments, the recovery module 13 includes:

[0162] The third judgment submodule is used to judge whether the reference count of the physical block address is 0; if it is confirmed that the reference count is 0, the recycling submodule is triggered;

[0163] The recycling submodule is used to perform garbage collection on physical block addresses.

[0164] In some embodiments, it also includes:

[0165] The maintenance submodule is used to maintain the reference information of each physical block address through a bitmap;

[0166] The bitmap includes reference information and usage marks corresponding to multiple physical block addresses.

[0167] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0168] In addition, the present invention also provides a computer program product, including a computer program / instruction, which implements the steps of the above storage recovery method when executed by a processor.

[0169] Figure 3 A schematic diagram of a storage recovery device provided by an embodiment of the present invention. Figure 3 As shown, the storage recovery equipment includes:

[0170] A memory 20, used for storing computer programs;

[0171] The processor 21 is used to implement the steps of the storage recycling method mentioned in the above embodiment when executing the computer program.

[0172] The storage recovery device provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer, or a desktop computer.

[0173] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of a digital signal processor (DSP), a field programmable gate array (FPGA), and a programmable logic array. The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0174] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the storage recovery method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. Data 203 may include but is not limited to data involved in the storage recovery method.

[0175] In some embodiments, the storage recycling device may further include a display screen 22 , an input / output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .

[0176] Those skilled in the art will understand that Figure 3 The structure shown in the figure does not constitute a limitation of the storage recovery device, and may include more or fewer components than shown in the figure.

[0177] Finally, the present invention also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.

[0178] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc. Various media that can store program codes.

[0179] The above is a detailed introduction to a storage recovery method, device, equipment and medium provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the present invention.

[0180] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A storage recovery method, characterized in that: Applied to a storage pool; the method comprises: When receiving the front-end data transmitted by the host, writing the front-end data into the corresponding logical block address, and determining the physical block address corresponding to the front-end data; Determine the data type of the front-end data and the write operation type to the logical block address; updating reference information of the physical block address according to the data type and the write operation type; The physical block address is recycled according to the reference information of the physical block address.

2. The storage recovery method according to claim 1, characterized in that: Determining the data type of the front-end data includes: Start the deduplication function and obtain the hash-to-physical mapping tree; Determining a hash value of the front-end data; The data type is determined according to the hash-to-physical mapping tree and the hash value of the front-end data.

3. The storage recovery method according to claim 2, characterized in that: Determining the data type according to the hash-to-physical mapping tree and the hash value of the front-end data includes: Searching for a physical block address corresponding to the hash value based on the hash-to-physical mapping tree; Determine whether the physical block address corresponding to the hash value can be found in the hash-to-physical mapping tree; If it is confirmed that the physical block address corresponding to the hash value is found in the hash-to-physical mapping tree, then reading the data in the physical block address corresponding to the hash value; Comparing the data in the physical block address corresponding to the hash value with the front-end data for consistency; Determine whether the data in the physical block address corresponding to the hash value is the same as the front-end data; If it is confirmed that the data in the physical block address corresponding to the hash value is the same as the front-end data, then the front-end data is confirmed to be deduplicated data; If it is confirmed that the data in the physical block address corresponding to the hash value is different from the front-end data, it is confirmed that the front-end data is not the deduplicated data; If it is confirmed that the physical block address corresponding to the hash value is not found in the hash-to-physical mapping tree, then the front-end data is confirmed to be the first copy of the deduplicated data.

4. The storage recovery method according to claim 3, characterized in that: Updating the reference information of the physical block address according to the data type and the write operation type includes: When the write operation type is not an overwrite write operation, and the data type is not the deduplicated data, executing the first update strategy to update the reference count; When the write operation type is not the overwrite write operation, and the data type is the deduplicated data and it is the first copy of the deduplicated data, executing the first update strategy to update the reference count; When the write operation type is not the overwrite write operation, and the data type is the deduplicated data and is not the first copy of the deduplicated data, executing a second update strategy to update the reference count; When the write operation type is the overwrite write operation, and the data type is not the deduplicated data, executing a third update strategy to update the reference count; When the write operation type is the overwrite write operation and the data type is the deduplicated data, a fourth update strategy is executed to update the reference count.

5. The storage recovery method according to claim 4, characterized in that: Execute the first update strategy to update the number of references, including: Writing the front-end data into the corresponding physical block address through an additional writing mechanism; Update the use mark of the physical block address to used, and set the reference count of the physical block address to 1; Correspondingly, executing the second update strategy to update the number of references includes: Determine the physical block address corresponding to the hash value of the front-end data as the physical block address corresponding to the front-end data; Increasing the number of references of the physical block address by 1; Correspondingly, executing the third update strategy to update the number of references includes: Obtaining a logical-to-physical mapping tree, and searching for a former physical block address corresponding to the logical block address according to the logical-to-physical mapping tree; Writing the front-end data into the corresponding physical block address, and clearing the reference count of the front physical block address to zero; Correspondingly, executing the fourth update strategy to update the number of references includes: Obtaining a logical-to-physical mapping tree, and searching for a former physical block address corresponding to the logical block address according to the logical-to-physical mapping tree; The front-end data is written into the corresponding physical block address, and the reference count of the front physical block address is reduced by 1.

6. The storage recovery method according to claim 5, characterized in that: Reclaiming the physical block address according to the reference information of the physical block address includes: Determine whether the reference count of the physical block address is 0; If it is confirmed that the reference count is 0, garbage collection of the physical block address is performed.

7. The storage recovery method according to any one of claims 1 to 6, characterized in that: Also includes: Maintaining the reference information of each physical block address through a bitmap; The bitmap includes the reference information and usage marks corresponding to multiple physical block addresses.

8. A storage recovery device, characterized in that: Applied to a storage pool; the device comprises: A writing module, used for writing the front-end data into the corresponding logical block address when receiving the front-end data transmitted by the host, and determining the physical block address corresponding to the front-end data; A determination module, used to determine the data type of the front-end data and the type of write operation to the logical block address; An updating module, configured to update the reference information of the physical block address according to the data type and the write operation type; The recycling module is used to recycle the physical block address according to the reference information of the physical block address.

9. A storage recovery device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the storage recovery method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the storage recycling method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Method for prolonging service life of solid-state disk

    CN102646069A

  • Writing, reading and garbage collection method of solid-state memory system

    CN103150258A

  • Storage equipment and junk data recovery method thereof

    CN105701024A

  • Data management method, electronic equipment and computer readable and writable storage medium

    CN115981573A