Mapping table reconstruction method and device, equipment, storage medium and computer program product

By reading the hot and cold status tables when the solid-state drive is powered on and optimizing the mapping table reconstruction strategy based on the tags, the problem of time-consuming L2P mapping table reconstruction is solved, a faster reconstruction process is achieved, and the user experience is improved.

CN120670330APending Publication Date: 2025-09-19JINAN MAIWEI INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510786615.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-12
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

After the SSD loses power, rebuilding the L2P mapping table takes a long time, resulting in a poor user experience.

Method used

During the power-on process of the solid-state drive, the hot and cold status tables are read from the flash memory device, and the status marks are traversed. If the mark is hot, the mapping segment to be loaded and the incremental segment are read into the system memory to update the address mapping table. If the mark is cold, the mapping segment is directly read into the system memory to optimize the mapping table reconstruction strategy.

Benefits of technology

This effectively shortens the address mapping table reconstruction time during the SSD power-on process and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120670330A_ABST
    Figure CN120670330A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of storage, and discloses a mapping table reconstruction method, device and equipment, a storage medium and a computer program product.The method comprises the steps that in the power-on process of a solid state disk, a cold and hot state table is read from flash memory equipment; wherein the cold and hot state table records a state mark of a mapping segment corresponding to the address mapping table; traversing the cold and hot state table to obtain a state mark of the to-be-loaded mapping segment; if the state mark is hot, reading a to-be-loaded mapping segment and an increment segment corresponding to the to-be-loaded mapping segment from the flash memory device to a system memory so as to rebuild and update the address mapping table; and if the state mark is cold, reading the to-be-loaded mapping segment from the flash memory device into the system memory so as to rebuild the address mapping table. The method has the technical effect of effectively shortening the reconstruction time consumption of the address mapping table in the power-on process of the solid state disk.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of storage technology, and in particular to a mapping table reconstruction method, apparatus, device, storage medium, and computer program product. Background Art

[0002] Solid State Drives (SSDs) use NAND flash memory (computer flash memory devices), which requires a mapping relationship to be established through an L2P mapping table and maintained through the FTL (Flash Translation Layer) algorithm, a critical software layer in flash storage systems.

[0003] During SSD operation, the L2P mapping table is typically stored in DRAM (dynamic random access memory). If the SSD loses power, the L2P mapping table in DRAM is lost, necessitating a rebuild. However, due to the large amount of data recorded in the L2P mapping table, rebuilding the L2P mapping table is time-consuming, resulting in a poor user experience.

[0004] Therefore, for those skilled in the art, how to quickly rebuild the L2P mapping table during the SSD power-on process is a technical problem that needs to be solved urgently. Summary of the Invention

[0005] The present application provides a mapping table reconstruction method, apparatus, device, storage medium, and computer program product, which can effectively shorten the time consumed in L2P mapping table reconstruction during SSD power-on.

[0006] A solid-state mapping table reconstruction method, comprising:

[0007] During the power-on process of the solid-state hard disk, a hot and cold status table is read from the flash memory device; wherein the hot and cold status table records the status mark of the mapping segment corresponding to the address mapping table;

[0008] Traversing the hot and cold state tables to obtain state marks of the mapping segments to be loaded;

[0009] If the status mark is hot, reading the to-be-loaded mapping segment and the incremental segment corresponding to the to-be-loaded mapping segment from the flash memory device into the system memory to rebuild and update the address mapping table;

[0010] If the status mark is cold, the to-be-loaded mapping segment is read from the flash memory device into the system memory to rebuild the address mapping table.

[0011] Preferably, the mapping segment to be loaded and the incremental segment corresponding to the mapping segment to be loaded are read from the flash memory device into the system memory to rebuild and update the address mapping table, including: reading the mapping segment to be loaded and the incremental segment from the flash memory device; adding the mapping segment to be loaded to the address mapping table; and updating the address mapping table using the incremental segment.

[0012] Preferably, the hot and cold state table is traversed to obtain the hot and cold marks of the mapping segment to be loaded, including: reading the index value of the hot and cold state table in the flash memory device; reading the hot and cold marks corresponding to the index value in the hot and cold state table to obtain the hot and cold marks of the mapping segment to be loaded; updating the index value to determine whether the index value appears repeatedly; if yes, ending the traversal; if not, reading the hot and cold marks corresponding to the index value in the hot and cold state table to obtain the hot and cold marks of the next mapping segment to be loaded.

[0013] Preferably, during the power-off process of the solid state hard disk, the method includes: writing the hot and cold state table and the index value into the flash memory device.

[0014] Preferably, during the operation of the solid state hard disk, the method includes dividing the address mapping relationship recorded in the address mapping table into a plurality of mapping segments of the same length and storing them in the system memory.

[0015] Preferably, during the operation of the solid state drive, the method includes: when a timing or incremental segment is full, flushing the corresponding incremental segment and mapping segment to the flash memory device to update the address mapping table in the flash memory device.

[0016] Preferably, during the operation of the solid state hard disk, the method includes: saving and updating the hot and cold state table and the index value in the system memory.

[0017] Preferably, saving and updating the hot and cold status table and the index value in the system memory includes: saving the hot and cold status table and the index value in the system memory; and updating the hot and cold status table and the index value when writing data to the solid state drive.

[0018] Preferably, when writing data to the solid-state hard disk, the hot and cold status table and the index value are updated, including: after receiving a write request from the host to the solid-state hard disk, generating incremental data of the address mapping corresponding to the write request; writing the incremental data into the target incremental segment corresponding to the target mapping segment; adjusting the status mark corresponding to the target mapping segment in the hot and cold status table to hot; after the target incremental segment is filled, starting from the current mapping segment corresponding to the index value, cyclically searching for the first mapping segment in the hot and cold status table whose status is marked as hot; flushing the target incremental segment and the found mapping segment combination into the flash memory device; clearing the target incremental segment, updating the index value; setting the status mark of the target mapping segment in the hot and cold status table to cold.

[0019] Preferably, writing the incremental data into the target incremental segment corresponding to the target mapping segment includes: using the logical block address in the incremental data to determine the target mapping segment to which the incremental data belongs; and writing the incremental data into the target incremental segment corresponding to the target mapping segment.

[0020] Preferably, updating the index value includes: adding 1 to the index value.

[0021] A mapping table reconstruction device, comprising:

[0022] A status table acquisition module is used to read the hot and cold status table from the flash memory device during the power-on process of the solid-state hard disk; wherein the hot and cold status table records the status mark of the mapping segment corresponding to the address mapping table;

[0023] A state traversal module, configured to traverse the hot and cold state tables to obtain a state mark of the mapping segment to be loaded;

[0024] an update and reconstruction module, configured to read the to-be-loaded mapping segment and the incremental segment corresponding to the to-be-loaded mapping segment from the flash memory device into a system memory to rebuild and update the address mapping table if the status mark is hot;

[0025] A direct reconstruction module is configured to read the to-be-loaded mapping segment from the flash memory device into the system memory to rebuild the address mapping table if the status mark is cold.

[0026] 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 mapping table reconstruction methods when executing the computer program.

[0027] 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 mapping table reconstruction methods are implemented.

[0028] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned mapping table reconstruction methods when executed by a processor.

[0029] The method provided by the embodiment of the present application includes: during the power-on process of the solid-state hard disk, reading the hot and cold status table from the flash memory device; wherein the hot and cold status table records the status mark of the mapping segment corresponding to the address mapping table; traversing the hot and cold status table to obtain the status mark of the mapping segment to be loaded; if the status mark is hot, reading the mapping segment to be loaded and the incremental segment corresponding to the mapping segment to be loaded from the flash memory device to the system memory to rebuild and update the address mapping table; if the status mark is cold, reading the mapping segment to be loaded from the flash memory device to the system memory to rebuild the address mapping table.

[0030] During the power-on process of the solid-state drive, the present application can read a hot and cold status table from the flash memory device. This hot and cold status table records the status flags of the mapping segments corresponding to the address mapping table. That is, by traversing the hot and cold status table, the hot and cold status of each mapping segment in the address mapping table can be clearly determined. If the status flag of the mapping segment to be loaded is hot, it indicates that the address mapping relationship corresponding to the mapping segment to be loaded has been updated. In this case, it is necessary to read the mapping segment to be loaded and the incremental segment corresponding to the mapping segment to be loaded from the flash memory device, thereby rebuilding the address mapping table based on the mapping segment. The address mapping table is then updated based on the incremental segment to ensure that the reconstructed address mapping table is consistent with the address mapping table maintained in the system memory before the last power failure. If the status flag of the mapping segment to be loaded is cold, it indicates that the address mapping relationship corresponding to the mapping segment to be loaded has not been updated. In this case, only the mapping segment to be loaded needs to be read from the flash memory device, and the address mapping table is rebuilt based on the mapping segment. In other words, for mapping segments marked as cold, incremental data processing can be skipped. In practice, the mapping relationships recorded in the mapping segments are updated unevenly and at different frequencies. Therefore, there are always mapping segments in a cold state. By skipping the update operation of data segments marked as cold, the time required to rebuild the address mapping table can be effectively shortened, thereby improving the user experience.

[0031] The present application has the technical effect of effectively shortening the time consumed in rebuilding the address mapping table during the power-on process of a solid-state hard disk.

[0032] Correspondingly, the present application also provides a mapping table reconstruction device, equipment, storage medium and computer program product corresponding to the above-mentioned mapping table reconstruction method, which also have the above-mentioned technical effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] 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.

[0034] Figure 1 A flowchart of an implementation method of a mapping table reconstruction method provided in an embodiment of the present application;

[0035] Figure 2 A system structure diagram provided for an embodiment of the present application;

[0036] Figure 3 A schematic diagram of a status marking and flashing process provided in an embodiment of the present application;

[0037] Figure 4 A process for rebuilding an address mapping table on a hard disk provided in an embodiment of the present application;

[0038] Figure 5 A schematic structural diagram of a mapping table reconstruction device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] 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.

[0040] 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.

[0041] 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.

[0042] An embodiment of the present application provides a mapping table reconstruction method, and the method is described in detail in conjunction with the execution flow of the mapping table reconstruction method.

[0043] Please refer to Figure 1This method can accelerate the reconstruction of the address mapping table during the SSD power-up process. This address mapping table is the L2P mapping table. L2P (LBA to PBA) is the mapping relationship between LBA (Logic Block Address, i.e., logical address) and PBA (Physical Block Address, i.e., physical address).

[0044] During SSD operation, the L2P mapping table is typically stored in DRAM (Dynamic Random Access Memory), due to its fast access speed and ability to support efficient read and write operations. However, because DRAM is volatile, data in the DRAM is lost when the SSD loses power. Therefore, the SSD firmware must regularly flush the L2P mapping table to the flash memory device to prevent data loss. The L2P mapping table is typically approximately one thousandth of the SSD's capacity. For example, the L2P mapping table for a 1TB drive is approximately 1GB. Given the large size of the mapping table, updates and saves are performed not in their entirety. Instead, the mapping table is divided into segments and saved to NAND using an incremental + segment approach.

[0045] When the host issues a read or write request to the SSD and triggers an L2P mapping table update, data to be updated (i.e., incremental data) is generated. For DRAM, the updated data can be immediately updated in the DRAM's L2P mapping table. However, for flash memory, the updated data must meet certain conditions (such as reaching a certain data size or a certain cycle length) before it is written to the flash memory. To ensure the accuracy and integrity of the L2P mapping table, the SSD firmware periodically refreshes the L2P mapping table (including incremental data) in DRAM to the flash memory. This can be achieved through periodic refreshes or by triggering a refresh based on certain conditions (such as when the incremental data reaches a certain size).

[0046] If the SSD is powered on again after a power outage, the firmware attempts to restore the L2P mapping table from the flash memory. Due to the presence of incremental data, the firmware needs to rebuild the complete L2P mapping table by scanning the incremental data in the flash memory.

[0047] Rebuilding the address mapping table is a complex and time-consuming process, especially when the storage medium has a large capacity or the data layout is complex. Therefore, when designing and implementing SSDs, a series of measures are usually taken to reduce the frequency and complexity of mapping table reconstruction to improve system reliability and performance. For large-capacity SSDs, the currently widely used mapping table storage and reconstruction solution is to divide the L2P mapping table on DRAM into several equal segments, called mapping segments, and then set several incremental segments of equal length on DRAM or SRAM, and write the newly generated increments to the incremental segments. When an incremental segment is full, the incremental segment and a mapping segment are simultaneously written to NAND, where the mapping segments are stored in NAND in a sequential cycle, and the incremental segment is cleared after each storage for the next use.

[0048] As can be seen, preserving incremental L2P mappings on SSDs involves multiple technologies and strategies, including incremental data generation, storage, synchronization and refresh, and reconstruction after power outages. These strategies aim to ensure the accuracy and completeness of the L2P mapping table while improving SSD performance and reliability.

[0049] When a large-capacity SSD is powered on, it must rebuild the L2P mapping table by scanning the incremental data in the NAND. This reconstruction time is proportional to the SSD capacity (for example, a 1TB SSD can take several to tens of seconds to rebuild). These reconstruction technologies have drawbacks: mixed storage of hot and cold data: all mapping segments are indiscriminately written, causing cold data to frequently occupy storage resources and increase inefficiencies during the rebuild; redundant updating of incremental data: all incremental segments must be processed in chronological order upon power-up, even if the mapping segments corresponding to some incremental segments have not been updated for a long time (cold data); and resource waste: cold data is repeatedly written to the NAND, exacerbating the write amplification effect and shortening the SSD lifespan.

[0050] This application optimizes the mapping table writing strategy by dynamically distinguishing between hot and cold data in the mapping table, significantly shortening the power-on reconstruction time, and improving the SSD boot speed and reliability. Specifically, this method can be applied to Figure 2 In the system structure shown in FIG. 1 , the host device is connected to the solid-state storage controller and the system memory via an interface, and the system memory, the solid-state drive controller, and the flash memory are connected to each other.

[0051] S101 : During the power-on process of the solid-state hard disk, a hot and cold state table is read from a flash memory device.

[0052] The hot and cold status table records the status mark of the mapping segment corresponding to the address mapping table.

[0053] In this embodiment, the address mapping table is an L2P mapping table, which records the logical addresses (logical block addresses) and physical addresses (physical block addresses) corresponding to the data stored in the SSD.

[0054] Typically, the L2P mapping table is about one thousandth of the SSD's capacity. For example, a 1TB drive has an L2P mapping table capacity of approximately 1GB. Given the large size of the address mapping table, it's typically not updated or saved as a whole. Instead, the table is divided into segments and saved to NAND flash memory (a computer flash memory device) using an incremental + segment approach.

[0055] The cold / hot status table records the status mark of the mapping segment corresponding to the address mapping table. The status mark indicates whether the corresponding mapping segment is cold data or hot data.

[0056] In one specific embodiment of the present application, when the solid-state drive is powered off, the hot and cold status table and index values ​​are written to a flash memory device. Specifically, when the solid-state drive is powered off, the hot and cold status table and index values ​​can be written to the flash memory device for storage. While the solid-state drive is operating, the hot and cold status table and index values ​​can be stored and updated in system memory.

[0057] S102: Traverse the hot and cold status tables to obtain status marks of the mapping segments to be loaded.

[0058] In order to clarify the status of each mapping segment, in this embodiment, it is necessary to traverse the hot and cold status tables to obtain the status tags of the mapping segments to be loaded. The mapping segments to be loaded are the mapping segments required to rebuild the address mapping table, and the "to be loaded" refers to the segments to be read from the flash memory device to the system memory.

[0059] That is, initially, all mapping segments corresponding to the address mapping table are mapping segments to be loaded, and as loading proceeds, the number of mapping segments to be loaded decreases accordingly.

[0060] In order to speed up the reconstruction of the address mapping table, in this embodiment, the status flags of all mapping segments to be loaded are obtained. Of course, in practice, each mapping segment to be loaded can be processed in sequence, and the corresponding status flag can be obtained for each mapping segment to be loaded one by one. Alternatively, the status flag of each mapping segment to be loaded can be obtained by sequentially traversing the hot and cold status tables.

[0061] In a specific embodiment of the present application, the hot and cold state table is traversed to obtain the hot and cold marks of the mapping segment to be loaded, including: reading the index value of the hot and cold state table in the flash memory device; reading the hot and cold marks corresponding to the index value in the hot and cold state table to obtain the hot and cold marks of the mapping segment to be loaded; updating the index value to determine whether the index value appears repeatedly; if so, ending the traversal; if not, reading the hot and cold marks corresponding to the index value in the hot and cold state table to obtain the hot and cold marks of the next mapping segment to be loaded.

[0062] That is, in actual applications, an index value can be set for the hot and cold state table. Based on this index value, the hot and cold tags in the hot and cold state table can be read in sequence to determine the hot and cold tags of the mapping segment to be loaded. After each hot and cold tag is read, the index value is updated, such as +1, and then it is determined whether the new index value appears repeatedly during the current power-on process. If so, it indicates that the traversal is complete. If not, the hot and cold tags corresponding to the index value are read from the hot and cold state table again to obtain the hot and cold tags of the next mapping segment to be loaded.

[0063] S103: If the status mark is hot, read the mapping segment to be loaded and the incremental segment corresponding to the mapping segment to be loaded from the flash memory device into the system memory to rebuild and update the address mapping table.

[0064] If the status is marked as hot, it indicates that there is an update / addition of the address mapping relationship of the mapping segment to be loaded. At this time, in order to ensure the integrity and consistency of the data, it is necessary not only to read the mapping segment to be loaded and the incremental segment corresponding to the mapping segment to be loaded from the flash memory device to the system memory, but also to update the address mapping table based on the incremental segment.

[0065] In a specific embodiment of the present application, reading the to-be-loaded mapping segment and the incremental segment corresponding to the to-be-loaded mapping segment from the flash memory device into the system memory to rebuild and update the address mapping table includes:

[0066] Read the mapping segment and incremental segment to be loaded from the flash device;

[0067] Add the mapping segment to be loaded to the address mapping table;

[0068] The address mapping table is updated using the incremental segment.

[0069] That is, for a mapping segment to be loaded that is marked as hot, rebuilding the address mapping table based on it requires reading the mapping segment to be loaded and its corresponding incremental segment from the flash memory device. The mapping segment to be loaded can then be added to the address mapping table, and then the address mapping table can be updated using the incremental segment. Alternatively, the mapping segment to be loaded can be updated based on the incremental segment first, and then the updated mapping segment can be added to the address mapping table.

[0070] S104: If the status mark is cold, read the mapping segment to be loaded from the flash memory device into the system memory to rebuild the address mapping table.

[0071] For a pending mapping segment marked as cold, this indicates that no address update has occurred. Therefore, there is no need to update the pending mapping segment based on the corresponding incremental segment, ensuring that the rebuilt address mapping table remains consistent with the address mapping table before power failure. Therefore, in this embodiment, once a pending mapping segment marked as cold is identified, it can be directly read from the flash memory device into the system memory and incorporated directly into the rebuilt address mapping table.

[0072] After the address mapping table is rebuilt, address mapping management can be performed on the solid state drive based on the rebuilt address mapping table.

[0073] That is, operations such as accessing, modifying, deleting, adding, and viewing the data content stored in the solid-state drive are implemented based on the address mapping table.

[0074] In this embodiment, after all mapping segments corresponding to the hot and cold state tables are loaded, it can be indicated that the reconstruction of the address mapping table has been completed.

[0075] In this application, when loading a mapping segment, a parameter L can be assigned a mapping segment, such as by using an index value to assign L to a specific mapping segment. After each mapping segment is loaded, the parameter L is incremented by 1, and then the remainder is calculated by comparing it with the total number of mapping segments. When the remainder is 0, it indicates that the reconstruction of the address mapping table is complete.

[0076] In one specific embodiment of the present application, during operation of the solid-state drive, the address mapping relationship recorded in the address mapping table is divided into a plurality of mapping segments of the same length and stored in the system memory. Specifically, considering the large amount of data in the address mapping table and for ease of management and operation, in this embodiment, the address mapping relationship recorded in the address mapping table can be stored in a plurality of mapping segments of the same length, and these mapping segments are stored in the system memory.

[0077] In one specific embodiment of the present application, during the operation of the solid-state drive, the following steps are performed: when a timed or incremental segment is fully written, the corresponding incremental segment and mapping segment are flushed to the flash memory device to update the address mapping table in the flash memory device. Considering that the contents of the system memory will be lost after a power outage, a timed flush to the flash memory device can be used, or the corresponding incremental segment and mapping segment can be flushed to the flash memory device when the incremental segment is fully written, thereby timely updating the address mapping table in the flash memory device. In this way, the flash memory device can continuously synchronize the address mapping table in the system memory.

[0078] In one embodiment of the present application, during operation of the solid-state drive, the method includes: storing and updating a hot / cold state table and index values ​​in system memory. To facilitate rapid reconstruction of the address mapping table, the hot / cold state table and index values ​​may be stored and updated in system memory during operation of the solid-state drive.

[0079] Specifically, the hot and cold status tables and index values ​​are saved and updated in the system memory, including:

[0080] Save hot and cold status tables and index values ​​in system memory;

[0081] When writing data to the solid-state drive, the hot and cold status tables and index values ​​are updated.

[0082] In other words, the system memory can store the hot and cold status table and index values. When data is written to the solid-state drive, the hot and cold status table and index values ​​can be updated.

[0083] When writing data to the solid-state drive, the hot and cold status tables and index values ​​are updated, including:

[0084] After receiving a write request from the host to the solid-state drive, it generates incremental data corresponding to the address mapping of the write request;

[0085] Write the incremental data into the target incremental segment corresponding to the target mapping segment;

[0086] Adjust the status mark of the target mapping segment in the hot and cold status table to hot;

[0087] After the target incremental segment is filled, start from the current mapping segment corresponding to the index value and loop to find the first mapping segment in the hot and cold state table that is marked as hot;

[0088] Flash the target incremental segment and the found mapping segment combination into the flash memory device;

[0089] Clear the target incremental segment and update the index value;

[0090] Set the status flag of the target mapping segment in the hot and cold status table to cold.

[0091] That is, when the host receives a write request to the solid-state drive, it can generate incremental data corresponding to the write request. The incremental data is the address mapping information corresponding to the newly written data, including the logical address and the physical address.

[0092] The incremental data is then written to the target incremental segment corresponding to the target mapping segment to which it belongs. The target mapping segment's status flag in the hot / cold status table is adjusted to hot. After the target incremental segment is filled, the system can loop back, starting with the current mapping segment corresponding to the index value, to find the first mapping segment in the hot / cold status table marked as hot. The target incremental segment and the searched mapping segment are then combined and input into the flash memory device. After the mapping segment is flashed, the target incremental segment is cleared, the index value is updated, and the target mapping segment's status flag in the hot / cold status table is set to cold.

[0093] The incremental data is written into the target incremental segment corresponding to the target mapping segment, including:

[0094] Using the logical block address in the incremental data, determine the target mapping segment to which the incremental data belongs;

[0095] Write the incremental data to the target incremental segment corresponding to the target mapping segment.

[0096] That is, based on the logical block address, it is possible to determine which mapping segment the incremental data belongs to, that is, to determine the target mapping segment. Then, the incremental data is written into the target incremental segment.

[0097] Updating the index value includes: adding 1 to the index value.

[0098] For example, a hot / cold state bit table (a specific hot / cold state table) is designed to mark the hot / cold state of each mapping segment in the L2P mapping table, denoted as TEMP_BMP. NEW_INDEX represents the index of the most recently saved mapping segment. The hot / cold state bit table (TEMP_BMP) has a 1-bit flag for each mapping segment (e.g., 0 = cold, 1 = hot). The flags are stored in DRAM / SRAM during SSD operation, stored in NAND during power-down, and read from DRAM / SRAM during power-up and rebuild. The flags for all mapping segments are initialized to 0 upon initial power-up and then dynamically updated based on access frequency as the SSD operates.

[0099] During SSD operation, when the host sends a write request to the SSD and triggers an L2P mapping table update, incremental data is generated. Each incremental data includes an LBA and a PBA.

[0100] like Figure 3 As shown, the update of the hot and cold state bit table (TEMP_BMP) and the index value (NEW_INDEX) includes the following steps.

[0101] 1. When the host triggers an L2P update, it marks TEMP_BMP[N]=1 (marking mapping segment - hot state) according to the mapping segment where the LBA in the increment is located (for example, segment N, that is, the target mapping segment).

[0102] 2. After the incremental segment is filled, start from the NEW_INDEX bit and loop to find the first mapping segment marked as 1 (for example, segment M), and flash it together with the incremental segment to NAND.

[0103] 3. Update NEW_INDEX = M + 1.

[0104] 4. Update the hot and cold status bit table TEMP_BMP[M]=0.

[0105] When the SSD is powered off, the hot and cold status bit table TEMP_BMP and index are saved to NAND.

[0106] like Figure 4 As shown in the figure, when the computer is first powered on, TEMP_BMP and NEW_INDEX are initialized to 0.

[0107] When the system is restarted, the SSD firmware performs a power-on rebuild as follows:

[0108] 1. Read the status bit tables TEMP_BMP and NEW_INDEX stored on NAND to DRAM / SRAM.

[0109] 2. Starting from L=NEW_INDEX, traverse the hot and cold status bit table, update different situations, and load them.

[0110] Case A: If the status is marked as 1, read the corresponding incremental segment and mapping segment data from NAND to DRAM, and update the incremental segment data to the mapping table.

[0111] Case B: If the status is marked as 0, read the mapping segment data from NAND to DRAM and skip the incremental update.

[0112] 3. L = (L + 1)% of the total number of mapping segments, that is, add one to L and take the remainder of the total number of mapping segments.

[0113] 4. Determine whether the last mapping segment has been rebuilt. If the remainder in step 3 is 0, it indicates that the reconstruction has been completed. At this time, address mapping management can be performed based on the rebuilt address mapping table.

[0114] It can be seen that in the application, in order to optimize the power-on reconstruction time and improve the boot speed, a mechanism is proposed to mark the mapping segments of the L2P mapping table as hot and cold, and to dynamically refresh the hot data during the operation of the SSD. In this way, the repeated and invalid refreshing of cold data can be reduced, the update frequency of hot data can be increased, the operation of updating the mapping table can be reduced during power-on reconstruction, and the power-on reconstruction time can be shortened.

[0115] In one specific implementation of this application, the above method can also be applied to distributed databases, optimizing fault recovery speed by dynamically marking frequently accessed data shards. It can also be applied to edge computing devices, combining hot and cold data differentiation strategies to reduce edge node startup delays.

[0116] The method provided by the embodiment of the present application includes: during the power-on process of the solid-state hard disk, reading the hot and cold status table from the flash memory device; wherein the hot and cold status table records the status mark of the mapping segment corresponding to the address mapping table; traversing the hot and cold status table to obtain the status mark of the mapping segment to be loaded; if the status mark is hot, reading the mapping segment to be loaded and the incremental segment corresponding to the mapping segment to be loaded from the flash memory device to the system memory to rebuild and update the address mapping table; if the status mark is cold, reading the mapping segment to be loaded from the flash memory device to the system memory to rebuild the address mapping table.

[0117] During the power-on process of the solid-state drive, the present application can read a hot and cold status table from the flash memory device. This hot and cold status table records the status flags of the mapping segments corresponding to the address mapping table. That is, by traversing the hot and cold status table, the hot and cold status of each mapping segment in the address mapping table can be clearly determined. If the status flag of the mapping segment to be loaded is hot, it indicates that the address mapping relationship corresponding to the mapping segment to be loaded has been updated. In this case, it is necessary to read the mapping segment to be loaded and the incremental segment corresponding to the mapping segment to be loaded from the flash memory device, thereby rebuilding the address mapping table based on the mapping segment. The address mapping table is then updated based on the incremental segment to ensure that the reconstructed address mapping table is consistent with the address mapping table maintained in the system memory before the last power failure. If the status flag of the mapping segment to be loaded is cold, it indicates that the address mapping relationship corresponding to the mapping segment to be loaded has not been updated. In this case, only the mapping segment to be loaded needs to be read from the flash memory device, and the address mapping table is rebuilt based on the mapping segment. In other words, for mapping segments marked as cold, incremental data processing can be skipped. In practice, the mapping relationships recorded in the mapping segments are updated unevenly and at different frequencies. Therefore, there are always mapping segments in a cold state. By skipping the update operation of data segments marked as cold, the time required to rebuild the address mapping table can be effectively shortened, thereby improving the user experience.

[0118] The present application has the technical effect of effectively shortening the time consumed in rebuilding the address mapping table during the power-on process of a solid-state hard disk.

[0119] 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.

[0120] like Figure 5As shown, an embodiment of the present application further provides a mapping table reconstruction device, the device comprising:

[0121] The state table acquisition module 101 is used to read the hot and cold state table from the flash memory device during the power-on process of the solid-state hard disk; wherein the hot and cold state table records the state mark of the mapping segment corresponding to the address mapping table;

[0122] The state traversal module 102 is used to traverse the hot and cold state tables to obtain the state mark of the mapping segment to be loaded;

[0123] An update and reconstruction module 103 is configured to read the to-be-loaded mapping segment and the incremental segment corresponding to the to-be-loaded mapping segment from the flash memory device into the system memory to rebuild and update the address mapping table if the status mark is hot;

[0124] The direct reconstruction module 104 is configured to read the mapping segment to be loaded from the flash memory device into the system memory to rebuild the address mapping table if the status mark is cold.

[0125] The device provided by the embodiment of the present application includes: during the power-on process of the solid-state hard disk, reading the hot and cold status table from the flash memory device; wherein the hot and cold status table records the status mark of the mapping segment corresponding to the address mapping table; traversing the hot and cold status table to obtain the status mark of the mapping segment to be loaded; if the status mark is hot, reading the mapping segment to be loaded and the incremental segment corresponding to the mapping segment to be loaded from the flash memory device to the system memory to rebuild and update the address mapping table; if the status mark is cold, reading the mapping segment to be loaded from the flash memory device to the system memory to rebuild the address mapping table.

[0126] During the power-on process of the solid-state drive, the present application can read a hot and cold status table from the flash memory device. This hot and cold status table records the status flags of the mapping segments corresponding to the address mapping table. That is, by traversing the hot and cold status table, the hot and cold status of each mapping segment in the address mapping table can be clearly determined. If the status flag of the mapping segment to be loaded is hot, it indicates that the address mapping relationship corresponding to the mapping segment to be loaded has been updated. In this case, it is necessary to read the mapping segment to be loaded and the incremental segment corresponding to the mapping segment to be loaded from the flash memory device, thereby rebuilding the address mapping table based on the mapping segment. The address mapping table is then updated based on the incremental segment to ensure that the reconstructed address mapping table is consistent with the address mapping table maintained in the system memory before the last power failure. If the status flag of the mapping segment to be loaded is cold, it indicates that the address mapping relationship corresponding to the mapping segment to be loaded has not been updated. In this case, only the mapping segment to be loaded needs to be read from the flash memory device, and the address mapping table is rebuilt based on the mapping segment. In other words, for mapping segments marked as cold, incremental data processing can be skipped. In practice, the mapping relationships recorded in the mapping segments are updated unevenly and at different frequencies. Therefore, there are always mapping segments in a cold state. By skipping the update operation of data segments marked as cold, the time required to rebuild the address mapping table can be effectively shortened, thereby improving the user experience.

[0127] The present application has the technical effect of effectively shortening the time consumed in rebuilding the address mapping table during the power-on process of a solid-state hard disk.

[0128] In a specific embodiment of the present application, the update and reconstruction module is specifically used to read the mapping segment to be loaded and the incremental segment from the flash memory device; add the mapping segment to be loaded to the address mapping table; and update the address mapping table using the incremental segment.

[0129] In a specific embodiment of the present application, the state traversal module is specifically used to read the index value of the hot and cold state table in the flash memory device; read the hot and cold marks corresponding to the index value in the hot and cold state table to obtain the hot and cold marks of the mapping segment to be loaded; update the index value to determine whether the index value appears repeatedly; if so, end the traversal; if not, read the hot and cold marks corresponding to the index value in the hot and cold state table to obtain the hot and cold marks of the next mapping segment to be loaded.

[0130] In a specific implementation of the present application, the power-off protection module is used to write the hot and cold status table and index value into the flash memory device during the power-off process of the solid-state hard disk.

[0131] In a specific implementation of the present application, the operation and maintenance module is used to divide the address mapping relationship recorded in the address mapping table into several mapping segments of the same length and store them in the system memory during the operation of the solid-state hard disk.

[0132] In a specific embodiment of the present application, the operation and maintenance module is used to flush the corresponding incremental segment and mapping segment to the flash memory device when the timing or incremental segment is full during the operation of the solid-state hard disk, so as to update the address mapping table in the flash memory device.

[0133] In a specific implementation of the present application, the operation and maintenance module is used to save and update the hot and cold status table and index values ​​in the system memory during the operation of the solid-state hard disk.

[0134] In a specific implementation of the present application, the operation and maintenance module is specifically used to save the hot and cold status table and index values ​​in the system memory; when writing data to the solid state drive, the hot and cold status table and index values ​​are updated.

[0135] In a specific embodiment of the present application, the operation and maintenance module is specifically used to generate incremental data of the address mapping corresponding to the write request after receiving a write request from the host to the solid-state hard disk; write the incremental data into the target incremental segment corresponding to the target mapping segment; adjust the status mark corresponding to the target mapping segment in the hot and cold status table to hot; after the target incremental segment is filled, starting from the current mapping segment corresponding to the index value, cyclically search for the first mapping segment in the hot and cold status table whose status is marked as hot; flush the target incremental segment and the found mapping segment combination into the flash memory device; clear the target incremental segment and update the index value; set the status mark of the target mapping segment in the hot and cold status table to cold.

[0136] In a specific implementation of the present application, the operation and maintenance module is specifically used to use the logical block address in the incremental data to determine the target mapping segment to which the incremental data belongs; and write the incremental data into the target incremental segment corresponding to the target mapping segment.

[0137] In a specific implementation of the present application, the operation and maintenance module is specifically configured to add 1 to the index value.

[0138] For the description of the features in the embodiment corresponding to the mapping table reconstruction device, reference can be made to the relevant description of the embodiment corresponding to the mapping table reconstruction method, which will not be repeated here.

[0139] 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 mapping table reconstruction method embodiments.

[0140] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above-mentioned mapping table reconstruction method embodiments when running.

[0141] 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.

[0142] 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 one of the above-mentioned mapping table reconstruction method embodiments are implemented.

[0143] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above-mentioned mapping table reconstruction method embodiments are implemented.

[0144] Those skilled in the art 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 composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0145] The mapping table reconstruction method, apparatus, device, storage medium and computer program product provided by the present application are introduced in detail above. 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 and core idea of ​​the present application. 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 present application.

Claims

1. A mapping table reconstruction method, characterized in that: include: During the power-on process of the solid-state hard disk, a hot and cold status table is read from the flash memory device; wherein the hot and cold status table records the status mark of the mapping segment corresponding to the address mapping table; Traversing the hot and cold state tables to obtain state marks of the mapping segments to be loaded; If the status mark is hot, reading the to-be-loaded mapping segment and the incremental segment corresponding to the to-be-loaded mapping segment from the flash memory device into the system memory to rebuild and update the address mapping table; If the status mark is cold, the to-be-loaded mapping segment is read from the flash memory device into the system memory to rebuild the address mapping table.

2. The mapping table reconstruction method according to claim 1, characterized in that: Reading the to-be-loaded mapping segment and the incremental segment corresponding to the to-be-loaded mapping segment from the flash memory device into the system memory to rebuild and update the address mapping table, including: Reading the to-be-loaded mapping segment and the incremental segment from the flash memory device; Adding the mapping segment to be loaded into the address mapping table; The address mapping table is updated using the incremental segment.

3. The mapping table reconstruction method according to claim 1, wherein: Traversing the hot and cold status table to obtain the hot and cold marks of the mapping segment to be loaded includes: Reading the index value of the hot and cold state table from the flash memory device; Read the hot and cold marks corresponding to the index values ​​in the hot and cold state table to obtain the hot and cold marks of the mapping segment to be loaded; Updating the index value, and determining whether the index value appears repeatedly; If yes, then end the traversal; If not, the hot and cold marks corresponding to the index values ​​in the hot and cold status table are read to obtain the hot and cold marks of the next mapping segment to be loaded.

4. The mapping table reconstruction method according to claim 3, characterized in that: The process of powering off the solid-state drive includes: The hot and cold state table and the index value are written into the flash memory device.

5. The mapping table reconstruction method according to claim 1, wherein: The operation process of the solid state drive includes: The address mapping relationship recorded in the address mapping table is divided into a plurality of mapping segments of the same length and stored in the system memory.

6. The mapping table reconstruction method according to claim 5, characterized in that: The operation process of the solid state drive includes: When the timing or incremental segment is full, the corresponding incremental segment and mapping segment are flushed to the flash memory device to update the address mapping table in the flash memory device.

7. The mapping table reconstruction method according to any one of claims 1 to 6, characterized in that: The operation process of the solid state drive includes: The hot and cold state table and the index value are stored and updated in the system memory.

8. The mapping table reconstruction method according to claim 7, characterized in that: Saving and updating the hot and cold state table and the index value in the system memory includes: Saving the hot and cold state table and the index value in the system memory; When data is written to the solid state drive, the hot and cold state table and the index value are updated.

9. The mapping table reconstruction method according to claim 8, characterized in that: When writing data to the solid state drive, updating the hot and cold state table and the index value includes: After receiving a write request from a host to the solid-state drive, generating incremental data of an address mapping corresponding to the write request; Writing the incremental data into the target incremental segment corresponding to the target mapping segment; Adjust the state flag corresponding to the target mapping segment in the hot and cold state table to hot; After the target incremental segment is filled, starting from the current mapping segment corresponding to the index value, cyclically search for the first mapping segment in the hot and cold state table that is marked as hot; Flashing the target incremental segment and the found mapping segment combination into the flash memory device; Clear the target incremental segment and update the index value; The status mark of the target mapping segment in the hot and cold status table is set to cold.

10. The mapping table reconstruction method according to claim 9, characterized in that: Writing the incremental data into a target incremental segment corresponding to the target mapping segment includes: Determining a target mapping segment to which the incremental data belongs using a logical block address in the incremental data; The incremental data is written into the target incremental segment corresponding to the target mapping segment.

11. The mapping table reconstruction method according to claim 10, characterized in that: Updating the index value includes: Add 1 to the index value.

12. A mapping table reconstruction device, characterized in that: include: A status table acquisition module is used to read the hot and cold status table from the flash memory device during the power-on process of the solid-state hard disk; wherein the hot and cold status table records the status mark of the mapping segment corresponding to the address mapping table; A state traversal module, configured to traverse the hot and cold state tables to obtain a state mark of the mapping segment to be loaded; an update and reconstruction module, configured to read the to-be-loaded mapping segment and the incremental segment corresponding to the to-be-loaded mapping segment from the flash memory device into a system memory to rebuild and update the address mapping table if the status mark is hot; A direct reconstruction module is configured to read the to-be-loaded mapping segment from the flash memory device into the system memory to rebuild the address mapping table if the status mark is cold.

13. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the mapping table reconstruction method according to any one of claims 1 to 11 when executing the computer program.

14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the mapping table reconstruction method according to any one of claims 1 to 11 are implemented.

15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the mapping table reconstruction method according to any one of claims 1 to 11 are implemented.