Data synchronization method, data synchronization system, nonvolatile readable storage medium, and electronic device
By managing the temporary storage area space of the upper-layer application of the solid-state drive, the problem of data consistency deviation caused by the management of the temporary storage area of the solid-state drive is solved, the data synchronization between the upper-layer application and the SSD is realized, and the stability and performance of the system are ensured.
Patent Information
- Application Number
- PCT/CN2024/079083
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-03
- Filing Date
- 2024-02-28
- Publication Date
- 2024-09-12
AI Technical Summary
The temporary storage area space management of solid-state drives leads to deviations in consistency between upper-layer applications and SSD internal data, causing the host to fail to trace back data. Existing technology cannot synchronize temporary storage area data in real time, affecting system stability and performance.
By receiving the write temporary storage area command, it is determined that the temporary storage area space range is managed by the upper-layer application of the host, and the flash conversion layer mapping table entry of the copied user data is updated to the mapping table of the temporary storage area space range to be written, ensuring that Data synchronization between upper-layer applications and SSD prevents additional data synchronization interfaces from affecting system writing performance.
It realizes the synchronization of temporary storage space data between upper-layer applications and SSD, ensures accurate data traceback, enhances the stability and reliability of the storage system, and avoids the complexity and performance degradation risks caused by additional interfaces.
Smart Images

Figure CN2024079083_12092024_PF_FP_ABST
Abstract
Description
Data synchronization method, data synchronization system, non-volatile readable storage medium and electronic device
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on March 3, 2023, with application number 202310194721.X, and entitled “A Data Synchronization Method, Data Synchronization System, Storage Medium and Electronic Device,” the entire contents of which are incorporated herein by reference. Technical Field
[0003] The present application relates to the field of data storage, and in particular to a data synchronization method, a data synchronization system, a non-volatile readable storage medium, and an electronic device. Background Art
[0004] The size of the internal temporary storage area of SSDs (Solid State Drives) is limited, but it must at least support the traceable data size of more than 2 seconds before the all-flash NVMe (NVM Express, non-volatile memory host controller interface specification) SSD host write failure. Assuming that the nominal 128K (kilobyte) performance indicator of the SSD is 5000MB / s (megabytes per second), the temporary storage area size is 10GB (gigabytes). This involves the issue of data retention and recycling in the temporary storage area space. Ideally, for any LBA (Logical Block Address) of traceable data on the host, the traceable data should be obtainable by reading the SSD.
[0005] However, in reality, the temporary storage space belongs to the internal resources of the SSD, and the use and recovery of the temporary storage space are completely implemented within the SSD. For example, the SSD releases some temporary storage space in advance, resulting in a failure of the host to trace back data. In even worse cases, because the upper-layer application of the all-flash NVMe SSD host and the internal firmware of the SSD are independent software systems, they are only connected when calling interfaces such as writing and reading the temporary storage area. Under network delays or other failure factors, there may be a large deviation between the traceable data space of the upper-layer application and the traceable data space inside the SSD, resulting in a large number of traceback failures when the host traces back data. Usually, an additional part of the space can be expanded on the basis of the existing temporary storage space size as a buffer, for example, a 10GB temporary storage space can be expanded to 16GB, of which 6GB is used as an error elimination buffer. Overall, the 16GB temporary storage space size uses a first-in-first-out method to ensure that the 10GB of valid data space can be accurately traced back. This method can alleviate the data consistency error between the upper-layer application and the SSD's internal temporary storage area to a certain extent. However, because the upper-layer application and the SSD do not synchronize the temporary storage area data in real time, the temporary storage area space is still managed by the SSD itself. Therefore, the data in a temporary storage area reclaimed by the SSD may not be what the NVMe host wants to be reclaimed, and the possibility of host backtracking failure still exists.
[0006] Summary of the Invention
[0007] The purpose of this application is to provide a data synchronization method, a data synchronization system, a non-volatile readable storage medium and an electronic device, which can realize the synchronization of temporary storage space data between the upper-layer application and the SSD without adding additional data synchronization interfaces to affect the system write performance.
[0008] According to a first aspect, the present application provides a data synchronization method, comprising:
[0009] Receive write buffer area command;
[0010] Determine the temporary storage area space range corresponding to the write temporary storage area command; wherein the temporary storage area space range is managed by the host upper layer application;
[0011] The flash translation layer mapping table entry corresponding to the overwritten user data is updated into the temporary storage area mapping table corresponding to the temporary storage area space range to be written.
[0012] Optionally, also include:
[0013] The temporary storage area function-related fields are configured inside the hard disk; the temporary storage area function-related fields include the temporary storage area size, the temporary storage area space allocation granularity and the number of temporary storage area mapping table entries, which are used to configure the temporary storage area space range.
[0014] Optionally, also include:
[0015] The temporary storage area is expanded by writing the command word to the cache area.
[0016] Optionally, the write buffer command word can be used to expand the temporary storage area, including:
[0017] Configure the parameters of the write cache command word; wherein the parameters include the starting address of the logic block to be deleted in the temporary storage area, the number of logic blocks to be deleted in the temporary storage area, and the status of the temporary storage area;
[0018] Expand the temporary storage area according to the parameters.
[0019] Optionally, before updating the flash translation layer mapping table entry corresponding to the overwritten user data into the temporary storage area mapping table corresponding to the temporary storage area space range to be written, the method includes:
[0020] Generate a temporary storage area mapping table.
[0021] Optionally, generating a temporary storage area mapping table includes:
[0022] Generate an array containing traceable data mapping relationships and use the array as a temporary storage area mapping table.
[0023] Optionally, before generating the array containing the traceable data mapping relationship, it also includes:
[0024] Record the logical block address and physical block address of traceable data;
[0025] A mapping relationship is constructed based on the logical block address and the physical block address, and an index is created.
[0026] Optionally, determining the temporary storage area space range corresponding to the write temporary storage area command includes:
[0027] Determine the granularity of the temporary storage space;
[0028] Determine the requested space size corresponding to the write buffer area command;
[0029] Determine the number of temporary storage areas based on the temporary storage area granularity and the requested space size;
[0030] Determine the cache index that meets the required cache requirements.
[0031] Optionally, after determining the cache index that satisfies the number of temporary storage areas, the method further includes:
[0032] Determine the buffer zone index corresponding to the starting buffer zone entry;
[0033] The temporary storage area index and the temporary storage area quantity are added to the starting address of the logic block to be deleted in the temporary storage area and the number of the logic blocks to be deleted in the temporary storage area in correspondence with each other.
[0034] Optionally, also include:
[0035] Set the temporary storage area status in the parameters to the user data write function.
[0036] Optionally, updating the flash translation layer mapping table entry corresponding to the overwritten user data to the temporary storage area mapping table corresponding to the temporary storage area space range to be written includes:
[0037] When the temporary storage area status in the write temporary storage area command is user data writing working, the flash translation layer mapping table entries corresponding to the user data to be overwritten are updated in sequence to the temporary storage area table range specified by the starting address of the temporary storage area to be deleted logical block and the number of temporary storage area to be deleted logical blocks in the temporary storage area mapping table.
[0038] Optionally, after all users have completed writing, it also includes:
[0039] The corresponding written physical block address is updated to the overwritten entry in the flash translation layer mapping table.
[0040] Optionally, after updating the corresponding written physical block address to the overwritten entry in the flash translation layer mapping table, the method further includes:
[0041] Release the occupied temporary storage space resources.
[0042] Optionally, also include:
[0043] A temporary storage area deletion instruction from an upper-layer application is received; wherein the temporary storage area status corresponding to the temporary storage area deletion instruction is that no user number is written.
[0044] Optionally, before receiving the temporary storage area deletion instruction from the upper-layer application, the following is further included:
[0045] The starting address of the logic block to be deleted in the temporary storage area and the number of the logic blocks to be deleted in the temporary storage area are added to the temporary storage area deletion instruction.
[0046] Optionally, the fields related to configuring the temporary storage area function within the hard disk include:
[0047] Configure the fields related to the temporary storage area function in the special supply area in the identification control data structure.
[0048] Optionally, also include:
[0049] Obtain the identification control data structure through the identification control command, and parse it to obtain the fields related to the temporary storage area function;
[0050] Allocate the corresponding size of the temporary storage area space in the upper-layer application according to the fields related to the temporary storage area function.
[0051] According to a second aspect, the present application further provides a data synchronization system, comprising:
[0052] A write temporary storage area command receiving module is configured to receive a write temporary storage area command;
[0053] a determination module configured to determine a temporary storage area space range corresponding to a write temporary storage area command; wherein the temporary storage area space range is managed by an upper layer application of the host;
[0054] The update module is configured to update the flash translation layer mapping table entry corresponding to the overwritten user data into the temporary storage area mapping table corresponding to the temporary storage area space range to be written.
[0055] Optionally, also include:
[0056] The temporary storage module is configured to configure temporary storage area function related fields inside the hard disk; the temporary storage area function related fields include temporary storage area size, temporary storage area space allocation granularity and the number of temporary storage area mapping table entries, which are used to configure the temporary storage area space range.
[0057] Optionally, also include:
[0058] The extension module is configured to extend the temporary storage area space range by writing a buffer area command word.
[0059] Optional extension modules include:
[0060] A configuration submodule is configured to configure parameters of a write cache command word; wherein the parameters include a starting address of a logic block to be deleted in the temporary storage area, a number of logic blocks to be deleted in the temporary storage area, and a status of the temporary storage area;
[0061] The extension submodule is configured to extend the temporary storage area according to the parameters.
[0062] Optionally, also include:
[0063] The generation module is configured to generate a temporary storage area mapping table.
[0064] Optionally, the generated modules include:
[0065] The generation submodule is configured to generate an array containing traceable data mapping relationships and use the array as a temporary storage area mapping table.
[0066] Optionally, also include:
[0067] A recording submodule, configured to record the logical block address and physical block address of the traceable data;
[0068] The construction submodule is configured to construct a mapping relationship based on the logical block address and the physical block address, and to create an index.
[0069] Optionally, the determination module includes:
[0070] A first determining submodule is configured to determine the temporary storage area space granularity;
[0071] The second determining submodule is configured to determine the application space size corresponding to the write temporary storage area command;
[0072] The third determination submodule is configured to determine the number of temporary storage areas according to the temporary storage area space granularity and the application space size;
[0073] The fourth determining submodule is configured to determine a buffer area index that satisfies the number of temporary storage areas.
[0074] Optionally, also include:
[0075] A fifth determining submodule is configured to determine a temporary storage area index corresponding to a starting temporary storage area entry;
[0076] The adding submodule is configured to add the temporary storage area index and the temporary storage area quantity to the starting address of the logic block to be deleted in the temporary storage area and the number of the logic blocks to be deleted in the temporary storage area in the parameters respectively.
[0077] Optionally, also include:
[0078] The setting submodule is configured to set the temporary storage area status in the parameter to the user data writing function.
[0079] Optionally, update modules include:
[0080] The first update submodule is configured to update the flash translation layer mapping table entries corresponding to the user data to be overwritten to the temporary storage area mapping table in sequence, when the temporary storage area status in the write temporary storage area command is user data writing working state, to the temporary storage area table range specified by the starting address of the temporary storage area logical block to be deleted and the number of temporary storage area logical blocks to be deleted.
[0081] Optionally, also include:
[0082] The second updating submodule is configured to update the corresponding written physical block address to the copied entry in the flash translation layer mapping table.
[0083] Optionally, also include:
[0084] The release submodule is configured to release occupied temporary storage space resources.
[0085] Optionally, also include:
[0086] The temporary storage area deletion instruction receiving module is configured to receive a temporary storage area deletion instruction from an upper layer application; wherein the temporary storage area status corresponding to the temporary storage area deletion instruction is that no user number is written.
[0087] Optionally, also include:
[0088] The adding module is configured to add the starting address of the logic block to be deleted in the temporary storage area and the number of the logic blocks to be deleted in the temporary storage area to the temporary storage area deletion instruction.
[0089] Optional, temporary storage modules include:
[0090] The temporary storage submodule is configured to configure temporary storage area function related fields in the special supply area in the identification control data structure.
[0091] Optionally, also include:
[0092] The identification control data structure acquisition module is configured to obtain the identification control data structure through the identification control command and parse it to obtain the fields related to the temporary storage area function;
[0093] The allocation module is configured to allocate a corresponding size of the temporary storage area space in the upper layer application according to the fields related to the temporary storage area function.
[0094] According to a third aspect, the present application further provides a non-volatile readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0095] According to a fourth aspect, the present application also provides an electronic device, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the above method when calling the computer program in the memory.
[0096] The present application provides a data synchronization method, including: receiving a write temporary storage area command; determining the temporary storage area space range corresponding to the write temporary storage area command; and updating the flash memory translation layer mapping table entry corresponding to the user data to be copied to the temporary storage area mapping table corresponding to the temporary storage area space range to be written.
[0097] This application transfers the temporary storage space inside the solid-state drive to the upper-layer application of the host for management, so that the solid-state drive no longer has the authority and ability to delete the data in the temporary storage space. After that, the host sends a write temporary storage command. After the solid-state drive receives the write temporary storage command, it will indicate the temporary storage space range inside the solid-state drive used by the write temporary storage command, so that the solid-state drive can parse the temporary storage space range to be written, and update the flash conversion layer mapping table entry corresponding to the user data to be overwritten to the temporary storage space range corresponding to the temporary storage space range to be written. In this way, the synchronization of temporary storage space data between the upper-layer application and the SSD is achieved without adding an additional data synchronization interface to affect the system write performance, ensuring that the upper-layer application accurately traces back to the valid data inside the SSD, avoiding the development complexity and system performance degradation risk brought by the newly added temp data synchronization interface, and enhancing the stability and reliability of the storage system operation.
[0098] The present application also provides a data synchronization system, a non-volatile readable storage medium and an electronic device, which have the above-mentioned beneficial effects and are not described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS
[0099] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.
[0100] FIG1 is a flow chart of a data synchronization method provided in an embodiment of the present application;
[0101] FIG2 is a diagram showing the structure of a temporary storage area table provided in an embodiment of the present application;
[0102] FIG3 is a schematic diagram of the structure of a data synchronization system provided in an embodiment of the present application;
[0103] FIG4 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0104] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, other embodiments obtained by ordinary technicians in this field without making creative efforts are all within the scope of protection of this application.
[0105] For all-flash NVMe SSD hosts that support data retracing, for any host LBA of retraceable data, there are two corresponding copies of user data inside the SSD that supports data retracing. One is the new data obtained by searching the FTL (Flash Translation Layer) mapping table through the LBA to obtain the physical block address and reading the normal space; the other is the old data obtained by searching the TEMP (temporary) mapping table through the LBA to obtain the physical block address and reading the temporary storage space. Among them, the temporary storage space is a part of the NAND space inside the SSD that supports data retracing, which is set to temporarily store overwritten user data inside the SSD. This is also the data space that the host can retrace.
[0106] To ensure the host can always access the latest data (also known as old data), the host typically writes to the SSD using a temporary buffer. That is, upon receiving a temporary buffer command, the SSD searches the FTL mapping table based on the LBA specified in the command to obtain the physical block address corresponding to the overwritten user data and transfers it to the corresponding location in the temp mapping table. Once the new user data is written to the SSD, the physical block address occupied by the new data is updated to the corresponding LBA location in the FTL mapping table.
[0107] To ensure data traceability for upper-layer applications, it's often helpful to consider expanding the existing temporary storage area to serve as a buffer. For example, a 10GB temporary storage area can be expanded to 16GB, with 6GB used as an error correction buffer. Overall, the 16GB temporary storage area uses a first-in, first-out (FIFO) mechanism to ensure accurate traceback of the 10GB of valid data. However, because this solution doesn't synchronize temporary storage data between the upper-layer application and the SSD, and the temporary storage area is still managed independently by the SSD, host traceback failures are still possible.
[0108] To solve the above problems, this application addresses the need for data consistency deviation between the temporary storage space of the host upper-layer application and the temporary storage space inside the SSD, which causes the upper-layer application to fail to backtrack data. It provides a method for the host to notify the SSD to manage the temporary storage space by reusing the write temporary storage command interface, which not only achieves the synchronization of temporary storage space data between the upper-layer application and the SSD, but also does not add additional data synchronization interfaces to affect the system write performance.
[0109] Please refer to FIG1 , which is a flow chart of a data synchronization method provided by an embodiment of the present application. The method includes:
[0110] S101: receiving a write command to a temporary storage area;
[0111] S102: Determine the temporary storage area space range corresponding to the write temporary storage area command; wherein the temporary storage area space range is managed by the host upper layer application;
[0112] S103: Update the flash translation layer mapping table entry corresponding to the overwritten user data into the temporary storage area mapping table corresponding to the temporary storage area space range to be written.
[0113] The core of the embodiment of the present application is to completely hand over the management of the temporary storage area space inside the solid-state drive to the upper-layer application of the host, and the solid-state drive no longer has the initiative to delete the data in the temporary storage area space. When the host sends a write temporary storage area command interface, it will indicate the range of the temporary storage area space inside the solid-state drive used by the current command. After receiving and parsing the write temporary storage area command, the solid-state drive obtains the range of the temporary storage area space to be written, and then updates the flash translation layer mapping table entry corresponding to the user data to be overwritten to the temporary storage area mapping table corresponding to the range of the temporary storage area space to be written.
[0114] Before performing data synchronization, you can first set up a temporary buffer space for the solid-state drive. Optionally, you can first configure the temporary buffer function-related fields inside the hard disk. The temporary buffer function-related fields include the temporary buffer size, the temporary buffer space allocation granularity, and the number of temporary buffer mapping table entries, which are used to configure the temporary buffer space range. By configuring the temporary buffer function-related fields in the special supply area in the identification control data structure inside the solid-state drive, that is, extending the Temp function-related fields in the vendor Specific area in the Identify Controller data structure inside the solid-state drive. Thereafter, the host containing the solid-state drive can obtain the temporary buffer function-related fields by identifying the Identify Controller, and allocate a temporary buffer space of corresponding size in the upper-level application based on the parsed temporary buffer function-related fields.
[0115] That is, allocating temporary storage space can include the following two steps:
[0116] The first step is to obtain the identification control data structure through the identification control command, and parse it to obtain the fields related to the temporary storage area function;
[0117] The second step is to allocate a corresponding size of temporary storage area space in the upper-level application according to the fields related to the temporary storage area function.
[0118] The execution subject in the above process can be a host that includes a solid-state drive, such as an all-flash NVMe SSD host.
[0119] The write buffer interface can reuse the standard NVMe write interface and distinguish the standard NVMe write by customizing the write buffer command word in the special vendor specific area. In addition, the buffer space range to be operated by the current command is expanded in the write buffer interface, as shown in Table 1. Table 1 shows the write buffer extension function:
[0120] Table 1 Write buffer area and extend buffer area function
[0121] When expanding the temporary buffer space using a write cache command, you can configure the parameters of the write cache command. These parameters include the starting address of the logical blocks to be deleted from the temporary buffer, the number of logical blocks to be deleted from the temporary buffer, and the temporary buffer status. The starting address of the logical blocks to be deleted from the temporary buffer is the Temp Starting Index, abbreviated as TSI, which indicates the starting address of the logical blocks to be deleted from the temporary buffer. The number of logical blocks to be deleted from the temporary buffer is the Number of Temp Logical Blocks, abbreviated as NTLB.
[0122] In addition, a temporary storage area mapping table can be recorded within the solid-state drive. Optionally, the temporary storage area mapping table can be generated before the flash translation layer mapping table entry corresponding to the user data to be overwritten is updated in the temporary storage area mapping table corresponding to the temporary storage area space range to be written. The format of the temporary storage area mapping table is not limited herein and can be in the form of an array or the like. If an array is used, when generating the temporary storage area mapping table, an array containing traceable data mapping relationships can be generated and used as the temporary storage area mapping table.
[0123] In the temporary storage area mapping table, the logical block address and the physical block address will be included. Optionally, you can refer to Figure 2, which is a diagram of the temporary storage area table structure provided by the embodiment of the present application. For any temporary storage area entry, such as temp entry n (LBAn, PBAn) in Figure 2:
[0124] LBAn: Flash translation layer LBA for traceable data, uses u32 data size and occupies 4 bytes;
[0125] PBAn: physical block address of traceable data, pointing to old data space, uses u32 data size, occupies 4 bytes;
[0126] The number of temporary storage area entries is recorded as Temp_entry_num:
[0127] The Temp table is denoted as temp_table[Temp_entry num], allocated in the SSD DDR, and indexed by index, with the index range being [0, Temp_entry_num-1].
[0128] After completing the above preparations, if a write-scratch zone command is received, the write-scratch zone command can be parsed to determine the scratch zone space range corresponding to the write-scratch zone command. The flash translation layer mapping table entry corresponding to the overwritten user data is then updated to the scratch zone mapping table corresponding to the scratch zone space range to be written.
[0129] For the upper-layer application, when initiating a new write buffer area command, it must apply for available resources in the buffer area space corresponding to the upper-layer application.
[0130] The SSD receives and parses the write-to-temporary buffer command, obtaining the parameters (TSI, NTLB, and DTF fields). If the DTF indicates a user data write, the FTL mapping table entries corresponding to the overwritten user data are sequentially updated to the temp table range specified by the TSI and NTLB fields in the temporary buffer mapping table. Once all new user writes are complete, the corresponding physical block addresses are updated to the overwritten entries in the FTL mapping table.
[0131] When the solid-state drive responds to the host that the write buffer area is completed, the buffer area space resources occupied by the write buffer area command in the upper-layer application can be released. Otherwise, the next write buffer area command cannot apply for the use of the buffer area space resources.
[0132] In fact, when upper-layer applications request available temporary storage space resources, they also indirectly delete data in the SSD's temporary storage space during the data writing process. That is, after the SSD receives the write temporary storage area command, it internally processes the flash translation layer mapping table to obtain the flash translation layer mapping table entry corresponding to the overwritten user data. It then overwrites the entry in the temp mapping table based on the TSI and NTLB.
[0133] When determining the temporary storage area space range corresponding to the write temporary storage area command, the following steps may be included:
[0134] The first step is to determine the granularity of the temporary storage space;
[0135] Step 2: Determine the size of the requested space corresponding to the write buffer area command;
[0136] Step 3: Determine the number of temporary storage areas based on the temporary storage area granularity and the requested space size;
[0137] Step 4: Determine the cache index that meets the number of temporary storage areas.
[0138] First, the granularity of the temporary storage area must be determined. This granularity can be set by those skilled in the art and is not specifically defined here. The number of temporary storage areas can then be determined based on the granularity and the requested space size. The number of temporary storage areas should at least meet the requested space size.
[0139] For example, when writing a large block of 128KB of data, if the SSD reports a 4KB granularity for the temporary buffer space, then for ease of operation, the upper-layer application must be able to request 32 consecutive 4KB granularities of temporary buffer space at once. The temporary buffer index corresponding to the starting temporary buffer entry and the number of temporary buffer entries are then entered into the TSI and NTLB fields of the write temporary buffer interface, respectively. The DTF field is then filled with the user data write function, and then sent to the SSD for write temporary buffer command processing.
[0140] At this time, the corresponding execution process of this embodiment is as follows:
[0141] The first step is to receive the command to write to the temporary storage area;
[0142] Step 2: Determine the space granularity of the temporary storage area;
[0143] Step 3: Determine the size of the requested space corresponding to the write buffer area command;
[0144] Step 4: Determine the number of temporary storage areas based on the temporary storage area granularity and the requested space size;
[0145] Step 5: Determine the cache index that meets the number of temporary storage areas.
[0146] Step 6: Update the flash translation layer mapping table entry corresponding to the overwritten user data into the temporary storage area mapping table corresponding to the temporary storage area space range to be written.
[0147] The data synchronization method provided by the embodiment of the present application is to hand over the temporary storage space inside the solid-state hard disk to the upper-layer application of the host for management, so that the solid-state hard disk no longer has the authority and ability to delete the data in the temporary storage space. After that, the host sends a write temporary storage command. After the solid-state hard disk receives the write temporary storage command, it will indicate the temporary storage space range inside the solid-state hard disk used by the write temporary storage command, so that the solid-state hard disk can parse the temporary storage space range to be written, and update the flash conversion layer mapping table entry corresponding to the copied user data to the temporary storage space range corresponding to the temporary storage space range to be written. In this way, the synchronization of the temporary storage space data of both the upper-layer application and the SSD is achieved without adding an additional data synchronization interface to affect the system write performance, ensuring that the upper-layer application accurately traces back to the valid data inside the SSD, avoiding the development complexity and system performance degradation risk brought by the newly added temp data synchronization interface, and enhancing the stability and reliability of the storage system operation.
[0148] Based on the above embodiment, as an optional embodiment, before generating the array containing the mapping relationship of the traceable data, the logical block addresses and physical block addresses of the traceable data can also be recorded, and then a mapping relationship is constructed based on the logical block addresses and physical block addresses, and an index is created. This process is actually the process of constructing a temporary storage area mapping table, which needs to be constructed based on the logical block addresses and physical block addresses of the traceable data.
[0149] At the same time, after determining the cache index that meets the cache quantity, the cache index corresponding to the starting cache entry can be determined, and the cache index and cache quantity can be added to the starting address of the cache logical block to be deleted and the number of cache logical blocks to be deleted in the parameters, respectively. The cache status in the parameters is set to the user data write function.
[0150] Optionally, updating the flash translation layer mapping table entry corresponding to the overwritten user data to the temporary storage area mapping table corresponding to the temporary storage area space range to be written includes:
[0151] When the temporary storage area status in the write temporary storage area command is user data writing working, the flash translation layer mapping table entries corresponding to the user data to be overwritten are updated in sequence to the temporary storage area table range specified by the starting address of the temporary storage area to be deleted logical block and the number of temporary storage area to be deleted logical blocks in the temporary storage area mapping table.
[0152] In addition, a temporary storage area deletion instruction from an upper-layer application can also be received, and the temporary storage area status corresponding to the temporary storage area deletion instruction is no user data is written. In other embodiments, the upper-layer application can also directly reuse the write temporary storage area interface to delete the data in the temporary storage area inside the solid-state drive. In addition to marking the TSI and NTLB to be deleted, it is also necessary to fill the DTF field with no user data written, only delete the temporary storage area function, and then send it to the solid-state drive for write temporary storage area command processing.
[0153] After all users have completed writing, the corresponding written physical block address can be updated to the copied table entry in the flash translation layer mapping table, and the occupied temporary storage area space resources can be released at the same time.
[0154] As an optional execution method, before receiving a temporary buffer deletion instruction from an upper-level application, the starting address of the logical block to be deleted in the temporary buffer and the number of logical blocks to be deleted in the temporary buffer can also be added to the temporary buffer deletion instruction. In this way, when executing the temporary buffer deletion, the temporary buffer to be deleted can be directly determined based on the starting address of the logical block to be deleted in the temporary buffer and the number of logical blocks to be deleted in the temporary buffer, quickly determining the temporary buffer to be deleted, improving the efficiency of temporary buffer deletion, and ensuring that there are sufficient free temporary buffers when the next write temporary buffer command is received.
[0155] In other embodiments of the present application, the temporary storage area function field may be expanded in the solid-state drive to configure the temporary storage area. The corresponding complete execution process is as follows:
[0156] The first step is to configure the fields related to the temporary storage function inside the hard disk;
[0157] The second step is to expand the temporary storage area space range by writing the cache command word and the temporary storage area function related fields;
[0158] Step 3: Receive the command to write to the temporary storage area;
[0159] Step 4: Determine the temporary storage area space range corresponding to the write temporary storage area command;
[0160] Step 5: Update the flash translation layer mapping table entry corresponding to the overwritten user data into the temporary storage area mapping table corresponding to the temporary storage area space range to be written.
[0161] During the second step, the parameters of the write cache command word can be configured to set the starting address and number of logical blocks, as well as the status of the temporary buffer. Furthermore, a temporary buffer mapping table can be configured within the SSD so that, when data synchronization is performed, the flash translation layer mapping table entries corresponding to the user data are updated to the temporary buffer mapping table corresponding to the temporary buffer space range to be written.
[0162] It can be seen that this application ensures the identity and consistency of the temporary storage space data between the upper-layer application and the solid-state drive, avoiding data consistency deviations between the two and the resulting failure of the upper-layer application to trace back data. In this process, the solid-state drive no longer has the ability to actively delete the temporary storage space data. Only after receiving the write temporary storage area command issued by the host, the solid-state drive has the authority to update the data to the temporary storage area mapping table.
[0163] A data synchronization system provided in an embodiment of the present application is introduced below. The data synchronization system described below and the data synchronization method described above can refer to each other.
[0164] FIG3 is a schematic diagram of the structure of a data synchronization system provided in an embodiment of the present application. As shown in FIG3 , the data synchronization system includes:
[0165] A write temporary storage area command receiving module is configured to receive a write temporary storage area command;
[0166] a determination module configured to determine a temporary storage area space range corresponding to a write temporary storage area command; wherein the temporary storage area space range is managed by an upper layer application of the host;
[0167] The update module is configured to update the flash translation layer mapping table entry corresponding to the overwritten user data into the temporary storage area mapping table corresponding to the temporary storage area space range to be written.
[0168] The embodiment of the present application uses a write temporary storage area command receiving module, a determination module, and an update module to hand over the temporary storage area space inside the solid-state drive to the upper-layer application of the host for management, so that the solid-state drive no longer has the authority and ability to delete the data in the temporary storage area space. After that, the host sends a write temporary storage area command. After the solid-state drive receives the write temporary storage area command, it will indicate the temporary storage area space range inside the solid-state drive used by the write temporary storage area command, so that the solid-state drive can parse the temporary storage area space range to be written, and update the flash conversion layer mapping table entry corresponding to the overwritten user data to the temporary storage area mapping table corresponding to the temporary storage area space range to be written. In this way, the synchronization of temporary storage area space data between the upper-layer application and the SSD is achieved without adding an additional data synchronization interface to affect the system write performance, ensuring that the upper-layer application accurately traces back to the valid data inside the SSD, avoiding the development complexity and system performance degradation risks brought by the newly added temp data synchronization interface, and enhancing the stability and reliability of the storage system operation.
[0169] Based on the above embodiment, as an optional embodiment, the following is further included:
[0170] The temporary storage module is configured to configure temporary storage area function related fields inside the hard disk; the temporary storage area function related fields include temporary storage area size, temporary storage area space allocation granularity and the number of temporary storage area mapping table entries, which are used to configure the temporary storage area space range.
[0171] Based on the above embodiment, as an optional embodiment, the following is further included:
[0172] The extension module is configured to extend the temporary storage area space range by writing a buffer area command word.
[0173] Based on the above embodiment, as an optional embodiment, the expansion module includes:
[0174] A configuration submodule is configured to configure parameters of a write cache command word; wherein the parameters include a starting address of a logic block to be deleted in the temporary storage area, a number of logic blocks to be deleted in the temporary storage area, and a status of the temporary storage area;
[0175] The extension submodule is configured to extend the temporary storage area according to the parameters.
[0176] Based on the above embodiment, as an optional embodiment, the following is further included:
[0177] The generation module is configured to generate a temporary storage area mapping table.
[0178] Based on the above embodiment, as an optional embodiment, the generating module includes:
[0179] The generation submodule is configured to generate an array containing traceable data mapping relationships and use the array as a temporary storage area mapping table.
[0180] Based on the above embodiment, as an optional embodiment, the following is further included:
[0181] A recording submodule, configured to record the logical block address and physical block address of the traceable data;
[0182] The construction submodule is configured to construct a mapping relationship based on the logical block address and the physical block address, and to create an index.
[0183] Based on the above embodiment, as an optional embodiment, the determination module includes:
[0184] A first determining submodule is configured to determine the temporary storage area space granularity;
[0185] The second determining submodule is configured to determine the application space size corresponding to the write temporary storage area command;
[0186] The third determination submodule is configured to determine the number of temporary storage areas according to the temporary storage area space granularity and the application space size;
[0187] The fourth determining submodule is configured to determine a buffer area index that satisfies the number of temporary storage areas.
[0188] Based on the above embodiment, as an optional embodiment, the following is further included:
[0189] A fifth determining submodule is configured to determine a temporary storage area index corresponding to a starting temporary storage area entry;
[0190] The adding submodule is configured to add the temporary storage area index and the temporary storage area quantity to the starting address of the logic block to be deleted in the temporary storage area and the number of the logic blocks to be deleted in the temporary storage area in the parameters respectively.
[0191] Based on the above embodiment, as an optional embodiment, the following is further included:
[0192] The setting submodule is configured to set the temporary storage area status in the parameter to the user data writing function.
[0193] Based on the above embodiment, as an optional embodiment, the update module includes:
[0194] The first update submodule is configured to update the flash translation layer mapping table entries corresponding to the user data to be overwritten to the temporary storage area mapping table in sequence, when the temporary storage area status in the write temporary storage area command is user data writing working state, to the temporary storage area table range specified by the starting address of the temporary storage area logical block to be deleted and the number of temporary storage area logical blocks to be deleted.
[0195] Based on the above embodiment, as an optional embodiment, the following is further included:
[0196] The second updating submodule is configured to update the corresponding written physical block address to the copied entry in the flash translation layer mapping table.
[0197] Based on the above embodiment, as an optional embodiment, the following is further included:
[0198] The release submodule is configured to release occupied temporary storage space resources.
[0199] Based on the above embodiment, as an optional embodiment, the following is further included:
[0200] The temporary storage area deletion instruction receiving module is configured to receive a temporary storage area deletion instruction from an upper layer application; wherein the temporary storage area status corresponding to the temporary storage area deletion instruction is that no user number is written.
[0201] Based on the above embodiment, as an optional embodiment, the following is further included:
[0202] The adding module is configured to add the starting address of the logic block to be deleted in the temporary storage area and the number of the logic blocks to be deleted in the temporary storage area to the temporary storage area deletion instruction.
[0203] Based on the above embodiment, as an optional embodiment, the temporary storage module includes:
[0204] The temporary storage submodule is configured to configure temporary storage area function related fields in the special supply area in the identification control data structure.
[0205] Based on the above embodiment, as an optional embodiment, the following is further included:
[0206] The identification control data structure acquisition module is configured to obtain the identification control data structure through the identification control command and parse it to obtain the fields related to the temporary storage area function;
[0207] The allocation module is configured to allocate a corresponding size of the temporary storage area space in the upper layer application according to the fields related to the temporary storage area function.
[0208] The present application also provides a non-volatile readable storage medium having a computer program stored thereon, which, when executed, can implement the steps provided in the above embodiment. The non-volatile readable storage medium may include: a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., various media that can store program code.
[0209] When the computer program is executed, it is configured to perform at least the following steps:
[0210] Receive the command to write to the temporary storage area;
[0211] Determine the temporary storage area space range corresponding to the write temporary storage area command; wherein the temporary storage area space range is managed by the host upper layer application;
[0212] The flash translation layer mapping table entry corresponding to the overwritten user data is updated into the temporary storage area mapping table corresponding to the temporary storage area space range to be written.
[0213] The non-volatile readable storage medium provided by the embodiment of the present application, when the computer program on it is executed, by handing over the temporary storage space inside the solid-state hard disk to the upper-layer application of the host for management, the solid-state hard disk no longer has the authority and ability to delete the data in the temporary storage space. After that, the host issues a write temporary storage command. After the solid-state hard disk receives the write temporary storage command, it will indicate the temporary storage space range inside the solid-state hard disk used by the write temporary storage command, so that the solid-state hard disk can parse the temporary storage space range to be written, and update the flash conversion layer mapping table entry corresponding to the overwritten user data to the temporary storage space range corresponding to the temporary storage space range to be written. In this way, the synchronization of temporary storage space data between the upper-layer application and the SSD is achieved without adding an additional data synchronization interface to affect the system write performance, ensuring that the upper-layer application accurately traces back to the valid data inside the SSD, avoiding the development complexity and system performance degradation risk brought by the newly added temp data synchronization interface, and enhancing the stability and reliability of the storage system operation.
[0214] The present application also provides an electronic device. See FIG4 , which is a schematic structural diagram of an electronic device provided in an embodiment of the present application. As shown in FIG4 , the electronic device may include a processor 1410 and a memory 1420 .
[0215] The processor 1410 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1410 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), or a PLA (Programmable Logic Array). The processor 1410 may also include a main processor and a coprocessor. The main processor is a processor configured to process data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor configured to process data in a standby state. In some embodiments, the processor 1410 may be integrated with a GPU (Graphics Processing Unit), which is configured to be responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1410 may also include an AI (Artificial Intelligence) processor, which is configured to process computing operations related to machine learning.
[0216] The memory 1420 may include one or more non-volatile readable storage media, which may be non-transitory. The memory 1420 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 1420 is at least configured to store the following computer program 1421, wherein the computer program can implement the relevant steps of the method disclosed in any of the aforementioned embodiments after being loaded and executed by the processor 1410. In addition, the resources stored in the memory 1420 may also include an operating system 1422 and data 1423, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 1422 may include Windows, Linux, Android, etc.
[0217] In some embodiments, the electronic device may further include a display screen 1430 , an input / output interface 1440 , a communication interface 1450 , a sensor 1460 , a power supply 1470 , and a communication bus 1480 .
[0218] Of course, the structure of the electronic device shown in FIG4 does not constitute a limitation on the electronic device in the embodiment of the present application. In actual applications, the electronic device may include more or fewer components than those shown in FIG4, or combine certain components.
[0219] When the computer program stored in the memory of the electronic device is executed, it is configured to perform at least the following steps:
[0220] Receive write buffer area command;
[0221] Determine the temporary storage area space range corresponding to the write temporary storage area command;
[0222] The flash translation layer mapping table entry corresponding to the overwritten user data is updated into the temporary storage area mapping table corresponding to the temporary storage area space range to be written.
[0223] The electronic device provided by the embodiment of the present application includes a memory and a processor. When the processor processes the computer program on the memory, the temporary storage space inside the solid-state drive is handed over to the upper-layer application of the host for management, so that the solid-state drive no longer has the authority and ability to delete the data in the temporary storage space. After that, the host issues a write temporary storage command. After the solid-state drive receives the write temporary storage command, it will indicate the temporary storage space range inside the solid-state drive used by the write temporary storage command, so that the solid-state drive can parse the temporary storage space range to be written and update the flash translation layer mapping table entry corresponding to the overwritten user data to the temporary storage space range corresponding to the temporary storage space range to be written. In this way, the synchronization of the temporary storage space data of both the upper-layer application and the SSD is achieved without adding an additional data synchronization interface to affect the system write performance, ensuring that the upper-layer application accurately traces back to the valid data inside the SSD, avoiding the development complexity and system performance degradation risk brought by the newly added temporary storage data synchronization interface, and enhancing the stability and reliability of the storage system operation.
[0224] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the systems provided in the embodiments, since they correspond to the methods provided in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.
[0225] Optional examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only intended to help understand the method and core concept of the present application. It should be noted that, for those skilled in the art, various improvements and modifications may be made to the present application without departing from the principles of the present application, and such improvements and modifications also fall within the scope of protection of the claims of the present application.
[0226] It should also be noted that, in this specification, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
Claims
1. A data synchronization method, characterized in that: include: Receive a command to write to the temporary storage area; Determine the temporary storage area space range corresponding to the write temporary storage area command; wherein the temporary storage area space range is managed by the host upper layer application; The flash translation layer mapping table entry corresponding to the overwritten user data is updated to the temporary storage area mapping table corresponding to the temporary storage area space range to be written.
2. The data synchronization method according to claim 1, characterized in that: Also includes: The temporary storage area function related fields are configured inside the hard disk; the temporary storage area function related fields include the temporary storage area size, the temporary storage area space allocation granularity and the number of temporary storage area mapping table entries, which are used to configure the temporary storage area space range.
3. The data synchronization method according to claim 1, characterized in that: Also includes: The temporary storage area space range is expanded by writing a cache area command word.
4. The data synchronization method according to claim 3, characterized in that: Expanding the temporary storage area space range by writing a cache area command word includes: Configure the parameters of the write cache command word; wherein the parameters include the starting address of the logic block to be deleted in the temporary storage area, the number of logic blocks to be deleted in the temporary storage area, and the status of the temporary storage area; The temporary storage area space range is expanded according to the parameter.
5. The data synchronization method according to claim 1, characterized in that: Before updating the flash translation layer mapping table entry corresponding to the overwritten user data into the temporary storage area mapping table corresponding to the temporary storage area space range to be written, the method further includes: Generate the temporary storage area mapping table.
6. The data synchronization method according to claim 5, characterized in that: Generating the temporary storage area mapping table includes: An array containing traceable data mapping relationships is generated, and the array is used as a temporary storage area mapping table.
7. The data synchronization method according to claim 6, characterized in that: Before generating an array containing traceable data mapping relationships, it also includes: Recording the logical block address and physical block address of the traceable data; A mapping relationship is constructed according to the logical block address and the physical block address, and an index is created.
8. The data synchronization method according to claim 4, characterized in that: Determining the temporary storage area space range corresponding to the write temporary storage area command includes: Determine the granularity of the temporary storage space; Determine the application space size corresponding to the write temporary storage area command; Determine the number of temporary storage areas according to the temporary storage area space granularity and the application space size; Determine a cache area index that satisfies the number of temporary storage areas.
9. The data synchronization method according to claim 8, characterized in that: After determining the cache area index that satisfies the number of temporary storage areas, the method further includes: Determine the buffer zone index corresponding to the starting buffer zone entry; The temporary storage area index and the temporary storage area quantity are added to the starting address of the logic block to be deleted in the temporary storage area and the number of the logic blocks to be deleted in the temporary storage area in the parameters respectively.
10. The data synchronization method according to claim 9, characterized in that: Also includes: The temporary storage area status in the parameters is set to the user data writing function.
11. The data synchronization method according to claim 10, characterized in that: The flash translation layer mapping table entry corresponding to the overwritten user data is updated to the temporary storage area mapping table corresponding to the temporary storage area space range to be written, including: When the temporary storage area status in the write temporary storage area command is the user data write working time, the flash memory translation layer mapping table entries corresponding to the user data to be overwritten are updated in sequence to the temporary storage area mapping table The temporary storage area table range specified by the starting address of the temporary storage area to be deleted logical block and the number of temporary storage area to be deleted logical blocks.
12. The data synchronization method according to claim 11, characterized in that: After all user writes are completed, it also includes: The corresponding written physical block address is updated to the copied entry in the flash translation layer mapping table.
13. The data synchronization method according to claim 12, characterized in that: After updating the corresponding written physical block address to the overwritten entry in the flash translation layer mapping table, the method further includes: Release the occupied temporary storage space resources.
14. The data synchronization method according to claim 1, characterized in that: Also includes: A temporary storage area deletion instruction from an upper layer application is received; wherein the temporary storage area status corresponding to the temporary storage area deletion instruction is that no user data is written.
15. The data synchronization method according to claim 14, characterized in that: Before receiving the temporary storage area deletion instruction from the upper application, it also includes: The starting address of the to-be-deleted logical block in the temporary storage area and the number of the to-be-deleted logical blocks in the temporary storage area are added to the temporary storage area deletion instruction.
16. The data synchronization method according to claim 2, characterized in that: The fields related to configuring the temporary storage area function inside the hard disk include: Configure the buffer area function related fields in the special supply area in the identification control data structure.
17. The data synchronization method according to claim 16, characterized in that: Also includes: Acquire the identification control data structure through the identification control command, and parse to obtain the fields related to the temporary storage area function; A temporary storage area space of a corresponding size is allocated in the upper layer application according to the temporary storage area function related fields.
18. A data synchronization system, characterized in that: include: A receiving module, configured to receive a write-to-temporary-area command; A determination module is configured to determine a temporary storage area space range corresponding to the write temporary storage area command; wherein the temporary storage area space range is managed by a host upper layer application; The update module is configured to update the flash translation layer mapping table entry corresponding to the overwritten user data into the temporary storage area mapping table corresponding to the temporary storage area space range to be written.
19. A non-volatile readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the data synchronization method according to any one of claims 1 to 17 are implemented.
20. An electronic device, characterized in that: It comprises a memory and a processor, wherein the memory stores a computer program, and when the processor calls the computer program in the memory, the steps of the data synchronization method as described in any one of claims 1 to 17 are implemented.
Citation Information
Patent Citations
Software-defined fusion storage method for solid-state disc
CN103777905A
Mixed storage system and method for supporting solid-state disk cache dynamic distribution
CN103902474A
Buffer storage management method, storage control circuit unit and storage device
CN106776376A
Full flash memory system based on ZNS solid state disk and address mapping method
CN114546296A
Data storage method and device, electronic equipment and readable medium
CN115543868A
Cited By
Instruction synchronization method, apparatus and device, readable storage medium and program product
CN121635967A
