Data management method, device, computer program product and storage medium
By introducing a two-level mapping table data management method in SSD, the write amplification problem of super-large capacity SSD storage is solved, efficient data writing is achieved, and the performance and service life of the hard disk is guaranteed.
Patent Information
- Application Number
- CN202411982609.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2044-12-30
AI Technical Summary
How to effectively implement super-large capacity SSD without affecting the performance and service life of the hard disk.
By introducing a two-level mapping table in the data management method, the data to be written is cached and stored. When the data reaches a certain size, the mapping relationship of the physical address entries is determined based on the logical address, and the second mapping table is used to write data blocks when necessary to avoid writing amplification.
It realizes effective storage of super-large-capacity SSD without write amplification, ensuring the performance and service life of the hard disk.
Smart Images

Figure CN119415043B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to a data management method, device, computer program product and storage medium. Background Art
[0002] As the main data storage method, HDD (Hard Disk Drive) has the advantages of large capacity and low cost. However, the introduction of ultra-large capacity SSD (Solid State Disk) is changing the prospect of data storage. It has stronger performance, lower energy consumption, stronger thermal management capabilities, and is easy to install. It has a competitive total cost of ownership and is gradually gaining major advantages.
[0003] See also Figure 1 , is a diagram of a mapping method currently used by standard capacity SSDs. L2P (Logical To Physical Table) is used to represent the mapping relationship between LBA (logical block address) and PBA (physical block address). Figure 1 In the L2P table, a 4-byte value is used to represent 4096 bytes of user data, that is, a single entry in the L2P table occupies 4 bytes, and the 4-byte value is specifically the physical address of the 4096 bytes of user data, so Figure 1 The total size of this L2P table is equal to 1‰ of the physical capacity of the hard disk. For example, when the SSD capacity is 7.68T, the L2P table needs to occupy 7.68G. The L2P table is stored in the DDR (Double Data Rate) cache. It can be seen that when the SSD capacity increases, the demand for DDR usage will also increase. However, due to the size limitation of the SSD and the upper limit of the single DDR capacity, the maximum DDR size that can be used for an SSD disk is usually 16GB. Therefore, it can be seen that if 4 bytes are used to represent a 4K data address, the SSD capacity will be limited to less than 16T, and a larger capacity cannot be achieved.
[0004] In addition, some current solutions that can realize ultra-large capacity SSDs use a 4-byte L2P table to represent an 8K or 16K or even larger data block in the SSD disk. This can break the limitation that the total size of the L2P table is equal to 1‰ of the physical capacity of the hard disk. However, such a solution will cause write amplification, limit the performance of the hard disk, and reduce the service life of the hard disk.
[0005] In summary, how to effectively realize an ultra-large capacity SSD without affecting the performance and service life of the hard disk is a technical problem that technicians in this field urgently need to solve. Summary of the invention
[0006] The object of the present invention is to provide a data management method, device, computer program product and storage medium to effectively realize an ultra-large capacity SSD without affecting the performance and service life of the hard disk.
[0007] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0008] In a first aspect, the present invention provides a data management method, comprising:
[0009] storing the received data to be written by caching;
[0010] When the data to be written reaches the first size, for each data block of the second size in the data to be written, according to the logical address of the data block, determining the physical address entry corresponding to the data block in the first mapping table, and judging whether the physical address entry points to the second mapping table;
[0011] If not, selecting a free table entry in the second mapping table as the table entry pointed to by the physical address entry, and recording the physical address stored in the physical address entry and the latest physical address of the data block in the table entry, and writing the data block to the hard disk according to the latest physical address of the data block;
[0012] If yes, modify the content in the table entry pointed to by the physical address entry in the second mapping table so that the latest physical address of the data block is recorded in the table entry, and write the data block into the hard disk according to the latest physical address of the data block;
[0013] Among them, the first mapping table is a mapping table from logical addresses to physical addresses, and a single physical address entry stores the physical address of data of a first size in the hard disk; the first size is K times the second size, and K is a positive integer greater than 1.
[0014] On the other hand, it also includes:
[0015] Determine whether the physical address entries corresponding to each data block in the data to be written in the first mapping table are consistent;
[0016] If so, the content in the physical address entry corresponding to the data block is updated to the latest physical address of the data to be written, and the data to be written is written to the hard disk according to the latest physical address of the data to be written, and when the physical address entry points to the second mapping table, the table entry pointed to by the physical address entry is removed so that the physical address entry does not point to the second mapping table.
[0017] On the other hand, it also includes:
[0018] When any non-free entry in the second mapping table meets the set elimination condition, the entry is used as an entry to be eliminated, and a physical address entry pointing to the entry to be eliminated in the first mapping table is determined;
[0019] Based on the content in the to-be-eliminated entry, read the data of a first size pointed to by the to-be-eliminated entry from the hard disk into the cache as the to-be-written-back data;
[0020] Assigning the latest physical address to the data to be written back, updating the content in the physical address entry pointing to the entry to be removed in the first mapping table to the latest physical address of the data to be written back, and writing the data to be written back to the hard disk according to the latest physical address of the data to be written back;
[0021] The entry to be removed is removed so that the physical address entry corresponding to the data to be written back does not point to the second mapping table, and the entry to be removed is restored to a free entry.
[0022] On the other hand, it also includes:
[0023] Determine whether the to-be-removed entry is the oldest non-free entry among all non-free entries;
[0024] If not, after the to-be-eliminated entry is removed, the content of each non-free entry whose generation time is older than the to-be-eliminated entry is moved, so that after the moving is completed, the current non-free entries in the second mapping table are non-free entries with consecutive entry numbers;
[0025] Wherein, whenever a free table entry is selected in the second mapping table, the number value of the selected free table entry is the number value of each current non-free table entry plus 1.
[0026] On the other hand, when any non-idle entry in the second mapping table meets the set removal condition, the entry is used as an entry to be removed, including:
[0027] For any non-free table entry in the second mapping table, determine whether the data of a first size pointed to by the non-free table entry meets the preset cold data requirement;
[0028] If yes, it is determined that the non-idle entry meets the set elimination condition.
[0029] On the other hand, it also includes:
[0030] After determining that the data of the first size pointed to by the non-free entry meets the preset cold data requirement, determining whether the non-free entry has a non-elimination mark;
[0031] If yes, it is determined that the non-idle entry does not meet the set elimination condition.
[0032] On the other hand, determining whether the data of the first size pointed to by the non-free table entry meets the preset cold data requirement includes:
[0033] Determine the hot and cold evaluation values of the K data blocks of the second size pointed to by the non-free table entry, and use the average of the hot and cold evaluation values of the K data blocks of the second size as the hot and cold determination value of the data of the first size pointed to by the non-free table entry;
[0034] Determining whether the hot and cold determination value meets a preset value range;
[0035] If yes, it is determined that the non-idle entry meets the set elimination condition.
[0036] On the other hand, determining the hot and cold evaluation values of the K data blocks of the second size pointed to by the non-free entry includes:
[0037] For each data block of the K data blocks of the second size pointed to by the non-free table entry, a hot / cold assessment value of the data block is determined based on the access frequency of the data block in the most recent first time period and the time difference between the current moment and the last access moment of the data block.
[0038] On the other hand, the total number of physical address entries in the first mapping table is M, the number of entries in the second mapping table is B, M and B are both positive integers and M is greater than B.
[0039] On the other hand, it also includes:
[0040] After determining that the physical address entry does not point to the second mapping table, when it is determined that there is no free table entry in the second mapping table, a non-free table entry is eliminated based on a preset elimination rule, and after the elimination is completed, the table entry is used as a free table entry pointed to by the selected physical address entry.
[0041] On the other hand, a non-free entry is removed based on the preset removal rules, including:
[0042] The oldest non-free entry among all non-free entries is removed.
[0043] On the other hand, the oldest non-free entries among all non-free entries are removed, including:
[0044] Taking the oldest non-free entry among all non-free entries as the entry to be removed, and determining the physical address entry in the first mapping table pointing to the entry to be removed;
[0045] Based on the content in the to-be-eliminated entry, read the data of a first size pointed to by the to-be-eliminated entry from the hard disk into the cache as the to-be-written-back data;
[0046] Assigning the latest physical address to the data to be written back, updating the content in the physical address entry pointing to the entry to be removed in the first mapping table to the latest physical address of the data to be written back, and writing the data to be written back to the hard disk according to the latest physical address of the data to be written back;
[0047] The entry to be removed is removed so that the physical address entry corresponding to the data to be written back does not point to the second mapping table, and the entry to be removed is restored to a free entry, so as to complete the removal of the oldest non-free entry among all non-free entries.
[0048] In a second aspect, the present invention provides a computer program product, comprising a computer program / instruction, which implements the steps of the data management method as described above when executed by a processor.
[0049] In a third aspect, the present invention provides a data management device, comprising:
[0050] Memory for storing computer programs;
[0051] A processor is used to execute the computer program to implement the steps of the data management method as described above.
[0052] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the data management method as described above are implemented.
[0053] Specifically, when the data to be written reaches the first size, the data to be written needs to be written. At this time, for each data block of the second size in the data to be written, it is necessary to determine the physical address entry corresponding to the data block in the first mapping table according to the logical address of the data block, and determine whether the physical address entry points to the second mapping table. The existence of the second mapping table allows the first size of data corresponding to a physical address entry to be stored in different locations in the present application.
[0054] When it is determined that the physical address entry does not point to the second mapping table, it means that the first size of data corresponding to the physical address entry in the hard disk is currently stored continuously and is not scattered in different locations. At this time, since the data block needs to be written, it is necessary to select a free table entry in the second mapping table as the table entry pointed to by the physical address entry, and record the physical address stored in the physical address entry and the latest physical address of the data block in the table entry, and then write the data block to the hard disk according to the latest physical address of the data block. It can be seen that in this case, it is only necessary to write the data block to the hard disk according to the latest physical address of the data block, and it is not necessary to read the first size of data of the physical address entry in the hard disk from the hard disk, so there will be no write amplification. If it is determined that the physical address entry points to the second mapping table, the content in the table entry pointed to by the physical address entry in the second mapping table can be directly modified so that the latest physical address of the data block is recorded in the table entry, and the data block is written to the hard disk according to the latest physical address of the data block.
[0055] It can be seen that since the first mapping table is a mapping table from logical addresses to physical addresses, a single entry stores the physical address of data of the first size in the hard disk, and the first size is K times the second size, so the larger the first size is set, the more conducive it is to realizing an ultra-large capacity SSD. When writing any data block of the second size, the second mapping table can be used to write the data block of the second size, so that write amplification will not occur, thereby effectively ensuring the performance of the hard disk and not affecting the service life of the hard disk. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0057] Figure 1 This is a schematic diagram of a mapping method currently used by standard capacity SSDs;
[0058] Figure 2 An implementation flow chart of a data management method provided by a specific implementation mode of the present invention;
[0059] Figure 3 This is a schematic diagram of another mapping method currently used by ultra-large capacity SSDs;
[0060] Figure 4 A schematic diagram of the write command processing process after a mapping method of using a 4-byte value to represent 16K user data is adopted;
[0061] Figure 5 A schematic diagram of the mapping principle of a two-level mapping table in a specific implementation manner of the present invention;
[0062] Figure 6 A schematic diagram of a table entry maintenance principle in a second mapping table in a specific implementation manner of the present invention;
[0063] Figure 7 A structural diagram of a data management device provided by a specific implementation mode of the present invention;
[0064] Figure 8 The present invention is a schematic diagram of the structure of a computer-readable storage medium. DETAILED DESCRIPTION
[0065] The core of the present invention is to provide a data management method, device, computer program product and storage medium, which can effectively realize ultra-large capacity SSD without affecting the performance and service life of the hard disk.
[0066] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0067] Please refer to Figure 2 , Figure 2 The following is a flowchart of a data management method provided by a specific embodiment of the present invention. The data management method may include the following steps:
[0068] Step S201: storing the received data to be written in a cache.
[0069] After analyzing the traditional ultra-large capacity SSD solutions, the applicant considered that, when the current ultra-large capacity SSD needs to write a data block, it is necessary to first read out the entire data block such as 8K or 16K to the cache, adjust part of the data content in the cache and then write it back to the hard disk, resulting in write amplification. That is to say, only part of the data content in the entire data block such as 8K or 16K written back to the hard disk is valid.
[0070] For easier understanding, please refer to Figure 3 , is a schematic diagram of another mapping method currently used by ultra-large capacity SSDs. In order to achieve ultra-large SSD capacity, a single entry in the L2P table can be used to represent more user data, such as Figure 3In the L2P table, a 4-byte value is used to represent 8K of user data, that is, Figure 3 The size of a single entry in the L2P table is 4 bytes, and the value of the 4 bytes is the physical address of the 8K user data, so Figure 3 The total size of this L2P table is equal to 0.5‰ of the physical capacity of the hard disk. Similarly, if a 4-byte value in the L2P table is used to represent 16K of user data, the total size of the L2P table is equal to 0.25‰ of the physical capacity of the hard disk, so that the maximum capacity of the SSD reaches 64T. The NAND in the figure indicates that the SSD is a NAND-based SSD. Other implementation parties can use other types of SSDs according to actual needs, which does not affect the implementation of the present invention.
[0071] The following example uses a 4-byte value to represent 16K of user data. Figure 4 , is a schematic diagram of the write command processing process after adopting this mapping method. Figure 4 Step ① in the figure indicates that the SSD receives 4K data from the host and moves it to the DDR in the disk for cache. Step ② indicates that according to the LBA of the 4K data, the corresponding L2P entry is queried from the L2P table, that is, the entry number corresponding to the LBA in the L2P table is queried. For example, if the LBA address of the 4K data is any LBA from LBA0 to LBA3, the corresponding L2P entry can be determined to be PBA0, that is, the 0th entry in the L2P table. Correspondingly, if the LBA address of the 4K data is any LBA from LBA4 to LBA7, the corresponding L2Pentry can be determined to be PBA1, that is, the 1st entry in the L2P table. By analogy, the specific content stored in the obtained L2P entry is a 16K physical address.
[0072] Step ③ indicates that according to the queried L2P entry, a 16K data volume is read from the corresponding physical address of the hard disk. Step ④ indicates that the 16K data volume read is placed in the DDR space. Step ⑤ indicates that the 4K data from the host needs to be merged with the read 16K data, that is, the 4K data from the host is used as new data to overwrite the old data at the corresponding position in the 16K data. For example, if the logical address of the 4K data from the host is LBA0, the first 4K data in the 16K data is overwritten. Similarly, if the logical address of the 4K data from the host is LBA1, the second 4K data in the 16K data is overwritten. If the logical address of the 4K data from the host is LBA2, the third 4K data in the 16K data is overwritten. If the logical address of the 4K data from the host is LBA3, the fourth 4K data in the 16K data is overwritten.
[0073] Step ⑥ means that the merged data needs to be written back to the hard disk, that is, written back to the NAND array, and the original 16K position is invalidated. This is because when writing to the SSD, it is not overwritten, but written to a new position and the old position is marked as invalid. The current SSD design usually uses page as the minimum unit, and the size of each page is usually set to 16K. Step ⑦ means that according to the new position of the 16K data written this time, the content in the corresponding L2P entry is updated, that is, the physical address in the corresponding L2P entry is updated, thereby completing the entire user write process.
[0074] It can be seen that in this example, when writing 16K data to the hard disk, only 4K data is actually valid write content, and the remaining 12K are invalid write content, that is, the amount of data written to the hard disk will be more than the amount of business write data received, causing write amplification. In the above example, the user writes 4K data, and the write amplification of the disk is 4 times, making the hard disk performance utilization rate only 25%, and it will also seriously reduce the write life.
[0075] In addition, it should be noted that if the mapping granularity of the L2P table is Figure 1 Such a 4K mapping granularity instead of 8K, 16K and other larger mapping granularity does not require the above steps ②③④⑤, but can directly write the 4K user data in the cache to the NAND of the hard disk. Of course, as described above, the mapping granularity is Figure 1 When the size of the L2P table is 4K, the storage space required by the L2P table is large, which limits the maximum capacity of the SSD.
[0076] In the solution of the present application, a two-level mapping table design is adopted, so that an ultra-large capacity SSD can be realized without write amplification. Specifically, in the solution of the present application, the received data to be written can also be stored in the cache, that is, the received user data can be stored in the DDR.
[0077] Step S202: When the data to be written reaches the first size, for each data block of the second size in the data to be written, determine the physical address entry corresponding to the data block in the first mapping table according to the logical address of the data block, and determine whether the physical address entry points to the second mapping table. If not, execute step S203, if yes, execute step S204.
[0078] The first mapping table is a mapping table from logical addresses to physical addresses, and a single physical address entry stores the physical address of data of a first size in the hard disk; the first size is K times the second size, and K is a positive integer greater than 1.
[0079] Specifically, in the present application, the first size represents the mapping granularity of the first mapping table, that is, the size of the data corresponding to a single physical address entry in the first mapping table in the hard disk, and it can be understood that in order to support ultra-large capacity SSDs, the first size should be greater than 4K, for example, it can be 16K, 32K, 64K, etc. In the following text of this application, the first size is equal to 16K as an example for explanation. The second size represents the mapping granularity of the second mapping table. Since the minimum data block sent by the host is usually 4K, the second size can usually be set to 4K.
[0080] The first mapping table includes multiple table entries, and the second mapping table also includes multiple table entries. For the convenience of distinction in description, in the following text of this application, the table entries in the first mapping table are referred to as physical address entries in the first mapping table, and the table entries in the second mapping table are referred to as table entries in the second mapping table, or entries in the second mapping table.
[0081] Take the first size equal to 16K and the second size equal to 4K as an example, that is, K=4 at this time. Therefore, when the data to be written reaches 16K, it means that the data to be written includes 4 4K data blocks. For these 4 4K data blocks, each has a different logical address. Therefore, each of these 4 4K data blocks has a corresponding physical address entry in the first mapping table.
[0082] For easier understanding, please refer to Figure 5 , Figure 5 This is a schematic diagram of the mapping principle of a two-level mapping table in a specific implementation of the present application.
[0083] For different logical addresses, there is a corresponding physical address entry in the first mapping table. The corresponding relationship can be established in advance. For example, a simple corresponding method is Figure 5 This design, that is, according to the value of LBA, every 4 LBAs correspond to the same physical address entry. For example, for LBA0 to LBA3, the corresponding physical address entries in the first mapping table are all Figure 5 For the physical address entry PBA0 in the first mapping table, for LBA4 to LBA7, the corresponding physical address entries in the first mapping table are Figure 5 The physical address entry PBA1 in , and so on.
[0084] For example, when the data to be written reaches the first size, the LBAs of the four 4K data blocks in the data to be written are LBA1, LBA7, LBA50 and LBA25. The following takes the data block LBA1 as an example, and the processing principles of the other three data blocks are the same.
[0085] At this time, for the 4K data block with the logical address LBA1 in the data to be written, it is necessary to determine the physical address entry corresponding to the data block in the first mapping table according to the logical address of the data block (ie, LBA1). Figure 5 In the example, the physical address entry corresponding to the data block in the first mapping table is the physical address entry PBA0, and it is necessary to determine whether the physical address entry PBA0 currently points to the second mapping table.
[0086] Step S203: Select a free entry in the second mapping table as the entry pointed to by the physical address entry, record the physical address stored in the physical address entry and the latest physical address of the data block in the entry, and write the data block to the hard disk according to the latest physical address of the data block.
[0087] For any physical address entry in the first mapping table, the physical address entry either does not point to the second mapping table but points to 16K data in the hard disk, or points to the second mapping table, depending on whether the 16K data corresponding to the physical address entry is stored continuously in the hard disk through the 16K address space or stored in different locations.
[0088] exist Figure 5 In the example, for the 4K data block with the logical address LBA1 in the data to be written, it is determined that the physical address entry corresponding to the data block in the first mapping table is PBA0, and it is determined that the physical address entry PBA0 does not point to the second mapping table at present, so for the 4K data block with the logical address LBA1, the operation of step S203 can be performed. At this time, it is necessary to apply for a free table entry from the second mapping table, that is, it is necessary to select a free table entry in the second mapping table as the table entry pointed to by the physical address entry PBA0.
[0089] After the selection is completed, it is necessary to record the physical address stored in the physical address entry in this table entry, and it is also necessary to record the latest physical address of the 4K data block with logical address LBA1, that is, record the 4K physical address where the 4K data block is about to be written.
[0090] In a specific implementation manner, the storage content of a single entry in the second mapping table may be in the format shown in Table 1 below.
[0091] Table 1 Format of a single entry in the second mapping table
[0092]
[0093] In the above example, for the 4K data block with logical address LBA1, after applying for a free table entry in the second mapping table, the content of the physical address entry PBA0 can be filled in the position of "16K physical address" according to the format of Table 1, that is, the 16K physical address stored in the physical address entry PBA0 can be filled in. And because it is LBA1, which is the second LBA among the 4 LBAs corresponding to the physical address entry PBA0, the latest 4K physical address of the 4K data block LBA1 can be filled in the position of "4K physical address -2" according to the format of Table 1. At this time, there is no need to fill in the 4K physical address -1, 4K physical address -3 and 4K physical address -4, which can be all 0, indicating that it is not referenced by the first mapping table.
[0094] It is understandable that, initially, when a 16K data with continuous logical addresses (for example, LBA0 to LBA3) is written to the SSD, a 16K physical address can be stored in the physical address entry PBA0, reflecting the current storage location of the 16K data in the hard disk. At this time, the physical address entry PBA0 does not point to the second mapping table. Later, for example, if the user modifies LBA1, the 4K data block with the logical address LBA1 sent by the host can be received. As described above, it is necessary to apply for a free table entry in the second mapping table, and fill in the latest 4K physical address of the 4K data block of LBA1 at the position "4K physical address - 2" of the table entry, so that if LBA1 needs to be read and written later, it is necessary to find its location in the hard disk through the physical address recorded at the position "4K physical address - 2" in the table entry. It is understandable that the reason why it is necessary to fill in the 16K physical address stored in the physical address entry PBA0 at the "16K physical address" position is because for LBA0, LBA2 and LBA3, since the storage position has not changed, it is still necessary to use the 16K physical address stored in the physical address entry PBA0 to realize the data positioning of LBA0, LBA2 and LBA3.
[0095] After recording the latest physical address of the data block, the data block can be written to the hard disk according to the latest physical address of the data block. For example, in the above example, the latest 4K physical address of the 4K data block with logical address LBA1 is recorded in the table entry corresponding to the physical address entry PBA0 in the second mapping table, and the data block can be stored at its latest 4K physical address.
[0096] Step S204: modify the content in the table entry pointed to by the physical address entry in the second mapping table so that the latest physical address of the data block is recorded in the table entry, and write the data block into the hard disk according to the latest physical address of the data block.
[0097] The following is an example of the 4K data block with the logical address LBA7 in the above example. For the 4K data block with the logical address LBA7 in the data to be written, it is determined that the physical address entry corresponding to the data block in the first mapping table is PBA1, and it is judged that at present, the physical address entry PBA1 points to the second mapping table. Therefore, for the 4K data block with the logical address LBA7, the operation of step S204 can be performed. At this time, it is necessary to modify the content in the table entry pointed to by the physical address entry PBA1 in the second mapping table so that the latest physical address of the data block is recorded in the table entry. When the table entry format is set according to the example of Table 1 above, since LBA7 is the fourth LBA among the four LBAs corresponding to the physical address entry PBA1, according to the format of Table 1, it is necessary to fill in the latest 4K physical address of the 4K data block with the logical address LBA7 at the position "4K physical address - 4" of the corresponding table entry to replace the original content at the position "4K physical address - 4" in the table entry.
[0098] After the latest physical address of the data block is recorded in the table entry of the second mapping table, the data block can be written to the hard disk according to the latest physical address of the data block. That is to say, for the 16K of data to be written above, the four 4K data blocks (LBA are LBA1, LBA7, LBA50 and LBA25 respectively) included therein can be written to the hard disk together, and the write position of each 4K data block, that is, the 4K physical address of the data block, is recorded in the corresponding table entry of the second mapping table. For example, in the above example, the physical address of the data block with the logical address LBA1 is recorded in the "4K physical address -2" in the table entry corresponding to the physical address entry PBA0 in the second mapping table, and the physical address of the data block with the logical address LBA7 is recorded in the "4K physical address -4" in the table entry corresponding to the physical address entry PBA1 in the second mapping table.
[0099] For each data block of the second size in the data to be written, after performing the relevant operations of the second mapping table as described above, when the data to be written is subsequently written to the hard disk, the writing of each data block of the second size in the data to be written is completed, and it can be seen that when the data to be written of the first size is written to the hard disk, all the contents of the data to be written are valid write contents. Therefore, the present application scheme will not have the situation of write amplification, thereby effectively ensuring the performance utilization of the hard disk and ensuring the write life of the hard disk.
[0100] The storage space occupied by the mapping table mainly depends on the mapping granularity of the first mapping table, that is, the setting of the first size. As described above, in order to support ultra-large capacity SSDs, the first size should be greater than 4K, for example, it can be 16K, 32K, 64K, etc.
[0101] In a specific embodiment of the present invention, it may also include:
[0102] Determine whether the physical address entries corresponding to each data block in the data to be written in the first mapping table are consistent;
[0103] If so, the content in the physical address entry corresponding to the data block is updated to the latest physical address of the data to be written, and the data to be written is written to the hard disk according to the latest physical address of the data to be written. When the physical address entry points to the second mapping table, the table entry pointed to by the physical address entry is removed so that the physical address entry does not point to the second mapping table.
[0104] For ease of understanding, Figure 5 For example, in some cases, each data block in the data to be written has the same physical address entry in the first mapping table. For example, the logical addresses of the four data blocks in the data to be written are LBA0 to LBA4, and the physical address entries corresponding to these four data blocks in the first mapping table are all the physical address entry PBA0.
[0105] In such a case, it can be seen that the user data from LBA0 to LBA4 are stored continuously in the hard disk, so they can be represented by a 16K physical address, which means that there is no need to point the physical address entry PBA0 to the second mapping table. In this regard, in this implementation, the content in the physical address entry corresponding to the data block can be updated to the latest physical address of the data to be written. In this example, the content in the physical address entry PBA0 is updated to the latest physical address of the data to be written, and the data to be written is written to the disk according to the latest physical address of the data to be written.
[0106] It can be understood that if the physical address entry PBA0 previously pointed to the second mapping table, then since it is no longer necessary to point to the second mapping table, the entry in the second mapping table pointed to by the physical address entry PBA0 can be removed, so that the physical address entry does not point to the second mapping table, that is, the entry in the second mapping table is released and restored to a free entry.
[0107] In a specific embodiment of the present invention, it also includes:
[0108] When any non-free entry in the second mapping table meets the set elimination condition, the entry is used as an entry to be eliminated, and a physical address entry pointing to the entry to be eliminated in the first mapping table is determined;
[0109] Based on the content in the to-be-eliminated entry, the data of the first size pointed to by the to-be-eliminated entry is read from the hard disk into the cache as the to-be-written-back data;
[0110] Assign the latest physical address to the data to be written back, update the content in the physical address entry pointing to the entry to be removed in the first mapping table to the latest physical address of the data to be written back, and write the data to be written back to the hard disk according to the latest physical address of the data to be written back;
[0111] The table entry to be removed is removed so that the physical address entry corresponding to the data to be written back does not point to the second mapping table, and the table entry to be removed is restored to a free table entry.
[0112] This implementation method takes into account that the storage space occupied by the mapping table in the present application solution mainly depends on the mapping granularity of the first mapping table, that is, the setting of the first size. The second mapping table should occupy a smaller storage space, which means that the total number of entries in the second mapping table cannot be set too large, and should be much smaller than the total number of entries in the first mapping table. Since the total number of entries in the second mapping table will not be set too large, in order to avoid the situation where there are no free entries to use, a removal mechanism can be set, that is, if any non-free entry in the second mapping table meets the set removal condition, this entry can be used as an entry to be removed and removed.
[0113] Specifically, for the entry to be removed, it is necessary to determine the physical address entry in the first mapping table that points to the entry to be removed.
[0114] Since the entry to be removed stores a 16K physical address and at least 1 and at most 4 4K physical addresses, based on the content in the entry to be removed, the location of the 16K data pointed to by the entry to be removed on the hard disk can be determined, and then the 16K data is read from the hard disk to the cache to form the data to be written back. For example, in a certain entry to be removed, a 16K physical address is recorded, and 4K physical address-1 and 4K physical address-2 both store 4K physical addresses, while 4K physical address-3 and 4K physical address-4 are both 0. Based on the 4K physical addresses in 4K physical address-1 and 4K physical address-2, a 4K data block can be obtained from the corresponding position of the hard disk, and based on the 16K physical address, the remaining 8K data blocks that have not been moved to the storage position can be obtained, and a total of 16K data pointed to by the entry to be removed can be obtained.
[0115] After the data of the first size pointed to by the entry to be removed is read from the hard disk to the cache as the data to be written back, the latest physical address can be assigned to the data to be written back, and then the content in the physical address entry pointing to the entry to be removed in the first mapping table is updated to the latest physical address of the data to be written back, and the data to be written back is written back to the disk according to the latest physical address of the data to be written back. It can be seen that, similar to the above implementation method, at this time, each data block in the data to be written back has the same physical address entry corresponding to it in the first mapping table, indicating that the user data of the corresponding logical address is continuously stored in the hard disk, so it can be represented by a 16K physical address, which means that there is no need to point the physical address entry to the second mapping table, so the corresponding entry is effectively removed and restored to a free entry.
[0116] In the above implementation, for each data block in the data to be written, the corresponding physical address entry in the first mapping table is exactly the same, which is equivalent to passively realizing the elimination of table entries in the second mapping table. In this implementation, it supports active elimination of table entries in the second mapping table and restores them to free table entries, so that the second mapping table can be recycled for a long time.
[0117] In a specific implementation of the present invention, the total number of physical address entries in the first mapping table is M, the number of entries in the second mapping table is B, M and B are both positive integers and M is greater than B.
[0118] As described above, the total number of entries in the second mapping table cannot be set too large, and should be much smaller than the total number of entries in the first mapping table. Therefore, in this implementation, the total number of physical address entries in the first mapping table can be M, and the number of entries in the second mapping table is B, and M will be greater than B. For example, in practical applications, B is usually tens, and M can be more than a thousand. In practical applications, the DDR capacity occupied by the second mapping table is usually only about 20% of the DDR capacity occupied by the first mapping table.
[0119] Further, in a specific implementation of the present invention, when any non-idle entry in the second mapping table meets the set removal condition, the entry is used as an entry to be removed, including:
[0120] For any non-free table entry in the second mapping table, determine whether the data of a first size pointed to by the non-free table entry meets the preset cold data requirement;
[0121] If so, it is determined that the non-free entry meets the set elimination condition.
[0122] When actively removing entries from the second mapping table, non-idle entries that meet the set removal conditions are removed. The specific content of the removal conditions can be set and adjusted according to actual needs, so that the second mapping table can be used cyclically for a long time.
[0123] For example, this implementation method takes into account that when a data block in a certain logical address is cold data, since the probability of reading and writing cold data is low, if the table entry pointed to by the physical address entry corresponding to the data block is removed, there will only be a low probability of needing to re-apply for the table entry in the second mapping table for the physical address entry. On the contrary, if the table entry pointed to by the physical address entry corresponding to the hot data block is removed, since there is a high probability of reading and writing hot data later, even if the table entry pointed to by the physical address entry corresponding to the data block is removed, it may be necessary to re-apply for the table entry in the second mapping table for the physical address entry in a short period of time.
[0124] Therefore, this implementation method determines whether to remove the table entry according to the hot and cold conditions of the data. Specifically, for any non-free table entry in the second mapping table, it can be determined whether the data of the first size pointed to by the non-free table entry meets the preset cold data requirements. If it meets the preset cold data requirements, it means that it is cold data, and it can be determined that the non-free table entry meets the set removal condition.
[0125] Further, in a specific implementation of the present invention, determining whether the data of a first size pointed to by the non-free table entry meets the preset cold data requirement includes:
[0126] Determine the hot and cold evaluation values of the K data blocks of the second size pointed to by the non-free table entry, and use the average of the hot and cold evaluation values of the K data blocks of the second size as the hot and cold determination value of the data of the first size pointed to by the non-free table entry;
[0127] Determine whether the hot and cold determination values meet the preset value range;
[0128] If so, it is determined that the non-free entry meets the set elimination condition.
[0129] This implementation takes into account that for any one non-free table entry, it points to K data blocks of the second size in the hard disk, and different data blocks have different degrees of hotness and coldness. Therefore, in this implementation, the hotness and coldness evaluation values of the K data blocks of the second size pointed to by the non-free table entry are determined, and then the average value is used as the hotness and coldness judgment value of the data of the first size pointed to by the non-free table entry. If the hotness and coldness judgment value meets the preset numerical range, it means that the data of the first size pointed to by the non-free table entry can be regarded as cold data, and then it can be determined that the non-free table entry meets the set elimination conditions, and the elimination operation of the non-free table entry can be actively performed. The specific implementation of the elimination operation can refer to the above description.
[0130] Further, in a specific implementation of the present invention, determining the cold and hot evaluation values of the K data blocks of the second size pointed to by the non-free table entries includes:
[0131] For each data block of the K data blocks of the second size pointed to by the non-free table entry, a hot / cold assessment value of the data block is determined based on the access frequency of the data block in the most recent first time period and the time difference between the current moment and the last access moment of the data block.
[0132] There are many specific implementation methods for determining the hot and cold evaluation value. This implementation method takes into account that when the access frequency of a data block in the most recent first time period is high, it means that the data block is hot. If the time difference between the current moment and the last access moment of the data block is short, it means that the data block is hot. Therefore, the hot and cold evaluation value of the data block can be determined more conveniently based on the access frequency of the data block in the most recent first time period and the time difference between the current moment and the last access moment of the data block. Of course, in other specific implementation methods, more complex hot and cold evaluation value calculation methods can be designed according to actual needs.
[0133] In a specific embodiment of the present invention, it may also include:
[0134] After determining that the data of the first size pointed to by the non-free entry meets the preset cold data requirement, determining whether the non-free entry has a non-elimination mark;
[0135] If so, it is determined that the non-free entry does not meet the set elimination condition.
[0136] In this implementation, staff can be supported to set non-removal marks for some non-idle entries to ensure the flexibility of the solution. If a non-idle entry has a non-removal mark, it means that the staff does not want the non-idle entry to be removed based on actual needs, and it can be directly determined that the non-idle entry does not meet the set removal conditions.
[0137] Of course, in addition to the staff setting the non-elimination mark for the non-idle table items according to actual needs, other rules for automatically generating / deleting the non-elimination mark can also be set according to actual needs to meet the usage requirements.
[0138] In a specific embodiment of the present invention, it also includes:
[0139] Determine whether the entry to be removed is the oldest non-free entry among all non-free entries;
[0140] If not, after the to-be-eliminated entry is removed, the content of each non-idle entry whose generation time is older than the to-be-eliminated entry is moved, so that after the moving is completed, the current non-idle entries in the second mapping table are non-idle entries with consecutive entry numbers;
[0141] Wherein, whenever a free table entry is selected in the second mapping table, the serial number value of the selected free table entry is the serial number value of each current non-free table entry plus 1.
[0142] This implementation takes into account that non-free entries may be removed, so in order to conveniently and effectively determine the location of free entries, the content in the non-free entries will be moved. Figure 6 , is a schematic diagram of a table entry maintenance principle in the second mapping table in a specific implementation mode, Figure 6 In the table, the current old entry = 2, that is, OldEntry = 2, which means that the oldest non-free entry is entry 2 (Entry2), and the current new entry = 6, that is, NewEntry = 6, which means that the latest non-free entry is entry 6 (Entry6). Figure 6 In this example, all entries 2 to 6 are non-free entries. Later, when a free entry needs to be selected in the second mapping table as the entry pointed to by a physical address entry, that is, when a new entry in the second mapping table is applied for, the number value of the selected free entry is the number value of the current non-free entries plus 1. In this example, the free entry 7 (Entry7) is selected, that is, the next entry of the current latest non-free entry is selected as the selected free entry, that is, NewEntry+1. After the selection is completed, the new entry = 7, that is, NewEntry = 7. In addition, it should be noted that Figure 6 For example, if NewEntry=8, then according to the principle of recycling, NewEntry+1=1.
[0143] exist Figure 6In the implementation mode, each table item can be scanned one by one according to the set background scanning direction to determine whether the corresponding table item meets the set elimination condition. For example, table item 4 meets the set elimination condition and is eliminated according to the above principle. It can be understood that if no other operations are performed, table item 4 will become an idle table item. In this implementation mode, after table item 4 becomes an idle table item, the content in the non-idle table item is moved.
[0144] Specifically, first, it can be determined whether the entry 4 is the oldest non-free entry among all non-free entries. Figure 6 In the example, OldEntry=2, so entry 4 is not the oldest non-free entry among all non-free entries. Therefore, the content of each non-free entry with a generation time older than entry 4 can be moved, so that after the move is completed, the current non-free entries in the second mapping table are non-free entries with consecutive entry numbers. Figure 6 In the implementation method, after entry 4 becomes a free entry, the content of entry 3 can be moved to entry 4 for storage, and correspondingly, the content of entry 2 can be moved to entry 3 for storage, so that in this example, after the move is completed, OldEntry becomes Entry3, and after the move is completed, the current non-free entries in the second mapping table are entry 3 to entry 7, that is, the purpose of continuous entry numbering of each non-free entry is achieved, which facilitates the entry management in the second mapping table.
[0145] In a specific embodiment of the present invention, it may also include:
[0146] After determining that the physical address entry does not point to the second mapping table, when it is determined that there is no free table entry in the second mapping table, a non-free table entry is eliminated based on a preset elimination rule, and after the elimination is completed, the table entry is used as a free table entry pointed to by the selected physical address entry.
[0147] In the above implementation, it is described that the entries in the second mapping table are passively removed, that is, each data block in the data to be written has the same physical address entry in the first mapping table. It is also described that the entry removal in the second mapping table is actively supported, so that the second mapping table can be used in a long-term cycle.
[0148] This implementation supports a situation where an entry is urgently removed. Specifically, after executing step S202 and determining that the physical address entry does not point to the second mapping table, a new entry needs to be applied to the second mapping table, that is, an idle entry needs to be applied for use. Normally, there will be idle entries in the second mapping table, but if there are no idle entries in the second mapping table, this implementation supports the emergency removal of an entry of a non-idle entry, which can ensure the flexibility of the solution and the smooth execution of the relevant data writing process.
[0149] Of course, in actual applications, since the present application solution will actively remove non-idle entries that meet the set removal conditions, in most cases, the situation in which the implementation method requires urgent entry removal will not be triggered.
[0150] Furthermore, based on a preset elimination rule, eliminating a non-idle entry may include:
[0151] The oldest non-free entry among all non-free entries is removed.
[0152] This implementation method takes into account that since there is no free table entry in the second mapping table at present, when a non-free table entry needs to be immediately selected for elimination, the oldest non-free table entry among all non-free table entries can be selected for elimination, and there is a greater probability that the user will not perform a write operation on the data corresponding to this table entry in a short time. Of course, other implementation methods also support eliminating a non-free table entry according to other elimination rules, which can be set according to actual needs.
[0153] In a specific implementation of the present invention, the oldest non-free entry among all non-free entries is removed, including:
[0154] The oldest non-free entry among all the non-free entries is used as the entry to be removed, and a physical address entry pointing to the entry to be removed is determined in the first mapping table;
[0155] Based on the content in the to-be-eliminated entry, the data of the first size pointed to by the to-be-eliminated entry is read from the hard disk into the cache as the to-be-written-back data;
[0156] Assign the latest physical address to the data to be written back, update the content in the physical address entry pointing to the entry to be removed in the first mapping table to the latest physical address of the data to be written back, and write the data to be written back to the hard disk according to the latest physical address of the data to be written back;
[0157] The table entry to be removed is removed so that the physical address entry corresponding to the data to be written back does not point to the second mapping table, and the table entry to be removed is restored to a free table entry, so as to complete the removal of the oldest non-free table entry among all non-free table entries.
[0158] In this implementation, since the oldest non-free entry needs to be removed, according to the same principle as above, the oldest non-free entry needs to be used as the entry to be removed, and the physical address entry pointing to the entry to be removed in the first mapping table is determined.
[0159] Since the to-be-eliminated table entry stores a 16K physical address and at least 1 and at most 4 4K physical addresses, the location of the 16K data pointed to by the to-be-eliminated table entry on the hard disk can be determined based on the content in the to-be-eliminated table entry, and then the 16K data is read from the hard disk to the cache to constitute the data to be written back. Then, the latest physical address can be assigned to the data to be written back, and the content in the physical address entry pointing to the to-be-eliminated table entry in the first mapping table is updated to the latest physical address of the data to be written back, and the data to be written back is written to the hard disk according to the latest physical address of the data to be written back.
[0160] Similar to the above implementation method, at this time, for each data block in the data to be written back, the corresponding physical address entry in the first mapping table is consistent, indicating that the storage location of the data of the corresponding logical address in the hard disk is continuous, so it can be represented by a 16K physical address, which means that there is no need to point the physical address entry to the second mapping table, thereby realizing the effective removal of the corresponding table entry, that is, the table entry to be removed is released, and it is restored to a free table entry.
[0161] In a specific embodiment of the present invention, it may also include:
[0162] When receiving a read instruction, the logical address pointed to by the read instruction is obtained, and the physical address entry corresponding to the logical address pointed to by the read instruction in the first mapping table is determined, and it is determined whether the physical address entry points to the second mapping table. If it does not point to the second mapping table, the data of the first size corresponding to the physical address can be read into the cache according to the physical address stored in the physical address entry, and then based on the logical address pointed to by the read instruction, the data content pointed to by the read instruction is extracted from the data of the first size and then fed back to the user. If it points to the second mapping table, the table entry pointed to by the physical address entry can be determined, and the content in the table entry can be read, and then based on the content in the table entry, the storage position of the logical address pointed to by the read instruction in the hard disk is determined, and then the data of the first size is read from the corresponding storage position of the hard disk into the cache, and the data of the first size read contains the corresponding content of the logical address pointed to by the read instruction, so the data content pointed to by the read instruction can be extracted from it and fed back to the user. It can be seen that after applying the design of the 2-level mapping table of the present application scheme, data reading can also be realized.
[0163] The present application scheme takes into account that in the traditional ultra-large capacity SSD scheme, a 4-byte L2P table is used to represent an 8K or 16K or even larger data block in the SSD disk, which does break the limitation that the total size of the L2P table is equal to 1‰ of the physical capacity of the hard disk. However, when the user performs a write operation, he usually does not write the entire data block such as 8K or 16K, but only writes part of it. This results in the current schemes needing to read out the entire data block such as 8K or 16K first, and then adjust part of it before writing it back to the hard disk, which also causes write amplification. In this regard, in the scheme of the present application, a 2-level mapping table design is adopted, which can realize ultra-large capacity SSD without write amplification.
[0164] Specifically, when the data to be written reaches the first size, the data to be written needs to be written. At this time, for each data block of the second size in the data to be written, it is necessary to determine the physical address entry corresponding to the data block in the first mapping table according to the logical address of the data block, and determine whether the physical address entry points to the second mapping table. The existence of the second mapping table allows the first size of data corresponding to a physical address entry to be stored in different locations in the present application.
[0165] When it is determined that the physical address entry does not point to the second mapping table, it means that the first size of data corresponding to the physical address entry in the hard disk is currently stored continuously and is not scattered in different locations. At this time, since the data block needs to be written, it is necessary to select a free table entry in the second mapping table as the table entry pointed to by the physical address entry, and record the physical address stored in the physical address entry and the latest physical address of the data block in the table entry, and then write the data block to the hard disk according to the latest physical address of the data block. It can be seen that in this case, it is only necessary to write the data block to the hard disk according to the latest physical address of the data block, and it is not necessary to read the first size of data of the physical address entry in the hard disk from the hard disk, so there will be no write amplification. If it is determined that the physical address entry points to the second mapping table, the content in the table entry pointed to by the physical address entry in the second mapping table can be directly modified so that the latest physical address of the data block is recorded in the table entry, and the data block is written to the hard disk according to the latest physical address of the data block.
[0166] It can be seen that since the first mapping table is a mapping table from logical addresses to physical addresses, a single entry stores the physical address of data of the first size in the hard disk, and the first size is K times the second size, so the larger the first size is set, the more conducive it is to realizing an ultra-large capacity SSD. When writing any data block of the second size, the second mapping table can be used to write the data block of the second size, so that write amplification will not occur, thereby effectively ensuring the performance of the hard disk and not affecting the service life of the hard disk.
[0167] Corresponding to the above method and system embodiments, the embodiments of the present invention further provide a data management method and device, a computer-readable storage medium, and a computer program product, which can be referred to in correspondence with the above.
[0168] See also Figure 7 As shown, the device may include:
[0169] Memory 701, used for storing computer programs;
[0170] The processor 702 is configured to execute a computer program to implement the steps of the data management method in any of the above embodiments.
[0171] The computer program product includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the data management method in any of the above embodiments are implemented.
[0172] See also Figure 8The computer readable storage medium 80 stores a computer program 81, and when the computer program 81 is executed by the processor, the steps of the data management method in any of the above embodiments are implemented. The computer readable storage medium 80 mentioned here includes RAM (Random Access Memory), memory, ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), register, hard disk, removable disk, or any other form of storage medium known in the technical field.
[0173] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0174] Professionals may further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention, and the description of the above embodiments is only used to help understand the technical solution and its core idea of the present invention. It should be pointed out that for ordinary technicians in the technical field, without departing from the principle of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the present invention.
Claims
1. A data management method, characterized in that: include: storing the data to be written received from the host through the cache; When the data to be written reaches the first size, for each data block of the second size in the data to be written, according to the logical address of the data block, determining the physical address entry corresponding to the data block in the first mapping table, and judging whether the physical address entry points to the second mapping table; If not, selecting a free table entry in the second mapping table as the table entry pointed to by the physical address entry, and recording the physical address stored in the physical address entry and the latest physical address of the data block in the table entry, and writing the data block to the hard disk according to the latest physical address of the data block; If yes, modify the content in the table entry pointed to by the physical address entry in the second mapping table so that the latest physical address of the data block is recorded in the table entry, and write the data block into the hard disk according to the latest physical address of the data block; Among them, the first mapping table is a mapping table from logical addresses to physical addresses, and a single physical address entry stores the physical address of data of a first size in the hard disk; the first size is K times the second size, and K is a positive integer greater than 1.
2. The data management method according to claim 1, characterized in that: Also includes: Determine whether the physical address entries corresponding to each data block in the data to be written in the first mapping table are consistent; If so, the content in the physical address entry corresponding to the data block is updated to the latest physical address of the data to be written, and the data to be written is written to the hard disk according to the latest physical address of the data to be written, and when the physical address entry points to the second mapping table, the table entry pointed to by the physical address entry is removed so that the physical address entry does not point to the second mapping table.
3. The data management method according to claim 1, characterized in that: Also includes: When any non-free entry in the second mapping table meets the set elimination condition, the entry is used as an entry to be eliminated, and a physical address entry pointing to the entry to be eliminated in the first mapping table is determined; Based on the content in the to-be-eliminated entry, read the data of a first size pointed to by the to-be-eliminated entry from the hard disk into the cache as the to-be-written-back data; Assigning the latest physical address to the data to be written back, updating the content in the physical address entry pointing to the entry to be removed in the first mapping table to the latest physical address of the data to be written back, and writing the data to be written back to the hard disk according to the latest physical address of the data to be written back; The entry to be removed is removed so that the physical address entry corresponding to the data to be written back does not point to the second mapping table, and the entry to be removed is restored to a free entry.
4. The data management method according to claim 3, characterized in that: Also includes: Determine whether the to-be-eliminated entry is the oldest non-free entry among all non-free entries; If not, after the to-be-eliminated entry is removed, the content of each non-free entry whose generation time is older than the to-be-eliminated entry is moved, so that after the moving is completed, the current non-free entries in the second mapping table are non-free entries with consecutive entry numbers; Wherein, whenever a free table entry is selected in the second mapping table, the number value of the selected free table entry is the number value of each current non-free table entry plus 1.
5. The data management method according to claim 3, characterized in that: When any non-idle entry in the second mapping table meets the set removal condition, the entry is used as an entry to be removed, including: For any non-free table entry in the second mapping table, determine whether the data of a first size pointed to by the non-free table entry meets the preset cold data requirement; If yes, it is determined that the non-idle entry meets the set elimination condition.
6. The data management method according to claim 5, characterized in that: Also includes: After determining that the data of the first size pointed to by the non-free entry meets the preset cold data requirement, determining whether the non-free entry has a non-elimination mark; If yes, it is determined that the non-idle entry does not meet the set elimination condition.
7. The data management method according to claim 5, characterized in that: Determining whether the data of a first size pointed to by the non-free table entry meets a preset cold data requirement includes: Determine the hot and cold evaluation values of the K data blocks of the second size pointed to by the non-free table entry, and use the average of the hot and cold evaluation values of the K data blocks of the second size as the hot and cold determination value of the data of the first size pointed to by the non-free table entry; Determining whether the hot and cold determination value meets a preset value range; If yes, it is determined that the non-idle entry meets the set elimination condition.
8. The data management method according to claim 7, characterized in that: Determining the hot and cold evaluation values of the K data blocks of the second size pointed to by the non-free entry, respectively, includes: For each data block of the K data blocks of the second size pointed to by the non-free table entry, a hot / cold assessment value of the data block is determined based on the access frequency of the data block in the most recent first time period and the time difference between the current moment and the last access moment of the data block.
9. The data management method according to claim 1, characterized in that: The total number of physical address entries in the first mapping table is M, and the number of entries in the second mapping table is B, where M and B are both positive integers and M is greater than B.
10. The data management method according to any one of claims 1 to 9, characterized in that: Also includes: After determining that the physical address entry does not point to the second mapping table, when it is determined that there is no free table entry in the second mapping table, a non-free table entry is eliminated based on a preset elimination rule, and after the elimination is completed, the table entry is used as a free table entry pointed to by the selected physical address entry.
11. The data management method according to claim 10, characterized in that: Based on the preset elimination rules, a non-free entry is eliminated, including: The oldest non-free entry among all non-free entries is removed.
12. The data management method according to claim 11, characterized in that: Eliminate the oldest non-free entry from all non-free entries, including: Taking the oldest non-free entry among all non-free entries as the entry to be removed, and determining the physical address entry in the first mapping table pointing to the entry to be removed; Based on the content in the to-be-eliminated entry, read the data of a first size pointed to by the to-be-eliminated entry from the hard disk into the cache as the to-be-written-back data; Assigning the latest physical address to the data to be written back, updating the content in the physical address entry pointing to the entry to be removed in the first mapping table to the latest physical address of the data to be written back, and writing the data to be written back to the hard disk according to the latest physical address of the data to be written back; The entry to be removed is removed so that the physical address entry corresponding to the data to be written back does not point to the second mapping table, and the entry to be removed is restored to a free entry, so as to complete the removal of the oldest non-free entry among all non-free entries.
13. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the data management method according to any one of claims 1 to 12 are implemented.
14. A data management device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the data management method according to any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data management method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Memory system and operating method thereof
CN114372010A
P2L data management method and device of storage device
CN117891415A