Cache method, device and computer readable storage medium of l2p table data
By dividing L2P table data into static and dynamic management types and using hash tables and cache control tables for management, the problem of HMB access strategies being unable to balance static and dynamic management is solved, thereby improving the read and write performance and data operation management efficiency of solid-state drives.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- YEESTOR MICROELECTRONICS CO LTD
- Filing Date
- 2023-12-28
- Publication Date
- 2026-07-21
AI Technical Summary
Existing HMB access strategies struggle to balance the static management of low-frequency file system areas accessed in SSDs with the dynamic management of real-time dynamic read/write areas, impacting read/write performance and data operation management.
By dividing L2P table data into static and dynamic management types and storing them in different areas of the HMB, and using hash tables and cache control tables for management, dynamic and static data storage strategies are implemented.
It improves the read and write performance and data operation and management efficiency of solid-state drives, takes into account both static and dynamic management needs, and enhances the overall performance of the system.
Smart Images

Figure CN117908784B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of solid-state drives, and more particularly to a method, apparatus, and computer-readable storage medium for caching L2P table data. Background Technology
[0002] For PCIe (Peripheral Component Interconnect express) solid-state drives (SSDs) that do not have built-in DRAM (Dynamic Random Access Memory), a portion of the host system's memory is typically used to store the data needed for control algorithms, thereby improving the SSD's read / write performance and managing data operations. This technology is called HMB (Host Memory Buffer).
[0003] Current HMB access strategies typically utilize limited memory for random reads. However, this approach struggles to balance the static management of low-frequency access file system areas with the dynamic management of real-time dynamic read / write areas, thus impacting the read / write performance and data management operations of solid-state drives.
[0004] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention
[0005] The main objective of this invention is to provide a method, device, and computer-readable storage medium for caching L2P table data. This invention aims to solve the technical problem that current HMB access methods cannot simultaneously handle the static management of low-frequency access file system areas and the dynamic management of real-time dynamic read / write areas, which in turn affects the read / write performance and data management operations of solid-state drives.
[0006] To achieve the above objectives, the present invention provides a method for caching L2P table data, the method comprising the following steps:
[0007] Upon receiving L2P table data, determine the table number and management type of the L2P table data;
[0008] When the management type is a static L2P table, the L2P table data is stored in the first HMB sub-region based on the table number and the static management area base address.
[0009] When the management type is dynamic L2P table, the storage unit of the L2P table data in the second HMB sub-region is determined according to the table sequence number and the cache control table, and the L2P table data is stored in the storage unit.
[0010] Optionally, when the management type is a dynamic L2P table, the step of determining the storage unit of the L2P table data in the second HMB sub-region based on the table sequence number and the cache control table, and storing the L2P table data in the storage unit includes:
[0011] Based on the table sequence number, the corresponding hash value is determined by hash function calculation;
[0012] The hash value is used to confirm whether a valid record exists based on the hash table.
[0013] If no valid record exists, an empty storage slot in the dynamic management area is selected as the storage unit based on the cache control table;
[0014] The L2P table data is written to the storage unit, and the cache control table and the hash table are updated based on the slot number of the storage unit, the table sequence number, and the hash value.
[0015] Optionally, after the step of confirming whether a valid record exists in the hash value based on the hash table, the method further includes:
[0016] If a valid record exists, determine the cache index value of the valid record;
[0017] Based on the cache index value, look up the corresponding slot number in the cache control table;
[0018] The storage slot corresponding to the slot number is used as the storage unit, and the data to be managed is written into the storage unit.
[0019] Optionally, before the step of using the storage slot corresponding to the slot number as the storage unit and writing the data to be managed into the storage unit, the method further includes:
[0020] Based on the cache index value, the initial table sequence number is found in the cache control table;
[0021] When the initial table sequence number is the same as the table sequence number, the hash link field of the row where the cache index value is located in the cache control table is filled with a preset field;
[0022] When the initial table sequence number is different from the table sequence number, the last cache entry corresponding to the hash value is found based on the cache control table, and the hash link field in the cache entry is filled with the cache index value.
[0023] Optionally, after the step of determining the storage unit of the L2P table data in the second HMB sub-region based on the table sequence number and the cache control table when the management type is a dynamic L2P table, and storing the L2P table data in the storage unit, the method further includes:
[0024] Upon receiving LBA data, the corresponding lookup table number is determined based on the LBA data;
[0025] The hash value corresponding to the table number to be looked up is determined by hash operation, and the presence of a valid record is searched based on the hash value.
[0026] If no valid record exists, load the L2P table corresponding to the lookup table number from the NAND flash memory according to the lookup table number;
[0027] Based on the mapping relationship of the L2P table, determine the physical address corresponding to the LBA data;
[0028] A read command is generated based on the physical address and sent to the NAND flash memory in response to a command to read data stored at the physical address.
[0029] Optionally, after the step of determining the hash value corresponding to the sequence number of the table to be searched through hash operation, and searching for a valid record based on the hash value, the method further includes:
[0030] If the valid record exists, the target storage unit where the L2P table corresponding to the lookup table number is located is confirmed in the cache entry of the cache control table;
[0031] Determine the offset of the target storage unit, and based on the offset of the target storage unit and the mapping relationship of the L2P table, determine the physical address corresponding to the LBA data;
[0032] A read command is generated based on the physical address and sent to the NAND flash memory in response to a command to read data stored at the physical address.
[0033] Optionally, the step of confirming the target storage unit where the L2P table corresponding to the lookup table sequence number is located in the cache entry of the cache control table if the valid record exists includes:
[0034] Based on the cache index value corresponding to the valid record item, the corresponding stored table number is confirmed in the cache control table;
[0035] Determine whether the table sequence number matches the table sequence number to be searched;
[0036] If they are inconsistent, based on the field value of the hash link field of the cache entry containing the table number, search for the next cache entry until a table number that is the same as the table number to be queried is found.
[0037] If they match, determine the slot number of the cache entry containing the table sequence number;
[0038] The storage unit corresponding to the slot number is used as the target storage unit.
[0039] Optionally, after the step of storing the L2P table data into the first HMB sub-region based on the table number and the static management region base address when the management type is a static L2P table, the method further includes:
[0040] Upon receiving LBA data, determine the corresponding table sequence number for the LBA data;
[0041] The L2P table address corresponding to the table number is determined based on the base address of the static management area, the table number, the starting table number of the static area, and the table data size.
[0042] Based on the mapping relationship of the L2P table addresses, determine the physical address corresponding to the LBA data.
[0043] In addition, to achieve the above objectives, the present invention also provides an L2P table data caching device, the device comprising: a memory, a processor, and an L2P table data caching program stored in the memory and executable on the processor, the L2P table data caching program being configured to implement the steps of the L2P table data caching method described above.
[0044] In addition, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a caching program for L2P table data, wherein the L2P table data caching program, when executed by a processor, implements the steps of the L2P table data caching method as described above.
[0045] This invention provides a method, device, and computer-readable storage medium for caching L2P table data. Upon receiving L2P table data, the method determines the table number and management type. If it is a static L2P table, it stores the data in a first HMB sub-region based on the table number and the base address of the static management area. If it is a dynamic L2P table, it determines the storage unit in a second HMB sub-region based on the table number and the cache control table, and stores the data in that unit. These steps simultaneously address both dynamic and static management of L2P table data, while also facilitating the location of L2P table data within the HMB region. Attached Figure Description
[0046] Figure 1 This is a flowchart illustrating the first embodiment of the L2P table data caching method of the present invention;
[0047] Figure 2 This is a flowchart illustrating the second embodiment of the L2P table data caching method of the present invention;
[0048] Figure 3 This is a flowchart illustrating the third embodiment of the L2P table data caching method of the present invention;
[0049] Figure 4 This is a schematic diagram of the connection structure between the HMB area and the host and solid-state drive in the first embodiment of the present invention;
[0050] Figure 5 This is a schematic diagram of the cache control table structure in the L2P table caching method of the present invention;
[0051] Figure 6 This is a schematic diagram of the hash table structure in the L2P table caching method of the present invention;
[0052] Figure 7 This is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiments of the present invention.
[0053] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0054] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0055] This invention provides a method for caching L2P tables, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of an L2P table caching method according to the present invention.
[0056] In this embodiment, the caching method for the L2P table includes:
[0057] Step S10: Upon receiving L2P table data, determine the table number and management type of the L2P table data.
[0058] In this embodiment, refer to Figure 4In a computer system, the host provides a memory block for a PCIe Solid State Drive (SSD). The SSD uses this memory to store data needed for its control algorithms, thereby improving its performance. This memory block is called the HMB (Hardware Block). The SSD firmware divides the HMB into slots, which are essentially storage units within the HMB. Each slot can store an L2P table. The SSD can directly access the L2P table data within the HMB via the PCIe bus. The SSD firmware is software embedded in the SSD controller, responsible for managing the read, write, and erase operations of the storage units. The L2P table (Logical to Physical Table) is a table used to store the mapping relationship between logical addresses and physical addresses, typically used to map logical addresses to addresses on the actual physical storage medium. When an application needs to read or write data at a specific logical address, it queries the L2P table to find the corresponding physical address based on the logical address, and then uses the physical address to perform the read or write operation on the actual storage medium. In communication between the processor and the solid-state drive (SSD), the host is responsible for accessing the L2P table in the HMB area. The host can send commands and data to the SSD via the PCIe bus, including reading or writing L2P table data in the HMB area. The SSD controller is responsible for managing and maintaining the L2P table; it collects and updates the mapping relationships in the L2P table to ensure correct data read and write operations.
[0059] When a host receives L2P table data, it can determine the table number and management type based on its attributes or tags. Static L2P table data may be marked as read-only, while dynamic L2P table data may be marked as writable. Furthermore, the table size and update method can also be used to determine the type. Static L2P tables are typically loaded into the cache at startup and maintain a fixed size, while dynamic L2P tables can dynamically adjust their size to adapt to changing data access patterns. Optionally, the management type of an L2P table can also be determined by observing its creation and destruction process. Static L2P tables are typically created at system startup and persist until system shutdown, while dynamic L2P tables may be dynamically created and destroyed as needed. The management type of an L2P table is usually determined by the SSD controller or operating system. Different controllers or operating systems may employ different management strategies and algorithms to maintain and manage L2P tables. Static L2P tables are suitable for read-intensive workloads where data access patterns are relatively stable and do not change significantly. Dynamic L2P tables are suitable for write-intensive workloads where data access patterns frequently change. Dynamic L2P tables can dynamically resize to adapt to constantly changing data access patterns.
[0060] In this embodiment, by determining the management type of L2P table data, it is easier to classify, store, and manage L2P table data of different management types in the future, so that the computer system can simultaneously take into account the dynamic and static management of the HMB area.
[0061] Step S20: When the management type is a static L2P table, the L2P table data is stored in the first HMB sub-region based on the table number and the static management area base address.
[0062] In this embodiment, the HMB area is divided into two regions. The first HMB sub-region is used for static management of L2P tables, storing the corresponding table data according to the L2P table order. The other region uses a dynamic management algorithm, storing the most recently used L2P tables in specific locations within the region according to a certain algorithm. When the SSD powers on, the L2P table data is pre-loaded into this space according to the table order. The dynamically loaded L2P address space does not overlap with the statically loaded L2P address space. When the L2P table data is updated, it is synchronously updated in the corresponding sub-region of the HMB. The division of the static and dynamic management regions is automatically completed by the firmware. When the firmware initializes the HMB, it automatically allocates the static management region to the last page or several pages of the host memory and creates the HMB metadata structure and L2P tables, as well as other data structures required by the firmware, within it. The size and number of the dynamic management regions can be determined by factors such as the host memory free capacity and firmware policies. The size and number of the dynamic management regions are dynamically changing; the firmware will decide whether to increase or decrease the number of DMA slots based on the current host memory free capacity and firmware policies to meet the needs of different application scenarios.
[0063] Furthermore, a mapping strategy needs to be formulated based on the size of the L2P table and the space size of the static management area to ensure that the L2P table data can be stored sequentially in the static management area. A direct mapping method can be used here, that is, storing the data into the static management area according to the index order of the L2P table. When the received L2P table data belongs to a static L2P table, it can be stored in the static management area according to the table sequence number and the base address of the static management area, ensuring that each table data is correctly stored and can be read efficiently. The addressing method for the table data in the static management area is as follows:
[0064] HmbOffset = Static management area base address + (table sequence number - static area starting table sequence number) * table size
[0065] Here, HmbOffset is the offset value relative to the starting address of the HMB, used to determine the specific location of table data in the HMB. The base address of the static management area is the starting address of the static management area. The table sequence number refers to the sequence number of the table to be accessed in the HMB. Each table corresponds to a logical address range used to cache data blocks in the storage device. The starting table sequence number of the static area is the sequence number of the first table in the HMB static management area. The table size is used to calculate the offset of the table data because the size of each table is fixed.
[0066] Furthermore, the timing of L2P table data updates in the static management area varies. One scenario involves loading L2P table data belonging to the static management area into the HMB static area by default during SSD power-on initialization. Another scenario, when L2P table data in the static management area is updated, involves two processing methods. The first is to calculate the L2P table sequence number based on the received LBN (Logical Block Address) data, locate the corresponding L2P table data position in the HMB cache using the L2P table sequence number, calculate the offset within the L2P table based on the LBN data, and update the corresponding data. The second method is to update it in a temporary L2P table, which is then written to the corresponding HMB static management area simultaneously when the temporary L2P table needs to be written back to the NAND Flash.
[0067] In this embodiment, by dividing a portion of the HMB space into a statically managed area and storing the corresponding table data in the order of the L2P table, the data reading speed and access efficiency are improved. This design can better utilize the characteristics of the HMB, accelerate data read and write operations, and improve system performance.
[0068] Step S30: When the management type is dynamic L2P table, determine the storage unit of the L2P table data in the second HMB sub-region according to the table number and cache control table, and store the L2P table data in the storage unit.
[0069] In this embodiment, when the management type is dynamic L2P table type, a dynamic management algorithm can be used to store it in a specific location within the dynamic management area. First, based on the table sequence number and the cache control table, the storage unit (slot) in the second HMB sub-region where the current L2P table data should be stored is calculated, and then it is stored in the corresponding storage unit. The storage unit of the L2P table data in the second HMB sub-region is determined, and the L2P table data is stored in that storage unit.
[0070] Furthermore, in this invention, the firmware maintains an HMB cache control table, referring to... Figure 5The HMB cache control table structure includes a cache index. Each cache line has a unique index that identifies its position in the cache. The index is an integer value ranging from 0 to the cache line number minus 1. The cache index allows for quick location of a specific cache line and retrieval of the corresponding data. It also includes an L2P table index, an HMB slot index, and a hash link field. The HMB slot number uniquely identifies a storage unit in the HMB, and the hash link field describes a linked list data structure based on a hash function. The hash function's calculation result allows for quick location of nodes with specific hash values. Therefore, when updating the HMB, if a collision occurs, the new table replaces the old table in the HMB. Simultaneously, the hash link field of the old table is found in the cache control table and linked to the cache index value of the new table in the cache control table. If no collision occurs, the hash link field is filled with the default field "0xffff". Additionally, the firmware manages a hash table, see [link to firmware]. Figure 6 The table includes hash values and cache indexes of the cache control table. Based on this table, there exists an expression: Hash(l2p_table_index) = cache index. In this expression, the L2P table index (l2p_table_index) serves as the input to the hash function, and the resulting cache index can be used to find the corresponding data in the cache.
[0071] For received L2P table data, a corresponding hash value is output based on its table sequence number. This hash value is used to check if a valid record exists in the hash table. If a valid record exists, meaning a corresponding cache index exists, this cache index is used to find the HMB slot number of the current L2P table data's storage unit in the HMB region in the cache control table. The data is then updated to the corresponding storage unit (slot). If no valid record exists, meaning this is the first time the L2P table has been stored in the HMB region, the cache control table is consulted to find an already occupied storage slot in the HMB region. A new storage unit or a storage unit that has not been updated for a long time is then allocated to store the L2P table data.
[0072] For dynamically managed HMB areas, data update timing is divided into two types. One type involves calculating the L2P table sequence number based on the LBN data upon receipt, locating the corresponding L2P table data's position in the HMB cache using this sequence number, calculating the offset within the L2P table based on the LBN data, and updating the corresponding data. The other type involves updating a temporary L2P table, which is then written to the corresponding dynamically managed HMB area simultaneously when the temporary L2P table needs to be written back to the NAND Flash.
[0073] In this embodiment, a cache control table and a hash table are added to record, update, and look up the storage status of the L2P table, thereby achieving dynamic management of the HMB dynamic management area. By using a hash algorithm to calculate the hash value of the L2P table sequence number, the storage location of the data in the HMB area can be obtained. When reading data, the same hash algorithm can be used for lookup, eliminating the need for a separate search, reducing memory consumption, and significantly improving random read performance. Due to the principles of temporal and spatial locality, the probability of collisions is low.
[0074] Furthermore, refer to Figure 2 In the second embodiment of the L2P table data caching method of the present invention, step S30 further includes the following steps:
[0075] Step S31: Determine the corresponding hash value by performing a hash function operation based on the table sequence number.
[0076] Step S32: Confirm whether there is a valid record for the hash value based on the hash table.
[0077] Step S33: If no valid record exists, select an empty storage slot in the dynamic management area as the storage unit based on the cache control table.
[0078] Step S34: Write the L2P table data into the storage unit, and update the cache control table and the hash table based on the slot number of the storage unit, the table sequence number and the hash value.
[0079] This invention divides the L2P table data in the dynamically managed area into three cases: the first case is when the currently updated L2P table data is stored for the first time; the second case is when the current L2P table data is updated and there is no conflict in the cache control table; and the third case is when the current L2P table data is updated, but there is a conflict in the cache control table. In this embodiment, for the case of storing L2P table data for the first time, the table sequence number is first hashed to obtain a hash value. Then, this hash value is used to search the hash table for a valid record (i.e., a cache index value). If no valid record is found, it means that the current L2P table data is stored for the first time. At this time, the cache control table can be searched to find the storage slots already occupied in the HBM area. Based on the previously pre-allocated storage slots, it can be determined which slots are currently unoccupied. The free slot with the smallest slot number is selected as its storage unit. If all slots are occupied, the cache control table can be used to find which slot has not been updated for a long time, and the slot with the longest period of no update is selected as the storage unit. Alternatively, in another feasible implementation, if the hash table does not store any records associated with a given hash value, the storage slot of the L2P table in the HMB area cannot be directly located. In this case, the starting address and size of the HMB dynamic management area can be determined by reading file system metadata or other information. Then, the hash value is divided by the size of the HMB area to obtain a remainder. This remainder is used as the storage slot number of the current L2P table data in the HMB area, and the L2P table data is stored in that storage slot. If the size of the HMB area is a power of 2, bitwise operations can be used to calculate the remainder, improving computational efficiency. After storage is complete, the cache control table will record the current storage status of the L2P table, including the cache index value, the table sequence number, the slot number, and the hash link field. The hash link field is filled with the preset field "0xffff", and the record corresponding to the current hash value in the hash table will also be modified to the cache index value. In subsequent processes, if the current L2P table is updated again, the cache index value in the valid entries is found by calculating the hash value, and the corresponding storage slot is found in the cache control table. Then, the old L2P table is replaced with the new L2P table.
[0080] It should be noted that when a hash table is initially defined, all hash value records (i.e., cache index values) are initially defined as invalid. As the L2P table data is stored and updated, the records in the hash table will also be modified accordingly and written to the cache index values.
[0081] Furthermore, when a valid record is found in the hash table using the hash value (i.e., the corresponding cache index value is found), the L2P table sequence number can be found in the cache control table using the cache index value. If the table sequence number stored in the cache control table is the same as the current L2P table sequence number, the corresponding storage slot number is further determined. The storage slot corresponding to this storage slot number is then used as the storage unit, and the new L2P table is directly overwritten and updated in that storage unit. In the third case, when a valid record is found in the hash table using the hash value, and the table sequence number stored in the table is found using the row cache index value, but this table sequence number is different from the current L2P table sequence number (i.e., a hash collision has occurred), the current L2P table data is copied to the storage unit corresponding to the storage slot number. Simultaneously, the cache control table needs to record the storage status of the current L2P table data, find the last record row with the conflicting hash value in the table, and modify its hash link field to the cache index value of the current L2P table in the cache control table. Alternatively, in another feasible implementation, the subsequent positions can be checked sequentially according to the collision resolution strategy of the hash table (such as linear probing, quadratic probing, etc.) until a storage unit matching the given table sequence number is found or an empty storage unit is encountered. After saving it to the storage unit, the last record row of the collision hash value is found in the table, and its hash link field is modified to the cache index value of the current L2P table in the cache control table.
[0082] In this embodiment, by providing a cache control table and using a hash function to calculate the cache index value for a given hash value, the storage location of L2P table data in the HMB dynamic management area can be determined. By maintaining the HMB cache control table, the firmware can control data transfer and caching between the SSD and host memory.
[0083] Reference Figure 3 The third embodiment of the L2P table data caching method of the present invention further includes the following steps after S30:
[0084] Step S40: Upon receiving LBA data, determine the corresponding lookup table number based on the LBA data.
[0085] Step S50: Determine the hash value corresponding to the sequence number of the table to be searched through hash operation, and search for a valid record based on the hash value.
[0086] Step S60: If no valid record exists, load the L2P table corresponding to the lookup table number from the NAND flash memory according to the lookup table number.
[0087] Step S70: Determine the physical address corresponding to the LBA data based on the mapping relationship of the L2P table.
[0088] Step S80: Generate a read command based on the physical address and send it to the NAND flash memory in response to the command to read the data stored at the physical address.
[0089] In this embodiment, when a data read operation is required from the dynamic management area of the HMB, a hash algorithm can be used to locate and search for the data. Furthermore, when LBA data is received, the corresponding L2P table sequence number is calculated from the address of the LBA data. This sequence number allows a search in the hash table to determine if a valid record exists. Confirming the existence of a valid record indicates whether the current LBA data has already been cached in the HMB area. If no valid record exists, there is no need to search in the HMB area; instead, the corresponding L2P table is loaded directly from the NAND Flash (a type of non-volatile memory) based on the table sequence number. The physical address of the LBA data is determined according to the mapping relationship in the L2P table, and then a command is sent to the NAND to retrieve the data stored at that physical address.
[0090] If a valid record exists in the hash table, the corresponding storage unit can be further searched in the cache control table using the cache index value in the hash table record. Furthermore, each row in the cache control table is called a cache entry. The cache control table is used to verify whether the table sequence number stored in the cache entry of the row containing the cache index value matches the table sequence number of the LBA data. If they match, the target storage unit where the L2P table corresponding to that table sequence number is actually located can be directly locked. If they do not match, the next cache entry in the linked list is searched through the hash link field until a cache entry with the same table sequence number is found, thus determining the target storage unit where the L2P table corresponding to that table sequence number is actually located. This is equivalent to determining the target storage unit where the LBA data is actually located. By calculating the offset of the target storage unit, the location of the storage unit in the HMB area can be determined. Next, based on the location of the storage unit, the offset of the LBA data in the storage unit can be calculated. Through the mapping relationship of the L2P table, the physical address corresponding to the LBA data can be finally determined, and a command can be sent to the NAND to retrieve the data stored at that physical address.
[0091] In this embodiment, dynamic management of the HMB (Host Management Block) dynamic management area is achieved by adding a cache control table and a hash table. By using a hash algorithm to calculate the hash value of the L2P table sequence number, the storage location of the data in that table within the HMB area can be obtained. When reading data, the same hash algorithm can be used for lookup, eliminating the need for a separate search, reducing memory consumption, and significantly improving random read performance. Due to the principles of temporal and spatial locality, the probability of collisions is low.
[0092] Reference Figure 7 , Figure 7 This is a schematic diagram of the L2P table data caching device structure in the hardware operating environment involved in the embodiments of the present invention.
[0093] like Figure 7 As shown, the L2P table data caching device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be a high-speed random access memory (RAM) or a stable non-volatile memory (NVM), such as a disk drive. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.
[0094] Those skilled in the art will understand that Figure 7 The structure shown does not constitute a limitation on the caching device for L2P table data and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0095] like Figure 7 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a data storage module, a network communication module, a user interface module, and a caching program for L2P table data.
[0096] exist Figure 7In the L2P table data caching device shown, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and memory 1005 in the L2P table data caching device of the present invention can be set in the L2P table data caching device, and the L2P table data caching device calls the L2P table data caching program stored in the memory 1005 through the processor 1001 and executes the following steps:
[0097] Upon receiving L2P table data, determine the table number and management type of the L2P table data;
[0098] When the management type is a static L2P table, the L2P table data is stored in the first HMB sub-region based on the table number and the static management area base address.
[0099] When the management type is dynamic L2P table, the storage unit of the L2P table data in the second HMB sub-region is determined according to the table sequence number and the cache control table, and the L2P table data is stored in the storage unit.
[0100] Furthermore, the L2P table data caching device, through processor 1001, calls the L2P table data caching program stored in memory 1005, and also performs the following steps:
[0101] Based on the table sequence number, the corresponding hash value is determined by hash function calculation;
[0102] The hash value is used to confirm whether a valid record exists based on the hash table.
[0103] If no valid record exists, an empty storage slot in the dynamic management area is selected as the storage unit based on the cache control table;
[0104] The L2P table data is written to the storage unit, and the cache control table and the hash table are updated based on the slot number of the storage unit, the table sequence number, and the hash value.
[0105] Furthermore, the L2P table data caching device, through processor 1001, calls the L2P table data caching program stored in memory 1005, and also performs the following steps:
[0106] If a valid record exists, determine the cache index value of the valid record;
[0107] Based on the cache index value, look up the corresponding slot number in the cache control table;
[0108] The storage slot corresponding to the slot number is used as the storage unit, and the data to be managed is written into the storage unit.
[0109] Furthermore, the L2P table data caching device, through processor 1001, calls the L2P table data caching program stored in memory 1005, and also performs the following steps:
[0110] Based on the cache index value, the initial table sequence number is found in the cache control table;
[0111] When the initial table sequence number is the same as the table sequence number, the hash link field of the row where the cache index value is located in the cache control table is filled with a preset field;
[0112] When the initial table sequence number is different from the table sequence number, the last cache entry corresponding to the hash value is found based on the cache control table, and the hash link field in the cache entry is filled with the cache index value.
[0113] Furthermore, the L2P table data caching device, through processor 1001, calls the L2P table data caching program stored in memory 1005, and also performs the following steps:
[0114] Upon receiving LBA data, the corresponding lookup table number is determined based on the LBA data;
[0115] The hash value corresponding to the table number to be looked up is determined by hash operation, and the presence of a valid record is searched based on the hash value.
[0116] If no valid record exists, load the L2P table corresponding to the lookup table number from the NAND flash memory according to the lookup table number;
[0117] Based on the mapping relationship of the L2P table, determine the physical address corresponding to the LBA data;
[0118] A read command is generated based on the physical address and sent to the NAND flash memory in response to a command to read data stored at the physical address.
[0119] Furthermore, the L2P table data caching device, through processor 1001, calls the L2P table data caching program stored in memory 1005, and also performs the following steps:
[0120] If the valid record exists, the target storage unit where the L2P table corresponding to the lookup table number is located is confirmed in the cache entry of the cache control table;
[0121] Determine the offset of the target storage unit, and based on the offset of the target storage unit and the mapping relationship of the L2P table, determine the physical address corresponding to the LBA data;
[0122] A read command is generated based on the physical address and sent to the NAND flash memory in response to a command to read data stored at the physical address.
[0123] Furthermore, the L2P table data caching device, through processor 1001, calls the L2P table data caching program stored in memory 1005, and also performs the following steps:
[0124] Based on the cache index value corresponding to the valid record item, the corresponding stored table number is confirmed in the cache control table;
[0125] Determine whether the table sequence number matches the table sequence number to be searched;
[0126] If they are inconsistent, based on the field value of the hash link field of the cache entry containing the table number, search for the next cache entry until a table number that is the same as the table number to be queried is found.
[0127] If they match, determine the slot number of the cache entry containing the table sequence number;
[0128] The storage unit corresponding to the slot number is used as the target storage unit.
[0129] Furthermore, the L2P table data caching device, through processor 1001, calls the L2P table data caching program stored in memory 1005, and also performs the following steps:
[0130] Upon receiving LBA data, determine the corresponding table sequence number for the LBA data;
[0131] The L2P table address corresponding to the table number is determined based on the base address of the static management area, the table number, the starting table number of the static area, and the table data size.
[0132] Based on the mapping relationship of the L2P table addresses, determine the physical address corresponding to the LBA data.
[0133] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0134] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0135] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0136] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method for caching L2P table data, characterized in that, The method for caching L2P table data includes the following steps: Upon receiving L2P table data, determine the table number and management type of the L2P table data; When the management type is a static L2P table, the L2P table data is stored in the first HMB sub-region based on the table number and the static management region base address. The L2P table address corresponding to the table number is determined according to the static management region base address, the table number, the static region starting table number, and the table data size. When the management type is dynamic L2P table, the storage unit for the L2P table data in the second HMB sub-region is determined according to the table sequence number and the cache control table, and the L2P table data is stored in the storage unit, including: Based on the table sequence number, the corresponding hash value is determined by hash function operation; based on the hash table, it is confirmed whether the hash value has a valid record; if the valid record exists, the cache index value of the valid record is determined; based on the cache index value, the corresponding slot number is found in the cache control table; the storage slot corresponding to the slot number is used as the storage unit, and the L2P table data is written into the storage unit.
2. The method for caching L2P table data as described in claim 1, characterized in that, After the step of confirming whether a valid record exists in the hash value based on the hash table, the method further includes: If no valid record exists, an empty storage slot in the dynamic management area is selected as the storage unit based on the cache control table; The L2P table data is written to the storage unit, and the cache control table and the hash table are updated based on the slot number of the storage unit, the table sequence number, and the hash value.
3. The method for caching L2P table data as described in claim 1, characterized in that, Before the step of using the storage slot corresponding to the slot number as the storage unit and writing the L2P table data into the storage unit, the method further includes: Based on the cache index value, the initial table sequence number is found in the cache control table; When the initial table sequence number is the same as the table sequence number, the hash link field of the row where the cache index value is located in the cache control table is filled with a preset field; When the initial table sequence number is different from the table sequence number, the last cache entry corresponding to the hash value is found based on the cache control table, and the hash link field in the cache entry is filled with the cache index value of the current L2P table in the cache control table.
4. The method for caching L2P table data as described in claim 1, characterized in that, When the management type is dynamic L2P table, after determining the storage unit of the L2P table data in the second HMB sub-region based on the table sequence number and the cache control table, and storing the L2P table data in the storage unit, the method further includes: Upon receiving LBA data, the corresponding lookup table number is determined based on the LBA data; The hash value corresponding to the table number to be looked up is determined by hash operation, and the presence of a valid record is searched based on the hash value. If no valid record exists, load the L2P table corresponding to the lookup table number from the NAND flash memory according to the lookup table number; Based on the mapping relationship of the L2P table, determine the physical address corresponding to the LBA data; A read command is generated based on the physical address and sent to the NAND flash memory in response to a command to read data stored at the physical address.
5. The method for caching L2P table data as described in claim 4, characterized in that, After the steps of determining the hash value corresponding to the sequence number of the table to be searched through hash operation, and checking whether there is a valid record item based on the hash value, the method further includes: If the valid record exists, the target storage unit where the L2P table corresponding to the lookup table number is located is confirmed in the cache entry of the cache control table; Determine the offset of the target storage unit, and based on the offset of the target storage unit and the mapping relationship of the L2P table, determine the physical address corresponding to the LBA data; A read command is generated based on the physical address and sent to the NAND flash memory in response to a command to read data stored at the physical address.
6. The method for caching L2P table data as described in claim 5, characterized in that, If a valid record exists, the step of confirming the target storage unit where the L2P table corresponding to the lookup table sequence number is located in the cache entry of the cache control table includes: Based on the cache index value corresponding to the valid record item, the corresponding stored table number is confirmed in the cache control table; Determine whether the table sequence number matches the table sequence number to be searched; If they are inconsistent, the next cache entry is searched based on the field value of the hash link field of the cache entry containing the table number, until a table number that is the same as the table number to be searched is found. If they match, determine the slot number of the cache entry containing the table sequence number; The storage unit corresponding to the slot number is used as the target storage unit.
7. The method for caching L2P table data as described in claim 1, characterized in that, When the management type is a static L2P table, after the step of storing the L2P table data into the first HMB sub-region based on the table serial number and the static management region base address, the method further includes: Upon receiving LBA data, determine the corresponding table sequence number for the LBA data; The L2P table address corresponding to the table number is determined based on the base address of the static management area, the table number, the starting table number of the static area, and the table data size. Based on the mapping relationship of the L2P table addresses, determine the physical address corresponding to the LBA data.
8. A caching device for L2P table data, characterized in that, The L2P table data caching device includes: a memory, a processor, and an L2P table data caching program stored in the memory and executable on the processor, wherein the L2P table data caching program is configured to implement the steps of the L2P table data caching method as described in any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a caching program for L2P table data, which, when executed by a processor, implements the steps of the L2P table data caching method as described in any one of claims 1 to 7.