Solid State Drive Mapping Table Recovery Methods, Devices, Computer Equipment, and Storage Media
By saving and updating the reverse mapping table when the solid-state drive enters a low-power state, and restoring the mapping table from the user data area when exiting the low-power state, the problem of SSD quickly recovering the mapping table in an extremely low-power state is solved, reducing the exit of low-power time and additional data writing, and improving the response speed and anti-write amplification ability.
Patent Information
- Application Number
- CN202111313328.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-08
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2041-11-08
AI Technical Summary
In extremely low power states, solid state drives (SSDs) need to quickly restore mapping tables to respond to host commands, but the prior art causes an increase in data volume writes by saving mapping tables, extending the entry time of low power states, and adversely affecting write amplification.
By checking the size of the reverse mapping table when the solid-state drive enters the low-power state, saving and updating if it exceeds one page, it will be restored from the last position of the user data area when exiting the low-power state, and gradually building a complete mapping table in response to host commands.
The mapping table is realized quickly, reducing the time for SSD to exit the low-power state, avoiding excessive extra data writing, and improving the resistance to write amplification.
Smart Images

Figure CN114003438B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of storage systems, and in particular to a method, device, computer equipment and storage medium for recovering a mapping table of a solid state hard disk. Background Art
[0002] With the development of solid state drive technology, SSD (Solid State Disk) has been widely used in various occasions and has gradually replaced traditional HDD (Hard Disk Drive) in the PC market, providing users with a better experience in terms of reliability and performance.
[0003] At present, when SSD is in an extremely low power state, most of its modules will be powered off. In this state, in order to quickly respond to commands from the host, the SSD needs to be able to quickly return to the normal state. In this process, the most important point is the recovery of the mapping table. In the prior art, in order to achieve the purpose of quickly responding to host commands under extremely low power consumption, SSD usually saves the mapping table when entering the extremely low power state. However, saving the mapping table may cause a large amount of data to be written, which not only prolongs the time to enter the low power state, but also has an adverse effect on write amplification. Summary of the invention
[0004] Based on this, it is necessary to provide a method, device, computer equipment and storage medium for recovering a mapping table of a solid state drive in response to the above technical problems.
[0005] A method for recovering a mapping table of a solid state drive, the method comprising:
[0006] Get the mapping table recovery request of the solid state drive;
[0007] When the solid state drive enters a low power consumption state, it is checked whether the size of the reverse mapping table exceeds one page;
[0008] If the reverse mapping table exceeds one page, save the reverse mapping table and check whether the current reverse mapping table is updated;
[0009] If the current reverse mapping table is updated, the reverse mapping page is saved to the last position of the user data area;
[0010] When the solid state hard disk exits the low power consumption state, the reverse mapping table is restored from the last position of the user data area to respond to the host command, and a complete mapping table is constructed during the operation.
[0011] In one embodiment, after the step of recovering the reverse mapping table from the last position of the user data area in response to the host command and constructing the complete mapping table during the running process, the step further includes:
[0012] For a received host command, if a mapping table corresponding to a logical address accessed by the host command has not been loaded, loading a mapping table corresponding to the logical address;
[0013] Check whether the accessed logical address is in the reverse mapping table;
[0014] If yes, the mapping information in the reverse mapping table is merged into the mapping page to form the latest mapping page for access by the host command processing process.
[0015] In one of the embodiments, after the step of checking whether the accessed logical address is in the reverse mapping table, the method further includes:
[0016] If the logical address accessed by the host command is not in the reverse mapping table, the mapping table is directly marked as loaded.
[0017] In one embodiment, the method further comprises:
[0018] When assigning addresses to user data, the logical addresses corresponding to the user data are recorded in sequence in the reverse mapping table;
[0019] Determine whether the reverse mapping table is full, and if so, clear the reverse mapping table;
[0020] The next write position of the reverse mapping table is set to the initial position, and it is marked that the reverse mapping table exceeds one page.
[0021] A mapping table recovery device for a solid state hard disk, the device comprising:
[0022] An acquisition module, the acquisition module is used to acquire a mapping table recovery request of the solid state drive;
[0023] A first checking module, wherein the first checking module is used to check whether the size of the reverse mapping table exceeds one page when the solid state drive enters a low power consumption state;
[0024] A second checking module, the second checking module is used to save the reverse mapping table if the reverse mapping table exceeds one page, and check whether the current reverse mapping table is updated;
[0025] A saving module, the saving module is used to save the reverse mapping page to the last position of the user data area if the current reverse mapping table is updated;
[0026] The recovery module is used to restore the reverse mapping table from the last position of the user data area to respond to the host command when the solid state hard disk exits the low power consumption state, and to build a complete mapping table during operation.
[0027] In one embodiment, the recovery module is further configured to:
[0028] For a received host command, if a mapping table corresponding to a logical address accessed by the host command has not been loaded, loading a mapping table corresponding to the logical address;
[0029] Check whether the accessed logical address is in the reverse mapping table;
[0030] If yes, the mapping information in the reverse mapping table is merged into the mapping page to form the latest mapping page for access by the host command processing process.
[0031] In one embodiment, the recovery module is further configured to:
[0032] If the logical address accessed by the host command is not in the reverse mapping table, the mapping table is directly marked as loaded.
[0033] In one of the embodiments, the apparatus further comprises an updating module, wherein the updating module is configured to:
[0034] When assigning addresses to user data, the logical addresses corresponding to the user data are recorded in sequence in the reverse mapping table;
[0035] Determine whether the reverse mapping table is full, and if so, clear the reverse mapping table;
[0036] The next write position of the reverse mapping table is set to the initial position, and it is marked that the reverse mapping table exceeds one page.
[0037] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above methods when executing the computer program.
[0038] A computer-readable storage medium stores a computer program, wherein the computer program implements the steps of any one of the above methods when executed by a processor.
[0039] The mapping table recovery method, device, computer equipment and storage medium of the solid state drive obtain a mapping table recovery request of the solid state drive; when the solid state drive enters a low power consumption state, check whether the size of the reverse mapping table exceeds one page; if the reverse mapping table exceeds one page, save the reverse mapping table, and check whether the current reverse mapping table has been updated; if the current reverse mapping table has been updated, save the reverse mapping page to the last position of the user data area; when the solid state drive exits a low power consumption state, restore the reverse mapping table from the last position of the user data area to respond to the host-side command, and build a complete mapping table during operation. The scheme proposed by the present invention can not only quickly restore the mapping table, but also avoid excessive additional data writing caused by this, effectively reducing the time for the SSD to exit low power consumption, thereby achieving the purpose of quickly responding to host commands. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A schematic diagram of a process of restoring a mapping table of a solid state drive in one embodiment;
[0041] Figure 2 It is a flowchart of a method for recovering a mapping table of a solid state drive in another embodiment;
[0042] Figure 3 A schematic diagram of a process of restoring a mapping table of a solid state drive in another embodiment;
[0043] Figure 4 A schematic diagram of the structure of a reverse mapping table in one embodiment;
[0044] Figure 5 A schematic diagram of a process for quickly restoring a reverse mapping table in one embodiment;
[0045] Figure 6 A schematic diagram of a process of updating a reverse mapping table in one embodiment;
[0046] Figure 7 It is a structural block diagram of a mapping table recovery device of a solid state hard disk in one embodiment;
[0047] Figure 8 is a structural block diagram of a mapping table recovery device for a solid state hard disk in another embodiment;
[0048] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] At present, in order to achieve the purpose of quickly responding to host commands under extremely low power consumption, SSDs usually save mapping tables when entering an extremely low power consumption state. However, saving the mapping table may result in a large amount of data being written, which not only prolongs the time to enter low power consumption, but also has an adverse effect on write amplification.
[0051] Based on this, the present invention provides a mapping table recovery method for a solid state drive, which aims to reduce the time it takes for the SSD to exit low power consumption, so as to achieve the purpose of quickly responding to host commands.
[0052] In one embodiment, Figure 1 As shown, a method for recovering a mapping table of a solid state drive is provided, the method comprising:
[0053] Step 102, obtaining a mapping table recovery request of the solid state drive;
[0054] Step 104, during the process of the solid state drive entering the low power consumption state, checking whether the size of the reverse mapping table exceeds one page;
[0055] Step 106, if the reverse mapping table exceeds one page, save the reverse mapping table and check whether the current reverse mapping table is updated;
[0056] Step 108, if the current reverse mapping table is updated, save the reverse mapping page to the last position of the user data area;
[0057] Step 110, when the solid state drive exits the low power consumption state, the reverse mapping table is restored from the last position of the user data area to respond to the host command, and a complete mapping table is constructed during operation.
[0058] In this embodiment, a method for recovering a mapping table of a solid state drive is provided, and the specific implementation process of the method is as follows:
[0059] Specifically, please refer to Figure 5 As shown, first, the mapping table recovery request of the solid state drive is obtained. Then, before the SSD enters the extremely low power consumption state, it is checked whether the reverse mapping table exceeds the size of one page after the last mapping table is saved. If so, the mapping table is saved. Then, it is checked whether the current reverse mapping table is updated. If there is an update, it is written to the last position of the user data area.
[0060] When the SSD exits the extremely low power consumption state, it can respond to host commands after restoring the reverse mapping table from the last position of the user data area, and gradually build a complete mapping table during operation, that is, restore the reverse mapping table from the last position of the user data area.
[0061] The structural diagram of the reverse mapping table is as follows: Figure 4 As shown, the reverse mapping table records the logical addresses corresponding to the user data stored in a group of blocks allocated to the user. Specifically, Figure 4 Page 1 of block 0 records the reverse mapping table information, which includes the logical address corresponding to the user data in page 0 of blocks 0 to 3, and the logical address corresponding to the reverse mapping page itself (D represents an invalid logical address).
[0062] It can be understood that, in the process of merging the reverse mapping table into the mapping table, these mappings can be rebuilt according to the above structure to update the mapping table.
[0063] In this embodiment, a mapping table recovery request is obtained from the solid-state drive; when the solid-state drive enters a low-power state, the size of the reverse mapping table is checked to see if it exceeds one page; if the reverse mapping table exceeds one page, the reverse mapping table is saved, and the current reverse mapping table is checked to see if it has been updated; if the current reverse mapping table has been updated, the reverse mapping page is saved to the last position of the user data area; when the solid-state drive exits a low-power state, the reverse mapping table is restored from the last position of the user data area to respond to the host-side command, and a complete mapping table is constructed during operation. This solution can not only quickly restore the mapping table, but also avoid excessive additional data writing, effectively reducing the time it takes for the SSD to exit low-power consumption, thereby achieving the purpose of quickly responding to host commands.
[0064] In one embodiment, Figure 2 As shown, a method for recovering a mapping table of a solid state drive is provided, wherein the method recovers a reverse mapping table from the last position of a user data area in response to a host command, and after the step of constructing a complete mapping table during the running process, further comprises:
[0065] Step 202: for a received host command, if the mapping table corresponding to the logical address accessed by the host command has not been loaded, then load the mapping table corresponding to the logical address;
[0066] Step 204, checking whether the accessed logical address is in the reverse mapping table;
[0067] Step 206, if yes, then merge the mapping information in the reverse mapping table into the mapping page to form the latest mapping page for access by the host command processing process;
[0068] Step 208: If the logical address accessed by the host command is not in the reverse mapping table, the mapping table is directly marked as loaded.
[0069] In this embodiment, a method for recovering a mapping table of a solid state drive is provided, and a host-side command can be responded to after the reverse mapping table is recovered.
[0070] Specifically, please refer to Figure 5 As shown, for a received host command, if the mapping table corresponding to the accessed logical address is not loaded, the corresponding mapping table is loaded. Then, it is checked whether the accessed logical address is in the reverse mapping table. If so, the mapping information in the reverse mapping table is merged into the mapping page to form the latest mapping page for access by the host command processing process.
[0071] In one embodiment, Figure 3 As shown, a method for recovering a mapping table of a solid state drive is provided, and the method further includes:
[0072] Step 302, when allocating addresses to user data, recording the logical addresses corresponding to the user data in sequence into a reverse mapping table;
[0073] Step 304, determining whether the reverse mapping table is full, and clearing the reverse mapping table if it is full;
[0074] Step 306: Set the next write position of the reverse mapping table to the initial position, and mark that the reverse mapping table exceeds one page.
[0075] In this embodiment, a method for recovering a mapping table of a solid state drive is provided. Figure 6 As shown, the update process of the reverse mapping table is described. When assigning addresses to user data, the logical addresses corresponding to the user data are recorded in sequence in the reverse mapping table. If the reverse mapping table is full, an indicator that the reverse mapping table exceeds one page is set, and the reverse mapping table is cleared at the same time.
[0076] During operation, it is necessary to maintain a reverse mapping table, the maximum size of which is a physical page size. Specifically, when allocating a physical address, the logical address corresponding to the physical address is recorded in the reverse mapping table. If the reverse mapping table is full, the table is cleared and recorded from the beginning, and it is marked that the reverse mapping table exceeds one page after the last mapping table is saved.
[0077] It should be understood that although Figure 1-6 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-6 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0078] In one embodiment, Figure 7 As shown, a mapping table recovery device 700 for a solid state hard disk is provided, and the device includes:
[0079] An acquisition module 701 is used to acquire a mapping table recovery request of a solid state drive;
[0080] A first checking module 702, the first checking module is used to check whether the size of the reverse mapping table exceeds one page when the solid state drive enters a low power consumption state;
[0081] A second checking module 703, the second checking module is used to save the reverse mapping table if the reverse mapping table exceeds one page, and check whether the current reverse mapping table is updated;
[0082] A saving module 704, which is used to save the reverse mapping page to the last position of the user data area if the current reverse mapping table is updated;
[0083] The recovery module 705 is used to recover the reverse mapping table from the last position of the user data area to respond to the host command when the solid state drive exits the low power consumption state, and to build a complete mapping table during operation.
[0084] In one embodiment, the recovery module 705 is further configured to:
[0085] For a received host command, if a mapping table corresponding to a logical address accessed by the host command has not been loaded, loading a mapping table corresponding to the logical address;
[0086] Check whether the accessed logical address is in the reverse mapping table;
[0087] If yes, the mapping information in the reverse mapping table is merged into the mapping page to form the latest mapping page for access by the host command processing process.
[0088] In one embodiment, the recovery module 705 is further configured to:
[0089] If the logical address accessed by the host command is not in the reverse mapping table, the mapping table is directly marked as loaded.
[0090] In one embodiment, Figure 8 As shown, a mapping table recovery device 700 for a solid state drive is provided, and the device also includes an update module 706 for:
[0091] When assigning addresses to user data, the logical addresses corresponding to the user data are recorded in sequence in the reverse mapping table;
[0092] Determine whether the reverse mapping table is full, and if so, clear the reverse mapping table;
[0093] The next write position of the reverse mapping table is set to the initial position, and it is marked that the reverse mapping table exceeds one page.
[0094] The specific limitations on the mapping table recovery device for the solid state drive can be found in the above limitations on the mapping table recovery method for the solid state drive, which will not be repeated here.
[0095] In one embodiment, a computer device is provided, whose internal structure diagram can be as follows: Fig. 9As shown. The computer device includes a processor, a memory and a network interface connected through a device bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating device, a computer program and a database. The internal memory provides an environment for the operation of the operating device and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a mapping table recovery method for a solid state hard disk is implemented.
[0096] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0097] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps in the above method embodiments when executing the computer program.
[0098] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0099] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0100] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0101] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for recovering a mapping table of a solid state drive, characterized in that: The method comprises: Get the mapping table recovery request of the solid state drive; When the solid state drive enters a low power consumption state, it is checked whether the size of the reverse mapping table exceeds one page; If the reverse mapping table exceeds one page, save the reverse mapping table and check whether the current reverse mapping table is updated; If the current reverse mapping table is updated, the reverse mapping page is saved to the last position of the user data area; When the solid state hard disk exits the low power consumption state, the reverse mapping table is restored from the last position of the user data area to respond to the host command, and a complete mapping table is constructed during the operation.
2. The method for recovering a mapping table of a solid state drive according to claim 1, characterized in that: After the steps of recovering the reverse mapping table from the last position of the user data area in response to the host command and constructing a complete mapping table during the running process, the following steps are also included: For a received host command, if a mapping table corresponding to a logical address accessed by the host command has not been loaded, loading a mapping table corresponding to the logical address; Check whether the accessed logical address is in the reverse mapping table; If yes, the mapping information in the reverse mapping table is merged into the mapping page to form the latest mapping page for access by the host command processing process.
3. The method for recovering a mapping table of a solid state drive according to claim 2, wherein: After the step of checking whether the accessed logical address is in the reverse mapping table, the method further includes: If the logical address accessed by the host command is not in the reverse mapping table, the mapping table is directly marked as loaded.
4. The method for recovering a mapping table of a solid state drive according to any one of claims 1 to 3, characterized in that: The method further comprises: When assigning addresses to user data, the logical addresses corresponding to the user data are recorded in sequence in the reverse mapping table; Determine whether the reverse mapping table is full, and if so, clear the reverse mapping table; The next write position of the reverse mapping table is set to the initial position, and it is marked that the reverse mapping table exceeds one page.
5. A mapping table recovery device for a solid state hard disk, characterized in that: The device comprises: An acquisition module, the acquisition module is used to acquire a mapping table recovery request of the solid state drive; A first checking module, wherein the first checking module is used to check whether the size of the reverse mapping table exceeds one page when the solid state drive enters a low power consumption state; A second checking module, the second checking module is used to save the reverse mapping table if the reverse mapping table exceeds one page, and check whether the current reverse mapping table is updated; A saving module, the saving module is used to save the reverse mapping page to the last position of the user data area if the current reverse mapping table is updated; The recovery module is used to restore the reverse mapping table from the last position of the user data area to respond to the host command when the solid state hard disk exits the low power consumption state, and to build a complete mapping table during operation.
6. The mapping table recovery device for a solid state drive according to claim 5, characterized in that: The recovery module is also used for: For a received host command, if a mapping table corresponding to a logical address accessed by the host command has not been loaded, loading a mapping table corresponding to the logical address; Check whether the accessed logical address is in the reverse mapping table; If yes, the mapping information in the reverse mapping table is merged into the mapping page to form the latest mapping page for access by the host command processing process.
7. The mapping table recovery device for a solid state drive according to claim 6, characterized in that: The recovery module is also used for: If the logical address accessed by the host command is not in the reverse mapping table, the mapping table is directly marked as loaded.
8. The mapping table recovery device for a solid state hard disk according to any one of claims 5 to 7, characterized in that: The device further comprises an updating module, wherein the updating module is configured to: When assigning addresses to user data, the logical addresses corresponding to the user data are recorded in sequence in the reverse mapping table; Determine whether the reverse mapping table is full, and if so, clear the reverse mapping table; The next write position of the reverse mapping table is set to the initial position, and it is marked that the reverse mapping table exceeds one page.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
SSD host hibernation optimization method
CN108710507A
Solid state disk abnormal power failure recovery method and system and storage medium
CN112463656A