Table item management method and device of solid state disk and solid state disk
By using two alternating cache tables in the SRAM of the solid-state drive, the problem of table entry replacement affecting write performance is solved, synchronous execution of write and read operations is achieved, and bandwidth utilization is improved.
Patent Information
- Application Number
- CN202310246843.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-08
- Publication Date
- 2024-09-10
AI Technical Summary
When existing solid-state drives perform random write operations, the table entry replacement task will affect the host's write performance, and read commands are not allowed to be processed during table entry replacement, causing the read performance to be affected.
Add two cache tables in SRAM and use them alternately to synchronize table entry replacement and update to ensure that write and read operations are not affected.
Through the alternate use of two cache tables, the synchronous execution of table entry replacement and host write operations is achieved, which improves the NAND bandwidth utilization of the solid-state drive, reduces the impact of random write performance, and allows the host to perform table entry replacement during the table entry replacement period. Read operation.
Smart Images

Figure CN118626416A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of solid-state hard disks, and in particular to a table entry management method and device for a solid-state hard disk, and a solid-state hard disk. Background Art
[0002] Solid State Drives (SSD) are storage hard disks made of solid-state electronic storage chips, mainly composed of controllers, storage media and cache units. Currently, the most mainstream solid-state drives use flash memory (Flash Memory) as the storage medium to store data, and use the controller's internal SRAM (Static Random Access Memory) or external DRAM (Dynamic Random Access Memory) as cache.
[0003] For SSDs with DRAM-LESS solutions, a two-level mapping solution is generally used to manage the L2P mapping table. However, in the two-level mapping management solution, only a small part of the two-level mapping table is stored in SRAM. Therefore, when the host performs random write operations, the solid-state drive will perform a large number of table entry replacement operations. During the execution of the table entry replacement task, the FW is not allowed to process the host's write commands (that is, it is not allowed to update the L2P table), resulting in the random write performance not being able to reach the optimal value. At the same time, during the execution of the table entry replacement task, the FW is not allowed to process the host read commands (that is, it is not allowed to query the L2P table), resulting in a certain impact on the read performance during mixed read and write. Summary of the invention
[0004] In view of the above problems, the purpose of the present application is to provide a table entry management method and device for a solid-state hard disk, and a solid-state hard disk. By adding a cache table in the SRAM, that is, using two cache tables at the same time, the table entry replacement, table entry update, and table entry reading of the cache table can be performed synchronously.
[0005] According to one aspect of the present application, a table entry management method for a solid-state drive is provided, wherein the SRAM of the solid-state drive includes a first cache table and a second cache table, and the table entry management method includes: marking the first cache table as a target cache table and writing first L2P information to be updated into the target cache table; when the target cache table is full, triggering a table entry replacement operation, wherein the table entry replacement operation is to update the L2P information in the target cache table to a flash memory; wherein, while executing the table entry replacement operation, the second cache table is marked as a target cache table for storing the second L2P information to be updated.
[0006] Optionally, the method further includes: the first cache table and the second cache table are alternately marked as target cache tables.
[0007] Optionally, the steps in which the first cache table and the second cache table are alternately marked as target cache tables include: receiving first L2P information to be updated; writing the first L2P information to be updated into the target cache table; judging whether the target cache table is full; when the target cache table is full, marking the second cache table as the target cache table; receiving second L2P information to be updated; writing the second L2P information to be updated into the target cache table; judging whether the target cache table is full; when the target cache table is full, marking the first cache table as the target cache table.
[0008] Optionally, the step of writing the L2P information to be updated into the target cache table includes: determining whether there is a mapping chain corresponding to the L2P information to be updated in the target cache table; if so, writing the L2P information to be updated into the corresponding mapping chain of the target cache table; if not, applying for a new mapping chain from the target cache table as the corresponding mapping chain, and writing the L2P information to be updated into the corresponding mapping chain of the target cache table.
[0009] Optionally, the steps of determining whether there exists a mapping chain corresponding to the L2P information to be updated in the target cache table and writing the L2P information to be updated into the mapping chain corresponding to the target cache table also include: counting the number A of mapping chains in the target cache table and the number B of mapping chains completed by replacing entries in another cache table; determining whether A is greater than B; if not, writing the L2P information to be updated into the mapping chain corresponding to the target cache table.
[0010] Optionally, when A is greater than B, a prompt indicating that the update failed is returned.
[0011] Optionally, a read operation is performed while executing the table entry replacement operation.
[0012] Optionally, the steps of performing a read operation include: receiving the LAA to be queried; calculating the first-level logical address corresponding to the LAA to be queried; querying the first-level mapping table according to the first-level logical address; determining whether the first-level mapping table points to the cache table; if so, querying the mapping chain of the cache table and determining whether the query is successful; if the query is successful, returning the queried PAA.
[0013] Optionally, the step of querying the mapping chain of the cache table and determining whether the query is successful includes: querying the mapping chain of the target cache table and determining whether the query is successful; if the query is successful, returning the queried PAA.
[0014] Optionally, the method further includes: if the target cache table is not queried successfully, querying a mapping chain of another cache table and determining whether the query is successful; if the query is successful, returning the queried PAA.
[0015] Optionally, the method further includes: if another cache table is not queried successfully, querying the flash memory.
[0016] Optionally, if the first-level mapping table does not point to the cache table, the flash memory is queried.
[0017] Optionally, the step of querying the flash memory includes: determining whether the primary mapping table points to the flash memory; if so, obtaining a required mapping relationship from the flash memory; and returning the queried PAA.
[0018] According to another aspect of the present application, a table entry management device for a solid state drive is provided, comprising a control module and an SRAM, for executing the table entry management method as described above.
[0019] According to another aspect of the present application, a solid state drive is provided, comprising a flash memory and the aforementioned table entry management device.
[0020] The table entry management method and device of the solid-state hard disk and the solid-state hard disk provided by the present application use two write cache tables (WCT) at the same time, one for updating the L2P information corresponding to the latest data written by the host; the other for replacing the table entry with the L2P information in the NAND, writing the L2P information in the cache table into the NAND, and the content in the cache table will be cleared after the table entry replacement is completed. Furthermore, the cache table used to update the L2P information to be written triggers the table entry replacement operation after it is full, and the other cache table used for table entry replacement clears the content after the table entry is updated as the cache table for updating the L2P information to be written. The functions of the two cache tables change alternately, so that the table entry replacement and table entry update of the cache table can be performed synchronously.
[0021] The table entry management method of the solid-state hard disk provided in the present application has two cache tables, one for table entry update operations and the other for table entry replacement tasks of the updated L2P information. This not only enables the table entry replacement tasks to be executed synchronously with the host write operations, but also improves the NAND bandwidth utilization of the solid-state hard disk, thereby reducing the impact of the table entry replacement tasks on the random write performance of the host.
[0022] The table entry management method for the solid-state hard disk provided in the present application does not change the link relationship in the cache table before the table entry replacement in the secondary mapping table is completed and written to NAND, so that the table entry replacement task and the host read operation can also be executed synchronously, and the host's read performance is less affected by the table entry replacement. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above and other objects, features and advantages of the present application will become more apparent through the following description of the embodiments of the present application with reference to the accompanying drawings, in which:
[0024] Figure 1 A schematic diagram of the structure of a solid state hard disk according to the prior art is shown;
[0025] Figure 2 A schematic diagram of table item storage of a solid state drive according to the prior art is shown;
[0026] Figure 3 shows a timeline of operation tasks of a solid state drive according to the prior art;
[0027] Figure 4 shows a timeline of operation tasks of a solid state drive according to the prior art;
[0028] Figure 5 A schematic diagram of table entry storage of a solid state drive according to an embodiment of the present invention is shown;
[0029] Figure 6 A flowchart of table entry update and table entry replacement in a table entry management method for a solid state drive according to an embodiment of the present invention is shown;
[0030] Figure 7 A flowchart of table entry reading in a table entry management method of a solid state drive according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0031] The present application will be described in more detail below with reference to the accompanying drawings. In each of the drawings, the same elements are represented by similar reference numerals. For the sake of clarity, the various parts in the drawings are not drawn to scale. In addition, some well-known parts may not be shown. For the sake of simplicity, the semiconductor structure obtained after several steps can be described in one figure.
[0032] It should be understood that when describing the structure of a device, when a layer or a region is referred to as being "on" or "over" another layer or another region, it may mean that it is directly on the other layer or another region, or that other layers or regions are included between it and the other layer or another region. Furthermore, if the device is turned over, the layer or a region will be "below" or "beneath" another layer or another region.
[0033] If it is intended to describe a situation where it is directly on another layer or another area, this article will use the expression “directly on…” or “on… and adjacent to…”.
[0034] The following are the English abbreviations used in this application and their corresponding term explanations.
[0035] SSD: Solid State Disk or Solid State Drive, solid state drive.
[0036] WL: wordline, word line.
[0037] program: Programming, writing to NAND from the master.
[0038] L2P: Logical to Physical, a conversion table from logical address to physical address.
[0039] WCT: Write Cache Table, which stores the L2P information corresponding to the most recently written data.
[0040] LBA: Logical Block Address, logical block address.
[0041] AU: Allocated Unit, allocation unit.
[0042] LAA: Logical AU Address, logical allocation unit address.
[0043] PAA: Physical AU Address, physical allocation unit address.
[0044] Table Flush: table entry replacement.
[0045] Figure 1 A schematic diagram of the structure of a solid state hard disk according to the prior art is shown; Figure 2 A schematic diagram of table item storage of a solid state drive according to the prior art is shown; Figure 3 shows a timeline of operation tasks of a solid state drive according to the prior art; Figure 4 FIG. 1 shows a timeline of operation tasks of a solid state drive according to the prior art.
[0046] refer to Figure 1 The solid state drive (SSD) 100 includes an interface 110, a control module 120, an SRAM 130 and a flash memory 140. The control module 120 is connected to the interface 110, the SRAM 130 and the flash memory 140 respectively, and the SRAM 130 is connected to the flash memory (NAND) 140.
[0047] The interface 110 is used to connect to the host 10, so as to receive the operation instructions issued by the host 10. The control module 120 is used to execute the operation instructions issued by the host 10. The SRAM 130 and the flash memory 140 store the first-level mapping table and the second-level mapping table (L2P) required for the read and write operations, but the storage space of the SRAM 130 is small and cannot store too much content.
[0048] Therefore, in the mapping table management of the SSD of the DRAM-LESS solution, due to the size of SRAM130, the L2P mapping table corresponding to the entire disk cannot be stored in SRAM130, so a two-level mapping solution is used to manage the mapping table. The first-level mapping table is resident in SRAM130, a small part of the second-level mapping table is located in SRAM130, and most of it is stored in the flash memory (NAND)140. Among them, the second-level mapping table directly stores the mapping of the user data logical address to the physical address in NAND140, and the first-level mapping table stores the address of the second-level mapping table in NAND140 or the address of SRAM130, that is, the location of the second-level mapping table can be found through the first-level mapping table.
[0049] The secondary mapping table located in SRAM 130 is divided into a write cache table (WCT) and a read cache table (RCT). The write cache table stores the L2P mapping corresponding to the data recently written into NAND 140. When the number of newly updated L2P mappings exceeds a certain number (such as there is no remaining space in WCT to store new L2P mappings), the table entry replacement process will be started to write the L2P information in WCT into NAND.
[0050] like Figure 2 As shown, the first-level mapping table is composed of N (e.g., N is 64K) key-value pairs, which cover the logical pages corresponding to the entire disk capacity of the SSD; wherein each "key" corresponds to a logical page set, and the "value" corresponding to the "key" stores the physical address stored in the second-level mapping table corresponding to the logical page set. A write mapping table buffer 131 is provided in the SRAM 130 for storing the newly added L2P mapping relationship. The mapping table in the write mapping table buffer is called a write cache table, which is referred to as WCT (Write Cache Table) in this article.
[0051] When the number of L2P mappings in WCT 131 reaches a certain threshold (for example, there is no remaining space in WCT to store the newly added L2P mappings, or the number of remaining WCT nodes only allows the FW to perform a host write operation to update the number of L2Ps required), it is necessary to replace the secondary table entries in NAND 140. The existing NAND 140 table entry replacement method (i.e., table flushing process) mainly consists of the following parts:
[0052] 1) Read the secondary mapping table from NAND 140. Assuming that the L2P mapping stored in WCT 131 corresponds to the logical page set 0 (page-0) and the logical page set 2 (page-2) in the primary mapping table, the secondary mapping table corresponding to the logical page set 0 (page-0) and the logical page set 2 (page-2) needs to be read from NAND 140.
[0053] 2) Update the new L2P mapping recorded in WCT 131 to the “secondary mapping table read from NAND 140”.
[0054] 3) Write the updated secondary mapping table into NAND 140 .
[0055] 4) Repeat the above operation until the entry replacement of NAND 140 is completed.
[0056] When the FW (Firmware) is executing the table entry replacement process, it is not allowed to update the L2P mapping in WCT131, that is, the host write process is suspended at this time. At the same time, the FW is not allowed to query the L2P mapping from WCT 131 during this period, that is, the host read process is also suspended at this time.
[0057] In the current solution, when executing the table entry replacement process, the L2P data corresponding to the WCTentry linked to each logical page set needs to be updated to the secondary mapping table corresponding to the logical page set. This process is called table entry replacement. Because the table entry replacement process will traverse the WCT entry linked list, and the update of WCT will also change the linked list of WCT entry, in order to ensure the consistency of L2P mapping, FW does not allow the update of new L2P mapping to WCT during the table entry replacement process.
[0058] Because the FW is not allowed to update the new L2P mapping to the WCT during the table entry replacement, the host write (HostWrite) process is suspended at this time. In order to prevent the table entry replacement time from being too long and causing fluctuations in write performance, the existing solution does not replace all the data in the WCT after executing a table entry replacement process. The table entry replacement strategy of the existing solution is: when the number of available entries in the WCT is less than a certain threshold (such as the number of remaining WCT nodes only allows the FW to perform a host write operation to update the number of L2Ps required), the table entry replacement task is triggered. The replaced WCT entry will be released during the table entry replacement process. When the number of available WCT entries exceeds a certain threshold, the current table entry replacement task ends. Because the replaced WCT will be released in real time during the table entry replacement, the link relationship of the WCT will be destroyed, making it impossible for the FW to perform a table lookup operation during the table entry replacement, that is, the host read process is suspended at this time.
[0059] When the host issues a random write operation command, only one L2P mapping can be stored in a WCT entry. It is easy for the WCT to have no remaining space to store new L2P mappings, so the frequency of table entry replacement will become very high. The FW behavior at this time can be regarded as a combination of the host write operation (Host Write) and the table entry replacement operation (Table Flush). Figure 3 As shown, during the process of the SSD executing the host operation command (read-write test / RW test), if the WCT 131 storage space is full, the process of the SSD executing the operation command is that the host write operation and the table entry replacement operation appear alternately.
[0060] The data written by the host will first be prepared in the write cache of the SSD. To ensure the accuracy of the data, the FW will update the WCT only when it writes the data in the write cache to the NAND. Therefore, during the table entry replacement, the WCT is not allowed to be updated, so the FW will not write the data in the write cache to the NAND at this time. In this scenario, the relationship between the NAND bandwidth usage and time during the table entry replacement is as follows: Figure 4 shown.
[0061] Among them, when performing a small-scale RW test, when triggering table entry replacement, the number of WCT entries linked to the logical page set corresponding to the secondary mapping table that needs to be replaced is large, and it takes a long time to update the L2P mapping in the WCT to the corresponding secondary mapping table.
[0062] In summary, the existing solutions have the following defects:
[0063] 1) When the host performs random writes in a small LBA range, the current solution cannot fully utilize the NAND bandwidth, so that the random write performance of the host does not reach the optimal value.
[0064] 2) The FW is not allowed to query the L2P mapping during the table entry replacement, resulting in a certain impact on the host's read performance during the host's mixed read and write operations.
[0065] In view of the above problems, the present application proposes a table entry management method for a solid state drive.
[0066] The specific implementation of the present application is further described in detail below in conjunction with the drawings and examples.
[0067] Figure 5 A schematic diagram of table entry storage of a solid state drive according to an embodiment of the present invention is shown; Figure 6 A flowchart of table entry updating and table entry replacement in a table entry management method of a solid state drive according to an embodiment of the present invention is shown.
[0068] refer to Figure 5 Combined with Figure 1 In the solid state drive SSD of the present application, the SRAM part is improved. The SRAM 230 includes three areas, namely a first storage area 231, a second storage area 232 and a third storage area 233.
[0069] The first storage area 231 is a storage area for the first-level mapping table; the second storage area 232 and the third storage area 233 are storage areas for part of the second-level mapping table. Specifically, the second storage area 232 and the third storage area 233 are areas for storing the cache table WCT. For the convenience of description, the second storage area 232 contains the first cache table, also called WCT[0], and the third storage area 233 contains the second cache table, also called WCT[1].
[0070] In this embodiment, since the second storage area 232 and the third storage area 233 store a cache table respectively, in order to facilitate the management of the mapping information corresponding to the newly written data, one of the WCT[0] of the second storage area 232 and the WCT[1] of the third storage area 233 is marked as the target cache table (Head WCT), that is, the mapping information corresponding to the newly written data will be recorded in the target cache table. When the new mapping information recorded in the target cache table is full, the empty cache table in the other storage area will be marked as the target cache table. The mark of the target cache table is alternated in WCT[0] and WCT[1], and the mark of the target cache table can only correspond to one cache table at the same time.
[0071] refer to Figure 5In the initial state, WCT[0] in the second storage area 232 is marked as the target cache table, and the mapping information corresponding to the newly written data will be recorded in WCT[0] until WCT[0] is full and cannot store new mapping relationships. Then, the target cache table mark of WCT[0] is canceled, and WCT[1] is marked as the target cache table, so that the mapping information corresponding to the newly written data will be recorded in WCT[1].
[0072] Furthermore, when one of WCT[0] and WCT[1] is full of new mapping relationships, a table entry replacement operation is performed, that is, the secondary mapping table corresponding to the full WCT is read from the flash memory 140, the new L2P mapping in the full WCT is updated to the read secondary mapping table, and the updated secondary mapping table is written to the flash memory 140.
[0073] In this embodiment, since there are two WCTs, the firmware (FW) is allowed to process the write command issued by the host 10 during the table entry replacement, and the firmware will update the newly updated L2P mapping into the target cache table.
[0074] by Figure 5 As shown in the example, assume that the current WCT[0] is full, and the logical page set 4 in the primary table points to WCT[0]. When the table entry is replaced, the secondary mapping table corresponding to the logical page set 4 will be read from the flash memory 140 to the SRAM 230, and the L2P mapping stored in the WCT entry pointed to by the logical page set 4 will be updated to the read secondary mapping table. At the same time, if the logical page address corresponding to the newly written data of the host 10 belongs to the logical page set 4, then the L2P mapping corresponding to these data will be updated to the target cache table label at this time, that is, WCT[1].
[0075] Figure 6 A flowchart of table entry update and table entry replacement in an embodiment of the present application is shown, and the specific steps include:
[0076] Step S101: WCT update task starts.
[0077] Step S102: Receive L2P information to be updated.
[0078] In this step, the control module 120 of the SSD receives a write operation command sent from the host, and receives L2P information to be updated corresponding to the write operation command.
[0079] The L2P information to be updated includes at least the mapping relationship between the L2P to be updated and the primary mapping table, and the mapping relationship between the secondary mapping table and data. The mapping relationship between the L2P to be updated and the primary mapping table is, for example, the logical page set position of the L2P to be updated in the primary mapping table.
[0080] In this embodiment, the L2P information to be updated includes first L2P information to be updated and second L2P information to be updated. The first L2P information to be updated and the second L2P information to be updated are used to distinguish that the contents of the two L2P information to be updated are different.
[0081] Step S103: Determine whether the L2P information to be updated has a corresponding target mapping chain in the target cache table.
[0082] In this step, the control module 120 searches for the corresponding mapping chain in the target cache table in the SRAM 230. The mapping chain is the mapping relationship between the L2P to be updated and the first-level mapping table. The mapping chain is, for example, the position where the second-level mapping table appears in the logical page set of the first-level mapping table.
[0083] For example, Figure 5 In the illustrated embodiment, the mapping chain corresponding to the L2P information to be updated is the logical page set 0 of the first-level mapping table, and the control module 120 first searches the target cache table for a mapping chain corresponding to the logical page set 0.
[0084] The existence of the mapping chain enables each L2P information to be updated to be correctly written into the corresponding storage block of the flash memory 140 in the subsequent table entry replacement operation, and also reduces the probability of read errors in subsequent read operations.
[0085] In this step, if the corresponding mapping chain exists in the target cache table, step S105 is executed; if the corresponding mapping chain does not exist in the target cache table, step S104 is executed.
[0086] Step S104: Apply for a new mapping chain from the target cache table.
[0087] In this step, if the target cache table does not have a mapping chain corresponding to the L2P information to be updated, it is necessary to apply for a new mapping chain in the target cache table and mark it as the mapping chain corresponding to the L2P information to be updated, so as to facilitate the subsequent writing of the L2P information to be updated into the target cache table and the replacement of the table entries.
[0088] refer to Figure 5 If the mapping chain corresponding to the L2P information to be updated is the logical page set 1 of the first-level mapping table, since the target cache table does not have the mapping chain corresponding to the L2P information to be updated, it is necessary to first apply for a new mapping chain in the target cache table and mark it as corresponding to the logical page set 1 of the first-level mapping table, so that the L2P information to be updated can be written into the target cache table.
[0089] Step S105: Count the number A of mapping chains in the target cache table and the number B of mapping chains that have been replaced in another cache table.
[0090] In order to execute the table entry replacement and table entry update operations simultaneously, the relative speed of the table entry replacement and the table entry update needs to be controlled.
[0091] In this step, the number of updated mapping chains in the target cache table is recorded, which is recorded as number A, and the number of mapping chains replaced in the cache table for entry replacement is recorded as number B.
[0092] Step S106: Determine whether the number A of mapping chains in the target cache table is greater than the number B of mapping chains that have been replaced in another cache table.
[0093] In this step, it is determined whether the number of mapping chains A in the target cache table is greater than the number of mapping chains B replaced in another cache table. If A is greater than B, step S109 is executed; if A is not greater than B, step S107 is executed.
[0094] Step S107: Update the L2P information to be updated to the mapping chain corresponding to the target cache table.
[0095] In this step, if the target cache table has a mapping chain corresponding to the L2P information to be updated, and since the number of mapping chains A in the target cache table is not greater than the number of mapping chains B that have been replaced in another cache table, it means that the speed of table entry update does not exceed the speed of table entry replacement, so the L2P information to be updated can be directly updated to the corresponding mapping chain.
[0096] refer to Figure 5 If the mapping chain corresponding to the L2P information to be updated is the logical page set 0 of the first-level mapping table, since the target cache table already has the mapping chain corresponding to the L2P information to be updated, the L2P information to be updated can be directly written into the target cache table.
[0097] Step S108: Return update success.
[0098] A successful update notification is returned to the host.
[0099] Step S109: Return update failure.
[0100] Returns update failure notification to the host.
[0101] Step S110: Determine whether the target cache table is full.
[0102] In this step, the control module 120 checks whether the target cache table is full. For example, it can be determined by judging whether there is any free storage space in the storage area corresponding to the target cache table. Alternatively, a threshold number of times the L2P information to be updated is recorded in WCT[0] and WCT[1] can be pre-set, and whether the target cache table is full can be determined by counting the number of writes to the target cache table.
[0103] In this step, if the target cache table is already full, step S111 is executed; if the target cache table is not full, step S113 is executed.
[0104] Step S111: mark another cache table as a target cache table.
[0105] In this step, once it is determined that the target cache table is full, another cache table is marked as the target cache table, and the subsequent L2P information to be updated will be written into the new target cache table.
[0106] Step S112: triggering the entry replacement task.
[0107] In this step, since there is a full cache table, the entry replacement task is triggered, and the control module 120 controls the information in the full cache table to be updated to the flash memory 140 .
[0108] Step S113: The WCT update task is completed.
[0109] When all the L2P information to be updated has been updated to the target cache table, and the target cache table is not yet full, the current table entry update task is completed and the next table entry update task is awaited.
[0110] In this embodiment, as the WCT update task is continuously performed, after a cache table is full, the entry replacement process is triggered. Because two cache tables are used to alternately store new L2Ps, when a full cache table is performing entry replacement, the newly updated L2P mapping can be stored in the target cache table (another cache table).
[0111] When all entries in the cache table involved in the entry replacement are replaced, the contents of the cache table can be completely cleared so that after the target cache table (another cache table) is full, it can be used as a new target cache table to store new L2P mappings.
[0112] In order to synchronize the operations of the two cache tables (one WCT is performing table entry replacement, and the other WCT is performing table entry update), the relative speed of table entry replacement and table entry update needs to be controlled. Record the number of updated mapping chains in the target cache table, recorded as quantity A, and the number of replaced mapping chains in the cache table for table entry replacement, recorded as quantity B. When the firmware is ready to update the full cache table, it will first determine the size of quantity A and quantity B. When quantity A is greater than quantity B, that is, the speed of table entry update exceeds the speed of table entry replacement, the cache table update is not allowed.
[0113] In this embodiment, because the cache table can be updated and replaced simultaneously when entry replacement is triggered, the flash memory bandwidth utilization rate is improved, so entry replacement will not have too great an impact on write performance.
[0114] Furthermore, since there are two cache tables in the present application, after the table entry replacement task is triggered, the entire cache table content is allowed to be replaced, and the cache table will not be cleared until the replaced secondary mapping table is rewritten to the flash memory. During the table entry replacement of the cache table, the new L2P information is recorded in the target cache table. Therefore, before the replacement of the secondary mapping table in the full cache table is completed and written to the flash memory, the link relationship of the cache table will not change, so during the execution of the table entry replacement, the firmware is allowed to perform the host read operation.
[0115] Further, in Figure 6 In the illustrated embodiment, because the L2P mapping corresponding to the newly written data is always updated to the target cache table, the mapping relationship in the target cache table is always the latest.
[0116] Figure 7 A flow chart of an entry reading phase in an entry management method for a solid state drive according to an embodiment of the present invention is shown.
[0117] In this embodiment, when a logical page set in the first-level mapping table points to both WCT[0] and WCT[1], when performing a table lookup, it is necessary to first query the target cache table. If the required mapping is not found in the target cache table, then query another cache table.
[0118] The flowchart for querying L2P mapping is as follows Figure 7 As shown, the specific steps are as follows:
[0119] Step S301: Query whether the L2P task is started.
[0120] Step S302: Receive the LAA to be queried.
[0121] In this step, the control module 120 receives the read operation command sent by the host, and receives the LAA to be queried corresponding to the read operation, where LAA (Logical AU Address) is a logical allocation unit address.
[0122] Step S303: Calculate the primary logical address corresponding to the LAA to be queried.
[0123] In this step, the control module 120 calculates the first-level logical address according to the LAA to be queried, and queries the corresponding logical page set of the first-level mapping table according to the first-level logical address to perform an accurate query.
[0124] In this embodiment, since a two-level mapping scheme is adopted, it is necessary to find the location of the second-level mapping table in the first-level mapping table according to the first-level logical address, and then obtain the physical address according to the second-level logical address in the second-level mapping table.
[0125] In the secondary mapping management solution, the primary mapping table stores the address of the secondary mapping table in the flash memory or the address of the SRAM, that is, the location of the secondary mapping table can be found through the primary mapping table. The secondary mapping table directly stores the mapping of the user data logical address to the flash memory physical address.
[0126] Step S304: query the first-level mapping table according to the first-level logical address.
[0127] In this step, the corresponding logic page set of the first-level mapping table is queried according to the calculated first-level logical address to obtain the logical address of the second-level mapping table.
[0128] Step S305: Determine whether the first-level mapping table points to the cache table.
[0129] Since in the secondary mapping management solution, a small portion of the secondary mapping table is stored in the SRAM 230 and most of it is stored in the flash memory 140, the small portion of the secondary mapping table in the SRAM 230 is the portion with a higher usage frequency.
[0130] In this step, for example, assuming that the LAA to be queried belongs to a more frequently used part, and since there are two cache tables in this application, this step is used to determine whether the logical address of the secondary mapping table obtained according to the first-level mapping table points to at least one of the two cache tables located in the SRAM.
[0131] In addition, since the information stored in the cache table is the latest information relative to the information stored in the flash memory, it is also necessary to first start the query from the cache table when reading, which can ensure that the queried information is the latest updated information.
[0132] In this embodiment, if the first-level mapping table points to the cache table, step S306 is executed; if the first-level mapping table does not point to the cache table, step S310 is executed.
[0133] Step S306: query the mapping chain of the target cache table.
[0134] Since the first-level mapping table points to two cache tables, and the information stored in the target cache table is the latest relative to the other cache table, it is necessary to query the target cache table first.
[0135] refer to Figure 5 In the illustrated embodiment, since WCT[1] is the target cache table, when the first-level mapping table points to two cache tables at the same time, WCT[1] is queried first.
[0136] Step S307: Determine whether the query is successful.
[0137] In this step, it is determined whether the target information is found in the target cache table. If the query is successful, step S312 is executed; if the query is not successful, step S308 is executed.
[0138] Step S308: query the mapping chain of another cache table.
[0139] Since the target information is not found in the target cache table, it is necessary to query from another cache table.
[0140] refer to Figure 5 In the illustrated embodiment, since WCT[1] is the target cache table, the first-level mapping table points to two cache tables at the same time, and if the target information is not found in WCT[1], it is necessary to query WCT[0].
[0141] Step S309: Determine whether the query is successful.
[0142] In this step, it is determined whether the target information is found from another cache table. If the search is successful, step S312 is executed; if the search is not successful, step S310 is executed.
[0143] Step S310: Determine whether the first-level mapping table points to the flash memory.
[0144] In this step, since the information corresponding to the LAA to be queried is not found in the cache table in SRAM 230, it is further determined whether the first-level mapping table points to the flash memory 140. If the first-level mapping table points to the flash memory, step S311 is executed; if the first-level mapping table does not point to the flash memory, step S313 is executed.
[0145] Step S311: Obtain the corresponding mapping relationship from the flash memory.
[0146] In this step, since the information corresponding to the LAA to be queried is stored in the flash memory, the flash memory is required to obtain the information corresponding to the LAA to be queried.
[0147] Step S312: Return the queried PAA.
[0148] In this step, the corresponding information stored in the secondary mapping table is returned to the host.
[0149] Step S313: Return invalid data.
[0150] Since the secondary mapping tables in SRAM and flash memory did not find the information corresponding to the LAA to be queried, it is considered that the data corresponding to the LAA to be queried is not stored in the flash memory, and invalid data (such as returning all 0 data) is returned to the host to alert the host.
[0151] Step S314: Query whether the L2P task is completed.
[0152] The table entry management method of the solid-state hard disk provided in the present application uses two cache tables (WCT) at the same time, one for normal host write operations, and the other for table entry replacement during table entry replacement tasks, so that the solid-state hard disk of the present application does not affect the read and write operation tasks issued by the host when performing table entry replacement tasks.
[0153] The table entry management method of the solid-state hard disk provided in the present application includes two cache tables, one for host write operations and the other for table entry replacement of table entry replacement tasks. This not only allows the table entry replacement tasks to be executed synchronously with the host write operations, but also improves the NAND bandwidth utilization of the solid-state hard disk, thereby reducing the impact of the table entry replacement tasks on the random write performance of the host.
[0154] The table entry management method of the solid-state hard disk provided in the present application does not change the link relationship in the WCT before the table entry replacement of the secondary mapping table is completed and written to the NAND, so that the table entry replacement task and the host read operation can also be executed synchronously, and the host's read performance is less affected by the table entry replacement.
[0155] The embodiments of the present application are described above, and these embodiments do not describe all the details in detail, nor do they limit the application to the specific embodiments described. Obviously, many modifications and changes can be made based on the above description. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can make good use of the present application and the modifications based on the present application. The present application is only limited by the claims and their full scope and equivalents.
Claims
1. A method for managing table entries of a solid state drive, characterized in that: The SRAM of the solid state drive includes a first cache table and a second cache table, and the table entry management method includes: Marking the first cache table as a target cache table and writing the first L2P information to be updated into the target cache table; When the target cache table is full, a table entry replacement operation is triggered, wherein the table entry replacement operation is to update the L2P information in the target cache table to the flash memory; Wherein, while executing the table entry replacement operation, the second cache table is marked as a target cache table for storing the second L2P information to be updated.
2. The table entry management method according to claim 1, wherein: The method further includes: the first cache table and the second cache table are alternately marked as target cache tables.
3. The table entry management method according to claim 2, wherein: The step of alternately marking the first cache table and the second cache table as target cache tables comprises: Receiving first L2P information to be updated; Writing the first L2P information to be updated into the target cache table; Determine whether the target cache table is full; When the target cache table is full, marking the second cache table as the target cache table; receiving second L2P information to be updated; Writing the second L2P information to be updated into the target cache table; Determine whether the target cache table is full; When the target cache table is full, the first cache table is marked as the target cache table.
4. The table entry management method according to claim 3, wherein: The step of writing the L2P information to be updated into the target cache table comprises: Determine whether there is a mapping chain corresponding to the L2P information to be updated in the target cache table; If so, writing the L2P information to be updated into the corresponding mapping chain of the target cache table; If it does not exist, a new mapping chain is applied from the target cache table as the corresponding mapping chain, and the L2P information to be updated is written into the corresponding mapping chain of the target cache table.
5. The table entry management method according to claim 4, wherein: The step of determining whether there is a mapping chain corresponding to the L2P information to be updated in the target cache table and writing the L2P information to be updated into the mapping chain corresponding to the target cache table further includes: Counting the number A of mapping chains in the target cache table and the number B of mapping chains that have been replaced by entries in another cache table; Determine whether A is greater than B; If not, the L2P information to be updated is written into the mapping chain corresponding to the target cache table.
6. The table entry management method according to claim 5, wherein: When A is greater than B, a prompt indicating that the update failed is returned.
7. The table entry management method according to claim 1, wherein: While executing the entry replacement operation, a read operation is performed.
8. The table entry management method according to claim 7, wherein: The steps to perform a read operation include: Receiving the LAA to be queried; Calculate the primary logical address corresponding to the LAA to be queried; Querying a first-level mapping table according to the first-level logical address; Determine whether the first-level mapping table points to a cache table; If yes, query the mapping chain of the cache table and determine whether the query is successful; If the query is successful, the queried PAA is returned.
9. The table entry management method according to claim 8, wherein: The steps of querying the mapping chain of the cache table and determining whether the query is successful include: Query the mapping chain of the target cache table and determine whether the query is successful; If the query is successful, the queried PAA is returned.
10. The table entry management method according to claim 9, wherein: Also includes: If the target cache table is not queried successfully, query the mapping chain of another cache table and determine whether the query is successful; If the query is successful, the queried PAA is returned.
11. The table entry management method according to claim 10, wherein: Also includes: If the other cache table is not queried successfully, the flash memory is queried.
12. The table entry management method according to claim 8, wherein: If the first-level mapping table does not point to the cache table, the flash memory is queried.
13. The table entry management method according to claim 11 or 12, wherein: The steps to query the flash memory include: Determine whether the first-level mapping table points to the flash memory; If yes, obtaining the required mapping relationship from the flash memory; Returns the queried PAA.
14. A table entry management device for a solid state hard disk, characterized in that: It comprises a control module and an SRAM, and is used to execute the table entry management method as described in any one of claims 1 to 13.
15. A solid state hard disk, characterized in that: It comprises a flash memory and the entry management device as claimed in claim 14.
