Data space recovery method, electronic device and storage medium

Through the time-segmented space management mechanism, the problem of high host latency during data space recovery is solved, efficient data space recovery is achieved, host latency is reduced and recovery efficiency is improved.

CN120491910BActive Publication Date: 2025-09-16INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510988008.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-17
Publication Date
2025-09-16
Estimated Expiration
2045-07-17

AI Technical Summary

Technical Problem

In the existing technology, the host latency is high during data space recovery, resulting in performance degradation.

Method used

Through the time-segmented space management mechanism, data space before the preset time point is reclaimed to avoid writing and reading accessing the same space at the same time, simplifying the recycling process and reducing host latency.

Benefits of technology

The host's latency during data space recovery is reduced, recovery efficiency is improved, and loss of host performance is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120491910B_ABST
    Figure CN120491910B_ABST
Patent Text Reader

Abstract

The data space recovery method, electronic device and storage medium of the present application relate to the field of data processing technology. The space is managed by time division, and the data space before a given time point, that is, a preset time point, is recovered. The host will not write to the data space before the preset time point, thereby avoiding the problem of writing and reading accessing the same space at the same time. Therefore, there is no need to lock during the space recovery process, which simplifies the recovery process and improves the efficiency of the recovery array. At the same time, the area to be recovered is selected according to the number of logical addresses corresponding to the data space, that is, the address storage capacity. There is no need to count the usage of all data spaces, and no other operations are required while reducing space occupancy, thereby achieving the technical effect of reducing the host's latency and the loss of host performance during the data space recovery process and improving the data space recovery efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method, electronic device, and storage medium for data space recovery. Background Art

[0002] Data space reclamation and defragmentation refers to migrating distributed hashed data to a compact space. The main steps include determining the data space that needs to be defragmented, migrating the data in the data space to a compact space, and changing the address mapping between the data logical address and the data physical address. Since the host will simultaneously write data and change the address mapping during the data space reclamation and defragmentation process, a mutual exclusion lock is generally used to ensure that writing data and changing the address mapping do not conflict.

[0003] The data space recovery and sorting method in the existing technology needs to wait for the release of the mutex lock and maintain the mapping of the data physical address to the data logical address when performing host write and read operations, which will introduce high latency to the host and cause host performance degradation.

[0004] Therefore, how to reduce the host latency during data space recovery is an urgent problem to be solved. Summary of the Invention

[0005] The present application provides a method, electronic device, and storage medium for data space recovery, in order to at least solve the problem in the related art of how to reduce the latency of a host during data space recovery.

[0006] This application provides a method for data space recovery, including:

[0007] performing region grouping processing on the plurality of physical address regions according to a preset time point to obtain a plurality of first data spaces and a plurality of second data spaces, wherein the first data space is a physical address region where storage data is written before the preset time point;

[0008] Performing space allocation processing according to attribute information corresponding to each of the plurality of first data spaces to obtain first storage spaces corresponding to each of the plurality of first data spaces, wherein the first storage spaces are used to store logical addresses corresponding to each of the plurality of first data spaces;

[0009] Performing address reading processing according to first mapping relationships corresponding to the plurality of first data spaces to obtain first logical addresses corresponding to the plurality of first data spaces, and storing the first logical addresses in the first storage spaces corresponding to the respective first data spaces, wherein the first mapping relationship is a mapping relationship between the logical addresses of the first data spaces and the physical addresses;

[0010] Determine to-be-reclaimed areas in a plurality of first data spaces according to the address storage capacity of the first storage space, and perform space reclamation processing on the to-be-reclaimed areas based on the first logical addresses.

[0011] The present application also provides a device for data space recovery, comprising:

[0012] a grouping unit, configured to perform region grouping processing on the plurality of physical address regions according to a preset time point to obtain a plurality of first data spaces and a plurality of second data spaces, wherein the first data space is a physical address region where storage data is written before the preset time point;

[0013] an allocation unit, configured to perform space allocation processing according to attribute information corresponding to each of the plurality of first data spaces, to obtain first storage spaces corresponding to each of the plurality of first data spaces, wherein the first storage spaces are used to store logical addresses corresponding to each of the plurality of first data spaces;

[0014] a reading unit, configured to perform address reading processing according to first mapping relationships corresponding to the plurality of first data spaces, to obtain first logical addresses corresponding to the plurality of first data spaces;

[0015] a storage unit, configured to store the first logical addresses in their corresponding first storage spaces, wherein the first mapping relationship is a mapping relationship between the logical addresses and the physical addresses of the first data space;

[0016] a determining unit, configured to determine areas to be reclaimed in the plurality of first data spaces according to the address storage capacity of the first storage space;

[0017] The recycling unit is configured to perform space recycling processing on the area to be recycled based on the first logical address.

[0018] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned data space recovery methods when executing the computer program.

[0019] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned data space recovery methods are implemented.

[0020] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned data space recovery methods when executed by a processor.

[0021] The data space recovery method, electronic device and storage medium of the present application are managed by time-dividing space, and the data space before a given time point, that is, a preset time point, is recovered, and the host will not write to the data space before the preset time point, thereby avoiding the problem of writing and reading accessing the same space at the same time. Therefore, there is no need to lock during the space recovery process, which simplifies the recovery process and improves the efficiency of the recovery array. At the same time, the area to be recovered is selected according to the number of logical addresses corresponding to the data space, that is, the address storage capacity. There is no need to count the usage of all data spaces, and no other operations are required while reducing space occupancy. Therefore, it can solve the technical problem of how to reduce the host's delay during data space recovery, thereby achieving the technical effect of reducing the host's delay and the loss of host performance during data space recovery, and improving data space recovery efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0023] Figure 1 A flowchart of a method for data space recovery provided in an embodiment of the present application;

[0024] Figure 2 A schematic diagram of the principle of data space recovery provided in an embodiment of the present application;

[0025] Figure 3 A schematic diagram of another principle of data space recovery provided in an embodiment of the present application;

[0026] Figure 4 A schematic diagram of the structure of a data space recovery device provided in an embodiment of the present application;

[0027] Figure 5 A schematic structural diagram of another data space recovery device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0029] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.

[0030] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0031] This application relates to a data space recovery method in the field of data processing technology, and in particular to the performance loss caused by space recovery operations in storage systems that support self-scaling functions. Traditional methods rely on a mutex lock mechanism to ensure data consistency, resulting in a significant increase in host access latency. This application uses a time-space partitioning mechanism to achieve efficient space recovery without the need for global locking.

[0032] Figure 1 A flowchart of a method for data space recovery provided in an embodiment of the present application is provided, and the method is described in detail in conjunction with the execution flow of the method for data space recovery.

[0033] like Figure 1 As shown, the data space recovery method includes:

[0034] Step 101 : performing region grouping processing on a plurality of physical address regions according to a preset time point to obtain a plurality of first data spaces and a plurality of second data spaces, wherein the first data space is a physical address region where storage data is written before the preset time point.

[0035] In embodiments of the present application, region grouping refers to dividing the physical address space (i.e., multiple physical address regions) of a storage system into mutually exclusive operating regions (i.e., a first data space and a second data space) based on the time dimension. Preset time points are dynamically randomly generated or custom-set logical time markers used to isolate active intervals of host write and reclaim operations. Preset time points can be periodically updated based on the current reclaim progress and host load.

[0036] During the grouping process, the physical address area, as the smallest management unit of the back-end storage device (e.g., a fixed-size block consisting of continuous Logical Block Addressing (LBA)), is divided into two categories: the first data space contains all physical areas to which data has been written before a preset time point, and its data content is considered to be frozen; the second data space contains the active write areas after the time point, and host input / output (I / O) operations are directed to the second data space.

[0037] Through time segmentation, the space where the host writes data needs to be reclaimed. For a given time point, the space before the time point is reclaimed, and the host does not write to the space before the time point, thereby avoiding both accessing the same space at the same time.

[0038] The timestamp-based partitioning mechanism ensures that recycling operations only act on historical data, avoiding conflicts with concurrent host access.

[0039] Step 102 : Perform space allocation processing according to attribute information corresponding to each of the plurality of first data spaces to obtain first storage spaces corresponding to each of the plurality of first data spaces, wherein the first storage spaces are used to store logical addresses corresponding to each of the plurality of first data spaces.

[0040] In the embodiment of the present application, the attribute information may characterize the intrinsic storage characteristics of each physical area in the first data space, including but not limited to parameters such as area capacity, historical writing mode, and data compression efficiency.

[0041] During space allocation, a first storage space is dynamically allocated for each first data space based on attribute information. This first storage space serves as a pre-store for logical address information required for subsequent recovery. Storing the first logical address in the first storage space significantly differs from traditional bidirectional mapping schemes, eliminating the need to maintain a real-time mapping for all physical areas and reducing metadata memory overhead.

[0042] Step 103: Perform address reading processing according to the first mapping relationship corresponding to each of the multiple first data spaces to obtain the first logical addresses corresponding to each of the multiple first data spaces, and store the first logical addresses in the corresponding first storage spaces respectively, wherein the first mapping relationship is the mapping relationship between the logical address and the physical address of the first data space.

[0043] In an embodiment of the present application, the first mapping relationship refers to the corresponding entries of the logical address and the physical address stored in the metadata index structure (such as: B+ tree (B PlusTree)), and the corresponding entries of the logical address and the physical address are all associated with the storage data written before the preset time point.

[0044] Address reading involves scanning the mapping structure, or the first mapping relationship, to extract the first logical address (i.e., the virtual address identifier used by the host to access data) belonging to the first data space. The obtained first logical address is then written to the corresponding first storage space, forming an address pool organized by physical area. This address pool structure optimizes addressing efficiency for subsequent migration operations.

[0045] Step 104 : determining to-be-reclaimed areas in the plurality of first data spaces according to the address storage capacity of the first storage space, and performing space reclamation processing on the to-be-reclaimed areas based on the first logical addresses.

[0046] In the embodiments of the present application, the address storage capacity refers to the number of valid logical address entries actually recorded in the first storage space (i.e., the number of first logical addresses). By monitoring the address storage capacity in real time, intelligent determination of areas to be reclaimed is performed. Specifically, when the address storage capacity corresponding to a first data space falls below a preset storage capacity threshold (indicating that data in that area is sparsely distributed), the first data space is marked as a candidate for reclaim.

[0047] Space reclamation involves migrating valid data from the area to be reclaimed. Based on the precise logical address list recorded in the first storage space, only a small amount of valid stored data is moved to a new physical location in the second data space. The logical-physical mapping relationship between the original area is then removed to free up space. Because the migration operation is based entirely on a frozen data snapshot from a pre-set point in time and eliminates the need to compete with host I / O for lock resources, the impact of the reclamation process on front-end business performance is minimized.

[0048] Furthermore, in order to facilitate understanding of the implementation process of the embodiment of the present application, the present application also provides a schematic diagram of the principle of data space recovery, such as Figure 2 As shown, the data recovery area is selected by generating data area records, and only the logical address counts of the physical areas below the threshold are recorded, without counting the usage of all physical areas, thereby reducing space occupation and eliminating the need for any operation during host operation. The mapping between data logical addresses and data physical addresses is scanned to mark the space to be recovered, and the minimum unit of data writing is used as the minimum recording unit to record the logical address corresponding to the physical address currently in use.

[0049] The data space recovery method of the present application is managed by time-dividing space, and the data space before a given time point, that is, a preset time point, is recovered, and the host will not write to the data space before the preset time point, thereby avoiding the problem of writing and reading accessing the same space at the same time. Therefore, there is no need to lock during the space recovery process, which simplifies the recovery process and improves the efficiency of the recovery array. At the same time, the area to be recovered is selected according to the number of logical addresses corresponding to the data space, that is, the address storage capacity. There is no need to count the usage of all data spaces, and no other operations are required while reducing space occupancy. Therefore, it can solve the technical problem of how to reduce the host's delay during data space recovery, thereby achieving the technical effect of reducing the host's delay and the loss of host performance during data space recovery, and improving data space recovery efficiency.

[0050] In one implementable method of an embodiment of the present application, when performing space allocation processing on the first data space, it can also be implemented in but not limited to the following methods: obtaining the average usage rate and data compression efficiency corresponding to each of the multiple first data spaces, wherein the attribute information includes the average usage rate and the data compression efficiency; performing multiplication calculation based on the average usage rate and the data compression efficiency to obtain a first coefficient, and performing space allocation processing on each target storage data in the target data space based on the first coefficient to obtain a first storage space, wherein the target data space is any physical address area in the multiple first data spaces, and the target storage data is the storage data in the target data space.

[0051] In an embodiment of the present application, the space allocation process is implemented by dynamically allocating resources based on the actual storage characteristics of the physical address area. The average utilization rate in the attribute information refers to the ratio of the number of valid data blocks in the first data space during the historical operation cycle to the total capacity of the area. It can be obtained through periodic sampling statistics and reflects the space utilization trend of the area. The data compression efficiency represents the average effect of the compression algorithm on the first data space. It is the ratio of the original data size before compression to the actual occupied space after compression. The data compression efficiency changes dynamically due to the influence of the data type and algorithm strategy.

[0052] The average utilization rate of each of the multiple first data spaces (for example, 0.6 represents 60% space utilization) is multiplied by the data compression efficiency (for example, 2.0 represents compression to 50% of the original size) to generate a first coefficient corresponding to each of the multiple first data spaces. The first coefficient is essentially a predictive indicator, representing the number of valid logical addresses expected to be carried per unit of physical capacity within the first data space. For example, when the average utilization rate is 0.6 and the compression efficiency is 2.0, the first coefficient is 1.2, indicating that each physical storage unit needs to record an average of 1.2 logical addresses.

[0053] Based on the guidance of the first coefficient, refined space allocation is performed on the target data space (i.e., the physical address area corresponding to any first data space). The target storage data refers to the set of data blocks actually written to the target data space, and the minimum granularity of the target storage data is aligned with the specified storage unit (e.g., 4 kilobyte (KB) blocks). During the space allocation process, the length of the logical address recording space reserved for each target storage data is equal to the value of the first coefficient. For example, when the first coefficient is 1.2, each 4KB storage unit is allocated a storage capacity of 1.2 logical addresses. The resulting aggregated first storage space serves as the logical address cache area dedicated to the target data space. The total capacity is determined by the product of the number of target storage data in the target data space and the corresponding allocated space.

[0054] A strong correlation between memory resources and data sparsity is achieved: for areas with dense data distribution or high compression rate (the first coefficient is greater than 1), a larger cache space is allocated to avoid address overflow; for areas with sparse data (the first coefficient is less than 1), memory usage is minimized.

[0055] The embodiments of this application, by introducing dynamic coefficients based on compression efficiency and space utilization, can accurately estimate the logical address recording requirements of different physical areas. Compared to traditional fixed-size allocation schemes, this significantly optimizes memory usage efficiency, reducing redundant reservations in low-value recovery areas (data-dense areas) while ensuring sufficient recording capacity in high-value recovery areas (data-sparse areas). Furthermore, the product calculation effectively integrates the interaction between compression technology and actual storage status, making the space allocation results more consistent with real-world business scenarios and avoiding address density misjudgments caused by compression algorithms. This substantially reduces overall metadata memory overhead while maintaining recovery accuracy.

[0056] In one implementable method of an embodiment of the present application, when space allocation is performed according to the first coefficient, it can also be implemented in the following manner but is not limited to: obtaining the address length of the first logical address, and performing multiplication processing based on the address length and the first coefficient to obtain the space length; based on the space length, allocating each target storage data in the target data space to a corresponding second storage space, wherein the size of the second storage space is the same as the space length, and the first storage space includes the second storage space.

[0057] In the embodiments of the present application, refined management and control of memory resources is achieved by accurately calculating the logical address record resource size required by physical storage units. When determining the logical address record resource size, the storage characteristics of the first logical address must be analyzed. The first logical address represents the logical location identifier used by the host system to access data. Its address length is the fixed number of bytes occupied by a single logical address in memory. The address length is predefined by the storage system's addressing architecture (e.g., 64-bit systems typically use an 8-byte length). This address length serves as the basic calculation unit, determining the granularity of subsequent space allocation.

[0058] Product processing involves performing an arithmetic multiplication of the first coefficient and the address length. The resulting space length represents the total number of bytes of logical address recording space (i.e., the second storage space) that should be allocated to a single physical storage unit (i.e., each target storage data). For example, if the first coefficient is 1 and the address length is 8 bytes, the space length is 8 bytes; if the first coefficient is 0.5, the space length is 4 bytes. This space length calculation ensures that the recording space size strictly matches the actual recovery value of the target storage data.

[0059] Based on the space length, each independent physical storage unit within the target data space (i.e., each target data item) is allocated a dedicated secondary storage space. The secondary storage space is a continuous storage area in memory, whose byte size is exactly equal to the space length value. For example, if the space length is 8 bytes, each target data item will receive an 8-byte memory block to record its associated logical address.

[0060] It should be noted that the second storage space does not exist in isolation. The entire target data space also has a first storage space at the aggregation level, that is, the first storage space is essentially a collection of the second storage spaces corresponding to all target storage data in the target data space.

[0061] Memory allocation is dynamically tied to the actual recycling needs of physical storage units through space length calculations: only a small amount of recording space is allocated to physical blocks with sparse valid data (e.g., units with high compression ratios and low usage), while sufficient resources are guaranteed for areas with potential high recycling value. The design of using the second storage space as the minimum allocation unit enables independent management of logical address recording resources at the physical block granularity. This not only avoids memory fragmentation caused by fixed large block allocations, but also enables the recycling scan process to accurately locate the storage status at the granularity of specific physical blocks. While ensuring the accuracy of recycling decisions, it significantly reduces the overall memory overhead of metadata maintenance in large-scale storage arrays.

[0062] In one implementable method of an embodiment of the present application, before reading the first logical address, it is necessary to first obtain the first mapping relationship. Regarding the acquisition of the first mapping relationship, the following method can also be used but is not limited to: obtaining target mapping data from a preset storage area, wherein the preset storage area is an area for storing address mapping data of multiple physical address areas, and the target mapping data is tree structure data; grouping and processing the mapping data according to a preset time point to obtain first data and second data, wherein the first data is the mapping data constructed before the preset time point; performing data inspection processing on the second data to obtain a data inspection result, and when it is determined that data can be read in the second data according to the data inspection result, data reading processing is performed in the second data to obtain the first mapping relationship; when it is determined that data cannot be read in the second data according to the data inspection result, data reading processing is performed in the first data to obtain the first mapping relationship.

[0063] In an embodiment of the present application, the preset storage area is a custom-determined persistent storage space (such as a solid-state drive (SSD) or a non-volatile dual in-line memory module (NVDIMM)) that is used to centrally store address mapping data for all physical address areas. The preset storage area organizes and manages target mapping data in a structured manner. The target mapping data refers to a set of metadata that records the correspondence between logical addresses and physical addresses. The target mapping data can be implemented using a tree-structured data model, such as a B+ tree index, which organizes mapping records through multi-level nodes to support efficient range queries and sequential scans.

[0064] Grouping involves logically segmenting tree-structured data (i.e., target mapping data) based on pre-set time points. This process scans all mapping records within the tree-structured data and, based on their creation timestamps, divides them into two separate data sets. The first data set contains historical mapping records generated before the pre-set time point, corresponding to the data location information in the first data space. The second data set contains new mapping records created after the pre-set time point, reflecting the address mapping relationships for newly written data from the host. After grouping is complete, independent but identical subtree indexes are created for the two data sets, forming a mapping management architecture that is separated in time and space.

[0065] Data checking involves verifying the data before accessing the mapped data, performing an integrity assessment on the secondary data. During this process, key status indicators of the secondary data's subtree can be checked, including but not limited to the validity of the subtree's root node's checksum, the consistency of pointer links between nodes, and the presence of unfinished operation records in the transaction log. By examining the generated data check results, it is possible to determine whether the secondary data is currently in a safe-to-read state. For example, if a subtree is undergoing a transactional update, the data check result will indicate that it is temporarily unreadable.

[0066] Retrieval of the mapping relationship is ensured through a dual path. Specifically, when the data check confirms that the second data is stable and readable, data read processing is performed directly in the second data subtree to retrieve the first mapping relationship (i.e., the mapping entry from the logical address to the physical address) corresponding to the first data space. If the data check indicates that the second data has structural anomalies or is being modified (for example, if an uncommitted transaction log is detected), the read operation is automatically switched to the first data subtree. This ensures that even if the second data is temporarily unavailable, the complete first mapping relationship can still be retrieved through the historical mapping dataset.

[0067] When maintaining the mapping between data logical addresses and data physical addresses, the mapping data is stored in a preset storage area. The mapping relationships are grouped according to time, and the mapping relationships before and after the time are managed using two different tree structures. When reading data, the two trees are read simultaneously. If the new tree can read the data, the result of the new tree is used; otherwise, the result of the old tree is used.

[0068] A spatiotemporal grouping strategy physically isolates historical mapping data from newly mapped data, preventing conflicts between reclamation operations and real-time metadata writes. A data inspection process adds a safety barrier to mapping access, preventing inconsistent intermediate state data from being read. Dual-path access provides seamless failover, ensuring that space reclamation operations can stably obtain the required information regardless of the mapping subsystem's state. This eliminates the need to lock the entire mapping tree, significantly reducing the risk of reclamation interruptions due to transient metadata system failures.

[0069] In one possible implementation of the embodiment of the present application, when reading the first logical address, it can also be implemented in the following manner but not limited to: determining the first physical address corresponding to each target storage data in the target data space; performing address query processing based on multiple first physical addresses and the first mapping relationship to obtain the first logical address corresponding to each of the multiple first physical addresses.

[0070] In an embodiment of the present application, in the execution process of obtaining the first logical address corresponding to the first data space, it can be achieved through a one-way mapping resolution mechanism. The target data space is composed of a number of independently addressable physical storage units, each of which is the target storage data and is the smallest data storage unit with a unique physical location identifier on the storage medium. By reading the space allocation table, the first physical address occupied by each target storage data in the target data space is determined one by one. The first physical address refers to the physical location code that actually carries the data on the storage medium, and is usually composed of hierarchical address elements such as channel number, chip number, block number and page number.

[0071] After obtaining multiple first physical addresses, a level-by-level search is performed in the tree structure based on the coding characteristics of the first physical address. The corresponding subtree branch is located according to the high-level information (such as the channel number) in the first physical address, and the search scope is narrowed down by the middle-level identifier (such as the chip number). Finally, the target mapping entry is accurately matched in the leaf node according to the bottom-level address (such as the block number and the page number).

[0072] The first logical address represents a unique logical identifier for the host system to identify the data, typically expressed as an offset in the linear address space or a logical block address in the file system. The address query process relies solely on the forward mapping tree from logical addresses to physical addresses (the first mapping relationship), eliminating the need to maintain a separate reverse mapping structure from physical addresses to logical addresses. Logical address resolution for a batch of physical addresses can be completed with a single tree traversal, reducing the computational complexity of the mapping query.

[0073] The embodiments of this application utilize a hierarchical tree-structured retrieval system based on physical addresses, resulting in a logarithmic increase in mapping query time with address size, maintaining high efficiency even in multi-data storage systems. This lightweight design, which eliminates reverse mapping, not only reduces metadata storage overhead but also avoids the complex transaction synchronization mechanisms required for bidirectional mapping. This allows the space reclamation process to obtain an accurate, real-time map of logical address distribution without increasing host write latency, laying the data foundation for subsequent intelligent reclamation decisions.

[0074] In one possible implementation of the embodiment of the present application, when storing the first logical address in the first storage space, it can also be implemented in but not limited to the following manner: storing the first logical address in the corresponding first storage space, and monitoring the remaining space of the first storage space; when the remaining space is greater than a preset remaining space threshold, continuing to store the first logical address until all first logical addresses are stored in the corresponding first storage space; when the remaining space is not greater than the preset remaining space threshold, stopping the storage processing of the first logical address.

[0075] In an embodiment of the present application, when storing logical addresses, a dynamic resource-aware write control mechanism can be used to precisely balance the physical area's recycling value with metadata storage costs. After obtaining multiple first logical addresses associated with a target data space through address query processing, each first logical address is sequentially written to the first storage space corresponding to the target data space.

[0076] After writing each first logical address, the currently unused memory capacity of the first storage space (i.e., free space) is dynamically calculated and compared with a preset free space threshold. The preset free space threshold is a custom value, such as 0 or 5%. The preset free space threshold can be dynamically adjusted based on the memory management policy.

[0077] When the remaining space is detected to be greater than a preset remaining space threshold, it indicates that the first storage space currently has sufficient capacity to accommodate more first logical addresses. The write operation will continue, sequentially storing all first logical addresses associated with the first data space into the first storage space until all logical addresses in the first data space are completely recorded. The state where all logical addresses are completely recorded is often found in physical areas with sparsely distributed valid data, where the total number of logical addresses is far less than the pre-allocated capacity.

[0078] When the remaining space is equal to or less than the preset remaining space threshold, the write termination mechanism is triggered. Writing any new first logical addresses to the first storage space is immediately stopped, even if there are unprocessed first logical addresses in the first data space. This indicates that the first data space has reached or is approaching its upper limit for recording first logical addresses, which generally means that the valid data in the first data space is highly densely distributed.

[0079] For a mapping relationship between a certain data logical address and a data physical address, the data logical address is recorded in the allocated first storage space. When the number of logical addresses that need to be recorded exceeds the size of the first storage space, the first logical address of the first data space is no longer recorded. Because if there are too many logical addresses, there is no need to reclaim this physical space area. Only the physical space area with fewer logical addresses needs to be reclaimed. This can reduce the data migration and update the mapping relationship less, thereby improving the space recovery efficiency.

[0080] By monitoring available real-time free space, the system intelligently identifies areas of high data density, i.e., areas with low recycling value (since migrating large amounts of valid data increases overhead), and proactively forgoes fully recording their first logical addresses. Threshold-triggered write termination automatically optimizes resource allocation, prioritizing limited memory resources to ensure record integrity in areas with high recycling value (data-sparse areas) while avoiding wasting resources on areas with low recycling value. This ensures that resources are consistently concentrated in the target areas that will generate the greatest space recycling benefits, significantly improving overall recycling efficiency, even when facing heterogeneous storage loads.

[0081] In one possible implementation of the embodiment of the present application, when determining the area to be reclaimed, the following methods may also be used but are not limited to: determine whether the address storage amount reaches a preset storage amount threshold, wherein the address storage amount is the number of first logical addresses stored in the first storage space; if the address storage amount reaches the preset storage amount threshold, mark the first storage space whose address storage amount reaches the preset storage amount threshold as the first target space; if the address storage amount does not reach the preset storage amount threshold, mark the first storage space whose address storage amount does not reach the preset storage amount threshold as the second target space; and determine the first data space corresponding to the second target space among multiple first data spaces as the area to be reclaimed.

[0082] In the embodiments of the present application, the address storage capacity represents the total number of first logical address entries actually recorded within the first storage space corresponding to the first data space. The address storage capacity can be used as a quantitative indicator of the reclaim value of a physical area. The numerical value of the address storage capacity directly reflects the density of valid data distribution in the first data space. A small number of first logical addresses indicates a large amount of reclaimable fragmented space within the first data space, while a dense distribution of first logical addresses indicates that the first data space carries a high proportion of valid data.

[0083] The preset storage capacity threshold is a custom-set value, and can also be dynamically set according to the inherent capacity characteristics of the physical address area. The preset storage capacity threshold is usually set to a specific percentage (such as 100%, 95%) of the maximum theoretical number of first logical addresses that the first storage space can accommodate. The threshold comparison is performed independently for each first data space. When the address storage capacity of a first data space reaches or exceeds the preset storage capacity threshold, it indicates that the valid data blocks in this first data space are too densely distributed, and recycling them requires migrating a large amount of valid data, which is less economical. At this time, the first storage space of this first data space is marked as the first target space, and the marking can be performed through a binary identifier in the memory (such as a flag bit with a value of 1).

[0084] When the address storage capacity falls below a preset storage capacity threshold, this indicates that valid data within the first data space is sparsely distributed, and a large number of recyclable fragmented storage units exist. The first storage space of the first data space is marked as the second target space. This marking can also be in the form of a binary flag (e.g., a flag with a value of 0). It should be noted that the marking status of the second target space has no direct correlation with the physical location of the first storage space; it is essentially an attribute identifier of a specific area in memory.

[0085] By traversing the marking status of all first storage spaces corresponding to the first data spaces, the first data space marked as corresponding to the second target space is determined as the area to be reclaimed. The area to be reclaimed has significant recycling value characteristics. The sparse first logical address distribution in the area to be reclaimed means that the recycling process only needs to migrate a small number of valid data blocks, but can release a large amount of continuous physical storage space.

[0086] Dynamic evaluation of actual logical address density enables reclamation target selection to focus on physical areas with the highest space benefits; global reclamation status management is achieved with extremely low overhead through binary tagging; and threshold-driven automated decision-making eliminates the need for manual intervention, allowing the storage system to autonomously optimize space utilization during continuous operation, significantly improving the self-management capabilities of large-scale storage arrays.

[0087] In one possible implementation of the embodiment of the present application, when marking the first storage space as the first target space, it can also be implemented in but not limited to the following manner: assigning a first marking value to the first storage space whose address storage capacity reaches a preset storage capacity threshold to obtain the first target space.

[0088] In an embodiment of the present application, a special mark is used to record that the number of valid data blocks in a physical address area has reached the upper limit (the number of logical addresses that need to be migrated is too large), and the mark information is recorded in the memory to allocate 1 bit of space for each physical address area. When the bit value is 1, it is marked as the first target space, indicating that the number of valid data blocks has reached the upper limit.

[0089] In one possible implementation of the embodiment of the present application, when marking the first storage space as the second target space, it can also be implemented in but not limited to the following manner: assigning a second marking value to the first storage space whose address storage capacity reaches a preset storage capacity threshold to obtain the second target space.

[0090] In an embodiment of the present application, a special mark is used to record that the number of valid data blocks in a physical address area has not reached the upper limit (the number of logical addresses that need to be migrated is not large), and the mark information is recorded in the memory to allocate 1 bit of space for each physical address area. When the bit value is 0, it is marked as the second target space, indicating that the number of valid data blocks has not reached the upper limit.

[0091] In one implementable method of the embodiment of the present application, when performing space recovery processing on the area to be recovered, it can also be implemented by but not limited to the following methods: determine whether there is a corresponding logical address to be recovered for the data to be recovered, wherein the data to be recovered is the storage data in the area to be recovered, and the logical address to be recovered is the first logical address corresponding to the area to be recovered; determine the data to be recovered that has a logical address to be recovered as migratable data, and determine the data to be recovered that does not have a logical address to be recovered as non-migratable data; perform data migration processing on the migratable data, and perform space recovery processing on the area to be recovered.

[0092] In an embodiment of the present application, the logical addresses to be reclaimed are a set of first logical addresses associated with the area to be reclaimed, extracted from the first mapping relationship. By searching the first storage space corresponding to the first data space, it is determined whether each piece of data to be reclaimed has a corresponding first logical address record. Data blocks with the first logical address mapping represent valid data accessible to the host, while data blocks without the first logical address record may be residual invalid data or system metadata.

[0093] The data to be recycled that has a logical address mapping to be recycled is clearly identified as migratable data. Migratable data carries valid information of the host system and its content integrity must be preserved through migration. The data to be recycled that is not referenced by any logical address is classified as non-migratable data. Non-migratable data is usually isolated data blocks left over from historical operations or invalid metadata fragments, and can be directly discarded without processing.

[0094] Data migration is performed on migratable data. It first allocates new contiguous physical space (typically in an actively written area), sequentially relocates migratable data blocks to the new location, and simultaneously updates the mapping between their logical addresses and the new physical addresses. The migration process only involves migratable data, skipping non-migratable data, significantly reducing migration costs.

[0095] During space reclamation, all physical storage units occupied by non-migratable data in the area to be reclaimed are cleared; the released continuous physical space is reintegrated into the storage resource pool for subsequent allocation.

[0096] Logical address verification accurately distinguishes valid and invalid data, avoiding the waste of resources required for a full migration. Invalid data blocks are directly discarded, significantly accelerating the space release process. The entire recovery process improves the efficiency of fragmented space recovery while ensuring zero data loss.

[0097] In one possible implementation of an embodiment of the present application, when migrating migratable data, the following method can also be used but not limited to: migrating the migratable data to a preset data space, wherein the preset data space is a data space among multiple second data spaces that meets preset conditions.

[0098] In the embodiments of the present application, the preset data space originates from the second data space (i.e., a newly allocated physical address area after a preset time point). The selection criteria for the preset data space are based on preset conditions. These conditions require that the preset data space not only have sufficient contiguous physical capacity but also be located in a physical address segment completely isolated from the area to be reclaimed, ensuring zero conflict between the migration operation and the host's current write activity at the physical media level. By monitoring the status of all second data spaces in real time, candidate areas that meet the preset conditions are selected.

[0099] During data migration, the migrateable data is read in batches in physical order and written to the selected pre-set data space. This data migration process can utilize, but is not limited to, large-block continuous transfers. For example, the original physical page of the migrateable data in the reclaimed area is directly read and, after verification, the entire page is written to the new physical location in the pre-set data space. The entire migration process is completely independent of the host I / O path, requiring neither host interruption nor shared resource locks.

[0100] The pre-conditional space isolation principle eliminates resource competition between reclamation operations and host writes, enabling parallel processing. Selecting a secondary data space as the migration target ensures strict physical partitioning of newly written and migrated data, preventing recursive migrations during subsequent reclamation. Continuous space allocation that meets pre-conditions ensures optimal physical distribution of migrated data, providing the lowest latency access path for subsequent read operations. Through sophisticated physical space management, data integrity is ensured while minimizing the impact of space reclamation on storage performance.

[0101] In one possible implementation method of the embodiment of the present application, after space recovery is performed on the area to be recovered based on the first logical address, the following method can also be used but is not limited to: a second mapping relationship is generated based on the logical address to be recovered and the second physical address corresponding to the migratable data, and the second mapping relationship is stored in a preset storage area.

[0102] In the embodiment of the present application, the generation process of the second mapping relationship is to reconstruct the data location information, using the to-be-reclaimed logical address as the key value (Key) and the corresponding second physical address as the mapping value (Value) to establish a one-to-one address mapping entry. For example: when the data block corresponding to the to-be-reclaimed logical address LBA 0x1000 is moved from the original physical location, namely the physical placement addressing (PPA) 0xA000 (first physical address) to the new location PPA0xB000 (second physical address), a mapping entry will be generated.<LBA 0x1000,PPA 0xB000> .

[0103] The generated second mapping relationship is stored in a pre-set storage area. This storage operation can employ an incremental update strategy, whereby new mapping entries are inserted into the subtree structure representing the new time period, while retaining the original mapping record as a historical version. This avoids the need to fully rebuild the entire mapping tree while also supporting instant rollback capabilities through a version separation mechanism.

[0104] Real-time mapping updates of migrated data ensure the continuity of storage services, allowing hosts to seamlessly access data without being aware of physical location changes. The incremental update strategy reduces metadata write overhead and avoids the performance degradation caused by full replication. The versioned coexistence of old and new mappings provides abnormal recovery capabilities. If the migration process is unexpectedly interrupted, data consistency can be quickly rebuilt based on historical mappings.

[0105] Furthermore, in order to facilitate understanding of the implementation process of the embodiment of the present application, the present application also provides another principle diagram of data space recovery, such as Figure 3 As shown, a storage space (first storage space) of a fixed length is allocated to the physical area (first data space) to record the logical address (first logical address) corresponding to this physical area; the length of the storage space depends on the compression efficiency and the average utilization rate of the space, for example: the average utilization rate of the back-end disk is 50%, the current data compression efficiency is 2, and a storage space of 1 (0.5×2) logical address length needs to be allocated to each storage data in each physical area; it should be noted that for a physical area containing x storage data, when the number of logical addresses that need to be recorded reaches x or more, no recycling is required.

[0106] Based on the mapping relationship between logical addresses and physical addresses, the logical addresses are recorded to the allocated storage space; when the number of logical addresses that need to be recorded exceeds the size of the storage space, the logical addresses of this physical area are no longer recorded. Because if there are too many logical addresses, there is no need to reclaim this physical space area. Only the physical space area with fewer logical addresses needs to be reclaimed. This can reduce the data migration and update the mapping relationship less, thereby improving the space recovery efficiency.

[0107] A special mark is used to record that the number of valid data blocks in a physical area has reached the upper limit (too many logical addresses need to be migrated). 1 bit of space is allocated for each physical area. When the bit value is 1, it means that the number of valid data blocks has reached the upper limit.

[0108] Specifically, the process of reading and storing the logical address can be implemented by, but not limited to, the following methods:

[0109] The physical areas are grouped according to the current moment (preset time point), and the mapping relationship between the logical address and the physical address before the current moment is read; based on the mapping relationship, the storage space corresponding to the physical area is calculated according to the physical address.

[0110] Check whether the number of valid blocks in the physical area has reached the upper limit, that is, whether the logical address in the storage space has reached the upper limit. If it has not reached the upper limit, write the logical address to the storage space allocated for this physical area and check whether it has reached the upper limit. If it has not reached the upper limit, continue to store the logical address until all the logical addresses are stored. If it has reached the upper limit, update the mark value to 1.

[0111] The above steps are executed repeatedly until all mapping records are scanned.

[0112] When writing data, the host manages the physical area and puts the physical areas that are already filled with storage data into the same linked list for recording; when grouping is required by time, the current linked list is locked, and the physical areas that are subsequently filled with storage data are put into a new linked list for management; when the area on the linked list that needs to be reclaimed completes space recovery, the area to be reclaimed is removed from the linked list; when all areas that need to be reclaimed are completed, the new linked list is merged with the linked list that has been recovered.

[0113] Maintain the mapping between logical addresses and physical addresses. The mapping data is stored in the space allocated by the space management module, that is, the preset storage space. Furthermore, the mapping relationships can be grouped according to time. The mapping relationships before and after the time are managed using two different tree structures. When reading data, the two trees are read simultaneously. If the new tree can read the data, the result of the new tree is used; otherwise, the result of the old tree is used.

[0114] Through the marked storage space, you can find the second target space with a bit value (marker value) of 0, indicating that the physical area corresponding to the second target space has less stored data. Data in the physical area with less stored data is recycled and sorted, and the mapping between the logical address and physical address of the migrated data is updated. The specific steps include but are not limited to:

[0115] Scan the target space that describes whether the number of valid data blocks in the physical area has reached a threshold, and find the second target space with a mark value of 0; relocate the storage data with the logical address according to the logical address recorded for the physical area; provide a new space that is separated from the space where the host writes data; when the data migration is completed, update the mapping of the physical address of the logical address.

[0116] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.

[0117] The embodiment of the present application also provides a device for data space recovery, Figure 4 This is a schematic diagram of the structure of a data space recovery device provided by this application, such as Figure 4 Shown, including:

[0118] a grouping unit 41 configured to perform region grouping processing on the plurality of physical address regions according to a preset time point to obtain a plurality of first data spaces and a plurality of second data spaces, wherein the first data space is a physical address region where storage data is written before the preset time point;

[0119] an allocation unit 42 configured to perform space allocation processing based on attribute information corresponding to each of the plurality of first data spaces to obtain first storage spaces corresponding to each of the plurality of first data spaces, wherein the first storage spaces are configured to store logical addresses corresponding to each of the plurality of first data spaces;

[0120] A reading unit 43 is configured to perform address reading processing according to first mapping relationships corresponding to the plurality of first data spaces, to obtain first logical addresses corresponding to the plurality of first data spaces;

[0121] The storage unit 44 is configured to store the first logical addresses in their corresponding first storage spaces, wherein the first mapping relationship is a mapping relationship between the logical addresses and the physical addresses of the first data space;

[0122] A determining unit 45, configured to determine areas to be reclaimed in the plurality of first data spaces according to the address storage capacity of the first storage space;

[0123] The reclaiming unit 46 is configured to perform space reclaiming processing on the area to be reclaimed based on the first logical address.

[0124] In one embodiment of the present application, the allocation unit 42 is further configured to:

[0125] Obtaining an average usage rate and a data compression efficiency corresponding to each of the plurality of first data spaces, wherein the attribute information includes the average usage rate and the data compression efficiency;

[0126] A first coefficient is obtained by multiplying the average usage rate and the data compression efficiency, and space allocation processing is performed on each target storage data in the target data space according to the first coefficient to obtain a first storage space, wherein the target data space is any physical address area in multiple first data spaces, and the target storage data is the storage data in the target data space.

[0127] In one embodiment of the present application, the allocation unit 42 is further configured to:

[0128] Obtaining the address length of the first logical address, and performing multiplication processing on the address length and the first coefficient to obtain the space length;

[0129] Based on the space length, each target storage data in the target data space is allocated a corresponding second storage space, wherein the size of the second storage space is the same as the space length, and the first storage space includes the second storage space.

[0130] In one embodiment of the present application, Figure 5 As shown, the data space recovery device also includes:

[0131] an acquiring unit 47, configured to acquire target mapping data from a preset storage area, wherein the preset storage area is an area storing address mapping data of a plurality of physical address areas, and the target mapping data is tree structure data;

[0132] The grouping unit 41 is further configured to group the mapping data according to a preset time point to obtain first data and second data, wherein the first data is mapping data constructed before the preset time point;

[0133] The reading unit 43 is further configured to perform data inspection processing on the second data to obtain a data inspection result, and if it is determined according to the data inspection result that data reading can be performed on the second data, perform data reading processing on the second data to obtain a first mapping relationship;

[0134] The reading unit 43 is further configured to, when it is determined according to the data check result that data reading cannot be performed on the second data, perform data reading processing on the first data to obtain a first mapping relationship.

[0135] In one embodiment of the present application, the reading unit 43 is further configured to:

[0136] Determine a first physical address corresponding to each target storage data in the target data space;

[0137] Address query processing is performed according to the multiple first physical addresses and the first mapping relationship to obtain first logical addresses corresponding to each of the multiple first physical addresses.

[0138] In one embodiment of the present application, the storage unit 44 is further configured to:

[0139] Storing the first logical address in the corresponding first storage space and monitoring the remaining space of the first storage space;

[0140] When the remaining space is greater than the preset remaining space threshold, continue to store the first logical addresses until all the first logical addresses are stored in the corresponding first storage space;

[0141] When the remaining space is not greater than the preset remaining space threshold, the storage process of the first logical address is stopped.

[0142] In one embodiment of the present application, the determining unit 45 is further configured to:

[0143] Determining whether the address storage capacity reaches a preset storage capacity threshold, wherein the address storage capacity is the number of first logical addresses stored in the first storage space;

[0144] When the address storage capacity reaches a preset storage capacity threshold, marking the first storage space where the address storage capacity reaches the preset storage capacity threshold as a first target space;

[0145] In a case where the storage capacity of the address does not reach the preset storage capacity threshold, marking the first storage space where the storage capacity of the address does not reach the preset storage capacity threshold as the second target space;

[0146] A first data space corresponding to the second target space among the plurality of first data spaces is determined as an area to be reclaimed.

[0147] In one embodiment of the present application, the determining unit 45 is further configured to:

[0148] A first mark value is allocated to a first storage space whose address storage capacity reaches a preset storage capacity threshold to obtain a first target space.

[0149] In one embodiment of the present application, the determining unit 45 is further configured to:

[0150] A second mark value is allocated to the first storage space whose address storage capacity reaches a preset storage capacity threshold to obtain a second target space.

[0151] In one embodiment of the present application, the recovery unit 46 is further configured to:

[0152] Determine whether the data to be recycled has a corresponding logical address to be recycled, wherein the data to be recycled is data stored in the area to be recycled, and the logical address to be recycled is a first logical address corresponding to the area to be recycled;

[0153] Determine the data to be recycled that has a to-be-reclaimed logical address as migratable data, and determine the data to be recycled that does not have a to-be-reclaimed logical address as non-migratable data;

[0154] Perform data migration on the migratable data and perform space recovery on the area to be recovered.

[0155] In one embodiment of the present application, the recovery unit 46 is further configured to:

[0156] The migratable data is migrated to a preset data space, wherein the preset data space is a data space that meets preset conditions among the plurality of second data spaces.

[0157] In one embodiment of the present application, Figure 5 As shown, the data space recovery device also includes:

[0158] The generating unit 48 is configured to generate a second mapping relationship according to the logical address to be reclaimed and the second physical address corresponding to the migratable data, and store the second mapping relationship in a preset storage area.

[0159] For the description of the features in the embodiment corresponding to the device for data space recovery, reference can be made to the relevant description of the embodiment corresponding to the method for data space recovery, which will not be repeated here.

[0160] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned data space recovery method embodiments.

[0161] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned data space recovery method embodiments when running.

[0162] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0163] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any of the above-mentioned data space recovery method embodiments are implemented.

[0164] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps in any of the above-mentioned data space recovery method embodiments.

[0165] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0166] The above is a detailed introduction to a method, electronic device and storage medium for data space recovery provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

Claims

1. A method for data space recovery, characterized in that: include: performing region grouping processing on a plurality of physical address regions according to a preset time point to obtain a plurality of first data spaces and a plurality of second data spaces, wherein the first data space is a physical address region where storage data is written before the preset time point; performing space allocation processing according to attribute information corresponding to each of the plurality of first data spaces to obtain first storage spaces corresponding to each of the plurality of first data spaces, wherein the first storage spaces are used to store logical addresses corresponding to each of the plurality of first data spaces; Performing address reading processing according to first mapping relationships corresponding to the plurality of first data spaces to obtain first logical addresses corresponding to the plurality of first data spaces, and storing the first logical addresses in the first storage spaces corresponding to the first data spaces, respectively, wherein the first mapping relationship is a mapping relationship between the logical addresses and the physical addresses of the first data spaces; determining a to-be-reclaimed area in the plurality of first data spaces according to the address storage capacity of the first storage space, and performing space reclamation processing on the to-be-reclaimed area based on the first logical address; The performing space allocation processing according to the attribute information corresponding to each of the plurality of first data spaces to obtain the first storage space corresponding to each of the plurality of first data spaces comprises: Obtaining an average usage rate and a data compression efficiency corresponding to each of the plurality of first data spaces, wherein the attribute information includes the average usage rate and the data compression efficiency; A first coefficient is obtained by multiplying the average usage rate and the data compression efficiency, and space allocation processing is performed on each target storage data in the target data space according to the first coefficient to obtain the first storage space, wherein the target data space is any physical address area in the multiple first data spaces, and the target storage data is the storage data in the target data space.

2. The data space recovery method according to claim 1, characterized in that: The performing space allocation processing on each target storage data in the target data space according to the first coefficient to obtain the first storage space includes: Obtaining an address length of the first logical address, and performing multiplication processing on the address length and the first coefficient to obtain a space length; Based on the space length, a corresponding second storage space is allocated to each target storage data in the target data space, wherein the size of the second storage space is the same as the space length, and the first storage space includes the second storage space.

3. The data space recovery method according to claim 1, characterized in that: Before performing address reading processing according to the first mapping relationships corresponding to the plurality of first data spaces to obtain the first logical addresses corresponding to the plurality of first data spaces, the method further includes: Acquire target mapping data from a preset storage area, wherein the preset storage area is an area storing address mapping data of the plurality of physical address areas, and the target mapping data is tree structure data; performing grouping processing on the mapping data according to the preset time point to obtain first data and second data, wherein the first data is mapping data constructed before the preset time point; performing data inspection processing on the second data to obtain a data inspection result, and when it is determined according to the data inspection result that data reading is to be performed on the second data, performing data reading processing on the second data to obtain the first mapping relationship; When it is determined according to the data check result that data reading cannot be performed in the second data, data reading processing is performed in the first data to obtain the first mapping relationship.

4. The method for data space recovery according to claim 3, characterized in that: The performing address reading processing according to the first mapping relationships corresponding to the plurality of first data spaces to obtain the first logical addresses corresponding to the plurality of first data spaces includes: Determine a first physical address corresponding to each of the target storage data in the target data space; Address query processing is performed according to the multiple first physical addresses and the first mapping relationship to obtain the first logical addresses corresponding to each of the multiple first physical addresses.

5. The method for data space recovery according to claim 1, wherein: The storing the first logical addresses respectively into the first storage spaces corresponding to the first logical addresses includes: Storing the first logical address in the corresponding first storage space, and monitoring the remaining space of the first storage space; When the remaining space is greater than a preset remaining space threshold, continue to store the first logical addresses until all the first logical addresses are stored in the corresponding first storage space; When the remaining space is not greater than a preset remaining space threshold, the storage process of the first logical address is stopped.

6. The method for data space recovery according to claim 1, characterized in that: The determining of the to-be-reclaimed areas in the plurality of first data spaces according to the address storage capacity of the first storage space includes: Determining whether the address storage capacity reaches a preset storage capacity threshold, wherein the address storage capacity is the number of first logical addresses stored in the first storage space; In a case where the storage capacity of the address reaches the preset storage capacity threshold, marking the first storage space where the storage capacity of the address reaches the preset storage capacity threshold as a first target space; In a case where the storage capacity of the address does not reach the preset storage capacity threshold, marking the first storage space where the storage capacity of the address does not reach the preset storage capacity threshold as the second target space; A first data space corresponding to the second target space among the multiple first data spaces is determined as the area to be reclaimed.

7. The method for data space recovery according to claim 6, characterized in that: The step of marking the first storage space where the address storage capacity reaches the preset storage capacity threshold as the first target space includes: A first tag value is allocated to the first storage space whose address storage capacity reaches the preset storage capacity threshold to obtain the first target space.

8. The method for data space recovery according to claim 7, characterized in that: The step of marking the first storage space whose storage capacity at the address does not reach the preset storage capacity threshold as the second target space includes: A second mark value is allocated to the first storage space whose address storage capacity reaches the preset storage capacity threshold to obtain the second target space.

9. The method for data space recovery according to claim 1, characterized in that: The performing space reclamation processing on the to-be-reclaimed area based on the first logical address includes: Determine whether there is a corresponding to-be-reclaimed logical address for the data to be reclaimed, wherein the data to be reclaimed is the stored data in the to-be-reclaimed area, and the to-be-reclaimed logical address is the first logical address corresponding to the to-be-reclaimed area; Determine the to-be-reclaimed data that has the to-be-reclaimed logical address as migratable data, and determine the to-be-reclaimed data that does not have the to-be-reclaimed logical address as non-migratable data; Data migration is performed on the migratable data, and space recovery is performed on the area to be recovered.

10. The method for data space recovery according to claim 9, characterized in that: The performing data migration processing on the migratable data includes: The migratable data is migrated to a preset data space, wherein the preset data space is a data space that meets a preset condition among the plurality of second data spaces.

11. The method for data space recovery according to claim 10, characterized in that: After performing space reclamation processing on the to-be-reclaimed area based on the first logical address, the method further includes: A second mapping relationship is generated according to the to-be-reclaimed logical address and the second physical address corresponding to the migratable data, and the second mapping relationship is stored in a preset storage area.

12. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the method for data space recovery as claimed in any one of claims 1 to 11 when executing the computer program.

13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method for data space recovery according to any one of claims 1 to 11.

14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method for data space reclamation according to any one of claims 1 to 11 are implemented.

Citation Information

Patent Citations

  • Storage space recovery method and device

    CN110399310A

  • Data processing method and device, electronic equipment and computer readable storage medium

    CN117632003A