CN117908784A - Caching method and equipment for L2P table data and computer readable storage medium - Google Patents

Caching method and equipment for L2P table data and computer readable storage medium Download PDF

Info

Publication number
CN117908784A
CN117908784A CN202311844787.5A CN202311844787A CN117908784A CN 117908784 A CN117908784 A CN 117908784A CN 202311844787 A CN202311844787 A CN 202311844787A CN 117908784 A CN117908784 A CN 117908784A
Authority
CN
China
Prior art keywords
data
sequence number
storage unit
hash
cache
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311844787.5A
Other languages
Chinese (zh)
Inventor
许铭霖
吴大畏
李晓强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Deyi Microelectronics Co ltd
Original Assignee
Deyi Microelectronics Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Deyi Microelectronics Co ltd filed Critical Deyi Microelectronics Co ltd
Priority to CN202311844787.5A priority Critical patent/CN117908784A/en
Publication of CN117908784A publication Critical patent/CN117908784A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses a caching method, equipment and a computer readable storage medium of L2P table data, wherein the caching method of the L2P table data comprises the following steps: when L2P table data is received, determining a table sequence number and a management type of the L2P table data; when the management type is a static L2P table, storing the L2P table data into a first HMB subarea based on the table sequence number and a static management area base address; and when the management type is a dynamic L2P table, determining a storage unit of the L2P table data in a second HMB subarea according to the table sequence number and the cache control table, and storing the L2P table data in the storage unit. Through the steps, dynamic management and static management of the L2P table data can be simultaneously considered, and the position of the L2P table data in the HMB area can be conveniently searched.

Description

Caching method and equipment for L2P table data and computer readable storage medium
Technical Field
The present invention relates to the field of solid state disks, and in particular, to a method and apparatus for caching L2P table data, and a computer readable storage medium.
Background
For PCIe (PERIPHERAL COMPONENT INTERCONNECT EXPRESS, high-speed serial computer expansion bus standard) solid state disks without a built-in DRAM (Dynamic Random Access Memory ), a part of the memory of the host system is generally used to replace the data needed by the DRAM storage control algorithm, so as to improve the read-write performance and manage the data operation of the solid state disk. This technique is known as HMB (Host Memory Buffer ).
The current access strategy of HMB generally uses limited random access of memory, but such a method is difficult to achieve both static management of a file system area with low frequency access and dynamic management of a system real-time dynamic read-write area, and thus the read-write performance and management data operation of the solid state disk are also affected.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present invention and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The invention mainly aims to provide a caching method, equipment and a computer readable storage medium of L2P table data, and aims to solve the technical problems that the current HMB access mode is difficult to consider the static management of a file system area with low-frequency access and the dynamic management of a system real-time dynamic read-write area, so that the read-write performance of a solid state disk and the management data operation are influenced.
In order to achieve the above object, the present invention provides a method for caching L2P table data, where the method for caching L2P table data includes the following steps:
when L2P table data is received, determining a table sequence number and a management type of the L2P table data;
When the management type is a static L2P table, storing the L2P table data into a first HMB subarea based on the table sequence number and a static management area base address;
And when the management type is a dynamic L2P table, determining a storage unit of the L2P table data in a second HMB subarea according to the table sequence number and the cache control table, and storing the L2P table data in the storage unit.
Optionally, when the management type is a dynamic L2P table, determining a storage unit of the L2P table data in the second HMB sub-area according to the table sequence number and the cache control table, and storing the L2P table data in the storage unit includes:
Determining a corresponding hash value through hash function operation according to the table sequence number;
Confirming whether a valid record item exists in the hash value or not based on a hash table;
if the effective record item does not exist, selecting an idle storage tank in the dynamic management area as the storage unit based on the cache control table;
And writing the L2P table data into the storage unit, and updating the cache control table and the hash table based on the slot number, the table sequence number and the hash value of the storage unit.
Optionally, after the step of confirming whether the hash value has a valid entry based on the hash table, the method further includes:
if the effective record item exists, determining a cache index value of the effective record item;
searching a corresponding slot number in the cache control table according to the cache index value;
And taking a storage groove corresponding to the groove number as the storage unit, and writing the data to be managed into the storage unit.
Optionally, before the step of taking 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:
Searching an initial table sequence number in the cache control table based on the cache index value;
When the initial table sequence number is the same as the table sequence number, filling a hash link field where the cache index value is located in the cache control table into a preset field;
And when the initial table sequence number is different from the table sequence number, searching a last cache entry corresponding to the hash value based on the cache control table, and filling a hash link field in the cache entry into the cache index value.
Optionally, when the management type is a dynamic L2P table, determining a storage unit of the L2P table data in the second HMB sub-area according to the table sequence number and the cache control table, and after the step of storing the L2P table data in the storage unit, further includes:
when LBA data is received, determining a corresponding serial number of a to-be-searched table according to the LBA data;
determining a hash value corresponding to the sequence number of the table to be searched through hash operation, and searching whether a valid record exists in the hash value or not based on a hash table;
If the effective record item does not exist, loading an L2P table corresponding to the table sequence number to be searched from the NAND flash memory according to the table sequence number to be searched;
determining a physical address corresponding to the LBA data according to the mapping relation of the L2P table;
And generating a read command based on the physical address and sending the read command to the NAND flash memory so as to respond to the command for reading the physical address storage data.
Optionally, after the step of determining the hash value corresponding to the serial number of the table to be searched through hash operation and searching whether the hash value has a valid record item based on the hash table, the method further includes:
If the effective record item exists, confirming a target storage unit where the L2P table corresponding to the sequence number of the table to be searched is located in a cache entry in the cache control table;
Determining the offset of the target storage unit, determining the physical address corresponding to the LBA data according to the offset of the target storage unit and the mapping relation of the L2P table;
And generating a read command based on the physical address and sending the read command to the NAND flash memory so as to respond to the command for reading the physical address storage data.
Optionally, if the valid entry exists, the step of confirming, in a cache entry in the cache control table, that the table number to be looked up corresponds to a target storage unit where the L2P table is located includes:
confirming a corresponding stored table sequence number in the cache control table based on the cache index value corresponding to the effective record item;
Judging whether the table sequence number is consistent with the table sequence number to be searched;
if the hash link fields are inconsistent, searching the next cache entry based on the field value of the hash link field of the cache entry where the table sequence number is located until the table sequence number which is the same as the sequence number to be searched;
If the table sequence numbers are consistent, determining the slot numbers of the cache entries where the table sequence numbers are located;
and taking the storage unit corresponding to the slot number as the target storage unit.
Optionally, when the management type is a static L2P table, after the step of storing the L2P table data into the first HMB sub-area based on the table sequence number and the static management area base address, the method further includes:
When LBA data is received, determining the LBA data and determining a corresponding table sequence number;
determining an L2P table address corresponding to the table sequence number according to the static management area base address, the table sequence number, the static area initial table sequence number and the table data size;
And determining the physical address corresponding to the LBA data according to the mapping relation of the L2P table address.
In addition, to achieve the above object, the present invention further provides a device for caching L2P table data, the device including: the system comprises a memory, a processor and a caching program of L2P table data stored on the memory and capable of running on the processor, wherein the caching program of the L2P table data is configured to realize the steps of the caching method of the L2P table data.
In addition, to achieve the above object, the present invention also provides a computer-readable storage medium having stored thereon a caching program of L2P table data, which when executed by a processor, implements the steps of the caching method of L2P table data as described above.
The embodiment of the invention provides a caching method, equipment and a computer readable storage medium for L2P table data, wherein when the L2P table data is received, the table sequence number and the management type of the current L2P table data are determined, if the L2P table is a static L2P table, the L2P table data are stored in a first HMB subarea according to the table sequence number and a static management area base address, and if the L2P table is a dynamic L2P table, a storage unit of the L2P table data in a second HMB subarea is determined according to the table sequence number and a caching control table, and the L2P table data are stored in the storage unit. Through the steps, dynamic management and static management of the L2P table data can be simultaneously considered, and the position of the L2P table data in the HMB area can be conveniently searched.
Drawings
FIG. 1 is a flowchart illustrating a first embodiment of a method for caching L2P table data according to the present invention;
FIG. 2 is a flowchart illustrating a second embodiment of a method for caching L2P table data according to the present invention;
FIG. 3 is a flowchart illustrating a third embodiment of a method for caching L2P table data according to the present invention;
FIG. 4 is a schematic diagram illustrating a connection structure between an HMB region and a host and a solid state disk according to a first embodiment of the present invention;
FIG. 5 is a schematic diagram of a cache control table in the cache method of the L2P table of the present invention;
FIG. 6 is a schematic diagram of a hash table in the method for caching L2P tables according to the present invention;
fig. 7 is a schematic diagram of a terminal structure of a hardware running environment according to an embodiment of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
An embodiment of the present invention provides a method for caching an L2P table, and referring to fig. 1, fig. 1 is a flow chart of a first embodiment of a method for caching an L2P table according to the present invention.
In this embodiment, the method for caching the L2P table includes:
step S10, when L2P table data is received, determining a table sequence number and a management type of the L2P table data.
In this embodiment, referring to fig. 4, in the computer system, a host (host) may provide a piece of memory for the PCIE Solid state disk (Solid STATE DRIVE, SSD), and the SSD may store data required by the control algorithm by using the piece of memory, so as to improve performance of the Solid state disk. This piece of memory is called HMB. The firmware of the solid state disk divides the HMB into a plurality of slots (slots), wherein the slots are equivalent to a storage unit of the HMB region, each unit can store an L2P table, and the SSD can directly access L2P table data in the HMB region through the PCIE bus. The firmware of the SSD is software embedded in the solid state disk controller and is responsible for managing the reading, writing and erasing operations of the storage unit. An L2P table (Logical to Physical Table) is a table that stores logical to physical address mappings, typically for mapping logical addresses to addresses on actual physical storage media. When the application program needs to read or write the data on a certain logic address, the L2P table is queried, the corresponding physical address is found in the L2P table according to the logic address, and then the data is read or written on the actual storage medium according to the physical address. In the communication between the processor and the solid state disk, the host is responsible for executing the access work of the L2P table in the HMB area. The host may send commands and data to the solid state disk over the PCIe bus, including reading or writing L2P table data in the HMB region. And the controller of the solid state disk is responsible for managing and maintaining the L2P table, and can collect and update the mapping relation in the L2P table so as to ensure correct data read-write operation.
When the host receives one L2P table data, the table number and the management type corresponding to the L2P table data can be determined by the attribute or the flag thereof, the static L2P table data may be marked as read-only, and the dynamic L2P table data may be marked as writable. In addition, the determination can be made by the size and updating mode of the table, the static L2P table is usually loaded into the cache at the time of starting and keeps a fixed size, and the dynamic L2P table can be dynamically sized to adapt to the continuously changing data access mode. Alternatively, the management type of the L2P table may also be determined by observing the creation and destruction processes of the table, the static L2P table is typically created at system start-up and exists until the system is shut down, and the dynamic L2P table may be dynamically created and destroyed as needed. The type of management to which the L2P table corresponds is typically determined by the solid state disk controller or operating system, and different controllers or operating systems may employ different management policies and algorithms to maintain and manage the L2P table. Static L2P tables are suitable for read-intensive workloads where the data access patterns are relatively stable and do not vary much. Dynamic L2P tables are suitable for write-intensive workloads, where data access patterns change frequently, and dynamic L2P tables can be dynamically resized to accommodate changing data access patterns.
In this embodiment, by determining the management type of the L2P table data, it is convenient to store and manage the L2P table data of different management types in a classified manner, so that the computer system can simultaneously consider dynamic management and static management of the HMB area.
And step S20, when the management type is a static L2P table, storing the L2P table data into a first HMB subarea based on the table serial number and the static management area base address.
In this embodiment, the present invention divides the HMB area into 2 areas, wherein the first HMB sub-area is used as static management of the L2P table, corresponding table data is stored according to the order of the L2P table, and the other area uses a dynamic management algorithm to store the L2P table that is used recently in a specific position in the area according to a certain algorithm. The l2p table data is loaded into the part of the space in the order of the table in advance when the solid-state disk is powered on. The dynamic loading L2P address space is not duplicated with the static loading L2P address space. When the L2P table data is updated, the data is synchronously updated into the subarea corresponding to the HMB. The division of the static management area and the dynamic management area is automatically accomplished by the firmware. When the firmware initializes the HMB, it automatically divides the static management area to the last page or pages of host memory and creates therein the HMB metadata structure and the data structures required by the firmware, such as the L2P table. The size and number of the dynamic management areas can be determined by the free capacity of the host memory and the firmware policy. The size and number of the dynamic management areas are dynamically changed, and the firmware can determine whether to increase or decrease the number of the DMA slots according to the current free capacity of the host memory and the firmware strategy so as to meet the requirements of different application scenes.
Further, a mapping policy needs to be formulated according to the size of the L2P table and the space size of the static management area, so as to ensure that the L2P table data can be sequentially stored in the static management area, where a direct mapping manner may be adopted, that is, sequentially stored in the space of the static management area according to the index order of the L2P table. When the received L2P table data belongs to the static L2P table, the L2P table data can be stored in the static management area according to the mapping strategy according to the table sequence number and the static management area base address, so that each table data is ensured to be correctly stored and can be efficiently read. And addressing of the static management area table data is performed according to the following expression:
HmbOffset = static management area base address + (table number-static area start table number) table size,
Wherein HmbOffset is an offset value relative to the starting address of the HMB for determining the specific location of the tabular data in the HMB. The static management area base address is the start address of the static management area. The table number refers to the number of the table to be accessed in the HMB, and each table corresponds to a logical address range for caching the data blocks in the storage device. The static area start table number is the number of the first table in the HMB static management area, and the table size is calculated because the size of each table is fixed.
In addition, the update timing of the L2P table data in the static management area is also classified into different cases, and one is that the L2P table data belonging to the static management area is loaded into the HMB static area by default upon power-up initialization of the solid-state disk. In another case, when the L2P table data in the static management area is updated, the first processing method is to calculate the L2P table sequence number according to the received LBN (logical block address) data, locate the corresponding L2P table data at the HMB cache location by the L2P table sequence number, then calculate the offset in the L2P table according to the LBN data, and update the corresponding data. The second is to update it to the temporary L2P table, and write back to NAND FLASH while re-centralizing the writing to the corresponding HMB static management area when the temporary L2P table needs to be written back to.
In this embodiment, the reading speed and the access efficiency of the data are improved by dividing a part of the space of the HMB into the statically managed areas and storing the corresponding table data in the order of the L2P table. The design can better utilize the characteristics of HMB, accelerate the read-write operation of data and improve the system performance.
And step S30, when the management type is a dynamic L2P table, determining a storage unit of the L2P table data in a second HMB subarea according to the table sequence number and the cache control table, and storing the L2P table data in the storage unit.
In this embodiment, when the management type is a dynamic L2P table type, a dynamic management algorithm may be used to store the management type in a specific location of the dynamic management area. Firstly, according to the table sequence number and the buffer control table, calculating which storage unit (slot) of the second HMB subarea the current L2P table data should be stored in, and then storing the current L2P table data into the corresponding storage unit. And determining a storage unit of the L2P table data in the second HMB subarea, and storing the L2P table data in the storage unit.
Further, in the present invention, the firmware maintains an HMB Cache control table, and referring to fig. 5, the table structure of the HMB Cache control table includes a Cache index value (Cache index), and each Cache line has a unique index for identifying the location of the Cache line in the Cache, where the index value is an integer value, and ranges from 0 to the number of Cache lines minus 1. Through cache index, the designated cache line can be quickly positioned, and corresponding data can be acquired. In addition, the method also comprises an L2P table sequence number (L2P table index) and an HMB slot number (HMB slot index) and a Hash link field (Hash link). The HMB slot number is used for uniquely identifying a storage unit in the HMB, the hash link field is used for describing a linked list data structure based on a hash function, and a node with a specific hash value can be quickly positioned through the calculation result of the hash function. Therefore, when the HMB is updated, if collision occurs, the old table in the HMB is directly replaced by the new table, and meanwhile, the hash link field of the old table is found in the cache control table, and is linked to the cache index value of the new table in the cache control table. And in the case of no collision, the hash chain field is filled with a preset field of "0xffff". In addition, the firmware also manages a Hash table (Hash table), and referring to fig. 6, the table includes a Hash value (Hash value) and a Cache index value (Cache index) of the Cache control table. There is an expression based on the table: hash (l2p_table_index) =cache index. In this formula, the table number (l2p_table_index) of the L2P table is used as an input of the hash function, and the cache index value (cache index) obtained after the hash calculation can be used to search the corresponding data in the cache.
For the received L2P table data, a corresponding hash value can be output through the table sequence number, whether a valid record item exists or not can be searched in the hash table through the hash value, and if the valid record item exists, namely, a corresponding cache index value exists, the HMB slot number of the storage unit of the current L2P table data in the HMB area can be searched in the cache control table through the cache index value. Thereby updating it to the corresponding memory cell (slot). If no effective record item exists, that is, the current L2P table is stored in the HMB area for the first time, the occupied storage tank in the HBM area can be searched by searching the cache control table, so that a new storage unit or a storage unit which is not updated for a long time is allocated for storing the L2P table data.
For the HMB area of dynamic management, the data update time is also divided into two types, one is that when LBN data is received, an L2P table sequence number is calculated according to the LBN data, the L2P table sequence number is used to locate the position of the corresponding L2P table data in the HMB cache, and then an offset in the L2P table is calculated according to the LBN data, and the corresponding data is updated. The other is to update the temporary L2P table, and write back to NAND FLASH and write back to the corresponding HMB dynamic management area when the temporary L2P table needs to be written back.
In this embodiment, a cache control table and a Hash table are added to record, update and find the storage condition of the L2P table, so as to realize dynamic management of the HMB dynamic management area, and the Hash algorithm is used to calculate the Hash value of the L2P table sequence number to obtain the storage position of the table data in the HMB area. When the data is read, the data can be searched by the Hash algorithm, the searching action is not needed, the memory consumption is reduced, and the random reading performance is greatly improved. Under the action of the principles of temporal locality and spatial locality, the probability of collision is low.
Further, referring to fig. 2, in a second embodiment of the method for caching L2P table data according to the present invention, step S30 further includes the following steps:
step S31, according to the table sequence numbers, corresponding hash values are determined through hash function operation.
And step S32, confirming whether a valid record item exists in the hash value based on the hash table.
And step S33, if the effective record item does not exist, selecting an idle storage groove in the dynamic management area as the storage unit based on the cache control table.
And step S34, writing the L2P table data into the storage unit, and updating the cache control table and the hash table based on the slot number, the table sequence number and the hash value of the storage unit.
The invention divides the L2P table data of the dynamic management area into three cases, wherein the first case is that the current updated L2P table data is stored for the first time, the second case is that the current L2P table data is updated table data and no conflict occurs in the cache control table, and the third case is that the current L2P table data is updated table data but the cache control table is in conflict. In this embodiment, for the case of storing L2P table data for the first time, firstly, performing hash operation on the table sequence number to obtain a hash value, and further searching whether a valid record item exists in the hash table (i.e. whether a cache index value exists) according to the hash value, if the valid record item does not exist, indicating that the current L2P table data is stored for the first time, at this time, the occupied storage slot in the HBM area can be searched by searching the cache control table, determining which slots are not occupied at present according to the storage slots previously divided, and selecting the free slot with the smallest slot number from the slots which are not occupied as the storage unit. If all the slots are occupied, the cache control table can find out which slot is not updated for a long time, and the slot which is not updated for the longest time is selected as a storage unit. Alternatively, in another possible embodiment, if any entry related to a given hash value is not stored in the hash table, it is not possible to locate directly to the slot of the L2P table in the HMB area, at this time, the starting address and size of the HMB dynamic management area may be first determined by reading the file system metadata or other information, then dividing the hash value by the size of the HMB area, to obtain a remainder, taking the remainder as the number of the slot of the current L2P table data in the HMB area, and storing the L2P table data in the slot. If the size of the HMB region is a power of 2, a bit operation may be used to calculate the remainder, thereby improving the calculation efficiency. After the storage is completed, the storage condition of the current L2P table is correspondingly recorded in the cache control table, wherein the storage condition comprises a cache index value, a filling table sequence number, a slot number and filling of a hash link field, the hash link field is filled into a preset field of 0xffff, and a record item corresponding to the current hash value in the hash table is also modified into the cache index value. In the subsequent process, if the current L2P table is updated again, the cache index value in the effective item is found by calculating the hash value, the corresponding storage groove is found in the cache control table, and then the old L2P table is replaced by the new L2P table.
It should be noted that, when the hash table is initially defined, each hash value entry (i.e. the cache index value) is first defined as invalid, and as the L2P table data is stored and updated, the hash table entry is correspondingly modified and written into the cache index value.
Further, when an effective record item is found in the hash table through the hash value, that is, a corresponding cache index value is found, an L2P table sequence number can be found in the cache control table through the cache index value, and when the table sequence number stored in the table is the same as the table sequence number of the current L2P table, the corresponding storage tank number is further determined, so that the storage tank corresponding to the storage tank number is used as a storage unit, and a new L2P table is directly updated in the storage unit in an overlaying manner. In the third case, when a valid entry is found in the hash table by the hash value, and then the table sequence number stored in the table is found by the line buffer index value, but the table sequence number is not the same as the table sequence number of the current L2P table, that is, a hash collision occurs, the current L2P table data is copied into the storage slot number corresponding storage unit. Meanwhile, the buffer control table also needs to record the storage condition of the current L2P table data, the last record row of the conflict hash value is searched from the table, and the hash link field is modified into the buffer index value of the current L2P table in the buffer control table. Optionally, in another possible implementation manner, the subsequent positions may be checked sequentially according to a collision resolution policy (such as linear detection, secondary detection, etc.) of the hash table until a storage unit matching a given table sequence number is found or an empty storage unit is encountered, after the storage unit is saved to the storage unit, the last record row of the collision hash value is found in the table, and the hash link field of the record row is modified to the cache index value of the current L2P table in the cache control table.
In this embodiment, by providing a buffer control table and calculating the buffer index value of a given hash value using a hash function, the storage location of the L2P table data in the HMB dynamic management area can be determined. By maintaining the HMB cache control table, the firmware can implement data transfer and cache control between the SSD and the host memory.
Referring to fig. 3, in a third embodiment of the method for caching L2P table data according to the present invention, the step S30 further includes the following steps:
And step S40, when LBA data is received, determining a corresponding serial number of the to-be-searched table according to the LBA data.
And S50, determining a hash value corresponding to the sequence number of the table to be searched through hash operation, and searching whether a valid record item exists in the hash value or not based on the hash table.
And step S60, if the effective record item does not exist, loading an L2P table corresponding to the table sequence number to be searched from the NAND flash memory according to the table sequence number to be searched.
Step S70, determining the physical address corresponding to the LBA data according to the mapping relation of the L2P table.
And step S80, generating a read command based on the physical address and sending the read command to the NAND flash memory so as to respond to the command for reading the physical address storage data.
In this embodiment, when the data reading operation is required from the dynamic management area of the HMB, the locating and searching can also be performed through the HASH algorithm. Further, when the LBA data is received, a corresponding L2P table sequence number is calculated according to the address of the LBA data, whether an effective record item exists or not can be searched in the hash table through the table sequence number, whether the current LBA data is cached in the HMB area or not can be judged by confirming whether the effective record item exists or not, if the effective record item does not exist, the corresponding L2P table is directly loaded from NAND FLASH (a nonvolatile memory) according to the table sequence number, the physical address of the LBA data is determined according to the mapping relation in the L2P table, and then a command is sent to the NAND based on the determined physical address to store the data in the physical address.
If the effective record item exists in the hash table, the corresponding storage unit can be further searched in the cache control table through the cache index value in the record item of the hash table. Further, we refer to the content of each line record in the cache control table as a cache entry, and confirm whether the table sequence number stored in the cache entry of the line where the cache index value is located is consistent with the table sequence number of the LBA data through the cache control table, if so, the target storage unit where the L2P table corresponding to the table sequence number is actually located can be directly locked. If the two types of the L2P tables are inconsistent, the next cache entry of the link is continuously searched through the hash link field until the cache entry which is the same as the current table sequence number is searched, so that the target storage unit where the L2P table corresponding to the table sequence number is actually located is determined, and the target storage unit where the LBA data is actually located is determined. By calculating the offset of the target memory cell, the location of the memory cell in the HMB region can be determined. Then, the offset of the LBA data in the storage unit may be calculated according to the location of the storage unit, and the corresponding physical address of the LBA data may be finally determined through the mapping relationship of the L2P table, so that the command is sent to the NAND to store the data in the physical address based on the determined physical address.
In this embodiment, the dynamic management of the HMB dynamic management area is implemented by adding a buffer control table and a hash table. By using a Hash algorithm, the storage position of the table data in the HMB area can be obtained by carrying out Hash value calculation on the L2P table sequence number. When the data is read, the data can be searched by the Hash algorithm, the searching action is not needed, the memory consumption is reduced, and the random reading performance is greatly improved. Under the action of the principles of temporal locality and spatial locality, the probability of collision is low.
Referring to fig. 7, fig. 7 is a schematic diagram of a cache device structure of L2P table data in a hardware running environment according to an embodiment of the present invention.
As shown in fig. 7, the buffering device of the L2P table data may include: a processor 1001, such as a central processing unit (Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., a wireless FIdelity (WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory or a stable non-volatile memory (NVM), such as a disk memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
It will be appreciated by those skilled in the art that the structure shown in fig. 7 does not constitute a limitation of the caching apparatus of L2P table data, and may include more or fewer components than illustrated, or may combine certain components, or may be a different arrangement of components.
As shown in fig. 7, a storage 1005, which is a storage medium, may include an operating system, a data storage module, a network communication module, a user interface module, and a cache program of L2P table data.
In the buffering device for L2P table data shown in fig. 7, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the L2P table data caching device of the present invention may be disposed in the L2P table data caching device, where the L2P table data caching device calls, through the processor 1001, a caching program of the L2P table data stored in the memory 1005, and performs the following steps:
when L2P table data is received, determining a table sequence number and a management type of the L2P table data;
When the management type is a static L2P table, storing the L2P table data into a first HMB subarea based on the table sequence number and a static management area base address;
And when the management type is a dynamic L2P table, determining a storage unit of the L2P table data in a second HMB subarea according to the table sequence number and the cache control table, and storing the L2P table data in the storage unit.
Further, the buffering device of the L2P table data calls, through the processor 1001, a buffering program of the L2P table data stored in the memory 1005, and further performs the following steps:
Determining a corresponding hash value through hash function operation according to the table sequence number;
Confirming whether a valid record item exists in the hash value or not based on a hash table;
if the effective record item does not exist, selecting an idle storage tank in the dynamic management area as the storage unit based on the cache control table;
And writing the L2P table data into the storage unit, and updating the cache control table and the hash table based on the slot number, the table sequence number and the hash value of the storage unit.
Further, the buffering device of the L2P table data calls, through the processor 1001, a buffering program of the L2P table data stored in the memory 1005, and further performs the following steps:
if the effective record item exists, determining a cache index value of the effective record item;
searching a corresponding slot number in the cache control table according to the cache index value;
And taking a storage groove corresponding to the groove number as the storage unit, and writing the data to be managed into the storage unit.
Further, the buffering device of the L2P table data calls, through the processor 1001, a buffering program of the L2P table data stored in the memory 1005, and further performs the following steps:
Searching an initial table sequence number in the cache control table based on the cache index value;
When the initial table sequence number is the same as the table sequence number, filling a hash link field where the cache index value is located in the cache control table into a preset field;
And when the initial table sequence number is different from the table sequence number, searching a last cache entry corresponding to the hash value based on the cache control table, and filling a hash link field in the cache entry into the cache index value.
Further, the buffering device of the L2P table data calls, through the processor 1001, a buffering program of the L2P table data stored in the memory 1005, and further performs the following steps:
when LBA data is received, determining a corresponding serial number of a to-be-searched table according to the LBA data;
determining a hash value corresponding to the sequence number of the table to be searched through hash operation, and searching whether a valid record exists in the hash value or not based on a hash table;
If the effective record item does not exist, loading an L2P table corresponding to the table sequence number to be searched from the NAND flash memory according to the table sequence number to be searched;
determining a physical address corresponding to the LBA data according to the mapping relation of the L2P table;
And generating a read command based on the physical address and sending the read command to the NAND flash memory so as to respond to the command for reading the physical address storage data.
Further, the buffering device of the L2P table data calls, through the processor 1001, a buffering program of the L2P table data stored in the memory 1005, and further performs the following steps:
If the effective record item exists, confirming a target storage unit where the L2P table corresponding to the sequence number of the table to be searched is located in a cache entry in the cache control table;
Determining the offset of the target storage unit, determining the physical address corresponding to the LBA data according to the offset of the target storage unit and the mapping relation of the L2P table;
And generating a read command based on the physical address and sending the read command to the NAND flash memory so as to respond to the command for reading the physical address storage data.
Further, the buffering device of the L2P table data calls, through the processor 1001, a buffering program of the L2P table data stored in the memory 1005, and further performs the following steps:
confirming a corresponding stored table sequence number in the cache control table based on the cache index value corresponding to the effective record item;
Judging whether the table sequence number is consistent with the table sequence number to be searched;
if the hash link fields are inconsistent, searching the next cache entry based on the field value of the hash link field of the cache entry where the table sequence number is located until the table sequence number which is the same as the sequence number to be searched;
If the table sequence numbers are consistent, determining the slot numbers of the cache entries where the table sequence numbers are located;
and taking the storage unit corresponding to the slot number as the target storage unit.
Further, the buffering device of the L2P table data calls, through the processor 1001, a buffering program of the L2P table data stored in the memory 1005, and further performs the following steps:
When LBA data is received, determining the LBA data and determining a corresponding table sequence number;
determining an L2P table address corresponding to the table sequence number according to the static management area base address, the table sequence number, the static area initial table sequence number and the table data size;
And determining the physical address corresponding to the LBA data according to the mapping relation of the L2P table address.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (10)

1. The caching method of the L2P table data is characterized by comprising the following steps of:
when L2P table data is received, determining a table sequence number and a management type of the L2P table data;
When the management type is a static L2P table, storing the L2P table data into a first HMB subarea based on the table sequence number and a static management area base address;
And when the management type is a dynamic L2P table, determining a storage unit of the L2P table data in a second HMB subarea according to the table sequence number and the cache control table, and storing the L2P table data in the storage unit.
2. The method for buffering L2P table data according to claim 1, wherein when the management type is a dynamic L2P table, the step of determining a storage unit of the L2P table data in the second HMB sub-area according to the table sequence number and the buffering control table, and storing the L2P table data in the storage unit comprises:
Determining a corresponding hash value through hash function operation according to the table sequence number;
Confirming whether a valid record item exists in the hash value or not based on a hash table;
if the effective record item does not exist, selecting an idle storage tank in the dynamic management area as the storage unit based on the cache control table;
And writing the L2P table data into the storage unit, and updating the cache control table and the hash table based on the slot number, the table sequence number and the hash value of the storage unit.
3. The method for buffering L2P table data according to claim 2, wherein after the step of confirming whether the hash value has a valid entry based on the hash table, further comprising:
if the effective record item exists, determining a cache index value of the effective record item;
searching a corresponding slot number in the cache control table according to the cache index value;
And taking a storage groove corresponding to the groove number as the storage unit, and writing the data to be managed into the storage unit.
4. The method for caching L2P table data according to claim 3, wherein before the step of taking the storage slot corresponding to the slot number as the storage unit and writing the data to be managed into the storage unit, further comprising:
Searching an initial table sequence number in the cache control table based on the cache index value;
When the initial table sequence number is the same as the table sequence number, filling a hash link field where the cache index value is located in the cache control table into a preset field;
And when the initial table sequence number is different from the table sequence number, searching a last cache entry corresponding to the hash value based on the cache control table, and filling a hash link field in the cache entry into the cache index value.
5. The method for buffering L2P table data according to claim 1, wherein when the management type is a dynamic L2P table, determining a storage unit of the L2P table data in the second HMB sub-area according to the table sequence number and the buffering control table, and storing the L2P table data in the storage unit, further comprises:
when LBA data is received, determining a corresponding serial number of a to-be-searched table according to the LBA data;
determining a hash value corresponding to the sequence number of the table to be searched through hash operation, and searching whether a valid record exists in the hash value or not based on a hash table;
If the effective record item does not exist, loading an L2P table corresponding to the table sequence number to be searched from the NAND flash memory according to the table sequence number to be searched;
determining a physical address corresponding to the LBA data according to the mapping relation of the L2P table;
And generating a read command based on the physical address and sending the read command to the NAND flash memory so as to respond to the command for reading the physical address storage data.
6. The method for caching L2P table data according to claim 5, wherein after the step of determining the hash value corresponding to the table number to be searched through the hash operation and searching whether the hash value has a valid entry based on the hash table, the method further comprises:
If the effective record item exists, confirming a target storage unit where the L2P table corresponding to the sequence number of the table to be searched is located in a cache entry in the cache control table;
Determining the offset of the target storage unit, determining the physical address corresponding to the LBA data according to the offset of the target storage unit and the mapping relation of the L2P table;
And generating a read command based on the physical address and sending the read command to the NAND flash memory so as to respond to the command for reading the physical address storage data.
7. The method for caching L2P table data according to claim 6, wherein the step of confirming, in the cache entry in the cache control table, that the table number to be looked up corresponds to the target storage unit in which the L2P table is located, if the valid entry exists, includes:
confirming a corresponding stored table sequence number in the cache control table based on the cache index value corresponding to the effective record item;
Judging whether the table sequence number is consistent with the table sequence number to be searched;
if the hash link fields are inconsistent, searching the next cache entry based on the field value of the hash link field of the cache entry where the table sequence number is located until the table sequence number which is the same as the sequence number to be searched;
If the table sequence numbers are consistent, determining the slot numbers of the cache entries where the table sequence numbers are located;
and taking the storage unit corresponding to the slot number as the target storage unit.
8. The method for buffering L2P table data according to claim 1, wherein when the management type is a static L2P table, after the step of storing the L2P table data into the first HMB sub-area based on the table sequence number and the static management area base address, further comprises:
When LBA data is received, determining the LBA data and determining a corresponding table sequence number;
determining an L2P table address corresponding to the table sequence number according to the static management area base address, the table sequence number, the static area initial table sequence number and the table data size;
And determining the physical address corresponding to the LBA data according to the mapping relation of the L2P table address.
9. A buffering apparatus for L2P table data, wherein the buffering apparatus for L2P table data comprises: memory, a processor and a caching program of L2P table data stored on the memory and executable on the processor, the caching program of L2P table data being configured to implement the steps of the caching method of L2P table data as claimed in any one of claims 1 to 8.
10. A computer readable storage medium, wherein a caching program of L2P table data is stored on the computer readable storage medium, and the caching program of L2P table data implements the steps of the L2P table data caching method according to any one of claims 1 to 8 when executed by a processor.
CN202311844787.5A 2023-12-28 2023-12-28 Caching method and equipment for L2P table data and computer readable storage medium Pending CN117908784A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311844787.5A CN117908784A (en) 2023-12-28 2023-12-28 Caching method and equipment for L2P table data and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311844787.5A CN117908784A (en) 2023-12-28 2023-12-28 Caching method and equipment for L2P table data and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN117908784A true CN117908784A (en) 2024-04-19

Family

ID=90693817

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311844787.5A Pending CN117908784A (en) 2023-12-28 2023-12-28 Caching method and equipment for L2P table data and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN117908784A (en)

Similar Documents

Publication Publication Date Title
CN110678836B (en) Persistent memory for key value storage
US20210349632A1 (en) Memory system and method for controlling nonvolatile memory
US7191306B2 (en) Flash memory, and flash memory access method and apparatus
US9910602B2 (en) Device and memory system for storing and recovering page table data upon power loss
US10915475B2 (en) Methods and apparatus for variable size logical page management based on hot and cold data
KR101185617B1 (en) The operation method of a flash file system by a wear leveling which can reduce the load of an outside memory
US7127551B2 (en) Flash memory management method
US7594067B2 (en) Enhanced data access in a storage device
US9092323B2 (en) Systems and methods for recovering addressing data
KR101612922B1 (en) Memory system and method of managing memory system
US9990277B2 (en) System and method for efficient address translation of flash memory device
US20070016719A1 (en) Memory device including nonvolatile memory and memory controller
US7287117B2 (en) Flash memory and mapping control apparatus and method for flash memory
JP2013137770A (en) Lba bitmap usage
US9122586B2 (en) Physical-to-logical address map to speed up a recycle operation in a solid state drive
TW201301030A (en) Fast translation indicator to reduce secondary address table checks in a memory device
KR101297442B1 (en) Nand flash memory including demand-based flash translation layer considering spatial locality
KR20160106240A (en) Semiconductor device and operating method thereof
US7058784B2 (en) Method for managing access operation on nonvolatile memory and block structure thereof
JP2007220107A (en) Apparatus and method for managing mapping information of nonvolatile memory
US10776262B2 (en) Memory system and operating method thereof
US10606517B2 (en) Management device and information processing device
CN110147332B (en) Management method of directory data and memory device
US20170220253A1 (en) Memory system
KR102321346B1 (en) Data journaling method for large solid state drive device

Legal Events

Date Code Title Description
PB01 Publication