Metadata management methods for solid-state drives (SSDs) and solid-state drives
By introducing an incremental refresh method in solid-state drives, metadata is divided into full and incremental blocks, which solves the problem of low metadata refresh efficiency in existing technologies and achieves more efficient metadata management and firmware upgrade support.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- MAXIO TECHNOLOGY (HANGZHOU) CO LTD
- Filing Date
- 2024-11-25
- Publication Date
- 2026-05-26
AI Technical Summary
In current solid-state drives (SSDs), all metadata is refreshed to the flash memory during the metadata refresh process, resulting in low efficiency and affecting firmware upgrades. In particular, errors are prone to occur when the metadata structure changes.
An incremental refresh method is adopted, which divides the metadata into full data blocks and incremental data blocks, refreshes them to the storage medium separately, and uses a two-dimensional bitmap to record the metadata information, refreshing only the metadata that has changed.
It improves metadata refresh efficiency, reduces the number of refreshes of unchanged metadata, extends the lifespan of solid-state drives, and supports accurate metadata recovery during firmware upgrades.
Smart Images

Figure CN122086304A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of memory technology, and more specifically, to a metadata management method for a solid-state drive (SSD) and the SSD itself. Background Technology
[0002] Solid-state drives (SSDs) are hard drives made with solid-state electronic storage chips, including a controller and storage media. Currently, the most common SSDs use flash memory as the storage medium for data storage, such as non-volatile memory like NAND flash.
[0003] Currently, mainstream solid-state drives (SSDs) generally have two hardware designs: one with DRAM as a cache unit; and the other without DRAM but typically with SRAM as a cache unit (called DRAM-Less SSDs). Due to the limited capacity of the cache unit, during controller operation, various metadata are first stored in the cache unit, then flushed to the storage medium, and restored from the storage medium to the cache unit at appropriate times. For example, before the host is normally shut down, the metadata is flushed to the storage medium, and when the host is powered on, it is restored from the storage medium to the cache unit. In existing solutions, each flush flushes all metadata (including some unchanged metadata) to the flash memory medium. Summary of the Invention
[0004] The purpose of this disclosure is to provide a metadata management method for a solid-state drive (SSD) and an SSD in general. This metadata management method implements incremental refresh so that only the changed metadata is refreshed.
[0005] According to a first aspect of the present disclosure, a metadata management method for a solid-state drive (SSD) is provided. The SSD includes a controller and a storage medium. The metadata management method is executed by the controller, which records metadata during various processes. The metadata management method includes the following steps:
[0006] When the first metadata refresh condition is met, the metadata of the current record is organized into a full data block and refreshed to the storage medium;
[0007] When the second metadata refresh condition is met, the changed metadata is organized into an incremental data block and refreshed to the storage medium; and
[0008] Metadata is restored from the storage medium to the controller based on the full data block and / or the incremental data block.
[0009] Each full data block and each incremental data block corresponds to a metadata information block, and the corresponding metadata information block is refreshed to the storage medium during the refresh. The metadata information block records the starting address of the full data block and the incremental data block in the storage medium, as well as the quantity and length of the metadata contained in the full data block or the incremental data block.
[0010] In some embodiments, a two-dimensional bitmap is used to record the metadata contained in the full data block and the incremental data block, respectively.
[0011] In some embodiments, the step of organizing the changed metadata into an incremental data block and refreshing it to the storage medium is performed multiple times to store multiple incremental data blocks in the storage medium.
[0012] In some embodiments, the metadata management method further includes: deleting the first incremental data block if it is determined that all the metadata contained in the first incremental data block among the plurality of incremental data blocks has expired.
[0013] In some embodiments, restoring the metadata to the controller includes:
[0014] The incremental data block or the full data block containing the required metadata is determined based on the two-dimensional bitmap.
[0015] The incremental data block and / or the full data block containing the required metadata are loaded into the controller to read the required metadata from them.
[0016] In some embodiments, the method further includes: if the current number of incremental data blocks reaches a threshold, or if the number of changed metadata that has not been refreshed to the storage medium reaches a threshold, then the metadata management method is re-executed.
[0017] In some embodiments, a management structure is used as an intermediate data structure to record the starting address and length of each metadata within a cache unit.
[0018] In some embodiments, the first metadata refresh condition is that the number or size of metadata in the current record exceeds a set threshold, and the second metadata refresh condition is that the number or size of metadata that has changed since the full data block or the previous incremental data block exceeds a set threshold.
[0019] According to a second aspect of the present disclosure, a controller for a storage device is provided for performing the metadata management method described above.
[0020] According to a third aspect of the present disclosure, a solid-state drive is provided, including a coupled controller and a flash memory storage medium, wherein the controller is used to implement the above-described metadata management method.
[0021] In summary, the embodiments of this disclosure implement incremental refresh of metadata, meaning that unchanged metadata and metadata that do not need to be saved can be skipped, thereby improving refresh efficiency. Simultaneously, each full data block and incremental data block corresponds to a metadata information block. During refresh, the corresponding metadata information blocks are also refreshed to the storage medium. Thus, when the firmware within the controller is upgraded, especially when the metadata structure corresponding to the metadata changes, the metadata can be matched to the changed metadata structure based on the metadata information blocks, facilitating firmware upgrades within the controller. Furthermore, incremental refresh can extend the lifespan of the solid-state drive. Attached Figure Description
[0022] The above and other objects, features and advantages of the present disclosure will become clearer from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0023] Figure 1 A schematic block diagram of a solid-state drive according to an embodiment of the present disclosure is shown;
[0024] Figure 2 and Figure 3 These are used to illustrate the processes of flushing metadata from the cache unit to the storage medium and restoring metadata from the storage medium to the cache unit in existing solutions, respectively.
[0025] Figure 4 A flowchart illustrating the metadata management method provided in the embodiments of this disclosure;
[0026] Figure 5 and Figure 6 This is used to illustrate the process of flushing metadata from the cache unit to the storage medium and restoring metadata from the storage medium to the cache unit provided in the embodiments of this disclosure. Detailed Implementation
[0027] The following description of embodiments of the present disclosure is based on examples, but the embodiments of the present disclosure are not limited to these embodiments. In the detailed description of the embodiments of the present disclosure below, certain specific details are described in detail. Those skilled in the art can fully understand the embodiments of the present disclosure even without these detailed descriptions. To avoid obscuring the essence of the embodiments of the present disclosure, well-known methods, processes, and flows are not described in detail. Furthermore, the accompanying drawings are not necessarily drawn to scale.
[0028] The flowcharts and block diagrams in the accompanying drawings illustrate possible system frameworks, functions, and operations of the systems, methods, and apparatuses according to embodiments of this disclosure. The blocks in the flowcharts and block diagrams may represent a module, program segment, or simply a piece of code. These modules, program segments, and code are all executable instructions used to implement a specified logical function. It should also be noted that the executable instructions implementing the specified logical function can be recombined to generate new modules and program segments. Therefore, the blocks and their order in the accompanying drawings are only used to better illustrate the processes and steps of the embodiments and should not be construed as limiting the invention itself.
[0029] Figure 1 A schematic block diagram of a solid-state drive according to an embodiment of the present disclosure is shown;
[0030] like Figure 1 As shown, the computer system 100 includes a host 110 and a solid-state drive (SSD). The SSD includes a controller 120 and a storage medium 130. The controller 120 is connected to the host 110 and is used to exchange data with the host 110. The controller 120 connects the host 110 and the storage medium 130 and stores the write data of the host 110 into the storage medium 130.
[0031] The controller 120 includes a host interface 121, a processor 123, a cache unit 124, and a memory controller 128. The host interface 121 of the control system 120 is connected to the host 110 to transmit data and read / write commands. The processor 123 is connected to the host interface 121, the cache unit 124, and the memory controller 128. The processor 123 parses read / write commands and executes read / write operations. The cache unit 124, for example, is SRAM, used to store a mapping table. The memory controller 128 controls the transmission and storage of write data. The processor 123 also executes the core software layer for memory control, namely the FTL (flash translation layer). The FTL consists of several programs. The processor 123 executes these programs, enabling it to translate read / write commands upon receipt, thereby completing access to the storage medium 130. Therefore, the host 110's file system and operating system can access the storage medium as if it were their own memory. The FTL also features, for example, support for bad block management, wear leveling, garbage collection, power-off recovery, and write balancing technologies.
[0032] Storage medium 130 is, for example, a flash memory chip array. To improve data read and write performance, the memory controller 128 of controller 120 can read and write to the flash memory chips of storage medium 130 via multiple channels (e.g., CH0 and CH2), with each channel connected to a group of flash memory chips.
[0033] Cache unit 124 can use SRAM and / or DRAM. Comparatively, SRAM offers speed advantages as a cache, but it is more expensive and has a smaller storage capacity per unit space. Accordingly, to improve cache space utilization, DRAM-less solid-state drives (SDS) employ a two-level mapping table for address management.
[0034] The metadata generated during the FTL management process is first stored in cache unit 124 and then refreshed to storage medium 130 when appropriate. At the same time, the controller restores the metadata from storage medium 130 when needed. Figure 2 and Figure 3 These are used to illustrate the processes of flushing metadata from cache unit 124 to storage medium 130 and restoring metadata from storage medium 130 to cache unit 124 in the existing scheme, respectively. 4K unit 211 refers to data organization based on 4K units.
[0035] refer to Figure 2 and combined Figure 1 In step S10, the metadata information that needs to be saved is stored in the management structure 210 in the cache unit 124. The management structure 210 records the starting address and length of each metadata that needs to be refreshed to the storage block. The figure shows the metadata A to C and metadata Y that need to be refreshed to the storage block, and also shows the metadata Z that is not added to the management structure 210 and does not need to be refreshed to the storage block.
[0036] In step S11, based on the information in the management structure 210, the metadata that needs to be brushed is copied sequentially into the 4K unit 211.
[0037] In step S12, 4K unit 211 is refreshed in storage block 131.
[0038] In step S13, steps S11 and S12 are repeated multiple times to refresh all the metadata that needs to be refreshed to storage block 131.
[0039] refer to Figure 3 and combined Figure 1 In step S21, the metadata information is stored in the management structure 210 in the cache unit 124. The management structure 210 records the starting address and length of each metadata that needs to be refreshed to the storage block.
[0040] In step S22, metadata is retrieved from storage block 131.
[0041] In step S23, the metadata is read into 4K unit 211.
[0042] In step S24, metadata is recovered sequentially from 4K unit 211 according to the starting address of each metadata in the management structure 210 and the length of the metadata.
[0043] In the existing solution, if the firmware in the controller 120 is upgraded, and if the metadata structure in the upgraded firmware changes, it will cause a metadata recovery error from storage block 131 to the cache unit. Furthermore, each refresh and recovery refreshes all metadata (including some metadata that has not changed) to the flash memory medium, which cannot achieve on-demand processing.
[0044] In view of this, embodiments of the present disclosure provide a method such as Figure 4 The metadata management method shown can be formed as follows: Figure 1 The firmware in the controller 120, and by Figure 1 The processors 123 in the middle execute and manage, such as Figure 1 The controller 120's FTL generates various metadata during various processes, including refreshing metadata in cache unit 124 to storage medium 130, and updating the storage medium 130 with the latest required metadata. The method specifically includes the following steps.
[0045] In step S401, it is determined that the amount of metadata has reached the first metadata refresh condition. If so, step S402 is executed. The first metadata refresh condition is, for example, that the amount or size of the metadata of the current record exceeds a set threshold.
[0046] In step S402, the metadata of the current record is organized into a full data block and refreshed to the storage medium.
[0047] In step S403, it is determined that the second metadata refresh condition has been met. If so, step S404 is executed. The second metadata refresh condition is, for example, that the number of incremental data blocks currently recorded exceeds a set threshold. Another example of the second metadata refresh condition is that, since the last refresh of full or incremental data blocks, the number or size of currently changed metadata exceeds a set threshold.
[0048] In step S404, the changed metadata is organized into an incremental data block and refreshed to the storage medium.
[0049] In step S405, metadata is restored from the storage medium to the controller based on incremental data blocks and / or full data blocks.
[0050] According to this embodiment, firstly, the currently recorded metadata is organized into a full data block in the cache unit and refreshed from the cache unit to the storage medium. Then, the changed metadata is organized into an incremental data block and refreshed to the storage medium. This step of organizing the changed metadata into an incremental data block and refreshing to the storage medium can be performed multiple times to store multiple incremental data blocks in the storage medium. Finally, the metadata is restored to the controller from the storage medium based on the full data block and / or the incremental data blocks. Furthermore, in this embodiment, to correctly perform metadata refresh and restoration, a metadata information block is used to record the starting address of the full data block and / or the incremental data block in the storage medium, the quantity and length of the metadata contained in the full data block or the incremental data block, and this metadata information block is also refreshed to the storage medium.
[0051] As an example, this embodiment can be organized according to the metadata information blocks in Table 1.
[0052] Table 1 name use Meta_len[MAX_META_CNT] MAX_META_CNT represents the length used to store each piece of metadata, and indicates the maximum number of metadata entries that can be recorded. Meta_cnt The amount of metadata used to store the current record Base_address Used to store the initial address of the entire data block on the storage medium. Extra_address[MAX_EXTRA_CNT] Used to store the initial address of incremental data blocks on the storage medium, MAX_EXTRA_CNT represents the maximum number of incremental data blocks that can be recorded. Extra_cnt Number of incremental data blocks used to store the current record bitmap Used to store two-dimensional bitmaps
[0053] According to Table 1, preferably, the starting address of the latest incremental data block can be persistently stored in a fixed storage location of the controller (or a fixed storage location of the flash memory medium). The latest incremental data block stores the starting address (Base_address) of the full data block in the storage medium and the starting address (Extra_address[MAX_EXTRA_CNT]) of all incremental data blocks in the storage medium.
[0054] As an example, this embodiment can organize the two-dimensional bitmap according to Table 2.
[0055] Table 2 Metadata sequence number Full data block Incremental data block 1 Incremental data block 2 Incremental data block 3 1 0 2 0 3 0 1 1 4 0 1 5 0 6 0 7 0 8 0 1 1 9 0 10 0 11 0
[0056] According to Table 2, the information in the 2D bitmap is cleared during initialization. Then, when constructing the full data block, metadata 1 to 11 contained in the full data block are set to 0 in the 2D bitmap to indicate that the full data block contains metadata 1 to 11. Then, changed metadata 3 and 8 are set to 1 in the 2D bitmap to indicate that metadata 3 and 8 have changed. The changed metadata 3 and 8 are then constructed as incremental data block 1, and so on. Table 2 also shows that incremental data blocks 2 and 3 contain the latest data of metadata 3 and 8. Therefore, based on the principle of retaining only the latest metadata, incremental data block 1 can be deleted.
[0057] As another example, this embodiment can organize the two-dimensional bitmap according to Table 3.
[0058] Table 3 Metadata sequence number Full data block Incremental data block 1 Incremental data block 2 Incremental data block 3 1 1 0 0 0 2 1 0 0 0 3 1 1 0 1 4 1 0 0 1 5 1 0 0 0 6 1 0 0 0 7 1 0 0 0 8 0 1 1 0 9 1 0 0 0 10 1 0 0 0 11 1 0 0 0
[0059] According to Table 3, during initialization, each element of the two-dimensional bitmap is initialized to zero. Then, when constructing the full data block, the full data block contains metadata 1 to 11, which is set to 1 in the two-dimensional bitmap to represent that the full data block contains metadata 1 to 7 and 9 to 11. Then, the changed metadata 3 and 8 are set to 1 in the two-dimensional bitmap to represent that metadata 3 and 8 have changed. Then, the changed metadata 3 and 8 are constructed as incremental data block 1, and so on.
[0060] Figure 5 and Figure 6 This is used to illustrate the process of flushing metadata from cache unit 124 to storage medium 130 and restoring metadata from storage medium 130 to cache unit 124 provided in the embodiments of this disclosure.
[0061] Figure 5 , Figure 6 and Figure 2 , Figure 3 Compared to the previous version, a new metadata information block has been added to record metadata information for both full and incremental data blocks, as well as other necessary information. The data structure of the metadata data block can be found in Table 1, and will not be elaborated here.
[0062] refer to Figure 5 First, in various operations, metadata is recorded, and the starting address and length of each metadata in the cache unit are recorded as a record in the management structure 210. The metadata information block is set to an initial value during initialization. When it is determined that a certain data in the metadata information block is equal to the initial value, and the current situation meets the first metadata refresh condition, the length of the metadata to be organized into the full data block is updated to the metadata information block according to the management structure 210. For a certain metadata that is not organized into the full data block, the corresponding length is set to 0, the starting address of the full data block in the storage medium is recorded to the metadata information block, and referring to Table 2, the corresponding element of the first column of the two-dimensional bitmap is set to 0 according to the metadata contained in the full data block. Then, the full data block and the metadata information block are organized into 4K units and refreshed to the storage block 131. Then, as the system runs, if a certain metadata changes, the corresponding element of the two-dimensional bitmap is set to 1, indicating that the metadata is dirty data. Then, the following operations are performed:
[0063] 1) Determine if the number of incremental data blocks has reached the threshold. If it has, refresh the full data blocks again. The refreshed full data blocks include the latest metadata, including both unchanged and changed metadata.
[0064] 2) Based on the two-dimensional bitmap, determine whether the number of metadata that is dirty data and has not been refreshed to the storage medium has reached the threshold. If the threshold is reached, refresh the full data block again. The refreshed full data block still includes the latest metadata.
[0065] 3) Delete the incremental data blocks that can be deleted based on the two-dimensional bitmap.
[0066] 4) When the current situation meets the second metadata refresh condition, organize the incremental data block into 4K unit 211 and refresh 4K unit 211 into storage block 131.
[0067] When all metadata needs to be restored, it should be done sequentially, first restoring the full data blocks, then the incremental data blocks. For more details, refer to [link to relevant documentation]. Figure 6 When restoring a full data block or an incremental data block from storage block 131, data is first read from the starting address of the full data block or incremental data block into 4K unit 211. Then, metadata information blocks are read from the first 4K unit 211. The starting address and length of each metadata are calculated based on the metadata information blocks and written into the management structure 211. Then, each metadata is read from 4K unit 211 in sequence according to the starting address and length of each metadata.
[0068] In the above embodiments, each full data block and each incremental data block corresponds to a metadata information block. The number and type of metadata contained in each data block can be different. Each metadata is restored sequentially according to the metadata information block corresponding to each data block. If the length of a recorded metadata is 0, the restoration of that metadata is skipped. Furthermore, the aforementioned management structure serves as an intermediate data structure. Before refreshing the metadata, it is used to record the starting address and length of each metadata that has not yet been refreshed to the storage medium. When restoring metadata, it is used to record the starting address and length of each metadata to be restored.
[0069] In some embodiments, if only one or a few required metadata items are to be recovered, the incremental data block or full data block where the required metadata is located can be determined first through a two-dimensional bitmap and metadata information block. Then, the starting address and length of the required metadata in the data block can be determined through the metadata information block, and the required metadata can be read from the data block according to the starting address and length.
[0070] Accordingly, this disclosure also provides a computer-readable storage medium for storing software program code formed according to the above embodiments.
[0071] In summary, the embodiments of this disclosure implement incremental refresh of metadata, that is, metadata that has not changed and metadata that does not need to be saved can be skipped, thereby improving refresh efficiency. At the same time, the full data block and the incremental data block each correspond to a metadata information block. During refresh, the corresponding metadata information block is refreshed to the storage medium together. In this way, when the firmware in the controller is upgraded, especially when the metadata structure corresponding to the metadata changes, the metadata can be matched to the changed metadata structure according to the metadata information block, thereby facilitating the firmware upgrade in the controller. Incremental refresh can also improve the lifespan of the solid-state drive.
[0072] Those skilled in the art will understand that the various modules or units of the data processing system according to embodiments of this disclosure can be implemented by hardware, firmware, or software. Software includes, for example, coded programs written in various programming languages such as JAVA, C / C++ / C#, and SQL. Although the steps and their order are given in the methods and method diagrams of embodiments of this disclosure, the executable instructions that perform the specified logical functions of the steps can be recombined to generate new steps. The order of the steps should not be limited to the order shown in the methods and method diagrams, and can be adjusted at any time according to functional needs. For example, some steps can be executed in parallel or in reverse order.
[0073] The above description is merely a preferred embodiment of this disclosure and is not intended to limit the scope of this disclosure. For those skilled in the art, various modifications and variations can be made to this disclosure. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the protection scope of this disclosure.
[0074] The embodiments of this disclosure are as described above. These embodiments do not exhaustively describe all details, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made based on the above description. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the embodiments of this disclosure, thereby enabling those skilled in the art to make good use of the embodiments of this disclosure and modifications based on them. The embodiments of this disclosure are limited only by the claims and their full scope and equivalents.
Claims
1. A metadata management method for a solid-state drive (SSD), the SSD including a controller and a storage medium, the metadata management method being executed by the controller, the controller recording metadata during various processes, wherein the metadata management method includes the following steps: When the first metadata refresh condition is met, the metadata of the current record is organized into a full data block and refreshed to the storage medium; When the second metadata refresh condition is met, the changed metadata will be organized into an incremental data block and refreshed to the storage medium. as well as Metadata is restored from the storage medium to the controller based on the full data block and / or the incremental data block. The full data block and the incremental data block each correspond to a metadata information block, and the corresponding metadata information blocks are refreshed to the storage medium during the refresh. Each metadata information block records the starting address of the full data block and / or the incremental data block in the storage medium, as well as the quantity and length of the metadata contained in the full data block or the incremental data block.
2. The metadata management method according to claim 1, wherein, A two-dimensional bitmap is used to record the metadata contained in the full data block and the incremental data block, respectively.
3. The metadata management method according to claim 1, wherein, The steps of organizing the changed metadata into an incremental data block and refreshing it to the storage medium are performed multiple times to store multiple incremental data blocks in the storage medium.
4. The metadata management method according to claim 3, further comprising: If it is determined that all the metadata contained in the first incremental data block among the plurality of incremental data blocks has expired, then the first incremental data block is deleted.
5. The metadata management method according to claim 1, wherein, The step of restoring the metadata to the controller includes: The incremental data block or the full data block containing the required metadata is determined based on the two-dimensional bitmap. The incremental data block and / or the full data block containing the required metadata are loaded into the controller to read the required metadata from them.
6. The metadata management method according to claim 3 further includes: If the current number of incremental data blocks has reached the threshold, or if the number of changed metadata that has not been refreshed to the storage medium has reached the threshold, then the metadata management method is re-executed.
7. The metadata management method according to claim 1 further includes: A management structure is used as an intermediate data structure to record the address and length of each metadata in the cache unit.
8. The metadata management method according to claim 1, wherein, The first metadata refresh condition is that the number or size of the metadata of the current record exceeds a set threshold, and the second metadata refresh condition is that the number or size of the metadata that has changed since the full data block or the previous incremental data block exceeds a set threshold.
9. A controller for a storage device, configured to perform the metadata management method as described in any one of claims 1 to 8.
10. A storage device comprising a coupled controller and a flash memory storage medium, the controller being configured to implement the metadata management method according to any one of claims 1 to 8.