Data processing method and device, equipment and medium
By setting up historical data storage space and mapping tables in solid-state drives, the problem that RAID cannot obtain historical data is solved, and data integrity guarantee and cost reduction are achieved.
Patent Information
- Application Number
- CN202411377772.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-09-30
AI Technical Summary
When the storage system encounters abnormal power failure scenarios when performing modification writing, RAID technology cannot effectively obtain historical data, affecting data integrity.
Set reserved space in the solid-state drive as the historical data storage area, and store mapping tables in memory to record logical addresses, latest data and physical addresses of secondary data in order to restore historical data in abnormal situations.
It realizes that historical data can still be obtained in abnormal power-down scenarios, ensures data integrity, and reduces data protection costs, avoiding the need for additional disk redundant backups.
Smart Images

Figure CN119248197A_ABST
Abstract
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 increases, it is particularly important to ensure data security. Among the related data protection methods, Redundant Array of Independent Disks (RAID) is used to create a fail-safe mechanism for data loss by combining two or more hard disk drives (HDDs) or solid-state drives (SSDs) into a coordinated storage unit or array.
[0003] However, when the storage system encounters an abnormal power failure during the modification write, the data read by the host is neither new data nor old data. If RAID technology is used to ensure data security, when a hard disk drive (HDD) or solid state drive (SSD) fails, the historical data (old data) cannot be obtained through RAID, which may affect data integrity during this period.
[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, an HDD or SSD failure occurs when RAID is protecting data, resulting in the inability to obtain historical data through RAID, affecting data integrity.
[0006] In order 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 for characterizing the acquisition of 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 characterize the acquisition of 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 includes a first index and a first table item corresponding to each first index, and each first table item 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;
[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 the 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] According to the information used to characterize the acquisition of new data, the second target physical address corresponding to the new data is acquired from the second mapping table, or, according to the information used to characterize the acquisition of new data, the index corresponding to the new data is acquired from the second mapping table, and according to the index corresponding to the new data, the second target physical address corresponding to the new data is acquired from the first mapping table; wherein the second mapping table is stored in the memory, the second mapping table includes at least one entry, the entry includes a second index and a second table item corresponding to the second index; each second index is a logical address, and each second table item 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] Receive information sent by the host for representing write data; wherein the information for representing write data at least includes 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 for 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 for 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, keep the current entry of the second mapping table;
[0030] 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 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-newest 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 for representing the write history data, the entries of the first mapping table, and the entries of the second mapping table includes:
[0037] 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, 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 current physical address is recorded in the table entry of the second entry, 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;
[0038] 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 next latest data to the target write logical address, the target physical address, and the current physical address;
[0039] The physical address of the second-newest 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 characterizing the write history data, the entries of the first mapping table, and the entries of the second mapping table comprises:
[0046] 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 table 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 table entry corresponding to the second entry of the first mapping table, the table 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 table entry of the first entry; when the table 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 table 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 table entry of the fourth entry is updated from the index of the second entry to the index of the first entry, and the table 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 a 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 hard disk, the device comprising:
[0055] A receiving module, used for receiving information sent by the host for representing the acquisition of historical data;
[0056] A first acquisition module, configured to acquire a first target physical address corresponding to the historical data from a first mapping table according to the information used to characterize the acquisition of historical data; wherein the first mapping table is stored in the memory of the solid state drive, the first mapping table includes at least one entry, the entry includes a first index and a first table item corresponding to each first index, and each first table item 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;
[0057] A second acquisition module, configured to 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;
[0058] A 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 data processing method as described above when executing the computer program.
[0062] In order to solve the above technical problem, the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the data processing method as described above are implemented.
[0063] The beneficial effect of the present invention lies in that, in the method, a part of the space is divided out 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-newest data. Relative to the physical address of the latest data, the physical address of the next-newest 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 preservation of historical data is achieved, 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, reducing 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-newest data, so that the physical address of the latest data and the physical address of the next-newest 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. 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 for obtaining new data sent by the host 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 mapping table and the second mapping table are updated according to the information used to characterize the writing of historical 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. When writing data, by updating the mapping table and storing the data according to the mapping table, it is ensured that the historical data can be stored and the data integrity is ensured.
[0066] When the information used to characterize the write history data, the entries of the first mapping table, and the entries of 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 includes 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, and 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 briefly introduces 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 paying 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 executing 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 corresponding relationship diagram 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 the 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] Fig. 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] Fig.10 A schematic diagram of a scenario in which a Temp table is overwritten and updated according to an embodiment of the present invention, a newly written LBA has an associated Temp table entry, but index_x identifies a Temp table entry of another LBA;
[0080] Fig.11 A structural diagram of a data processing device provided in another embodiment of the present invention. DETAILED DESCRIPTION
[0081] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are 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 the storage system encounters an abnormal power failure during modification and write, and an HDD or SSD failure occurs when RAID protects data, historical data cannot be obtained through RAID, affecting data integrity.
[0083] Among the 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 the complete loss of disk drive data by duplicating or recreating data and storing it on additional drives. This process is also called 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 one HDD or SSD fails, the system needs to perform calculations when recovering the data, which may result in slower data access and may risk data integrity during this period.
[0086] 3. Increased costs: Since additional disks are required for data redundancy backup, the cost of RAID is relatively high. Additional hardware costs need to be considered.
[0087] The current storage system modification and writing 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 writing process include: object storage device, Bluetooth storage, driver, solid-state drive and data block. The storage system performs 128K modification and writing, while the SSD firmware internal processing 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 the power is cut off during the writing process, some 4K write processes may be completed and the L2P table is updated, and the remaining 4K write processes are terminated because the firmware responds to the abnormal power failure. In this way, the Host reads the 128k data that failed to be written again, and the obtained 128K data 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 inside an SSD.
[0088] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Figure 2 A flowchart of a data processing method provided by an embodiment of the present invention. The method is applied to a solid state drive, and the method includes:
[0089] S10: receiving information sent by the host for representing the acquisition of historical data;
[0090] S11: acquiring a first target physical address corresponding to the historical data from a first mapping table according to information used to characterize the acquired historical data;
[0091] S12: acquiring historical data corresponding to the first target physical address from the first space according to the first target physical address; wherein the first space is a part of the reserved space of the solid state drive;
[0092] S13: Send historical data to the host.
[0093] As a data storage entity in the storage system, SSD has an over-provisioning (OP) space inside that can reduce write amplification (OP ratio = (SSD raw capacity - SSD user capacity) / SSD user capacity). Different from the normal space that stores all valid user data (which can be indexed by the Flash Translation Layer (FTL) mapping table (i.e., the second mapping table)), the OP space stores old data that is about to be garbage collected due to overwrite or trim operations. Generally, the OP ratio of SSD is ≥15%, that is, for a 3.2TB SSD, there is at least 480GB of OP space. At least 10GiB of data redundancy backup space (i.e., the first space of the present invention, also called the backup retention area) is designed to be reserved in the OP space. A corresponding data structure table is established in the double data rate (DDR) memory of the SSD, named the Temp table (i.e., the first mapping table), which is used 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, and 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, the 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 next latest data is stored in the memory of the SSD.
[0095] Receive information sent by the host for characterizing the acquisition of historical data. The information used to characterize the acquisition of historical data includes at least the logical address corresponding to the historical data. There is no limitation on the historical data to be acquired by the host. For example, in the storage system, there are 4+2 data to be written in the case of 128KB atomic write, of which storage nodes 0, 1, 2 are written successfully, and storage nodes 3, 4, 5 fail to be powered off. At this time, the transaction cannot succeed and needs to be rolled back. Storage nodes 0, 1, 2 need to restore the data to the state before writing. However, since it is a modification write mode, the old data has been overwritten at this time, so other methods are needed to obtain the old data. SSD supports at least 10G of old data storage space to meet the storage software stack's historical data search size requirements. The SSD space occupied by old data is called the backup retention area. The storage software stack reads the old data corresponding to the successful data written by storage nodes 0, 1, 2 in the above fault scenario through a dedicated read backup retention area interface, that is, at this time, the information sent by the host for characterizing the acquisition of historical data includes the logical address corresponding to the successful data written by storage nodes 0, 1, 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 above-mentioned host needs to obtain historical data, in practice, the host may also need to obtain new data. In this case, the data processing method includes:
[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 a 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 item corresponding to the second index; each second index is a logical address, and each second table item records a physical address or a first index corresponding to the latest data;
[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 storing 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 for obtaining new data sent by the host 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 A diagram showing a correspondence relationship between a first mapping table and a second mapping table provided in an 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 table entry of the first mapping table records the logical address, the new physical address and the next newest physical address. 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 that can back up and retain data;
[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 the cache entry index or 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, such as Figure 4As shown, this scenario is the interaction between the host and the SSD. A first mapping table is newly added to the double data rate memory in the SSD, and a first space is divided to store historical data based on the normal space of the SSD itself. The object storage device in the host sends the command to the SSD controller through the host interface, and the SSD controller obtains the corresponding data from the storage space (including the normal space and the first space) according to the first mapping table and the second mapping table 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 in the Temp table are the latest data, the Host usually sends the write SSD command in the customized write Temp mode;
[0112] Similar to FTL mapping table operations, Temp table also needs to support index, update and delete operations. Therefore, SSD provides customized interfaces to the outside world, including read temp, write temp and delete temp.
[0113] For Host LBAx, there are both new data and old data in the SSD storage space. That is, when the Host sends a normal read request of Host LBAx to the SSD, the SSD feeds back the new data pointed to by PBAx in the L2P table (L2P is part of FTL, and FTL also has other functions such as wear leveling and garbage collection) 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. Normally, the Host uses normal read requests to read the SSD, and only sends a read Temp 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 out 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-newest data. Relative to the physical address of the latest data, the physical address of the next-newest data is the address corresponding to the historical data. Therefore, after the solid-state hard disk obtains the information for 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 preservation of historical data is achieved, 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, reducing 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-newest data, so that the physical address of the latest data and the physical address of the next-newest 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, such as Figure 5 As shown, the method includes:
[0116] S14: The subqueue receives the message for writing into the first space and parses out 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: Organizing the entries of the first mapping table into a first logical address, a space number and a third physical address;
[0123] S21: updating to 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 a 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. Get 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 the obsolete of PBA1;
[0136] 7. Organize temp_entry (LBA0, cache_idx0, PBA11);
[0137] 8. Update the table 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 the 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, such as Figure 6 As shown, the method includes:
[0142] S27: The subqueue receives the message for reading the first space and parses out the logical address;
[0143] S28: Get the lock of the logical address;
[0144] S29: reading the second mapping table according to the logical address, and continuing 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 resolved 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 above process is described below 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 to release 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 implement the locking of the FTL mapping table. That is, after the SSD receives the write command sent by the Host, it will first use the intervalEngine to lock the continuous LBA specified in the input / output (IO) command as a whole. After the lock is successful, the SSD will flush the data to be written specified in the IO command to the non-volatile memory NAND (short for NOT-AND).
[0159] In order to maintain the atomicity of writing, the FTL mapping table is updated uniformly only after all LBAs specified in the IO command are processed. If an abnormal power failure or other error processing occurs during the processing of the IO command, the SSD will not update the FTL mapping table and feedback 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] Receive information sent by the host for representing write data; wherein the information for representing write data at least includes 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 a first mapping table and an entry of a 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 used to characterize the write history data, the entries of the first mapping table, and the entries 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 historical data backup area of the SSD is the temp table. Generally, there are four scenarios in which the Temp table is read and written. 1) The backup retention area is updated for the first time; 2) The backup retention area is overwritten and updated, and the index identifies the temp_entry of the same LBA; 3) The Temp table is updated for the first time, and index_x identifies the temp_entry corresponding to different LBAs; 4) The Temp table is overwritten and updated, and the newly written LBA has an associated Temp table entry, but index_x identifies the Temp table entry of another 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 used to characterize 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, the table entry of the current entry of the second mapping table is updated from the current physical address to the target index;
[0168] 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.
[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] 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;
[0172] Migrate the data corresponding to the current physical address from the second space to the first space.
[0173] 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. Figure 7As shown, in the pre-write stage, there is any entry in the second mapping table, the index of the entry is the logical address x, and the table item is the physical address x; the index of the first mapping table is index x, and the initial value state of the table item is 0. The information initiated by the host to modify the write includes the logical address x, the new physical address xx, and the index x; then in the post-write stage, the index of the entry in the second mapping table is the logical address x, and the table item is index x; the index of the first mapping table is index x, and the table item includes the logical address x, the physical address xx, and the physical address x.
[0174] Specifically, the pre-writing stage:
[0175] Any FTL_entry (LBAx, PBAx) exists in the FTL mapping table;
[0176] The temp tables are all 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 specifies to update the entry of index_x in the Temp table.
[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 used to characterize the write history data, the entry of the first mapping table, and the entry 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 maintained;
[0183] The table entry of the current entry of the first mapping table is updated 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;
[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 A schematic diagram of a scenario in which a data backup holding area (Temp table) is overwritten and updated, and index identifies the temp_entry of the same LBA, provided by an embodiment of the present invention. Figure 8 As shown, in the pre-write stage, there is any entry in the second mapping table, the index of the entry is the logical address x, and the table item is the physical address x; the index of the first mapping table is index x, and the table item includes the logical address x, the physical address xx, and the physical address x. The information initiated by the host to modify the write includes the logical address x, the new physical address xxx, and the index x; then in the post-write stage, the index of the entry in the second mapping table is the logical address x, and the table item is index x; the index of the first mapping table is index x, and the table item includes the logical address x, the physical address xxx, and the physical address xx, and the physical address x is cleared.
[0190] Specifically, 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 FTL_entry (LBAx, index_x);
[0193] The host initiates a modification write. Assume that an FTL mapping table update (LBAx, PBAxxx) is generated inside the SSD, and the entry indexed by index_x in the temp table is specified to be updated. At this time, 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 of LBAx index continues to record the index of temp_entry:index_x;
[0196] In the Temp table, the table 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 (the data backup storage area (Temp table) is updated for the first time, and index_x identifies temp_entry corresponding to different LBAs), updating the first mapping table and the second mapping table according to the information used to characterize the write history data, the entry of the first mapping table, and the entry of 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 the 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 current physical address is recorded in the table entry of the second entry, 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] The table entry of the current entry of the first mapping table is updated 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] 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;
[0204] Migrate the 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] Fig. 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. Fig. 9 As shown, in the pre-write stage, the index of the first mapping table is index x, and the table entry includes logical address x, new physical address xx and index x; there are two entries in the second mapping table, namely the first entry and the second entry, the index of the first entry is logical address x, and the table entry is index x; the index of the second entry is logical address y, and the table entry is physical address y. The information initiated by the host to modify the write includes logical address y, new physical address yy and index x; then in the post-write stage, the index of the first entry of the second mapping table is logical address x, the table entry is physical address xx, the index of the second entry is logical address y, and the table entry is index x; the index of the first mapping table is index x, and the table entry includes logical address y, physical address yy and physical address y. And clear physical address x.
[0207] Specifically, 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 the entry indexed by index_x in the Temp table is updated.
[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 historical temp_entry (LBAx, PBAxx, PBAx) that is overwritten needs to retain the mapping relationship between LBAx and the new data, that is, update the physical block address PBAxx to the entry indexed by LBAx in the FTL mapping table; and 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, the newly written LBA has an associated Temp table entry, but index_x identifies a Temp table entry of another LBA), both the first mapping table and the second mapping table include multiple entries; updating the first mapping table and the second mapping table according to the information used to represent the write history data, the entry of the first mapping table, and the entry of 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 table 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 table entry corresponding to the second entry of the first mapping table, the table 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 table entry of the first entry; when the table 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 table 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 table entry of the fourth entry is updated from the index of the second entry to the index of the first entry, and the table 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 a 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] Fig.10 A schematic diagram of a scenario in which a Temp table is overwritten and updated according to an embodiment of the present invention, a newly written LBA has an associated Temp table entry, but index_x identifies a Temp table entry of another LBA. Fig.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 index of the first entry is index x, and the table entry includes logical address x, physical address xx and physical address x; the index of the second entry is index y, and the table entry includes logical address y, physical address yy and physical address y; the index of the third entry is logical address x, and the table entry is index x; the index of the fourth entry is logical address y, and the table entry is index y. The information initiated by the host to modify the write includes logical address y, new physical address yyy and index x; then in the post-write stage, the index of the third entry of the second mapping table is logical address x, the table entry is physical address xx, the index of the fourth entry is logical address y, and the table entry is index x; the index of the first mapping table is 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 cleared.
[0224] Specifically, 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 of 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 specifies to update the entry of index_x in the temp table.
[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 table entry indexed by index_x is updated to the newly generated temp_entry (LBAy, PBAyy, PBAy). The historical temp_entry (LBAx, PBAxx, PBAx) that is overwritten needs to retain the mapping relationship between LBAx and new data, that is, update the physical block address PBAxx to the table entry indexed by LBAx in the FTL mapping table; and the obsolete operation is performed on the obsolete physical block addresses PBAx and PBAy that point to old data (the ultimate goal is to reclaim the storage space occupied by PBAx and PBAy).
[0231] In the method provided in this embodiment, when the information used to characterize the write history data, the entries of the first mapping table, and the entries of the second mapping table are different, the first mapping table and the second mapping table are updated in different ways, so that the mapping table (including the first mapping table and the second mapping table) can be updated in an appropriate way; in the process of updating the mapping table, the oldest data information is also cleared (the write information sent by the host includes 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, and 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.
[0232] In practice, in order to verify the integrity of historical data, the information sent by the receiving host to represent the write data includes:
[0233] receiving information for representing write data sent by the host to the first logical address;
[0234] Before receiving the information sent by the host to the first logical address and used to represent the write data, the method further includes:
[0235] receiving a command for information about reading 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 to read 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 information of 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 table 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 characterizing the write data, the data is determined to be complete.
[0246] In order to verify the data integrity, the implementation specifically includes the following steps:
[0247] 1) Format the SSD and clear the data in the disk;
[0248] 2) Pre-embed data processing on SSD, the data characteristic value is A;
[0249] 3) Send a normal read command to read data of a fixed length and save it as file U with the content a;
[0250] 4) Send a command to write the backup holding area to LBAx, write a piece of data to the SSD, and the data characteristic value is B
[0251] 5) Send a command to read the backup holding area, read the old data of index_x in the backup holding area, and save it as file V, with the content a;
[0252] 6) Send a normal read command to read data of a fixed length and save it as file W, with content B;
[0253] 7) Send a command to write the backup holding area to LBAy, write 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, read data of fixed length, save it as file X, and the content is B;
[0255] 9) Send a read backup holding area command to LBAy, read the old data of index_x in the backup holding area, and save it as file Y, with the content of B;
[0256] 10) Send a normal read command to LBAy to read data of fixed length and save it as file Z with content c;
[0257] 11) Compare file Y with file W to see if the contents are consistent;
[0258] 12) Compare file X with file W to see if the 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 to different addresses and verifying the read data.
[0261] In the method provided by the embodiment of the present invention, the solution of saving historical data in the SSD OP space can retrieve historical data through the Temp table, and realize 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, there are both a new data and an old data in the SSD storage space, that is, when the host sends a normal read request of 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 with the RAID solution, there is no performance loss, it is implemented inside the SSD, and the hardware cost is not increased.
[0262] In the above embodiments, the data processing method is described in detail, and the present invention also provides corresponding embodiments of the data processing device and the data processing equipment. It should be noted that the present invention describes the embodiments of the device part from two perspectives, one is based on the functional module perspective, and the other is based on the hardware perspective.
[0263] An embodiment of the present invention provides a data processing device, which includes:
[0264] A receiving module, used for receiving information sent by the host for representing the acquisition of historical data;
[0265] A first acquisition module is used to acquire a first target physical address corresponding to the historical data from a first mapping table according to information used to characterize the acquisition of historical data; wherein the first mapping table is stored in a memory of the solid-state hard disk, the first mapping table includes at least one entry, the entry includes a first index and a first table item corresponding to each first index, and each first table item 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;
[0266] A second acquisition module, used to acquire historical data corresponding to the first target physical address from the first space according to the first target physical address; wherein the first space is a part of the 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, used for receiving information sent by the host for representing the acquisition of new data;
[0270] A third acquisition module is used to acquire 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 to acquire 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 to acquire a 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 includes a second index and a second table item corresponding to the second index; each second index is a logical address, and each second table item records a physical address or a first index corresponding to the latest data;
[0271] A fourth acquisition module, configured to 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;
[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 used to receive information sent by the host for representing write data; wherein the information for representing write data at least includes 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, used to acquire entries of the first mapping table and entries of the second mapping table; wherein the entries include indexes and table items;
[0276] An updating module, used for updating the first mapping table and the second mapping table according to the information used to characterize the writing 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 device 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 device part, and they will not be repeated here. The effects are the same as above.
[0279] Fig.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 Fig.11 As shown, the data processing device includes:
[0280] A memory 20, used for storing computer programs;
[0281] The processor 21 is used to implement the steps of the data processing method mentioned in the above embodiment when executing the computer program.
[0282] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and 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 the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process 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 Fig.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: a data processing method, with the same effect 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, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.
[0289] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc. Various media that can store program codes.
[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 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 a number of 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 only used 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 "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A data processing method, characterized in that: Applied to a solid state drive, the method comprises: Receive information sent by the host for characterizing the acquisition of historical data; Obtaining a first target physical address corresponding to the historical data from a first mapping table according to the information used to characterize the acquisition of 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 includes a first index and a first table item corresponding to each first index, and each first table item 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; 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 the reserved space of the solid state drive; The historical data is sent to the host.
2. The data processing method according to claim 1, characterized in that: The method further comprises: Receive information sent by the host to indicate the acquisition of new data; According to the information used to characterize the acquisition of new data, the second target physical address corresponding to the new data is acquired from the second mapping table, or, according to the information used to characterize the acquisition of new data, the index corresponding to the new data is acquired from the second mapping table, and according to the index corresponding to the new data, the second target physical address corresponding to the new data is acquired from the first mapping table; wherein the second mapping table is stored in the memory, the second mapping table includes at least one entry, the entry includes a second index and a second table item corresponding to the second index; each second index is a logical address, and each second table item 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; The new data is sent to the host.
3. The data processing method according to claim 2, characterized in that: The method further comprises: Receive information sent by the host for representing write data; wherein the information for representing write data at least includes 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.
4. The data processing method according to claim 3, characterized in that: The updating of the first mapping table and the second mapping table according to the information for representing the writing history data, the entries of the first mapping table and the entries of the second mapping table comprises: 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.
5. The data processing method according to claim 4, characterized in that: The storing the data to be written and the historical data according to the updated first mapping table comprises: 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.
6. The data processing method according to claim 3, characterized in that: The updating of the first mapping table and the second mapping table according to the information for representing the writing history data, the entries of the first mapping table and the entries of the second mapping table comprises: 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, keep the current entry of the second mapping table; The table entry of the current entry of the first mapping table is updated 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-newest 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 comprises: 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.
8. The data processing method according to claim 3, characterized in that: The updating of the first mapping table and the second mapping table according to the information for representing the writing history data, the entries of the first mapping table and the entries of the second mapping table comprises: 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, 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 current physical address is recorded in the table entry of the second entry, 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; 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 next latest data to the target write logical address, the target physical address, and the current physical address; The physical address of the second-newest data is 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 comprises: 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.
10. The data processing method according to claim 3, characterized in that: 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 characterizing the write history data, the entries of the first mapping table, and the entries of the second mapping table comprises: 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 table 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 table entry corresponding to the second entry of the first mapping table, the table 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 table entry of the first entry; when the table 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 table 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 table entry of the fourth entry is updated from the index of the second entry to the index of the first entry, and the table 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 table entry of 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.
11. The data processing method according to claim 10, 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 comprises: 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 a 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.
12. A data processing device, characterized in that: Applied to a solid state hard disk, the device comprises: A receiving module, used for receiving information sent by the host for representing the acquisition of historical data; A first acquisition module, configured to acquire a first target physical address corresponding to the historical data from a first mapping table according to the information used to characterize the acquisition of historical data; wherein the first mapping table is stored in the memory of the solid state drive, the first mapping table includes at least one entry, the entry includes a first index and a first table item corresponding to each first index, and each first table item 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; A second acquisition module, configured to 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; A sending module is used to send the historical data to the host.
13. 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 11 when executing the computer program.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data processing method according to any one of claims 1 to 11 are implemented.
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
Data storage apparatus and operating method thereof
US20190220416A1
Cited By
Data processing method and device, electronic equipment and storage medium
CN119440421A
Data backtracking method and electronic equipment
CN121349773A
