Data processing method, device, equipment and medium

By allocating reserved space in the solid-state drive and establishing a mapping table, the problem of being unable to obtain historical data when the storage system loses power abnormally is solved, thus achieving data integrity protection and cost reduction.

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

Patent Information

Application Number
CN202411377772.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-09-26
Estimated Expiration
2044-09-30

AI Technical Summary

Technical Problem

When the storage system encounters an abnormal power failure while performing a modification write, the RAID technology cannot obtain historical data, resulting in a loss of data integrity.

Method used

Reserve space in the solid-state drive as a historical data storage area, and establish a mapping table to record logical addresses and physical addresses. The mapping table can be used to restore historical data in abnormal power outage scenarios, and data protection is performed directly inside the solid-state drive to avoid additional disk redundant backup.

Benefits of technology

It ensures that historical data can be obtained in abnormal power outage scenarios, reduces data protection costs, and realizes partitioned storage of historical and latest data to ensure data integrity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248197B_ABST
    Figure CN119248197B_ABST
Patent Text Reader

Abstract

The present invention discloses a data processing method, device, equipment and medium, and relates to the field of storage technology. A portion of space is divided from the reserved space of a solid-state hard disk as a space for storing historical data, and then a mapping table is stored in the memory of the solid-state hard disk, which records at least a logical address, a physical address of the latest data corresponding to the logical address, and a physical address of the next latest data, so that after the solid-state hard disk obtains the information of reading historical data sent by the host, it can first obtain the physical address corresponding to the historical data from the first mapping table, and then obtain the historical data from the first space according to the obtained physical address. In the event of an abnormal power outage, the historical data can still be restored from the mapping table, which ensures that the historical data can be obtained and the integrity of the data is guaranteed; and data protection is performed directly inside the solid-state hard disk, without the need for an additional disk for data redundancy backup, reducing the cost of data protection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] As information grows, ensuring data security becomes increasingly important. One data protection method, Redundant Array of Independent Disks (RAID), combines two or more hard disk drives (HDDs) or solid-state drives (SSDs) into a coordinated storage unit or array, creating a fail-safe mechanism against data loss.

[0003] However, if the storage system experiences an unexpected power outage during a write-modify operation, the data read by the host may be neither the new data nor the old data. If RAID technology is used to ensure data security, a failure of a hard disk drive (HDD) or solid-state drive (SSD) could prevent the RAID from retrieving historical data (old data), potentially compromising data integrity.

[0004] It can be seen that providing a new data protection method to ensure the integrity of data is a technical problem that people in this field urgently need to solve. Summary of the Invention

[0005] The purpose of the present invention is to provide a data processing method, device, equipment and medium to solve the technical problem that when a storage system encounters an abnormal power failure during modification and write execution, an HDD or SSD failure occurs when RAID is protecting data, resulting in the inability to obtain historical data through RAID, thereby affecting data integrity.

[0006] To solve the above technical problems, the present invention provides a data processing method applied to a solid-state drive, the method comprising:

[0007] Receive information sent by the host to represent the historical data;

[0008] Obtaining a first target physical address corresponding to the historical data from a first mapping table according to the information used to represent the historical data; wherein the first mapping table is stored in a memory of the solid-state drive, the first mapping table includes at least one entry, the entry including a first index and a first table item corresponding to each first index, each first table item recording at least a logical address, a physical address of the latest data corresponding to the logical address, and a physical address of the next latest data;

[0009] Acquire historical data corresponding to the first target physical address from a first space according to the first target physical address; wherein the first space is a portion of a reserved space of the solid-state drive;

[0010] The historical data is sent to the host.

[0011] In one aspect, the method further comprises:

[0012] Receive information sent by the host to indicate the acquisition of new data;

[0013] Obtaining a second target physical address corresponding to the new data from the second mapping table according to the information used to characterize the acquisition of new data, or obtaining an index corresponding to the new data from the second mapping table according to the information used to characterize the acquisition of new data, and obtaining the second target physical address corresponding to the new data from the first mapping table according to the index corresponding to the new data; wherein the second mapping table is stored in the memory, the second mapping table includes at least one entry, the entry including a second index and a second table entry corresponding to the second index; each second index is a logical address, and each second table entry records the physical address corresponding to the latest data or the first index;

[0014] Acquire new data corresponding to the second target physical address from a second space according to the second target physical address; wherein the second space is a space in the solid-state drive for storing new data;

[0015] The new data is sent to the host.

[0016] In another aspect, the method further comprises:

[0017] Receiving information sent by a host for representing write data; wherein the information for representing write data includes at least a target write logical address, a target physical address corresponding to the target write logical address, a target index, and data to be written;

[0018] Obtaining an entry of the first mapping table and an entry of the second mapping table; wherein the entry includes an index and a table item;

[0019] updating the first mapping table and the second mapping table according to the information for representing the write history data, the entries of the first mapping table, and the entries of the second mapping table;

[0020] The data to be written and the historical data are stored according to the updated first mapping table, or the data to be written and the historical data are stored according to the updated first mapping table and the updated second mapping table.

[0021] On the other hand, updating the first mapping table and the second mapping table according to the information representing the write history data, the entries of the first mapping table, and the entries of the second mapping table includes:

[0022] When it is detected that the target index is the same as the index of the current entry of the first mapping table, the table entry corresponding to the current entry of the first mapping table is 0, the table entry of the current entry of the second mapping table is the current physical address corresponding to the target write logical address, and the logical address corresponding to the index of the current entry of the second mapping table is the same as the target write logical address, updating the table entry of the current entry of the second mapping table from the current physical address to the target index;

[0023] The table entry of the current entry of the first mapping table is updated from 0 to the target write logical address, the target physical address and the current physical address.

[0024] On the other hand, storing the data to be written and the historical data according to the updated first mapping table includes:

[0025] storing the data to be written in the second space according to the target physical address recorded in the updated first mapping table;

[0026] Acquire data corresponding to the current physical address from the second space according to the current physical address recorded in the updated first mapping table;

[0027] Migrate data corresponding to the current physical address from the second space to the first space.

[0028] On the other hand, updating the first mapping table and the second mapping table according to the information representing the write history data, the entries of the first mapping table, and the entries of the second mapping table includes:

[0029] When it is detected that the target index is the same as the index of the current entry of the first mapping table, the table entry corresponding to the current entry of the first mapping table records the current logical address, the physical address of the latest data corresponding to the current logical address, and the physical address of the next latest data, the table entry of the current entry of the second mapping table is the current index of the current entry of the first mapping table, and the logical address corresponding to the index of the current entry of the second mapping table is the same as the target write logical address, the current entry of the second mapping table is retained;

[0030] updating the entry of the current entry of the first mapping table from the current logical address, the physical address of the latest data corresponding to the current logical address, and the physical address of the next latest data to the target write logical address, the target physical address, and the physical address of the latest data corresponding to the current logical address;

[0031] The physical address of the second-most recent data is cleared.

[0032] On the other hand, storing the data to be written and the historical data according to the updated first mapping table includes:

[0033] storing the data to be written in the second space according to the target physical address recorded in the updated first mapping table;

[0034] Acquire data corresponding to the physical address of the latest data corresponding to the current logical address from the second space according to the physical address of the latest data corresponding to the current logical address recorded in the updated first mapping table;

[0035] The data corresponding to the physical address of the latest data corresponding to the current logical address is migrated from the second space to the first space.

[0036] On the other hand, updating the first mapping table and the second mapping table according to the information representing the write history data, the entries of the first mapping table, and the entries of the second mapping table includes:

[0037] Upon detecting that the target index is the same as the index of the current entry of the first mapping table, the table entry corresponding to the current entry of the first mapping table records the current logical address, the physical address of the latest data corresponding to the current logical address, and the physical address of the next latest data, there are multiple entries in the second mapping table, the table entry of a first entry among the multiple entries is the index of the first mapping table, the logical address corresponding to the index of the first entry is the same as the logical address in the table entry of the first mapping table, the logical address corresponding to the index of the second entry among the multiple entries is the same as the target write logical address, and the table entry of the second entry records the current physical address, keeping the index of the first entry and the index of the second entry unchanged, updating the table entry of the second entry from the current physical address to the index of the first mapping table, and updating the table entry of the first entry from the index of the first mapping table to the physical address of the latest data;

[0038] updating the table entry of the current entry of the first mapping table from the current logical address, the physical address of the latest data corresponding to the current logical address, and the physical address of the second latest data to the target write logical address, the target physical address, and the current physical address;

[0039] The physical address of the second-most recent data is cleared.

[0040] On the other hand, storing the data to be written and the historical data according to the updated first mapping table and the updated second mapping table includes:

[0041] storing the data to be written in the second space according to the target physical address recorded in the updated first mapping table;

[0042] Acquire data corresponding to the current physical address from the second space according to the current physical address recorded in the updated first mapping table;

[0043] Migrating the data corresponding to the current physical address from the second space to the first space;

[0044] The data corresponding to the physical address of the latest data corresponding to the current logical address is kept in the second space according to the physical address of the latest data recorded in the updated second mapping table.

[0045] On the other hand, the first mapping table and the second mapping table each contain a plurality of entries; and updating the first mapping table and the second mapping table according to the information for representing the write history data, the entries in the first mapping table, and the entries in the second mapping table includes:

[0046] Upon detecting that the target index is the same as the index of the first entry of the first mapping table, the first current logical address, the first physical address of the latest data corresponding to the first current logical address, and the first physical address of the next-to-latest data are recorded in the entry corresponding to the first entry of the first mapping table, the second current logical address, the second physical address of the latest data corresponding to the second current logical address, and the second physical address of the next-to-latest data are recorded in the entry corresponding to the second entry of the first mapping table, the entry of the third entry of the second mapping table is the index of the first entry, and the logical address corresponding to the index of the third entry is the same as the logical address in the entry of the first entry; the entry of the fourth entry of the second mapping table is the index of the second entry, and the logical address corresponding to the index of the fourth entry is the same as the logical address in the entry of the second entry, and the logical address corresponding to the index of the second entry is the same as the target write logical address, the index of the third entry and the index of the fourth entry are kept unchanged, the entry of the fourth entry is updated from the index of the second entry to the index of the first entry, and the entry of the third entry is updated from the index of the first entry to the first physical address of the latest data corresponding to the first current logical address;

[0047] updating the first entry of the first mapping table from the first current logical address, the first physical address of the latest data corresponding to the first current logical address, and the first physical address of the second latest data to the target write logical address, the target physical address, and the second physical address of the latest data corresponding to the second current logical address;

[0048] The first physical address of the less recent data and the second physical address of the less recent data are cleared.

[0049] On the other hand, storing the data to be written and the historical data according to the updated first mapping table and the updated second mapping table includes:

[0050] storing the data to be written in the second space according to the target physical address recorded in the updated first mapping table;

[0051] Acquire data corresponding to the second physical address of the latest data corresponding to the second current logical address from the second space according to the second physical address of the latest data corresponding to the second current logical address recorded in the updated first mapping table;

[0052] Migrating data corresponding to the second physical address of the latest data corresponding to the second current logical address from the second space to the first space;

[0053] The data corresponding to the first physical address of the latest data corresponding to the first current logical address recorded in the updated first mapping table is kept in the second space.

[0054] In order to solve the above technical problems, the present invention further provides a data processing device applied to a solid state drive, the device comprising:

[0055] A receiving module, used to receive information sent by the host for representing the acquisition of historical data;

[0056] a first acquisition module, configured to acquire, from a first mapping table, a first target physical address corresponding to the historical data according to the information used to represent the historical data; wherein the first mapping table is stored in a memory of the solid-state drive, the first mapping table including at least one entry, each entry including a first index and a first table entry corresponding to each first index, each first table entry recording at least a logical address, a physical address of the latest data corresponding to the logical address, and a physical address of the next latest data;

[0057] a second acquisition module, configured to acquire, according to the first target physical address, historical data corresponding to the first target physical address from a first space; wherein the first space is a portion of a reserved space of the solid-state drive;

[0058] The sending module is used to send the historical data to the host.

[0059] In order to solve the above technical problems, the present invention further provides a data processing device, comprising:

[0060] memory for storing computer programs;

[0061] A processor is used to implement the steps of the above-mentioned data processing method when executing the computer program.

[0062] In order to solve the above technical problems, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above data processing method are implemented.

[0063] The beneficial effect of the present invention is that, in this method, a part of the space is divided from the reserved space of the solid-state hard disk as a space for storing historical data, and then a mapping table is stored in the memory of the solid-state hard disk, which records at least the logical address, the physical address of the latest data corresponding to the logical address, and the physical address of the next latest data. Relative to the physical address of the latest data, the physical address of the next latest data is the address corresponding to the historical data, so that after the solid-state hard disk obtains the information of reading historical data sent by the host, it can first obtain the physical address corresponding to the historical data from the first mapping table, and then obtain the historical data from the first space according to the obtained physical address. That is, by setting up space for storing historical data and storing historical data inside the solid-state drive, the historical data is preserved, and a mapping relationship table is stored in the internal memory of the solid-state drive. In the event of an abnormal power outage, the historical data can still be restored from the mapping table, ensuring that the historical data can be obtained and the integrity of the data is guaranteed; secondly, data protection is performed directly inside the solid-state drive, and no additional disk is required for data redundancy backup, which reduces the cost of data protection; thirdly, the established mapping table records the logical address, the physical address of the latest data corresponding to the logical address, and the physical address of the next latest data, so that the physical address of the latest data and the physical address of the next latest data can be obtained through the mapping table, that is, while being able to obtain historical data, the latest data can also be obtained.

[0064] In addition, a second mapping table is also stored in the memory that stores the first mapping table. Each index in the second mapping table is a logical address, and the table entry records the physical address corresponding to the latest data or the index of the first mapping table. At the same time, new data is stored in the second space, so that when the information sent by the host to obtain new data is received, the physical address corresponding to the new data can be obtained from the second mapping table, and then the new data can be obtained from the second space according to the obtained physical address, thereby ensuring that the new data can be obtained.

[0065] When writing data, the first and second mapping tables are updated based on the information representing the historical data being written, the entries in the first mapping table, and the entries in the second mapping table. The data to be written and the historical data are stored based on the updated first mapping table, or the data to be written and the historical data are stored based on the updated first mapping table and the updated second mapping table. When writing data, updating the mapping tables and storing data based on the mapping tables ensures that historical data can be stored and data integrity is guaranteed.

[0066] When the information used to characterize the write historical data, the entries in the first mapping table, and the entries in the second mapping table are different, the first mapping table and the second mapping table are updated in different ways, so that the mapping tables (including the first mapping table and the second mapping table) can be updated in an appropriate way; in the process of updating the mapping tables, the oldest data information is also cleared (the write information sent by the host contains the information to be written, the information of the latest data and the information of the second-newest data stored in the first mapping table. At this time, the oldest data information is the information of the second-newest data), so that the storage space occupied by the oldest data information can be reclaimed.

[0067] After the mapping table is updated, the data storage space is adjusted according to the mapping table, ensuring that historical data is stored in the first space and the latest data is stored in the second space, thereby realizing partitioned storage of historical data and latest data.

[0068] In addition, the present invention also provides a data processing device, a data processing equipment and a computer-readable storage medium, which have the same or corresponding technical features as the above-mentioned data processing method and have the same effects as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the embodiments of the present invention, 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0070] Figure 1 A schematic diagram of a storage system provided by an embodiment of the present invention encountering a power outage scenario when performing a modification write;

[0071] Figure 2 A flowchart of a data processing method provided by an embodiment of the present invention;

[0072] Figure 3 A diagram showing the correspondence between the first mapping table and the second mapping table provided in an embodiment of the present invention;

[0073] Figure 4 A schematic diagram of interaction between a host and a solid-state drive provided by an embodiment of the present invention;

[0074] Figure 5 A schematic diagram of saving and writing historical data provided by an embodiment of the present invention;

[0075] Figure 6 A schematic diagram of reading historical data provided by an embodiment of the present invention;

[0076] Figure 7 A schematic diagram of a scenario of updating a data backup holding area for the first time provided by an embodiment of the present invention;

[0077] Figure 8 A schematic diagram of a scenario in which a data backup holding area (Temp table) is overwritten and updated, and an index identifies a temp_entry of the same LBA, provided by an embodiment of the present invention;

[0078] Figure 9 A schematic diagram of a scenario in which a data backup storage area (Temp table) is updated for the first time, and index_x identifies temp_entry corresponding to different LBAs, provided by an embodiment of the present invention;

[0079] Figure 10 A schematic diagram of a scenario in which a Temp table is overwritten and updated, provided by an embodiment of the present invention, where a newly written LBA has an associated Temp table entry, but index_x identifies a Temp table entry of another LBA;

[0080] Figure 11 A structural diagram of a data processing device provided in another embodiment of the present invention. DETAILED DESCRIPTION

[0081] 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. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.

[0082] The core of the present invention is to provide a data processing method, device, equipment and medium to solve the technical problem that when a storage system encounters an abnormal power failure during modification and write, an HDD or SSD failure occurs when RAID is protecting data, resulting in the inability to obtain historical data through RAID, affecting data integrity.

[0083] Among related data protection methods, RAID technology is used for data protection. RAID data redundancy backup technology creates a fail-safe mechanism for data loss by combining two or more HDDs or SSDs into a coordinated storage unit or array. RAID storage prevents complete loss of disk drive data by duplicating or recreating data and storing it on additional drives, a process also known as data redundancy. However, RAID technology has the following main disadvantages:

[0084] 1. Limited write performance: Since parity information needs to be recalculated when writing data, the write performance of RAID is lower than that of read operations.

[0085] 2. Data integrity during drive failure: If a HDD or SSD fails, the system needs to perform computations when recovering the data, which may result in slower data access and may risk data integrity during this period.

[0086] 3. Increased costs: RAID is relatively expensive because it requires additional disks for data redundancy. You also need to consider the additional hardware costs.

[0087] The current storage system's modification and write method cannot guarantee data reliability in abnormal power failure scenarios. Figure 1 A schematic diagram of a storage system provided by an embodiment of the present invention encountering a power outage scenario when performing a modification write. Figure 1 As shown, the interactive objects involved in the modification and write process include: object storage devices, Bluetooth storage, drivers, solid-state drives, and data blocks. The storage system performs a 128K modification write, while the SSD firmware internally writes and updates the L2p table in units of 4k, and does not write and update the L2P table in units of 128k. The 128K user data is split into 32 4K writes and processed in parallel. If there is a power outage during the write process, some of the 4K write processes may be completed and the L2P table updated, while the remaining 4K write processes are terminated because the firmware responds to the abnormal power outage. In this way, the host reads the 128K data that failed to be written again, and the 128K data obtained is neither new data nor old data as a whole. The data needs to be restored to the state before writing. However, since it is a modification write method, the old data has been overwritten at this time, so other methods are needed to obtain the old data. Therefore, an embodiment of the present invention provides a method for implementing data protection within the SSD.

[0088] In order to enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific implementation methods. Figure 2 This is a flow chart of a data processing method provided by an embodiment of the present invention. The method is applied to a solid-state drive and includes:

[0089] S10: receiving information sent by the host for representing the acquired historical data;

[0090] S11: Acquire a first target physical address corresponding to the historical data from a first mapping table according to information used to represent the acquired historical data;

[0091] S12: Acquire historical data corresponding to the first target physical address from a first space according to the first target physical address; wherein the first space is a portion of a reserved space of the solid state drive;

[0092] S13: Send historical data to the host.

[0093] As the data storage entity in a storage system, an SSD contains over-provisioning (OP) space to reduce write amplification (OP ratio = (SSD raw capacity - SSD user capacity) / SSD user capacity). Unlike normal space, which stores only valid user data (accessible by the Flash Translation Layer (FTL) mapping table (i.e., the second mapping table), OP space stores old data that is about to be garbage collected due to overwrite or trim operations. Generally, an SSD's OP ratio is ≥15%, meaning a 3.2TB SSD has at least 480GB of OP space. The OP space is designed to retain at least 10GiB of data redundancy backup space (i.e., the first space of this invention, also known as the backup retention area). A corresponding data structure table, named the Temp table (i.e., the first mapping table), is established in the SSD's double data rate (DDR) memory to store historical data. Specifically, the first mapping table includes at least one entry (temp entry), which includes a first index and a first table entry corresponding to each first index. Each first table entry records at least a logical address, a physical address of the latest data corresponding to the logical address, and a physical address of the next latest data.

[0094] After the first space is set in the SSD, historical data is stored in the first space, and a mapping table recording at least the logical address, the physical address of the latest data corresponding to the logical address, and the physical address of the second latest data is stored in the memory of the SSD.

[0095] Receive information sent by the host to represent historical data acquisition. This information includes at least the logical address corresponding to the historical data. There are no restrictions on the historical data the host wants to acquire. For example, in a storage system, there are 4+2 data entries to be written in a 128KB atomic write scenario. Storage nodes 0, 1, and 2 successfully write, but storage nodes 3, 4, and 5 fail due to a power outage. In this case, the transaction cannot succeed and needs to be rolled back. Storage nodes 0, 1, and 2 need to restore the data to their pre-write state. However, since the write is modified, the old data has already been overwritten, so other methods are needed to retrieve the old data. The SSD supports at least 10GB of storage space for old data, meeting the storage software stack's historical data search requirements. The SSD space occupied by old data is called the backup retention area. The storage software stack uses a dedicated read backup retention area interface to read the old data corresponding to the successfully written data on storage nodes 0, 1, and 2 in the above failure scenario. In this case, the information sent by the host to represent historical data acquisition includes the logical address corresponding to the successfully written data on storage nodes 0, 1, and 2.

[0096] After receiving the information sent by the host for characterizing the acquisition of historical data, the first target physical address corresponding to the historical data is obtained from the first mapping table according to the information for characterizing the acquisition of historical data; then, the historical data corresponding to the first target physical address is obtained from the first space according to the first target physical address; finally, the historical data is sent to the host.

[0097] In addition to the host needing to obtain historical data, in practice, the host may also need to obtain new data. In this case, the data processing methods include:

[0098] Receive information sent by the host to indicate the acquisition of new data;

[0099] Obtaining a second target physical address corresponding to the new data from the second mapping table according to the information used to characterize the acquisition of the new data, or obtaining an index corresponding to the new data from the second mapping table according to the information used to characterize the acquisition of the new data, and obtaining the second target physical address corresponding to the new data from the first mapping table according to the index corresponding to the new data; wherein the second mapping table is stored in a memory, the second mapping table includes at least one entry, the entry includes a second index and a second table entry corresponding to the second index; each second index is a logical address, and each second table entry records the physical address corresponding to the latest data or the first index;

[0100] Acquire new data corresponding to the second target physical address from the second space according to the second target physical address; wherein the second space is a space in the solid state drive for storing new data;

[0101] Send new data to the host.

[0102] A second mapping table is also stored in the memory that stores the first mapping table. Each index in the second mapping table is a logical address. The table entry records the physical address corresponding to the latest data or the index of the first mapping table. At the same time, new data is stored in the second space (i.e., the normal space), so that when the information sent by the host to obtain new data is received, the physical address corresponding to the new data can be obtained from the second mapping table, and then the new data can be obtained from the second space according to the obtained physical address, thereby ensuring that the new data can be obtained.

[0103] In order to better understand the formats of the first mapping table and the second mapping table and the corresponding relationship between the two mapping tables of the present invention. Figure 3 The corresponding relationship diagram between the first mapping table and the second mapping table provided in the embodiment of the present invention. Figure 3 As shown, each mapping table contains entries, indexes and table entries. The index is the content above each table, and the table entry is the content inside each table. Each index and the corresponding table entry constitute an entry. The index of the second mapping table is the logical address, and the physical address or index value is recorded in the table entry; the logical address, the new physical address and the next newest physical address are recorded in the table entry of the first mapping table. The table entry of the second mapping table can be the index of the first mapping table. In order to realize the data backup and retention function, a new metadata of the Temp table is added inside the SSD. The Temp table records the temp_entry containing the physical block address old_PBAx pointing to the historical data. The number of Temp entries represents the number of data storage units in the historical data space. For any tempentry, such as temp entry n(LBAn, PBAnn, PBAn):

[0104] LBAn represents the FTL logical block address where data can be backed up and retained;

[0105] PBAnn represents the physical block address of the new data, which is the cache entry index or flash address;

[0106] PBAn represents the physical block address of the data that can be backed up and retained, which is a cache entry index or a flash address.

[0107] Figure 4 A schematic diagram of the interaction between a host and a solid-state drive provided by an embodiment of the present invention is shown in FIG. Figure 4The scenario shown in Figure 1 illustrates the interaction between a host and an SSD. A first mapping table is added to the SSD's double data rate memory. Furthermore, a first space is allocated in addition to the SSD's normal space to store historical data. The host's object storage device sends commands to the SSD controller via the host interface. The SSD controller retrieves the corresponding data from the storage space (including the normal space and the first space) based on the first and second mapping tables stored in the double data rate memory.

[0108] The host obtains historical data and new data in the following steps:

[0109] 1) The SSD receives the Normal read command, searches the FTL mapping table, reads the new data in the normal space, and sends it to the Host;

[0110] 2) The SSD receives the customized read temp command, searches the Temp table, reads the old data in the Temp space, and sends it to the host;

[0111] 3) To ensure that the old data mapped to the Temp table is the latest data, the host usually sends the write SSD command using the customized write Temp method;

[0112] Similar to FTL mapping table operations, the Temp table also needs to support indexing, updating, and deleting operations. Therefore, the SSD provides customized interfaces, including read temp, write temp, and delete temp.

[0113] For host LBAx, both new data and old data exist in the SSD storage space. Specifically, when the host sends a normal host LBAx read request to the SSD, the SSD returns the new data pointed to by PBAx in the L2P table (L2P is part of the FTL; the FTL also provides other functions such as wear leveling and garbage collection). When the host sends a host LBAx read request to the SSD, the SSD returns the old data pointed to by old_PBAx in the Temp table. Typically, the host uses normal read requests to read data from the SSD and only sends a Temp read request to the SSD to read old data when historical data is needed.

[0114] In the method provided in this embodiment, a portion of space is divided from the reserved space of the solid-state hard disk as a space for storing historical data, and then a mapping table is stored in the memory of the solid-state hard disk, which records at least the logical address, the physical address of the latest data corresponding to the logical address, and the physical address of the next latest data. Relative to the physical address of the latest data, the physical address of the next latest data is the address corresponding to the historical data, so that after the solid-state hard disk obtains the information of reading historical data sent by the host, it can first obtain the physical address corresponding to the historical data from the first mapping table, and then obtain the historical data from the first space according to the obtained physical address. That is, by setting up space for storing historical data and storing historical data inside the solid-state drive, the historical data is preserved, and a mapping relationship table is stored in the internal memory of the solid-state drive. In the event of an abnormal power outage, the historical data can still be restored from the mapping table, ensuring that the historical data can be obtained and the integrity of the data is guaranteed; secondly, data protection is performed directly inside the solid-state drive, and no additional disk is required for data redundancy backup, which reduces the cost of data protection; thirdly, the established mapping table records the logical address, the physical address of the latest data corresponding to the logical address, and the physical address of the next latest data, so that the physical address of the latest data and the physical address of the next latest data can be obtained through the mapping table, that is, while being able to obtain historical data, the latest data can also be obtained.

[0115] In order to save and write historical data, Figure 5 A schematic diagram of saving and writing historical data provided by an embodiment of the present invention is shown as follows: Figure 5 As shown, the method includes:

[0116] S14: The subqueue receives the message for writing into the first space and parses it to obtain the first logical address;

[0117] S15: Acquire a lock, apply for storage space, number the space, record the entry index of the first mapping table, and transmit the data of the space to the write data controller;

[0118] S16: Read the second mapping table in the double data rate memory to obtain the first physical address;

[0119] S17: Read the first mapping table according to the index of the first mapping table, and obtain the second logical address, the third physical address, and the second physical address;

[0120] S18: Determine whether the first logical address is the same as the second logical address; if so, proceed to step S19; if not, proceed to step S22;

[0121] S19: Initiate clearing of the second physical address;

[0122] S20: Organize the entries of the first mapping table into a first logical address, a space number, and a third physical address;

[0123] S21: updating the entry of the first mapping table index in the double data rate memory;

[0124] S22: Initiate clearing of the second physical address;

[0125] S23: Acquire the lock of the second logical address;

[0126] S24: Determine whether the lock of the second logical address is acquired successfully; if so, proceed to step S25; if not, return to step S23;

[0127] S25: updating the third physical address into the second mapping table indexed by the second logical address;

[0128] S26: Release the locks of the first logical address and the second logical address.

[0129] The above process is described below by taking the first logical address as LBA0, the second logical address as LBA1, the first physical address as PBA0, the second physical address as PBA1, and the third physical address as PBA11 as an example:

[0130] 1. The sub-queue (SubQ) receives the write temp_req message and parses LBA0;

[0131] 2. Acquire the lock, apply for the cache control block (CCB), cache_idx0, record the tempentry index, perform interleave division multiple access (IDMA), and send the CCB to the write manager (WM).

[0132] 3. Read PBA0 in the L2P table of DDR;

[0133] 4. Read the DDR Temp table (LBA1, PBA11, PBA1) according to req.temp_index;

[0134] 5. Determine whether LBA1 is equal to LBA0;

[0135] 6. If LBA1 is equal to LBA0, initiate obsolete of PBA1;

[0136] 7. Organize temp_entry (LBA0, cache_idx0, PBA11);

[0137] 8. Update the entry indexed by req.temp_index in DDR and release the locks of LBA0 and LBA1;

[0138] 9. If LBA1 is not equal to LBA0, initiate obsolete of PBA1;

[0139] 10. Get the lock of LBA1;

[0140] 11. Determine whether LBA1 is locked successfully. If not, return to obtain the lock of LBA1. If successful, update PBA11 to the FTL table indexed by LBA1 and release the locks of LBA0 and LBA1.

[0141] The above process describes the process of saving and writing historical data. In order to read historical data, Figure 6 A schematic diagram of reading historical data provided by an embodiment of the present invention is as follows: Figure 6 As shown, the method includes:

[0142] S27: The subqueue receives the message for reading the first space and parses the logical address.

[0143] S28: Get the lock of the logical address;

[0144] S29: Read the second mapping table according to the logical address, and continue to read the first mapping table;

[0145] S30: Determine whether the logical address in the entry of the first mapping table is the same as the parsed logical address; if so, proceed to step S31; if not, proceed to step S34;

[0146] S31: Reading user data according to the old physical address in the entry of the first mapping table;

[0147] S32: Enhanced direct memory access moves data to host memory;

[0148] S33: Feedback to the host and release the lock of the logical address;

[0149] S34: Feedback indicating failure in reading the first mapping table.

[0150] The following describes the above process by taking the resolved logical address as LBA, the logical address in the entry of the first mapping table as Temp_entry.LBA, and the old physical address in the entry of the first mapping table as temp entry.old_pba as an example:

[0151] 1. subQ receives the read temp message and parses it to obtain the LBA;

[0152] 2. Get the LBA lock;

[0153] 3. Read the FTL table according to LBA and continue to read the temp table;

[0154] 4. Check if Temp_entry.LBA is equal to req.LBA;

[0155] 5. If they are equal, read the user data according to temp entry.old_pba;

[0156] 6. Enhanced Direct Memory Access (EDMA) moves data to the host memory and returns CQ_CPL to the host, releasing the LBA lock.

[0157] 7. If they are not equal, Read.status = READ_TEMP_FAIL, and CQ_CPL is fed back to the Host to release the LBA lock.

[0158] The SSD firmware architecture introduces the IntervalEngine mechanism to lock the FTL mapping table. Specifically, upon receiving a write command from the host, the SSD first uses the IntervalEngine to lock the contiguous LBAs specified in the Input / Output (IO) command. Once locked, the SSD flushes the data specified in the IO command to the non-volatile NAND (not-AND) memory.

[0159] To maintain write atomicity, the FTL mapping table is updated only after all LBAs specified in the IO command are processed. If a power outage or other error occurs during IO command processing, the SSD will not update the FTL mapping table and will report the corresponding error status to the host.

[0160] In order to update the first mapping table and the second mapping table, and store new data and historical data, the method includes:

[0161] Receiving information sent by the host for representing write data; wherein the information for representing write data includes at least a target write logical address, a target physical address corresponding to the target write logical address, a target index, and data to be written;

[0162] Obtaining an entry of the first mapping table and an entry of the second mapping table; wherein the entry includes an index and a table item;

[0163] updating the first mapping table and the second mapping table according to the information representing the write history data, the entry of the first mapping table, and the entry of the second mapping table;

[0164] The data to be written and the historical data are stored according to the updated first mapping table, or the data to be written and the historical data are stored according to the updated first mapping table and the updated second mapping table.

[0165] The SSD's historical data backup area, also known as the temp table, is typically read and written in four scenarios: 1) Initial update of the backup holding area; 2) Overwriting the backup holding area, where the index identifies the temp_entry for the same LBA; 3) Initial update of the temp table, where index_x identifies the temp_entry for a different LBA; and 4) Overwriting the temp table, where the newly written LBA has an associated temp table entry, but index_x identifies the temp table entry for a different LBA.

[0166] Specifically, in the first scenario (updating the data backup holding area (temp table) for the first time), updating the first mapping table and the second mapping table according to the information representing the write history data, the entries of the first mapping table, and the entries of the second mapping table includes:

[0167] When it is detected that the target index is the same as the index of the current entry of the first mapping table, the table entry corresponding to the current entry of the first mapping table is 0, the table entry of the current entry of the second mapping table is the current physical address corresponding to the target write logical address, and the logical address corresponding to the index of the current entry of the second mapping table is the same as the target write logical address, updating the table entry of the current entry of the second mapping table from the current physical address to the target index;

[0168] The entry of the current entry of the first mapping table is updated from 0 to the target write logical address, the target physical address and the current physical address.

[0169] Storing the data to be written and the historical data according to the updated first mapping table includes:

[0170] Storing the data to be written in the second space according to the target physical address recorded in the updated first mapping table;

[0171] Obtaining data corresponding to the current physical address from the second space according to the current physical address recorded in the updated first mapping table;

[0172] Migrate the data corresponding to the current physical address from the second space to the first space.

[0173] Figure 7 Schematic diagram of a scenario of first updating the data backup holding area provided by an embodiment of the present invention. Figure 7As shown, in the pre-write phase, there is an entry in the second mapping table whose index is logical address x and whose entry is physical address x; the index in the first mapping table is index x, and the initial value of the entry is 0. The host initiates a modification write with information including logical address x, new physical address xx, and index x; in the post-write phase, the index of the entry in the second mapping table is logical address x and whose entry is index x; the index in the first mapping table is index x, and the entry includes logical address x, physical address xx, and physical address x.

[0174] Specifically, in the pre-writing stage:

[0175] There is any FTL_entry(LBAx,PBAx) in the FTL mapping table;

[0176] The temp table is in the initial value state 0.

[0177] The host initiates a modification write. Assume that an FTL mapping table update (LBAx, PBAxx) is generated inside the SSD, and the entry indexed by index_x in the Temp table is specified for update.

[0178] Post-writing stage:

[0179] In the FTL mapping table, the entry of LBAx index is updated to the index of temp_entry: index_x;

[0180] In the Temp table, the entry indexed by index_x is updated to the newly generated temp_entry (LBAx, PBAxx, PBAx).

[0181] In the second scenario (overwriting and updating the data backup holding area (Temp table), and the index identifies the temp_entry of the same LBA), updating the first mapping table and the second mapping table according to the information representing the write history data, the entries of the first mapping table, and the entries of the second mapping table includes:

[0182] When it is detected that the target index is the same as the index of the current entry of the first mapping table, the table entry corresponding to the current entry of the first mapping table records the current logical address, the physical address of the latest data corresponding to the current logical address, and the physical address of the next latest data, the table entry of the current entry of the second mapping table is the current index of the current entry of the first mapping table, and the logical address corresponding to the index of the current entry of the second mapping table is the same as the target write logical address, the current entry of the second mapping table is retained;

[0183] Update the table entry of the current entry of the first mapping table from the current logical address, the physical address of the latest data corresponding to the current logical address, and the physical address of the second latest data to the target write logical address, the target physical address, and the physical address of the latest data corresponding to the current logical address;

[0184] Clear the physical address of the next most recent data.

[0185] Storing the data to be written and the historical data according to the updated first mapping table includes:

[0186] Storing the data to be written in the second space according to the target physical address recorded in the updated first mapping table;

[0187] Acquire data corresponding to the physical address of the latest data corresponding to the current logical address from the second space according to the physical address of the latest data corresponding to the current logical address recorded in the updated first mapping table;

[0188] The data corresponding to the physical address of the latest data corresponding to the current logical address is migrated from the second space to the first space.

[0189] Figure 8 This is a schematic diagram of a scenario in which an index identifies a temp_entry of the same LBA and an update data backup storage area (Temp table) is overwritten and updated according to an embodiment of the present invention. Figure 8 As shown, in the pre-write phase, there is an entry in the second mapping table whose index is logical address x and whose entry is physical address x. The index of the first mapping table is index x, and the entry includes logical address x, physical address xx, and physical address x. The host initiates a modification write with information including logical address x, new physical address xxx, and index x. In the post-write phase, the index of the entry in the second mapping table is logical address x and its entry is index x. The index of the first mapping table is index x, and its entry includes logical address x, physical address xxx, and physical address xx, with physical address x cleared.

[0190] Specifically, in the pre-writing stage:

[0191] There is any FTL_entr(LBAx,index_x) in the FTL mapping table, where index_x identifies the entry corresponding to the temp table;

[0192] Any temp_entry (LBAx, PBAxx, PBAx) in the Temp table is associated with an FTL_entry (LBAx, index_x);

[0193] The host initiates a modification write. Assume that an FTL mapping table update (LBAx, PBAxxx) is generated within the SSD, and that the entry indexed by index_x in the temp table is updated. At this point, PBAxxx points to the new data to be written, PBAxx points to the next-newest data in the normal space, and PBAx points to the old data in the temp space.

[0194] Post-writing stage:

[0195] In the FTL mapping table, the entry indexed by LBAx continues to record the index of temp_entry:index_x;

[0196] In the Temp table, the entry indexed by index_x is updated to the newly generated temp_entry (LBAx, PBAxxx, PBAxx), and the obsolete operation is performed on the obsolete physical block address PBAx pointing to the oldest data (the ultimate goal is to reclaim the storage space occupied by PBAx).

[0197] In the third scenario (when the data backup storage area (Temp table) is updated for the first time, and index_x identifies temp_entries corresponding to different LBAs), updating the first mapping table and the second mapping table according to the information representing the write history data, the entries in the first mapping table, and the entries in the second mapping table includes:

[0198] When it is detected that the target index is the same as the index of the current entry of the first mapping table, the current logical address, the physical address of the latest data corresponding to the current logical address, and the physical address of the next latest data are recorded in the table entry corresponding to the current entry of the first mapping table, there are multiple entries in the second mapping table, the table entry of a first entry among the multiple entries is the index of the first mapping table, the logical address corresponding to the index of the first entry is the same as the logical address in the table entry of the first mapping table, the logical address corresponding to the index of the second entry among the multiple entries is the same as the target write logical address, and the table entry of the second entry records the current physical address, the index of the first entry and the index of the second entry are kept unchanged, the table entry of the second entry is updated from the current physical address to the index of the first mapping table, and the table entry of the first entry is updated from the index of the first mapping table to the physical address of the latest data;

[0199] Update the table entry of the current entry of the first mapping table from the current logical address, the physical address of the latest data corresponding to the current logical address, and the physical address of the second latest data to the target write logical address, the target physical address, and the current physical address;

[0200] Clear the physical address of the next most recent data.

[0201] Storing the data to be written and the historical data according to the updated first mapping table and the updated second mapping table includes:

[0202] Storing the data to be written in the second space according to the target physical address recorded in the updated first mapping table;

[0203] Obtaining data corresponding to the current physical address from the second space according to the current physical address recorded in the updated first mapping table;

[0204] Migrating data corresponding to the current physical address from the second space to the first space;

[0205] The data corresponding to the physical address of the latest data corresponding to the current logical address is kept in the second space according to the physical address of the latest data recorded in the updated second mapping table.

[0206] Figure 9 This is a schematic diagram of a scenario in which a data backup storage area (Temp table) is updated for the first time, and index_x identifies temp_entry corresponding to different LBAs. Figure 9 As shown, in the pre-write phase, the first mapping table is indexed by index x, and the entry includes logical address x, new physical address xx, and index x. The second mapping table contains two entries, the first entry and the second entry. The first entry is indexed by logical address x and the entry is index x; the second entry is indexed by logical address y and the entry is physical address y. The host-initiated modification write includes information including logical address y, new physical address yy, and index x. In the post-write phase, the first entry in the second mapping table is indexed by logical address x and the entry is physical address xx, while the second entry is indexed by logical address y and the entry is index x. The first mapping table is indexed by index x, and the entry includes logical address y, physical address yy, and physical address y. Physical address x is then cleared.

[0207] Specifically, in the pre-writing stage:

[0208] There are any two FTL_entries in the FTL mapping table, FTL_entry1 (LBAx, index_x), where index_x identifies the entry corresponding to the temp table, FTL_entry2 (LBAy, PBAy);

[0209] Any temp_entry (LBAx, PBAxx, PBAx) in the Temp table is associated with FTL_entry1 (LBAx, index_x);

[0210] The host initiates a modification write. Assume that an FTL mapping table update (LBAy, PBAyy) is generated inside the SSD and specifies to update the entry indexed by index_x in the Temp table.

[0211] Post-writing stage:

[0212] In the FTL mapping table, the entry of LBAy index is updated to index:index_x of temp_entry;

[0213] In the temp table, the entry indexed by index_x is updated to the newly generated temp_entry (LBAy, PBAyy, PBAy). The overwritten historical temp_entry (LBAx, PBAxx, PBAx) must retain the mapping relationship between LBAx and the new data. This means that the physical block address PBAxx is updated to the entry indexed by LBAx in the FTL mapping table. The obsolete operation is performed on the obsolete physical block address PBAx that points to the old data.

[0214] In the fourth scenario (overwriting and updating the Temp table, where the newly written LBA has an associated Temp table entry but index_x identifies a Temp table entry for another LBA), both the first mapping table and the second mapping table contain multiple entries. Updating the first mapping table and the second mapping table based on the information representing the write history data, the entries in the first mapping table, and the entries in the second mapping table includes:

[0215] When it is detected that the target index is the same as the index of the first entry of the first mapping table, the first current logical address, the first physical address of the latest data corresponding to the first current logical address, and the first physical address of the next latest data are recorded in the entry corresponding to the first entry of the first mapping table, the second current logical address, the second physical address of the latest data corresponding to the second current logical address, and the second physical address of the next latest data are recorded in the entry corresponding to the second entry of the first mapping table, the entry of the third entry of the second mapping table is the index of the first entry, and the logical address corresponding to the index of the third entry is the same as the logical address in the entry of the first entry; when the entry of the fourth entry of the second mapping table is the index of the second entry, the logical address corresponding to the index of the fourth entry is the same as the logical address in the entry of the second entry, and the logical address corresponding to the index of the second entry is the same as the target write logical address, the index of the third entry and the index of the fourth entry are kept unchanged, the entry of the fourth entry is updated from the index of the second entry to the index of the first entry, and the entry of the third entry is updated from the index of the first entry to the first physical address of the latest data corresponding to the first current logical address;

[0216] Update the first entry of the first mapping table from the first current logical address, the first physical address of the latest data corresponding to the first current logical address, and the first physical address of the second latest data to the target write logical address, the target physical address, and the second physical address of the latest data corresponding to the second current logical address;

[0217] The first physical address of the less recent data and the second physical address of the less recent data are cleared.

[0218] Storing the data to be written and the historical data according to the updated first mapping table and the updated second mapping table includes:

[0219] Storing the data to be written in the second space according to the target physical address recorded in the updated first mapping table;

[0220] Acquire data corresponding to the second physical address of the latest data corresponding to the second current logical address from the second space according to the second physical address of the latest data corresponding to the second current logical address recorded in the updated first mapping table;

[0221] Migrating data corresponding to the second physical address of the latest data corresponding to the second current logical address from the second space to the first space;

[0222] The data corresponding to the first physical address of the latest data corresponding to the first current logical address recorded in the updated first mapping table is kept in the second space.

[0223] Figure 10 The present invention provides a schematic diagram of a scenario in which a Temp table is overwritten and updated, the newly written LBA has an associated Temp table entry, but index_x identifies a Temp table entry of another LBA. Figure 10 As shown, the first mapping table contains two entries, namely the first entry and the second entry, and the second mapping table contains two entries, namely the third entry and the fourth entry. The first entry is indexed by index x, and the table entry includes logical address x, physical address xx, and physical address x; the second entry is indexed by index y, and the table entry includes logical address y, physical address yy, and physical address y; the third entry is indexed by logical address x, the table entry is index x; and the fourth entry is indexed by logical address y, the table entry is index y. The host initiates a write modification with information including logical address y, new physical address yyy, and index x. In the post-write phase, the third entry of the second mapping table is indexed by logical address x, the table entry is physical address xx, the fourth entry is indexed by logical address y, the table entry is index x; the first mapping table is indexed by index x, and the table entry includes logical address y, physical address yyy, and physical address yy. Physical address x and physical address y are then cleared.

[0224] Specifically, in the pre-writing stage:

[0225] The FTL mapping table contains any two FTL_entries, FTL_entry1 (LBAx, index_x) and FTL_entry2 (LBAy, index_y), where index_x and index_y identify the corresponding entries in the temp table;

[0226] There are any two temp_entries in the Temp table, where temp_entry1 (LBAx, PBAxx, PBAx) is associated with FTL_entry1 (LBAx, index_x), and temp_entry2 (LBAy, PBAyy, PBAy) is associated with FTL_entry2 (LBAy, index_y);

[0227] The host initiates a modification write. Assume that an FTL mapping table update (LBAy, PBAyyy) is generated inside the SSD, and the entry indexed by index_x in the temp table is updated.

[0228] Post-writing stage:

[0229] In the FTL mapping table, the entry of LBAy index is updated to index:index_x of temp_entry;

[0230] In the temp table, the entry indexed by index_x is updated to the newly generated temp_entry (LBAy, PBAyy, PBAy). The overwritten historical temp_entry (LBAx, PBAxx, PBAx) must retain the mapping relationship between LBAx and the new data. This means that the physical block address PBAxx is updated to the entry indexed by LBAx in the FTL mapping table. The obsolete operation is performed on the obsolete physical block addresses PBAx and PBAy that point to the old data (ultimately, the storage space occupied by PBAx and PBAy is reclaimed).

[0231] In the method provided in this embodiment, when the information used to characterize the write history data, the entries in the first mapping table, and the entries in the second mapping table are different, the first mapping table and the second mapping table are updated in different ways, so that the mapping tables (including the first mapping table and the second mapping table) can be updated in an appropriate way; in the process of updating the mapping tables, the oldest data information is also cleared (the write information sent by the host contains the information to be written, the information of the latest data and the information of the second-newest data stored in the first mapping table, in this case, the oldest data information is the information of the second-newest data), so that the storage space occupied by the oldest data information can be reclaimed.

[0232] In practice, to verify the integrity of historical data, the information sent by the receiving host to represent the write data includes:

[0233] receiving information representing write data sent by the host to the first logical address;

[0234] Before receiving the information indicating the write data sent by the host to the first logical address, the method further includes:

[0235] receiving a command for reading information about data from the second space, and responding to the command with the content of the first file;

[0236] After storing the data to be written and the historical data according to the updated first mapping table, or storing the data to be written and the historical data according to the updated first mapping table and the updated second mapping table, the method further includes:

[0237] receiving a command for reading information about data from the first space, and responding to the command with the content of the second file;

[0238] receiving a command for reading information about data from the second space, and responding to the command with the content of the third file;

[0239] After receiving a command to read data from the second space and responding to the command with the content of the third file, the method further includes:

[0240] receiving information sent by the host to the second logical address for representing write data, wherein the index corresponding to the second logical address is the entry of the first logical address in the first mapping table;

[0241] After storing the data to be written and the historical data according to the updated first mapping table, or storing the data to be written and the historical data according to the updated first mapping table and the updated second mapping table, the method further includes:

[0242] receiving a command for reading data from the second space issued to the first logical address, and responding to the command with the content of the fourth file;

[0243] receiving a command for reading data from the first space issued to the second logical address, and responding to the command with the content of the fifth file;

[0244] receiving a command for reading data from the second space issued to the second logical address, and responding to the command with the content of the sixth file;

[0245] When it is detected that the content of the fifth file is the same as that of the third file, the content of the fourth file is the same as that of the third file, and the content of the sixth file is the same as the data characteristics corresponding to the data after the data is written according to the information sent by the host to the second logical address for representing the write data, the data is determined to be complete.

[0246] In order to verify the integrity of the data, the implementation specifically includes the following steps:

[0247] 1) Format the SSD and clear the data in the disk;

[0248] 2) Pre-process the SSD data, and the data characteristic value is A;

[0249] 3) Issue a normal read command to read fixed-length data and save it as file U with content a;

[0250] 4) Send a command to write the backup holding area to LBAx, writing a piece of data to the SSD, the data characteristic value is B

[0251] 5) Issue a command to read the old data in the backup holding area index_x and save it as file V with the content a;

[0252] 6) Issue a normal read command to read fixed-length data and save it as file W with content B.

[0253] 7) Send a command to write the backup holding area to LBAy, writing a piece of data to the SSD. The corresponding index is index_x, and the data characteristic value is C;

[0254] 8) Send a normal read command to LBAx to read fixed-length data and save it as file X, with content B;

[0255] 9) Send a read backup hold area command to LBAy to read the old data of index_x in the backup hold area and save it as file Y with content B.

[0256] 10) Send a normal read command to LBAy to read fixed-length data and save it to file Z with content c;

[0257] 11) Compare file Y with file W to see if their contents are consistent;

[0258] 12) Compare file X and file W to see if their contents are consistent;

[0259] 13) Check if the content of file Z is C.

[0260] In the method provided in this embodiment, data integrity verification is achieved by issuing commands to read data from different areas at different addresses and verifying the read data.

[0261] In the method provided in an embodiment of the present invention, a solution for storing historical data in the SSD OP space can retrieve historical data through the Temp table, thereby achieving redundant backup of historical data. The Temp table records the temp_entry containing the physical block address old_PBAx pointing to the historical data. The number of Temp entries represents the number of data storage units in the data backup space. For Host LBAx, both new data and old data exist in the SSD storage space. That is, when the host sends a normal read request for HostLBAx to the SSD, the SSD feeds back the new data pointed to by PBAx in the L2P table to the host; when the host sends a Host LBAx read Temp request to the SSD, the SSD feeds back the old data pointed to by old_PBAx recorded in the Temp table to the host. Compared to RAID solutions, this solution has no performance loss and is implemented within the SSD, without increasing hardware costs.

[0262] In the above embodiments, the data processing method is described in detail. The present invention also provides corresponding embodiments of a data processing apparatus and a data processing device. It should be noted that the present invention describes the embodiments of the apparatus from two perspectives: one from the perspective of functional modules and the other from the perspective of hardware.

[0263] An embodiment of the present invention provides a data processing device, which includes, from the perspective of functional modules:

[0264] A receiving module, used to receive information sent by the host for representing the acquisition of historical data;

[0265] a first acquisition module, configured to acquire a first target physical address corresponding to the historical data from a first mapping table based on information used to represent the acquired historical data; wherein the first mapping table is stored in a memory of the solid-state drive, the first mapping table including at least one entry, the entry including a first index and a first table entry corresponding to each first index, each first table entry recording at least a logical address, a physical address of the latest data corresponding to the logical address, and a physical address of the next latest data;

[0266] a second acquisition module, configured to acquire, according to the first target physical address, historical data corresponding to the first target physical address from a first space; wherein the first space is a portion of a reserved space of the solid-state drive;

[0267] The sending module is used to send historical data to the host.

[0268] In some embodiments, the data processing apparatus further comprises:

[0269] A first receiving module is used to receive information sent by the host to indicate the acquisition of new data;

[0270] a third acquisition module, configured to acquire a second target physical address corresponding to the new data from the second mapping table based on the information used to characterize the acquisition of the new data, or to acquire an index corresponding to the new data from the second mapping table based on the information used to characterize the acquisition of the new data, and to acquire the second target physical address corresponding to the new data from the first mapping table based on the index corresponding to the new data; wherein the second mapping table is stored in the memory, the second mapping table includes at least one entry, the entry including a second index and a second table entry corresponding to the second index; each second index is a logical address, and each second table entry records the physical address corresponding to the latest data or the first index;

[0271] a fourth acquisition module, configured to acquire, according to the second target physical address, new data corresponding to the second target physical address from the second space; wherein the second space is a space in the solid-state drive for storing new data;

[0272] The first sending module is used to send new data to the host.

[0273] In some embodiments, the data processing apparatus further comprises:

[0274] A second receiving module is configured to receive information sent by the host for representing write data; wherein the information for representing write data includes at least a target write logical address, a target physical address corresponding to the target write logical address, a target index, and data to be written;

[0275] a fifth acquisition module, configured to acquire an entry of the first mapping table and an entry of the second mapping table; wherein the entry includes an index and a table item;

[0276] an updating module, configured to update the first mapping table and the second mapping table according to the information representing the write history data, the entries of the first mapping table, and the entries of the second mapping table;

[0277] The storage module is used to store the data to be written and the historical data according to the updated first mapping table, or to store the data to be written and the historical data according to the updated first mapping table and the updated second mapping table.

[0278] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, and will not be repeated here. The effects are the same as above.

[0279] Figure 11 This is a structural diagram of a data processing device provided by another embodiment of the present invention. This embodiment is based on the hardware perspective, such as Figure 11 As shown, the data processing equipment includes:

[0280] Memory 20, for storing computer programs;

[0281] The processor 21 is configured to implement the steps of the data processing method mentioned in the above embodiment when executing a computer program.

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

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

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

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

[0286] The data processing device provided by the embodiment of the present invention includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: data processing method, the effect is the same as above.

[0287] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned data processing method when executed by a processor.

[0288] Finally, the present invention also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above method embodiment.

[0289] It is understood that if the methods in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, 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 executes all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage media include various media that can store program code, such as USB flash drives, mobile hard drives, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.

[0290] The computer-readable storage medium provided by the present invention includes the above-mentioned data processing method, and the effect is the same as above.

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

[0292] It should also be noted that, in this specification, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.

Claims

1. A data processing method, characterized in that: Applied to a solid-state drive, the method includes: Receive information sent by the host to represent the historical data; Obtaining a first target physical address corresponding to the historical data from a first mapping table according to the information used to represent the historical data; wherein the first mapping table is stored in a memory of the solid-state drive, the first mapping table includes at least one entry, the entry including a first index and a first table item corresponding to each first index, each first table item recording at least a logical address, a physical address of the latest data corresponding to the logical address, and a physical address of the next latest data; Acquire historical data corresponding to the first target physical address from a first space according to the first target physical address; wherein the first space is a portion of a reserved space of the solid-state drive; Sending the historical data to the host; The method further comprises: Receive information sent by the host to indicate the acquisition of new data; Obtaining a second target physical address corresponding to the new data from the second mapping table according to the information used to characterize the acquisition of new data, or obtaining an index corresponding to the new data from the second mapping table according to the information used to characterize the acquisition of new data, and obtaining the second target physical address corresponding to the new data from the first mapping table according to the index corresponding to the new data; wherein the second mapping table is stored in the memory, the second mapping table includes at least one entry, the entry including a second index and a second table entry corresponding to the second index; each second index is a logical address, and each second table entry records the physical address corresponding to the latest data or the first index; Acquire new data corresponding to the second target physical address from a second space according to the second target physical address; wherein the second space is a space in the solid-state drive for storing new data; Sending the new data to the host; The method further comprises: Receiving information sent by a host for representing write data; wherein the information for representing write data includes at least a target write logical address, a target physical address corresponding to the target write logical address, a target index, and data to be written; Obtaining an entry of the first mapping table and an entry of the second mapping table; wherein the entry includes an index and a table item; updating the first mapping table and the second mapping table according to the information for representing the write history data, the entries of the first mapping table, and the entries of the second mapping table; The data to be written and the historical data are stored according to the updated first mapping table, or the data to be written and the historical data are stored according to the updated first mapping table and the updated second mapping table.

2. The data processing method according to claim 1, wherein: The updating of the first mapping table and the second mapping table according to the information for representing the write history data, the entries of the first mapping table, and the entries of the second mapping table includes: When it is detected that the target index is the same as the index of the current entry of the first mapping table, the table entry corresponding to the current entry of the first mapping table is 0, the table entry of the current entry of the second mapping table is the current physical address corresponding to the target write logical address, and the logical address corresponding to the index of the current entry of the second mapping table is the same as the target write logical address, updating the table entry of the current entry of the second mapping table from the current physical address to the target index; The table entry of the current entry of the first mapping table is updated from 0 to the target write logical address, the target physical address and the current physical address.

3. The data processing method according to claim 2, characterized in that: Storing the data to be written and the historical data according to the updated first mapping table includes: storing the data to be written in the second space according to the target physical address recorded in the updated first mapping table; Acquire data corresponding to the current physical address from the second space according to the current physical address recorded in the updated first mapping table; Migrate data corresponding to the current physical address from the second space to the first space.

4. The data processing method according to claim 1, wherein: The updating of the first mapping table and the second mapping table according to the information for representing the write history data, the entries of the first mapping table, and the entries of the second mapping table includes: When it is detected that the target index is the same as the index of the current entry of the first mapping table, the table entry corresponding to the current entry of the first mapping table records the current logical address, the physical address of the latest data corresponding to the current logical address, and the physical address of the next latest data, the table entry of the current entry of the second mapping table is the current index of the current entry of the first mapping table, and the logical address corresponding to the index of the current entry of the second mapping table is the same as the target write logical address, the current entry of the second mapping table is retained; updating the entry of the current entry of the first mapping table from the current logical address, the physical address of the latest data corresponding to the current logical address, and the physical address of the next latest data to the target write logical address, the target physical address, and the physical address of the latest data corresponding to the current logical address; The physical address of the second-most recent data is cleared.

5. The data processing method according to claim 4, characterized in that: Storing the data to be written and the historical data according to the updated first mapping table includes: storing the data to be written in the second space according to the target physical address recorded in the updated first mapping table; Acquire data corresponding to the physical address of the latest data corresponding to the current logical address from the second space according to the physical address of the latest data corresponding to the current logical address recorded in the updated first mapping table; The data corresponding to the physical address of the latest data corresponding to the current logical address is migrated from the second space to the first space.

6. The data processing method according to claim 1, wherein: The updating of the first mapping table and the second mapping table according to the information for representing the write history data, the entries of the first mapping table, and the entries of the second mapping table includes: Upon detecting that the target index is the same as the index of the current entry of the first mapping table, the table entry corresponding to the current entry of the first mapping table records the current logical address, the physical address of the latest data corresponding to the current logical address, and the physical address of the next latest data, there are multiple entries in the second mapping table, the table entry of a first entry among the multiple entries is the index of the first mapping table, the logical address corresponding to the index of the first entry is the same as the logical address in the table entry of the first mapping table, the logical address corresponding to the index of the second entry among the multiple entries is the same as the target write logical address, and the table entry of the second entry records the current physical address, keeping the index of the first entry and the index of the second entry unchanged, updating the table entry of the second entry from the current physical address to the index of the first mapping table, and updating the table entry of the first entry from the index of the first mapping table to the physical address of the latest data; updating the table entry of the current entry of the first mapping table from the current logical address, the physical address of the latest data corresponding to the current logical address, and the physical address of the second latest data to the target write logical address, the target physical address, and the current physical address; The physical address of the second-most recent data is cleared.

7. The data processing method according to claim 6, characterized in that: The storing the data to be written and the historical data according to the updated first mapping table and the updated second mapping table includes: storing the data to be written in the second space according to the target physical address recorded in the updated first mapping table; Acquire data corresponding to the current physical address from the second space according to the current physical address recorded in the updated first mapping table; Migrating the data corresponding to the current physical address from the second space to the first space; The data corresponding to the physical address of the latest data corresponding to the current logical address is kept in the second space according to the physical address of the latest data recorded in the updated second mapping table.

8. The data processing method according to claim 1, wherein: The first mapping table and the second mapping table each contain a plurality of entries; and updating the first mapping table and the second mapping table according to the information used to represent the write history data, the entries in the first mapping table, and the entries in the second mapping table includes: Upon detecting that the target index is the same as the index of the first entry of the first mapping table, the first current logical address, the first physical address of the latest data corresponding to the first current logical address, and the first physical address of the next-to-latest data are recorded in the entry corresponding to the first entry of the first mapping table, the second current logical address, the second physical address of the latest data corresponding to the second current logical address, and the second physical address of the next-to-latest data are recorded in the entry corresponding to the second entry of the first mapping table, the entry of the third entry of the second mapping table is the index of the first entry, and the logical address corresponding to the index of the third entry is the same as the logical address in the entry of the first entry; the entry of the fourth entry of the second mapping table is the index of the second entry, and the logical address corresponding to the index of the fourth entry is the same as the logical address in the entry of the second entry, and the logical address corresponding to the index of the second entry is the same as the target write logical address, the index of the third entry and the index of the fourth entry are kept unchanged, the entry of the fourth entry is updated from the index of the second entry to the index of the first entry, and the entry of the third entry is updated from the index of the first entry to the first physical address of the latest data corresponding to the first current logical address; updating the first entry of the first mapping table from the first current logical address, the first physical address of the latest data corresponding to the first current logical address, and the first physical address of the second latest data to the target write logical address, the target physical address, and the second physical address of the latest data corresponding to the second current logical address; The first physical address of the less recent data and the second physical address of the less recent data are cleared.

9. The data processing method according to claim 8, characterized in that: The storing the data to be written and the historical data according to the updated first mapping table and the updated second mapping table includes: storing the data to be written in the second space according to the target physical address recorded in the updated first mapping table; Acquire data corresponding to the second physical address of the latest data corresponding to the second current logical address from the second space according to the second physical address of the latest data corresponding to the second current logical address recorded in the updated first mapping table; Migrating data corresponding to the second physical address of the latest data corresponding to the second current logical address from the second space to the first space; The data corresponding to the first physical address of the latest data corresponding to the first current logical address recorded in the updated first mapping table is kept in the second space.

10. A data processing device, characterized in that: Applied to a solid state drive, the device comprises: A receiving module, used to receive information sent by the host for representing the acquisition of historical data; a first acquisition module, configured to acquire, from a first mapping table, a first target physical address corresponding to the historical data according to the information used to represent the historical data; wherein the first mapping table is stored in a memory of the solid-state drive, the first mapping table including at least one entry, each entry including a first index and a first table entry corresponding to each first index, each first table entry recording at least a logical address, a physical address of the latest data corresponding to the logical address, and a physical address of the next latest data; a second acquisition module, configured to acquire, according to the first target physical address, historical data corresponding to the first target physical address from a first space; wherein the first space is a portion of a reserved space of the solid-state drive; A sending module, configured to send the historical data to the host; The data processing device further comprises: A first receiving module is used to receive information sent by the host to indicate the acquisition of new data; a third acquisition module, configured to acquire a second target physical address corresponding to the new data from the second mapping table based on the information used to characterize the acquisition of the new data, or to acquire an index corresponding to the new data from the second mapping table based on the information used to characterize the acquisition of the new data, and to acquire the second target physical address corresponding to the new data from the first mapping table based on the index corresponding to the new data; wherein the second mapping table is stored in the memory, the second mapping table includes at least one entry, the entry including a second index and a second table entry corresponding to the second index; each second index is a logical address, and each second table entry records the physical address corresponding to the latest data or the first index; a fourth acquisition module, configured to acquire, according to the second target physical address, new data corresponding to the second target physical address from the second space; wherein the second space is a space in the solid-state drive for storing new data; A first sending module, used for sending new data to the host; The data processing device further comprises: A second receiving module is configured to receive information sent by the host for representing write data; wherein the information for representing write data includes at least a target write logical address, a target physical address corresponding to the target write logical address, a target index, and data to be written; a fifth acquisition module, configured to acquire an entry of the first mapping table and an entry of the second mapping table; wherein the entry includes an index and a table item; An updating module, configured to update the first mapping table and the second mapping table according to the information representing the write history data, the entries of the first mapping table, and the entries of the second mapping table; The storage module is used to store the data to be written and the historical data according to the updated first mapping table, or to store the data to be written and the historical data according to the updated first mapping table and the updated second mapping table.

11. A data processing device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the data processing method according to any one of claims 1 to 9 when executing the computer program.

12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the data processing method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Data storage device and a non-volatile memory operation method

    CN109582599A

  • Data writing method and device for partition namespace solid state disk and electronic equipment

    CN115951839A