SSD mapping table and user data storage synchronization method, device, computer equipment and storage medium

By obtaining and comparing timestamp information in SSD and judging the physical page status of the DIE write point, the performance degradation problem during mapping table storage is solved, and high performance consistency is achieved without interrupting user data reading and writing.

CN115220664BActive Publication Date: 2025-09-02SUZHOU UNIONMEMORY INFORMATION SYST LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210997533.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-19
Publication Date
2025-09-02
Estimated Expiration
2042-08-19

AI Technical Summary

Technical Problem

Existing SSDs need to pause the host read and write request processing when saving the mapping table, resulting in performance degradation and affecting performance consistency.

Method used

By obtaining the read and write request issued by the host, we determine whether the mapping table is triggered to save, obtain the time stamp information of the current write point, and save the mapping table and timestamp information to the NAND mapping table saving area. After the host powers off, the power is on to obtain the last copy data, compare the timestamps and determine whether the physical page of the corresponding write point of DIE has been written to the user data. If it is valid, the mapping table is restored to respond to the read and write request.

Benefits of technology

When saving the mapping table, the read and write user data is not interrupted, which greatly improves performance consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115220664B_ABST
    Figure CN115220664B_ABST
Patent Text Reader

Abstract

The present invention relates to a method, device, computer equipment, and storage medium for synchronizing an SSD mapping table with user data storage. The method comprises: obtaining a read / write request issued by a host; determining whether the read / write request triggers mapping table storage; obtaining timestamp information of a current write point; powering off the host; powering on the host, obtaining the last copy of data in a mapping table storage area; obtaining write information in a user data storage area; determining whether the timestamp in the write information is greater than the timestamp in the last copy of data; determining whether the timestamp in the write information is equal to the timestamp in the last copy of data; reading a physical page of a write point; determining whether all physical pages of the write point have user data written therein; restoring the last copy of data based on the mapping table stored therein if the data is valid, and responding to the read / write request issued by the host. The present invention can prevent the reading and writing of user data from being interrupted while the mapping table is being stored, thereby greatly improving performance consistency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of SSD mapping table technology, and in particular to a method, device, computer equipment, and storage medium for synchronizing an SSD mapping table with user data. Background Art

[0002] SSD (solid-state drive) has been widely used in various occasions. Currently in the PC market, it has gradually replaced traditional HDD, providing users with a better experience in terms of reliability and performance.

[0003] SSDs use NAND as the data storage medium. Host access to the SSD is based on logical addresses (LBAs). The SSD maintains a mapping table (L2P table) internally, which indicates the physical address where the data at the corresponding logical address is stored. Host commands carry LBA address information, which the SSD converts internally to LPA addresses (e.g., LBA0-7 corresponds to LPA0, LBA8-15 corresponds to LPA1, and so on). The L2P table maintained in memory is indexed by LPA and contains GPPA (physical NAND address). For read commands, the LPA address is used to query the L2P table in memory to obtain the physical address GPPA of the data. This allows the host to initiate a read of the corresponding address and return the data to the host. For write commands, the SSD allocates a physical address to store the relevant data and updates the L2P table with the corresponding LPA index.

[0004] In existing SSDs, a mapping table from logical addresses to physical addresses is maintained in memory to speed up address queries and updates for host read and write commands.

[0005] Since the contents of the memory will be lost when the power is off, it is generally necessary to periodically save the mapping table in the memory to the NAND. The writing (effectiveness) of the mapping table and the writing (effectiveness) of the user data are dependent on each other: the user data must be written / effective before the corresponding mapping table can be written / effective. Otherwise, it will cause anomalies in reading unwritten user data during recovery. To achieve this goal, when writing the mapping table, it is necessary to suspend the host's read and write processing, and complete the operations that have been submitted to the back-end NAND. Then the mapping table is written, and after completion, the host's read and write processing is resumed. This process is called synchronization, which is used to ensure the write order of user data and the mapping table. During this process, it is necessary to suspend the processing of the host's read and write requests and recover the submitted requests. Therefore, the host performance will be temporarily reduced, which greatly affects the performance consistency. Summary of the Invention

[0006] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a method, apparatus, computer equipment and storage medium for synchronizing an SSD mapping table with user data.

[0007] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0008] In a first aspect, this embodiment provides a method for synchronizing an SSD mapping table with user data, including the following steps:

[0009] Get the read and write requests sent by the host;

[0010] Determine whether the read and write request triggers the mapping table save;

[0011] If a read or write request triggers the mapping table to be saved, the timestamp information of the current write point is obtained;

[0012] Save the mapping table that needs to be saved and the current write point timestamp information to the NAND mapping table storage area;

[0013] The host loses power;

[0014] The host is powered on and the last copy of the mapping table storage area is obtained;

[0015] Get the user data storage area write information;

[0016] Compare the timestamp in the last copied data with the timestamp in the written information;

[0017] Determine whether the timestamp in the written information is greater than the timestamp in the last copied data;

[0018] If the timestamp in the written information is not greater than the timestamp in the last copy of the data, then determine whether the timestamp in the written information is equal to the timestamp in the last copy of the data;

[0019] If the timestamp in the write information is equal to the timestamp in the last copy data, read the physical page of the write point corresponding to each DIE in the last copy data;

[0020] Determine whether the write point physical pages corresponding to each DIE are all written with user data;

[0021] If user data is written into the physical pages of the write points corresponding to each DIE, the last copy of the data is valid and is restored based on the mapping table stored therein to respond to the read and write requests issued by the host.

[0022] A further technical solution is: in the step of obtaining the current write point timestamp information, the write point timestamp information includes the physical block number, the physical block timestamp and the write point physical page number of each DIE.

[0023] Its further technical solution is: after the step of determining whether the timestamp in the write information is equal to the timestamp in the last copy data, it also includes: if the timestamp in the write information is not equal to the timestamp in the last copy data, the last copy data is invalid, the previous copy data of the last copy data is verified, and the step of obtaining the write information of the user data storage area is jumped to execute.

[0024] Its further technical solution is: after the step of judging whether the write point physical pages corresponding to each DIE have all user data written into them, it also includes: if the write point physical pages corresponding to each DIE have not all user data written into them, then jump to execute the invalid last copy data and verify the previous copy data of the last copy data.

[0025] In a second aspect, this embodiment provides an SSD mapping table and user data storage synchronization device, including: a first acquisition unit, a first judgment unit, a second acquisition unit, a storage unit, a power-off unit, a power-on acquisition unit, a third acquisition unit, a comparison unit, a second judgment unit, a third judgment unit, a reading unit, a fourth judgment unit, and a recovery response unit;

[0026] The first acquiring unit is configured to acquire a read / write request sent by a host;

[0027] The first determining unit is configured to determine whether a read or write request triggers saving of the mapping table;

[0028] The second acquiring unit is configured to acquire the timestamp information of the current write point if the read / write request triggers the saving of the mapping table;

[0029] The storage unit is used to store the mapping table and the current write point timestamp information that need to be stored in the NAND mapping table storage area;

[0030] The power-off unit is used to power off the host;

[0031] The power-on acquisition unit is used for powering on the host and acquiring the last copy of the data in the mapping table storage area;

[0032] The third acquiring unit is used to acquire the writing information of the user data storage area;

[0033] The comparison unit is used to compare the timestamp in the last copy of the data with the timestamp in the written information;

[0034] The second judgment unit is used to judge whether the timestamp in the written information is greater than the timestamp in the last copy of the data;

[0035] The third judgment unit is configured to judge whether the timestamp in the written information is equal to the timestamp in the last copy of the data if the timestamp in the written information is not greater than the timestamp in the last copy of the data;

[0036] The reading unit is configured to read the write point physical page corresponding to each DIE in the last copy of the data if the timestamp in the write information is equal to the timestamp in the last copy of the data;

[0037] The fourth judgment unit is used to judge whether the write point physical pages corresponding to each DIE are all written with user data;

[0038] The recovery response unit is used to recover the last copy of data if user data is written into the write point physical pages corresponding to each DIE, and respond to the read and write requests issued by the host based on the mapping table stored therein.

[0039] A further technical solution is: in the second acquisition unit, the write point timestamp information includes a physical block number, a physical block timestamp and a physical page number of the write point of each DIE.

[0040] Its further technical solution is: it also includes: a verification jump unit, which is used to verify the previous copy data of the last copy data if the timestamp in the written information is not equal to the timestamp in the last copy data, and jump to execute the acquisition of the user data storage area write information.

[0041] Its further technical solution is: it also includes: a jump unit, which is used to jump to execute the last copy data invalid if the write point physical pages corresponding to each DIE have not all written user data, and verify the previous copy data of the last copy data.

[0042] In a third aspect, this embodiment provides a computer device, which includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the SSD mapping table and user data storage synchronization method as described above.

[0043] In a fourth aspect, this embodiment provides a storage medium storing a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method for synchronizing the SSD mapping table and user data storage as described above can be implemented.

[0044] Compared with the prior art, the present invention has the following advantages: reading and writing of user data can be continued while the mapping table is being saved, thereby greatly improving performance consistency.

[0045] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0047] Figure 1 This is a diagram of a typical SSD read and write scenario;

[0048] Figure 2 A schematic diagram of the scenario that triggers the mapping table to be saved during the existing reading and writing process;

[0049] Figure 3 A flowchart of a method for synchronizing an SSD mapping table and user data storage provided by an embodiment of the present invention;

[0050] Figure 4 Schematic diagram of an application scenario of the SSD mapping table and user data storage synchronization method provided by an embodiment of the present invention Figure 1 ;

[0051] Figure 5 Schematic diagram of an application scenario of the SSD mapping table and user data storage synchronization method provided by an embodiment of the present invention Figure 2 ;

[0052] Figure 6 A schematic block diagram of an SSD mapping table and user data storage synchronization device provided by an embodiment of the present invention;

[0053] Figure 7 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0054] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0055] It will be understood that when used in this specification and the appended claims, the terms “comprises” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0056] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the present invention. As used in the specification and appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.

[0057] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0058] See also Figure 1 The typical read and write process of SSD is shown below:

[0059] The host sends a command to the SSD hardware module;

[0060] After the SSD hardware module PCIe / NVMe receives the command, it transfers it to the firmware module for processing;

[0061] The SSD firmware front-end module divides the command into mapping units (typically 4KB);

[0062] Submit the operation request to the buffer management module and allocate read and write buffers;

[0063] If it is a write command, data transmission with the host is established according to the allocated buffer, and the host is notified of the command completion after the data transmission is completed;

[0064] If it is a read command, the operation request is submitted to the mapping table management module;

[0065] The mapping table management module is responsible for allocating the corresponding physical address (write command) according to the logical address or converting the logical address into a NAND physical address (read command);

[0066] Submit the operation request to the back-end module, and the back-end module initiates a NAND read / write request based on the physical address;

[0067] Waiting for NAND read / write operation request to complete;

[0068] If it is a read command, after the data is ready, the data transmission from the NAND Cache Register (NAND memory) to the host is started.

[0069] See also Figure 2 The scenario in which the mapping table is saved is triggered during the reading and writing process shown:

[0070] As host read and write requests accumulate, many entries in the mapping table in memory have changed since the last save. If power is lost at any point, the corresponding user area must be scanned to rebuild, which takes a long time. To ensure the rebuild time after power failure, the mapping table is periodically saved to NAND. When the mapping table save is triggered, strict synchronization is required to ensure the write and validation order of user data and mapping table data.

[0071] The mapping table management module suspends host read and write command processing;

[0072] Wait for all NAND read and write requests submitted to the backend module to be processed (to ensure that user data is written / valid).

[0073] Start saving the mapping table to the NAND storage area (mapping table data is written / valid);

[0074] The mapping table management module resumes host read and write command processing.

[0075] During the mapping table saving process, specific synchronization actions need to be performed, which causes the host's command processing to be interrupted, thereby causing performance fluctuations.

[0076] See also Figure 3 In the specific embodiment shown, the present invention discloses a method for synchronizing an SSD mapping table with user data, comprising the following steps:

[0077] S1, obtains the read and write request sent by the host;

[0078] S2, determining whether the read / write request triggers the mapping table to be saved; if the read / write request does not trigger the mapping table to be saved, returning to execute the read / write request issued by the host;

[0079] S3: If the read / write request triggers the mapping table to be saved, the timestamp information of the current write point is obtained;

[0080] In a specific embodiment, in step S3, the write point timestamp information includes a physical block number, a physical block timestamp, and a write point physical page number of each DIE.

[0081] S4, saving the mapping table to be saved and the timestamp information of the current write point to the NAND mapping table storage area;

[0082] In a specific embodiment, after step S4, the method further includes: executing steps S1 to S4 in a loop.

[0083] S5, host power off;

[0084] S6, the host is powered on and the last copy of the mapping table storage area is obtained;

[0085] S7, obtaining the user data storage area writing information;

[0086] In a specific embodiment, in step S7, the write information includes the physical block number of the write point, the physical block timestamp, and the physical page number of the write point of each DIE.

[0087] S8, comparing the timestamp in the last copy of the data with the timestamp in the written information;

[0088] Specifically, the timestamp in the last copy of the data is compared with the timestamp in the write information, that is, the two timestamps are compared to determine which one is earlier or later.

[0089] Specifically, the physical block timestamp corresponds to the timestamp of the physical block of the user data area write point, which is a monotonically increasing integer. The sizes can be directly compared by comparing the physical block time of the timestamp in the copied data and the timestamp of the current user data area write point.

[0090] S9, determine whether the timestamp in the write information is greater than the timestamp in the last copy data; if the timestamp in the write information is greater than the timestamp in the last copy data, then jump to execute the last copy data, restore it based on the mapping table stored therein, and respond to the read and write request issued by the host.

[0091] Specifically, it is determined which of the timestamp in the written information and the timestamp in the last copy of the data is later.

[0092] S10, if the timestamp in the write information is not greater than the timestamp in the last copy data, that is, the timestamp in the write information is not later than the timestamp in the last copy data, then determine whether the timestamp in the write information is equal to the timestamp in the last copy data; if the timestamp in the write information is not equal to the timestamp in the last copy data, then the last copy data is invalid, the previous copy data of the last copy data is verified, and the process jumps to executing the step of obtaining the write information of the user data storage area, that is, step S14;

[0093] Specifically, verifying the previous copy of the last copy refers to repeating the aforementioned verification process, except that the copy of the mapping area is replaced from the last one to the previous one.

[0094] S11, if the timestamp in the write information is equal to the timestamp in the last copy data, that is, the timestamp in the write information is the same as the timestamp in the last copy data, then read the write point physical page corresponding to each DIE in the last copy data;

[0095] S12, judging whether the write point physical pages corresponding to each DIE have all user data written into them; if the write point physical pages corresponding to each DIE have not all user data written into them, then jumping to execute the invalid last copy data and verifying the previous copy data of the last copy data.

[0096] S13, if the user data is written into the physical pages of the write points corresponding to the DIEs, the last copy of the data is valid, and the data is restored based on the mapping table stored therein to respond to the read and write requests issued by the host.

[0097] Specifically, restoring based on the mapping table stored therein means reading the contents of the mapping table storage area into the memory. Responding to the read and write request sent by the host means processing the host read and write command. For details, refer to Figure 1 The host reading and writing process should not need to be repeated here.

[0098] See also Figure 4 The application scenario diagram shown in the figure shows the physical components of an SSD, including: DIE, an independent operation unit, which contains multiple physical blocks; Block, a physical block, an independent erasing unit, which contains multiple physical pages; Page, a physical page, the smallest read / write unit, which must erase the entire physical block before it can be overwritten again after being written; an SSD is composed of multiple DIEs to improve capacity and concurrent performance. For ease of explanation, the present invention uses two DIEs for illustration: DIE0 and DIE1.

[0099] The NAND inside the SSD is divided into multiple areas, including at least the following:

[0100] User data storage area, used to store user data;

[0101] A mapping table storage area for storing mapping table data;

[0102] In the user data storage area, the user data write point at any time consists of the physical block next to each DIE, such as Block X in the figure. Furthermore, to indicate the order in which data is written, there will be a user data timestamp corresponding to TS_X (this timestamp is monotonically increasing, and each time a new set of physical blocks is allocated, the corresponding timestamp information will be incremented);

[0103] Mapping table storage area, each complete copy (copy data) contains several physical pages, each physical page is composed as follows:

[0104] Some mapping entries in the memory L2P table have changed since the last save.

[0105] The user area timestamp is used to indicate the location of the write point in the corresponding user data area when the mapping table is saved. It should be noted that due to the asynchronous operation between the mapping table management module and the backend module, when the write point information is recorded, the physical location of the corresponding user data area may have been allocated but the writing may not have been completed yet;

[0106] The timestamp format of the user area of ​​the mapping table Copy further includes the following information:

[0107] The write point physical block number refers to the physical block number of the user data area write point;

[0108] The physical block timestamp refers to the timestamp of the physical block corresponding to the user data area write point;

[0109] The page number currently written to the physical block of each DIE write point: DIE 0 Page X / DIE 1 Page Y.

[0110] When a mapping table save is triggered, no special synchronization is required. By synchronizing the user area timestamp information with the saved copy of the mapping table, the mapping table save and backend user data reading and writing can be completed in parallel. Synchronization of the mapping table and user data is left to the subsequent power failure recovery, at which point the decision is made. Host power failures are relatively rare, and shifting synchronization from frequent saves to infrequent restores significantly improves performance consistency during operation.

[0111] See also Figure 5 The following application scenario diagram shows the processing flow after abnormal power failure and power on:

[0112] The timestamp information of the user data area of ​​the two most recent copies of the mapping table storage area is as follows:

[0113] Copy N:

[0114] User data area write point physical block number X;

[0115] User data area write point physical block write point timestamp TS_X;

[0116] User data area write point physical page: DIE 0, Page 1; DIE 1, Page 1;

[0117] Copy N+1:

[0118] User data area write point physical block number X;

[0119] User data area write point physical block write point timestamp TS_X;

[0120] The physical pages of the user data area write point are: DIE 0, Page 4; DIE 1, Page 4.

[0121] The current write point of the user data area is:

[0122] The physical block number of the current write point is X;

[0123] Current write point physical block write point timestamp TS_X;

[0124] The physical pages of the user data area write point are: DIE 0, Page 4; DIE 1, Page 3.

[0125] In this scenario, the mapping table in the mapping table storage area COPY N+1, the corresponding DIE 1, Page 4 mapping table has taken effect, but in the actual user data area, the corresponding DIE 1, Page 4 has not yet been written (still empty). If COPY N+1 is mistakenly used for recovery, the user data will point to a blank physical page, which will cause an exception.

[0126] In the present invention, the physical page of the DIE corresponding to the user data area saved in the mapping table copy can be read first. If it is empty, it means that the current mapping table COPY is invalid, and it is necessary to fall back to the previous mapping table copy (COPY N) for another attempt. If the physical pages of the user data area write points pointed to by COPYN are all non-empty, it means that they are valid and can be used to restore the mapping table.

[0127] The present invention can keep reading and writing user data uninterrupted when the mapping table is saved, thereby greatly improving performance consistency.

[0128] See also Figure 6 As shown, the present invention also discloses an SSD mapping table and user data storage synchronization device, including: a first acquisition unit 10, a first judgment unit 20, a second acquisition unit 30, a storage unit 40, a power-off unit 50, a power-on acquisition unit 60, a third acquisition unit 70, a comparison unit 80, a second judgment unit 90, a third judgment unit 100, a reading unit 110, a fourth judgment unit 120 and a recovery response unit 130;

[0129] The first acquiring unit 10 is configured to acquire a read / write request sent by a host;

[0130] The first determination unit 20 is configured to determine whether a read or write request triggers saving of the mapping table;

[0131] The second acquiring unit 30 is configured to acquire the timestamp information of the current write point if the read / write request triggers the saving of the mapping table;

[0132] The storage unit 40 is used to store the mapping table and the current write point timestamp information to be stored in the NAND mapping table storage area;

[0133] The power-off unit 50 is used to power off the host;

[0134] The power-on acquisition unit 60 is used to power on the host and obtain the last copy of the mapping table storage area;

[0135] The third obtaining unit 70 is used to obtain the writing information of the user data storage area;

[0136] The comparison unit 80 is used to compare the timestamp in the last copy of the data with the timestamp in the written information;

[0137] The second judgment unit 90 is used to judge whether the timestamp in the written information is greater than the timestamp in the last copy of the data;

[0138] The third judgment unit 100 is configured to judge whether the timestamp in the written information is equal to the timestamp in the last copy of the data if the timestamp in the written information is not greater than the timestamp in the last copy of the data;

[0139] The reading unit 110 is configured to read the write point physical page corresponding to each DIE in the last copy of the data if the timestamp in the write information is equal to the timestamp in the last copy of the data;

[0140] The fourth determination unit 120 is configured to determine whether user data is written into all write-point physical pages corresponding to the DIEs;

[0141] The recovery response unit 130 is used to recover the last copy of data based on the mapping table stored therein if user data is written into the write point physical pages corresponding to each DIE, and respond to the read and write request issued by the host.

[0142] Wherein, in the second acquisition unit 30, the write point timestamp information includes a physical block number, a physical block timestamp and a write point physical page number of each DIE.

[0143] The device also includes: a check jump unit 140, which is used to verify the previous copy data of the last copy data if the timestamp in the write information is not equal to the timestamp in the last copy data, then the last copy data is invalid, and jump to execute the acquisition of the user data storage area write information.

[0144] The device further includes: a jump unit for jumping to execute the last copy data invalid if the write point physical pages corresponding to each DIE have not all written user data, and verifying the previous copy data of the last copy data.

[0145] It should be noted that technical personnel in the relevant field can clearly understand that the specific implementation process of the above-mentioned SSD mapping table and user data storage synchronization device and each unit can refer to the corresponding description in the aforementioned method embodiment. For the convenience and conciseness of the description, it will not be repeated here.

[0146] The above-mentioned SSD mapping table and user data storage synchronization device can be implemented in the form of a computer program. The computer program can be used in the following ways: Figure 7 Runs on the computer device shown.

[0147] See also Figure 7 , Figure 7 This is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 500 can be a terminal or a server. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, personal digital assistant, wearable device, or other electronic device with communication capabilities. The server can be a standalone server or a server cluster consisting of multiple servers.

[0148] See Figure 7 The computer device 500 includes a processor 502 , a memory, and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .

[0149] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions, which, when executed, can enable the processor 502 to execute a method for synchronizing an SSD mapping table with user data.

[0150] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500.

[0151] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a method for synchronizing the storage of an SSD mapping table and user data.

[0152] The network interface 505 is used to communicate with other devices through the network. Figure 7 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0153] The processor 502 is configured to execute a computer program 5032 stored in the memory to implement the following steps:

[0154] Step S1, obtaining a read / write request from a host;

[0155] Step S2, determining whether the read / write request triggers the mapping table to be saved;

[0156] Step S3: If the read / write request triggers the mapping table to be saved, the timestamp information of the current write point is obtained;

[0157] Step S4, saving the mapping table to be saved and the timestamp information of the current write point to the NAND mapping table storage area;

[0158] Step S5, the host is powered off;

[0159] Step S6: The host is powered on and the last copy of the mapping table storage area is obtained;

[0160] Step S7, obtaining the user data storage area writing information;

[0161] Step S8, comparing the timestamp in the last copy of the data with the timestamp in the written information;

[0162] Step S9, determining whether the timestamp in the written information is greater than the timestamp in the last copy of the data;

[0163] Step S10, if the timestamp in the written information is not greater than the timestamp in the last copy of the data, then determining whether the timestamp in the written information is equal to the timestamp in the last copy of the data;

[0164] Step S11: If the timestamp in the write information is equal to the timestamp in the last copy data, then read the write point physical page corresponding to each DIE in the last copy data;

[0165] Step S12, determining whether the write point physical pages corresponding to each DIE are all written with user data;

[0166] Step S13: If user data is written into the physical pages of the write points corresponding to the DIEs, the last copy of the data is valid and is restored based on the mapping table stored therein to respond to the read and write requests issued by the host.

[0167] It should be understood that in the embodiment of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0168] Those skilled in the art will appreciate that all or part of the steps in the method of the above-described embodiment can be implemented by instructing the relevant hardware through a computer program. The computer program includes program instructions, which can be stored in a storage medium that is computer-readable. The program instructions are executed by at least one processor in the computer system to implement the steps in the method of the above-described embodiment.

[0169] Therefore, the present invention also provides a storage medium. The storage medium can be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the program instructions can implement the above-mentioned SSD mapping table and user data storage synchronization method. The storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the program instructions can implement the above-mentioned method. The program instructions include the following steps:

[0170] Step S1, obtaining a read / write request from a host;

[0171] Step S2, determining whether the read / write request triggers the mapping table to be saved;

[0172] Step S3: If the read / write request triggers the mapping table to be saved, the timestamp information of the current write point is obtained;

[0173] Step S4, saving the mapping table to be saved and the timestamp information of the current write point to the NAND mapping table storage area;

[0174] Step S5, the host is powered off;

[0175] Step S6: The host is powered on and the last copy of the mapping table storage area is obtained;

[0176] Step S7, obtaining the user data storage area writing information;

[0177] Step S8, comparing the timestamp in the last copy of the data with the timestamp in the written information;

[0178] Step S9, determining whether the timestamp in the written information is greater than the timestamp in the last copy of the data;

[0179] Step S10, if the timestamp in the written information is not greater than the timestamp in the last copy of the data, then determining whether the timestamp in the written information is equal to the timestamp in the last copy of the data;

[0180] Step S11: If the timestamp in the write information is equal to the timestamp in the last copy data, then read the write point physical page corresponding to each DIE in the last copy data;

[0181] Step S12, determining whether the write point physical pages corresponding to each DIE are all written with user data;

[0182] Step S13: If user data is written into the physical pages of the write points corresponding to the DIEs, the last copy of the data is valid and is restored based on the mapping table stored therein to respond to the read and write requests issued by the host.

[0183] The storage medium may be any computer-readable storage medium that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk.

[0184] Those skilled in the art will 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. Professional and technical personnel can 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 the present invention.

[0185] In the several embodiments provided herein, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the various units is merely a logical functional division, and actual implementation may employ other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be omitted or not implemented.

[0186] The steps in the methods of the embodiments of the present invention may be adjusted in order, combined, or deleted as needed. The units in the devices of the embodiments of the present invention may be combined, divided, or deleted as needed. Furthermore, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit.

[0187] If this integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the existing technology, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, terminal, or network device, etc.) to execute all or part of the steps of the method described in various embodiments of the present invention.

[0188] The above embodiments are preferred implementation schemes of the present invention. In addition, the present invention can also be implemented in other ways. Any obvious replacement without departing from the concept of the present technical solution is within the scope of protection of the present invention.

Claims

1. A method for synchronizing SSD mapping table and user data storage, characterized in that: The following steps are involved: Get the read and write requests sent by the host; Determine whether the read and write request triggers the mapping table save; If a read or write request triggers the mapping table to be saved, the timestamp information of the current write point is obtained; Save the mapping table that needs to be saved and the current write point timestamp information to the NAND mapping table storage area; The host loses power; The host is powered on and the last copy of the mapping table storage area is obtained; Get the user data storage area write information; Compare the timestamp in the last copied data with the timestamp in the written information; Determine whether the timestamp in the written information is greater than the timestamp in the last copied data; If the timestamp in the written information is not greater than the timestamp in the last copy of the data, then determine whether the timestamp in the written information is equal to the timestamp in the last copy of the data; If the timestamp in the write information is equal to the timestamp in the last copy data, read the physical page of the write point corresponding to each DIE in the last copy data; Determine whether the write point physical pages corresponding to each DIE are all written with user data; If user data is written into the physical pages of the write points corresponding to each DIE, the last copy of the data is valid and is restored based on the mapping table stored therein to respond to the read and write requests issued by the host.

2. The method for synchronizing the SSD mapping table and user data storage according to claim 1, wherein: In the step of obtaining the current write point timestamp information, the write point timestamp information includes the physical block number, the physical block timestamp and the write point physical page number of each DIE.

3. The method for synchronizing the SSD mapping table and user data storage according to claim 1, wherein: After the step of determining whether the timestamp in the write information is equal to the timestamp in the last copy data, the method further includes: if the timestamp in the write information is not equal to the timestamp in the last copy data, the last copy data is invalid, the previous copy data of the last copy data is verified, and the process of obtaining the write information of the user data storage area is jumped to execute.

4. The method for synchronizing the SSD mapping table and user data storage according to claim 3, wherein: After the step of determining whether the write point physical pages corresponding to each DIE have all user data written into them, the step also includes: if the write point physical pages corresponding to each DIE have not all user data written into them, then jumping to execute the last copy data is invalid, and verifying the previous copy data of the last copy data.

5. The SSD mapping table and user data storage synchronization device is characterized in that: include: a first acquiring unit, a first judging unit, a second acquiring unit, a saving unit, a power-off unit, a power-on acquiring unit, a third acquiring unit, a comparing unit, a second judging unit, a third judging unit, a reading unit, a fourth judging unit, and a recovery response unit; The first acquiring unit is configured to acquire a read / write request sent by a host; The first determining unit is configured to determine whether a read or write request triggers saving of the mapping table; The second acquiring unit is configured to acquire the timestamp information of the current write point if the read / write request triggers the saving of the mapping table; The storage unit is used to store the mapping table and the current write point timestamp information that need to be stored in the NAND mapping table storage area; The power-off unit is used to power off the host; The power-on acquisition unit is used for powering on the host and acquiring the last copy of the data in the mapping table storage area; The third acquiring unit is used to acquire the writing information of the user data storage area; The comparison unit is used to compare the timestamp in the last copy of the data with the timestamp in the written information; The second judgment unit is used to judge whether the timestamp in the written information is greater than the timestamp in the last copy of the data; The third judgment unit is configured to judge whether the timestamp in the written information is equal to the timestamp in the last copy of the data if the timestamp in the written information is not greater than the timestamp in the last copy of the data; The reading unit is configured to read the write point physical page corresponding to each DIE in the last copy of the data if the timestamp in the write information is equal to the timestamp in the last copy of the data; The fourth judgment unit is used to judge whether the write point physical pages corresponding to each DIE are all written with user data; The recovery response unit is used to recover the last copy of data if user data is written into the write point physical pages corresponding to each DIE, and respond to the read and write requests issued by the host based on the mapping table stored therein.

6. The SSD mapping table and user data storage synchronization device according to claim 5, characterized in that: In the second acquisition unit, the write point timestamp information includes a physical block number, a physical block timestamp, and a write point physical page number of each DIE.

7. The SSD mapping table and user data storage synchronization device according to claim 5, characterized in that: Also includes: The check jump unit is used to verify the previous copy data of the last copy data if the timestamp in the write information is not equal to the timestamp in the last copy data, and jump to execute the acquisition of the user data storage area write information.

8. The SSD mapping table and user data storage synchronization device according to claim 7, characterized in that: Also includes: The jump unit is used to jump to execute the last copy data invalid if the write point physical pages corresponding to each DIE have not all written user data, and to verify the previous copy data of the last copy data.

9. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the SSD mapping table and user data storage synchronization method according to any one of claims 1 to 4 when executing the computer program.

10. A storage medium, characterized in that: The storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor, the method for synchronizing the SSD mapping table and user data storage according to any one of claims 1 to 4 can be implemented.

Citation Information

Patent Citations

  • An SSD abnormal power-down recovery method based on block growth record and system thereof

    CN109445987A

  • Rapid data copying method and device, computer equipment and storage medium

    CN114780448A