Metadata saving method and device, computer device, and storage medium
By dynamically adjusting the delta and base ratios of metadata in the SSD, the problem of the ratios being difficult to adapt to the SSD's state in existing technologies is solved, achieving an optimal balance between lifespan and power-on time, thus extending the SSD's lifespan and shortening its power-on time.
Patent Information
- Application Number
- CN202510037821.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-09
- Publication Date
- 2026-06-23
- Estimated Expiration
- 2045-01-09
AI Technical Summary
In existing technologies, when solid-state drives (SSDs) store metadata, the delta to base ratio is difficult to adapt to the current state, resulting in the SSD's lifespan and average power-on time not reaching their optimal state.
By acquiring the average number of flash write cycles and power-on time of the hard drive, the ratio of delta and base is dynamically adjusted, a metadata snapshot is generated, and it is saved to the hard drive to ensure that the ratio is adapted to the current state of the SSD.
It achieves an optimal balance between SSD lifespan and average power-on time, reducing flash memory erase/write frequency, extending SSD lifespan, and shortening power-on time.
Smart Images

Figure CN119960687B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more specifically to a method, apparatus, computer device, and storage medium for storing metadata. Background Technology
[0002] Saving metadata is crucial for SSDs (Solid State Disks). It determines whether the SSD can correctly save all metadata each time it loses power, whether it can be restored to a normal state upon power-up, and whether it can process host commands promptly. Currently, to ensure that the latest metadata is saved to the NAND flash memory in the event of an SSD's abnormal power loss, a snapshot method is used to save metadata. That is, during SSD operation, the amount of metadata changes (delta) is stored in the write buffer. When the amount of changes accumulates to a certain level, a portion of the metadata is copied to the write buffer as a snapshot (base). Finally, the base and delta are saved together to the NAND flash memory.
[0003] This snapshot-saving method requires determining the delta to base ratio. Specifically, it determines how much delta is saved before adding a base segment and flushing the NAND flash. When the base segment is small and the delta segment is large, the amount of delta that needs to be recovered during SSD power-on recovery is very large, and it needs to be recovered in a specific order, resulting in a longer SSD power-on time. Conversely, if the base segment is large and the delta segment is small, although this reduces the SSD power-on time, the frequent NAND flashing for every small accumulation of delta leads to a high frequency of block (data block) erases and writes, significantly impacting the SSD's lifespan. Currently, a static, fixed ratio is used when saving metadata. However, during SSD use, the average power-on time and PE (P / Ecycle, the number of times the flash memory is erased and written) constantly change. PE affects the SSD's lifespan, and the current delta to base ratio is insufficient to adapt to the current state of the SSD, failing to balance SSD lifespan and average power-on time to achieve optimal performance.
[0004] Therefore, when storing metadata, the related technologies have the problem that the ratio of delta to base is difficult to adapt to the current state of the SSD, and cannot optimize the lifespan and average power-on time of the SSD. Summary of the Invention
[0005] In view of this, the present invention provides a metadata storage method, apparatus, computer device and storage medium to solve the problem that when storing metadata, the ratio of delta to base is difficult to adapt to the current state of SSD, and the lifespan and average power-on time of SSD cannot reach the optimal state.
[0006] In a first aspect, the present invention provides a method for storing metadata, the method comprising:
[0007] After powering on the hard drives of various types, the average number of flash memory erase / write cycles, the average power-on time, and the current ratio of the hard drives of various types are obtained. The ratio of the average number of flash memory erase / write cycles of the hard drives of different types is determined. The current ratio is the ratio between the number of metadata changes and the number of metadata snapshots.
[0008] Based on the average power-on time, average flash memory erase / write cycles, and cycle ratio, adjust the current ratio to obtain the target ratio;
[0009] Based on the metadata of hard drives under various hard drive types, determine the amount of metadata change, and generate a metadata snapshot in memory according to the target ratio, the amount of metadata change, and the metadata. The metadata snapshot contains the metadata of the hard drive.
[0010] Write the metadata snapshot in memory to the disk corresponding to the metadata in the metadata snapshot.
[0011] The metadata storage method provided in this embodiment adjusts the current ratio based on the hard drive's average power-on time, the average flash memory erase / write cycles for various hard drive types, and the ratio between the average flash memory erase / write cycles, and then saves the hard drive's metadata according to the adjusted current ratio. By continuously adjusting the current ratio to adapt to the SSD's state, a more suitable target ratio is obtained, optimizing the SSD's lifespan and average power-on time. This solves the problem that when saving metadata, the delta and base ratios are difficult to adapt to the SSD's current state, thus failing to optimize the SSD's lifespan and average power-on time.
[0012] In some alternative implementations, the method further includes:
[0013] Create a write buffer in memory with a preset data capacity;
[0014] The write buffer is divided into three parts: the first part is used to store the target ratio, the second part is used to store the metadata change, and the third part is used to store the metadata snapshot.
[0015] In this embodiment, a write buffer is created in memory to store the target ratio, metadata changes, and metadata snapshots. On the one hand, during power-on recovery, the target ratio can be quickly read in the first part and the SSD's metadata can be restored according to the target ratio. On the other hand, during power-on recovery, the metadata changes and metadata snapshots can be obtained from the second and third parts to complete the metadata restoration.
[0016] In some optional implementations, the amount of metadata change is determined based on the metadata of hard drives under various hard drive types, and a metadata snapshot is generated in memory based on the target ratio, the amount of metadata change, and the metadata, including:
[0017] When the metadata of a hard drive changes under various hard drive types, determine the amount of metadata change and write the amount of metadata change into the second part;
[0018] Based on the target proportion in Part 1, determine the threshold for the amount of metadata change;
[0019] In the second part, when the number of metadata changes equals the quantity threshold, the target metadata is determined from the metadata based on the metadata changes.
[0020] Based on the target metadata and the first preset order, a metadata snapshot is created and written to the third part;
[0021] Flush the metadata snapshot in memory to the disk corresponding to the metadata in the metadata snapshot, including:
[0022] If the space occupied by the data in the write buffer is equal to the preset capacity, the data in the write buffer will be flushed from memory to the hard disk corresponding to the metadata in the metadata snapshot.
[0023] In this embodiment, a metadata snapshot is created based on the target ratio in the first part, and the metadata changes and the metadata snapshot are written to the second and third parts of the write buffer, respectively, to facilitate subsequent recovery of the SSD's metadata. Furthermore, the metadata storage strategy can be adjusted by modifying the target ratio in the first part.
[0024] In some optional implementations, after flushing the metadata snapshot in memory to the disk corresponding to the metadata in the metadata snapshot, the method further includes:
[0025] Retrieve the data from the write buffer from the hard drive containing the data in the write buffer, and determine the target amount of metadata change based on the target proportion in the first part of the write buffer;
[0026] In the second part of the write buffer, obtain the target number of metadata changes as the target change amount;
[0027] Based on the second preset order, the target change amount, and the metadata snapshot in the third part of the write buffer, restore the metadata in memory.
[0028] In some optional implementations, the current ratio is adjusted based on the average power-on time, the average number of flash memory erase / write cycles, and the cycle ratio, including:
[0029] If the average power-on time is greater than or equal to the first preset threshold, the value of the change in metadata in the current ratio is reduced by the first preset step size.
[0030] Alternatively, if the average number of flash write cycles is greater than or equal to the second preset threshold, the value of the metadata change in the current ratio is increased by the second preset step.
[0031] Alternatively, if the frequency ratio is within a first preset range, increase the value of the metadata change in the current ratio by a third preset step.
[0032] In this embodiment, the average power-on time, average flash memory erase / write cycles, and cycle ratio are compared with the corresponding preset thresholds to determine whether the current ratio needs to be adjusted and how to adjust it. By continuously adjusting the current ratio, the system adapts to the state of the SSD and obtains a more suitable target ratio, so that the lifespan and average power-on time of the SSD reach an optimal state.
[0033] In some alternative implementations, the method further includes:
[0034] Determine whether the value of the change in metadata in the adjusted current ratio is within the second preset range;
[0035] If the value of the change in metadata in the adjusted current ratio is within the second preset range, the target ratio in the first part is replaced by the adjusted current ratio.
[0036] If the value of the change in metadata in the adjusted current ratio is not within the second preset range, the third preset range is determined based on the value of the change in metadata in the current ratio and the critical value of the second preset range.
[0037] Based on any integer in the third preset range and the current ratio, a first intermediate ratio is obtained, and the target ratio in the first part is replaced by the first intermediate ratio.
[0038] In this embodiment, during the adjustment of the current ratio, the value of the change in metadata in the current ratio is constrained by the second preset range or the third preset range, so as to avoid the change in metadata being too large or too small, which would cause the SSD power-on time to be too long or the flash memory erase / write cycles to increase rapidly.
[0039] In some alternative implementations, the method further includes:
[0040] If the third preset range does not contain an integer, then the target ratio in the first part is replaced with the preset ratio, or it is determined whether a ratio setting instruction has been received.
[0041] If a scaling instruction is received, a second intermediate scaling ratio is determined based on the scaling instruction, and the target scaling ratio in the first part is replaced by the second intermediate scaling ratio.
[0042] In this implementation, if a suitable ratio cannot be determined during the adjustment of the current ratio, the preset ratio is reset as the target ratio or the target ratio is determined according to the ratio setting instruction, so as to avoid continuously adjusting the target ratio and affecting the read and write services of the SSD.
[0043] In a second aspect, the present invention provides a metadata storage device, the device comprising:
[0044] The parameter acquisition module is used to acquire the average number of flash memory erase / write cycles, the average power-on time, and the current ratio of hard drives under various hard drive types after the hard drives are powered on again, and to determine the ratio between the average number of flash memory erase / write cycles of hard drives under different hard drive types. The current ratio is the ratio between the number of metadata changes and the number of metadata snapshots.
[0045] The ratio adjustment module is used to adjust the current ratio based on the average power-on time, the average number of flash memory erase / write cycles, and the cycle ratio to obtain the target ratio;
[0046] The snapshot generation module is used to determine the amount of metadata change based on the metadata of hard drives under various hard drive types, and generate a metadata snapshot in memory based on the target ratio, the amount of metadata change, and the metadata. The metadata snapshot contains the metadata of the hard drive.
[0047] The snapshot flushing module is used to flush the metadata snapshot in memory to the hard disk corresponding to the metadata in the metadata snapshot.
[0048] Thirdly, the present invention provides a computer device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the metadata storage method of the first aspect or any corresponding embodiment described above.
[0049] Fourthly, the present invention provides a computer non-volatile readable storage medium storing computer instructions, which are used to cause a computer to execute the metadata storage method of the first aspect or any corresponding embodiment described above.
[0050] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the metadata storage method of the first aspect or any corresponding embodiment thereof. Attached Figure Description
[0051] To more clearly illustrate the technical solutions in the specific embodiments or related technologies of the present invention, the drawings used in the description of the specific embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0052] Figure 1 This is a flowchart illustrating a metadata storage method according to an embodiment of the present invention;
[0053] Figure 2 This is a flowchart illustrating a metadata storage method according to an embodiment of the present invention;
[0054] Figure 3 This is a flowchart of a method for dynamically adjusting the amount of changes in saved metadata and the snapshot ratio according to an embodiment of the present invention;
[0055] Figure 4 This is a structural block diagram of a metadata storage device according to an embodiment of the present invention;
[0056] Figure 5 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0058] The current method for storing SSD metadata involves saving the changes (delta) in the metadata during SSD operation in a write buffer. Once the changes accumulate to a certain amount, a portion of the metadata is copied to the buffer as a snapshot (base). Finally, the snapshot and the changes are saved together to the NAND flash memory. In the event of a power outage, since capacitor power supply only lasts for tens of milliseconds, this method only requires writing a small amount of data to save the complete metadata, achieving fast and comprehensive storage of all the latest metadata. Upon power-up, only the snapshot needs to be restored, and then the changes are restored in a specific order. The ratio of delta to base is currently static and fixed. A suitable ratio is determined during the product development phase through calculation and testing. Once determined, this ratio remains unchanged during subsequent use until the disk enters read-only mode and becomes unusable.
[0059] In addition, to quickly write metadata to the NAND flash memory upon power-off, a portion of the NAND flash memory chips are used in SLC (Single-Level Cell) mode. The metadata is stored in these blocks, and the number of these blocks is limited. Frequent writes result in a high frequency of block erasures. Although the PE (Erase / Write) limit for SLC is higher than that for TLC (Trinary-Level Cell), the limited number of SLC chips and the high write frequency cause the PE to rise rapidly. When SLC reaches its PE limit, it becomes unstable and may experience read / write errors, leading to inaccurate data recording. The SSD then needs to enter read-only mode and cannot continue writing data, significantly impacting its lifespan.
[0060] Based on the above, this invention provides a metadata storage method that uses a ratio obtained through testing or calculation as the default ratio setting upon the first power-on. A variable is added to record the delta-base ratio at the next power-on, and this variable is stored in the Nand. After power-on, this variable is read to confirm the delta-base ratio in the write buffer. This ratio is recorded by noting the number of changes in delta, and this ratio is recorded in the buffer header when flushing each buffer. During the buffer adjustment process, this variable is adjusted based on the ratio of SLC PE to TLC PE, the number of SLC PEs, and the average power-on time of the SSD, to adjust the delta-base ratio in the write buffer. When restoring metadata, the number of deltas to be restored is determined by the delta-base ratio recorded in the buffer header. This achieves the technical effect of continuously adapting the delta-base ratio in the write buffer to the SSD's state, balancing the SSD's lifespan and average power-on time.
[0061] According to an embodiment of the present invention, a metadata storage embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer device with data processing capabilities, such as a computer, server, etc. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0062] This embodiment provides a method for storing metadata. Figure 1 This is a flowchart of a metadata storage method according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps:
[0063] Step S101: After the hard drives are powered on again under various hard drive types, obtain the average number of flash memory erase / write cycles, the average power-on time, and the current ratio of the hard drives under various hard drive types, and determine the ratio of the number of average flash memory erase / write cycles under different hard drive types. The current ratio is the ratio between the number of metadata changes and the number of metadata snapshots.
[0064] Specifically, the overall process for saving metadata in this embodiment is as follows: When the SSD is running, metadata is generated in memory (DDR) and stored in memory. Metadata includes, for example, L2P (Logical To Physical Table) mapping tables (FTL mapping tables), Bad Block Management (BBM) information, and Garbage Collection (GC) information. Based on this metadata, the operating system (OS) can query the required data on the hard drive. Furthermore, the metadata can be saved using a snapshot method. When the amount of metadata change reaches a certain value, a snapshot is generated and temporarily stored in DDR. When the SSD is powered off, the metadata in DDR needs to be written to the SSD's Nand flash memory, i.e., the snapshot is written to the Nand flash memory. The SSD includes a controller chip, Nand flash memory, etc. Nand flash memory is a non-volatile storage medium used to store data. Afterwards, when the SSD is powered on, the metadata snapshot needs to be read from the Nand flash memory and the metadata from the snapshot restored to DDR. Additionally, if there is a change in metadata (delta) in the Nand, it is necessary to determine the metadata corresponding to delta and restore it to the DDR.
[0065] Hard drives are categorized based on the type of NAND flash memory they contain, such as TLC and SLC. Since L2P metadata is the most abundant type and has the greatest impact on SLC PE and power-on time, this embodiment uses L2P metadata as an example for explanation.
[0066] Based on the above, after power-on of the SSDs under various hard drive types, the average power-on time for each type is obtained. The average flash memory erase / write cycles for each hard drive type (e.g., TLC and SLC) are also obtained, such as the average PE cycles for SLC and TLC. Furthermore, the ratio between the average flash memory erase / write cycles is obtained, for example, the ratio of the average PE cycles for SLC to that for TLC.
[0067] The ratio of metadata change (delta) obtained through testing or calculation to the metadata snapshot (base) is set as the default ratio on the first power-on, and this ratio is the current ratio. Subsequently, this embodiment adds a variable to record the ratio of delta to base at the next power-on, and saves this variable in the Nand array; the ratio recorded in this variable is the current ratio.
[0068] Step S102: Adjust the current ratio based on the average power-on time, average flash memory erase / write cycles, and cycle ratio to obtain the target ratio.
[0069] Specifically, the current ratio is adjusted based on the average power-on time, average flash memory erase / write cycles, and the ratio of cycles. For example, if the average power-on time is too long, the delta component of the current ratio is reduced, such as reducing 2:5 to 1:5. If the average PE cycles of SLC are about to reach their limit, or if the ratio of the average PE cycles of SLC to TLC is too large, the delta component of the current ratio is increased, such as increasing 2:5 to 3:5. The adjusted current ratio is then used as the target ratio.
[0070] Because SSDs record the average PE count for SLC and TLC drives, as well as the average power-on time, the average power-on time tends to stabilize as SSD usage time increases. The ratio of the average PE count for SLC to that for TLC drives also tends to stabilize, and the write buffer ratio gradually stabilizes as well. Ultimately, because the average PE count for SLC drives eventually increases, the write buffer delta ratio gradually increases, ultimately reducing the flushing frequency, which helps extend the SSD's lifespan.
[0071] Step S103: Determine the amount of metadata change based on the metadata of the hard disks under various hard disk types, and generate a metadata snapshot in memory based on the target ratio, the amount of metadata change, and the metadata. The metadata snapshot contains the metadata of the hard disk.
[0072] Specifically, when an L2P table entry changes during SSD operation, the variable needs to be saved as metadata change data. This process is performed by the JM (Journal Manager).
[0073] When the SSD is running, when the amount of delta accumulates to the target ratio, a portion of the metadata is copied into the buffer as a metadata snapshot (base). Finally, the delta and base are saved together into the Nand. For example, if the target ratio of delta to base is 1:3, then when the amount of delta equals 1, the base corresponding to these deltas is generated.
[0074] Step S104: Write the metadata snapshot in memory to the hard disk corresponding to the metadata in the metadata snapshot.
[0075] Specifically, metadata snapshots in memory can be written to the hard drive corresponding to the metadata in the metadata snapshot in various ways. Specifically, they need to be written to the flash memory of that hard drive. For example, a time interval such as 5 seconds or 10 seconds can be set, and the metadata snapshot in memory can be written to the Nand flash memory of the SSD every time the time interval is elapsed; a maximum number can be set, and whenever the number of metadata snapshots in memory reaches the maximum number, the metadata snapshot in memory can be written to the Nand flash memory of the SSD... The specific method can be adjusted according to actual needs.
[0076] The metadata storage method provided in this embodiment adjusts the current ratio based on the hard drive's average power-on time, the average flash memory erase / write cycles for various hard drive types, and the ratio between the average flash memory erase / write cycles, and then saves the hard drive's metadata according to the adjusted current ratio. By continuously adjusting the current ratio to adapt to the SSD's state, a more suitable target ratio is obtained, optimizing the SSD's lifespan and average power-on time. This solves the problem that when saving metadata, the delta and base ratios are difficult to adapt to the SSD's current state, thus failing to optimize the SSD's lifespan and average power-on time.
[0077] In some alternative implementations, the method further includes:
[0078] Create a write buffer in memory with a preset data capacity;
[0079] The write buffer is divided into three parts: the first part is used to store the target ratio, the second part is used to store the metadata change, and the third part is used to store the metadata snapshot.
[0080] Specifically, while saving the modified L2P, it's necessary to consider ensuring that all changes (delta) are saved to the NAND flash memory within a limited timeframe during normal power-on / off cycles and abnormal power outages. This means that upon the next power-on, the entire L2P data should be restored to its state before power-off. However, excessively frequent write operations to save the L2P data are detrimental. Firstly, frequent write operations can shorten the lifespan of the NAND flash memory, which has a limited number of write cycles. Once this limit is reached, the NAND flash memory becomes unstable, compromising the integrity and accuracy of the written data. Secondly, frequent write operations increase write amplification.
[0081] Therefore, when the SSD is running, JM creates a write buffer in DDR memory with a space size equal to a preset capacity when saving L2P. The preset capacity is, for example, 16KB, 32KB, etc., to meet actual needs.
[0082] Divide the write buffer into a first part, a second part, and a third part, for example: a header part, a delta part, and a base part. Figure 2 As shown, the Header section stores the target ratio, the Delta section stores the metadata changes, and the base section stores a metadata snapshot. The Delta and Header sections together occupy 4KB, and the base section occupies 12KB.
[0083] In this embodiment, a write buffer is created in memory to store the target ratio, metadata changes, and metadata snapshots. On the one hand, during power-on recovery, the target ratio can be quickly read in the first part and the SSD's metadata can be restored according to the target ratio. On the other hand, during power-on recovery, the metadata changes and metadata snapshots can be obtained from the second and third parts to complete the metadata restoration.
[0084] In some optional implementations, the amount of metadata change is determined based on the metadata of hard drives under various hard drive types, and a metadata snapshot is generated in memory based on the target ratio, the amount of metadata change, and the metadata, including:
[0085] When the metadata of a hard drive changes under various hard drive types, determine the amount of metadata change and write the amount of metadata change into the second part;
[0086] Based on the target proportion in Part 1, determine the threshold for the amount of metadata change;
[0087] In the second part, when the number of metadata changes equals the quantity threshold, the target metadata is determined from the metadata based on the metadata changes.
[0088] Based on the target metadata and the first preset order, a metadata snapshot is created and written to the third part;
[0089] Flush the metadata snapshot in memory to the disk corresponding to the metadata in the metadata snapshot, including:
[0090] If the space occupied by the data in the write buffer is equal to the preset capacity, the data in the write buffer will be flushed from memory to the hard disk corresponding to the metadata in the metadata snapshot.
[0091] Specifically, let's take L2P as an example to illustrate the concept. When the content of an L2P table entry changes, the variable needs to be saved as the metadata change value. This metadata change value is then written into the second part, and this process is performed by JM (JournalManager).
[0092] When the SSD powers on for the first time, the Delta and base sizes are determined according to a default ratio of 1:3. During the write operation, the amount of change in the buffer in the second part is recorded in the first part, i.e., the target ratio is stored in the first part. After the SSD powers on again, the target ratio in the first part remains unchanged to ensure stable operation. Based on the target ratio in the first part, a threshold for the amount of metadata changes is determined. For example, if the target ratio of Delta and base is 1:3, then the threshold for the amount of metadata changes is 1.
[0093] In the second part, if the number of metadata changes equals the quantity threshold, it means that the accumulated delta amount fills the entire second part of the write buffer to the target proportion. The metadata corresponding to delta in the metadata is then used as the target metadata. JM retrieves the target metadata that needs to be saved at this time according to the first preset order and writes the target data into the third part as a metadata snapshot (base). The first preset order is, for example, writing the target data corresponding to delta into the third part according to the order in which delta was created.
[0094] The write buffer has a preset capacity. When the space occupied by the data in the write buffer is equal to the preset capacity, it means that the data fills the entire write buffer. JM will then flush the entire write buffer, writing the data in the write buffer from memory to the Nand in the SSD.
[0095] Since SSDs record SLC PE and the average power-on time of the SSD, as the SSD is used for a longer period of time, the average power-on time will tend to stabilize, the ratio of SLC to TLC PE will also tend to stabilize, and the target ratio in the write cache will gradually tend to stabilize.
[0096] In this embodiment, a metadata snapshot is created based on the target ratio in the first part, and the metadata changes and the metadata snapshot are written to the second and third parts of the write buffer, respectively, to facilitate subsequent recovery of the SSD's metadata. Furthermore, the metadata storage strategy can be adjusted by modifying the target ratio in the first part.
[0097] In some optional implementations, after flushing the metadata snapshot in memory to the disk corresponding to the metadata in the metadata snapshot, the method further includes:
[0098] Retrieve the data from the write buffer from the hard drive containing the data in the write buffer, and determine the target amount of metadata change based on the target proportion in the first part of the write buffer;
[0099] In the second part of the write buffer, obtain the target number of metadata changes as the target change amount;
[0100] Based on the second preset order, the target change amount, and the metadata snapshot in the third part of the write buffer, restore the metadata in memory.
[0101] Specifically, after JM writes the data in the write buffer from memory to the hard drive, and the SSD is powered off and then powered on again, the metadata in memory can be restored according to the data in the write buffer of the SSD, and the metadata can be restored according to the target proportion recorded in the first part of the write buffer.
[0102] The data in the write buffer is retrieved from the hard drive containing the data in the write buffer. Based on the target ratio in the first part of the write buffer, the target number of metadata changes is determined. For example, if the target ratio of delta to base is 2:5, then the target number of metadata changes (delta) is 2. The target number of metadata changes is then retrieved from the second part of the write buffer as the target change amount.
[0103] The second preset order is the order in which metadata is restored based on the target change. For example, the metadata is restored according to the order in which the target change was generated. Furthermore, a metadata snapshot is read from the third part of the write buffer to perform metadata restoration.
[0104] In some optional implementations, the current ratio is adjusted based on the average power-on time, the average number of flash memory erase / write cycles, and the cycle ratio, including:
[0105] If the average power-on time is greater than or equal to the first preset threshold, the value of the change in metadata in the current ratio is reduced by the first preset step size.
[0106] Alternatively, if the average number of flash write cycles is greater than or equal to the second preset threshold, the value of the metadata change in the current ratio is increased by the second preset step.
[0107] Alternatively, if the frequency ratio is within a first preset range, increase the value of the metadata change in the current ratio by a third preset step.
[0108] Specifically, taking an 8TB SSD as an example, with the Delta and base values determined by the default 1:3 ratio, the longest power-on time for the SSD is approximately 9.1 seconds. Without Delta, with full base, the power-on time is approximately 4.1 seconds. Based on the above, set the first preset threshold, such as 6.5 seconds, 7 seconds, 7.5 seconds, etc. The first preset step size, such as 1, 2, ..., is a value that meets actual needs. The second preset step size, such as 1, 2, ..., is a value that meets actual needs. The third preset step size, such as 1, 2, ..., is a value that meets actual needs. The first, second, and third preset step sizes can be the same or different.
[0109] If the average power-on time is greater than or equal to the first preset threshold, the value of the change in metadata in the current ratio is reduced by the first preset step size, and the amount of delta in the current ratio is gradually adjusted. For example, if the average power-on time is greater than or equal to 7s, and the average power-on time is too long, the delta portion in the current ratio is reduced, such as reducing 2:5 to 1:5.
[0110] The second preset threshold is the upper limit of the SSD's PE (Electronic Erasure) count. For example, the second preset threshold for the average PE count of SLC is 90,000, and the second preset threshold for the average PE count of TLC is 9,000. When the average flash write / erase count is greater than or equal to the second preset threshold, the value of the metadata change in the current ratio is increased by a second preset step size, and the amount of delta in the current ratio is gradually adjusted. For example, when the average PE count of SLC reaches 90,000, the delta portion in the current ratio is increased, such as increasing 1:3 to 2:3.
[0111] The average maximum number of PE (Extended Execution) cycles for TLC is approximately 10,000, while the average maximum number of PE cycles for SLC is approximately 100,000. To ensure the accuracy of metadata storage, the usage of SLC blocks is designed based on the scenarios that have the greatest impact on SLC PE, maintaining the ratio of TLC to SLC PE at approximately 1:10. However, in actual use, it is generally not used in the manner that maximizes SLC PE cycles throughout the entire lifecycle. Therefore, the ratio of TLC PE to SLC PE will not reach 1:10, and the first preset range is 1:9 to 1:10.
[0112] If the ratio of the number of occurrences is within the first preset range, and the ratio of the average number of PE occurrences of SLC to the average number of PE occurrences of TLC is too large, then the delta part of the current ratio will be increased. For example, if the ratio of the number of occurrences is within the first preset range, 1:5 will be increased to 2:5.
[0113] In this embodiment, the average power-on time, average flash memory erase / write cycles, and cycle ratio are compared with the corresponding preset thresholds to determine whether the current ratio needs to be adjusted and how to adjust it. By continuously adjusting the current ratio, the system adapts to the state of the SSD and obtains a more suitable target ratio, so that the lifespan and average power-on time of the SSD reach an optimal state.
[0114] In some alternative implementations, the method further includes:
[0115] Determine whether the value of the change in metadata in the adjusted current ratio is within the second preset range;
[0116] If the value of the change in metadata in the adjusted current ratio is within the second preset range, the target ratio in the first part is replaced by the adjusted current ratio.
[0117] If the value of the change in metadata in the adjusted current ratio is not within the second preset range, the third preset range is determined based on the value of the change in metadata in the current ratio and the critical value of the second preset range.
[0118] Based on any integer in the third preset range and the current ratio, a first intermediate ratio is obtained, and the target ratio in the first part is replaced by the first intermediate ratio.
[0119] Specifically, this embodiment sets constraints for modifying the current ratio. For example, whether increasing or decreasing the delta value in the current ratio, the total adjustment cannot exceed 10% of the original delta value. That is, the range of delta in the adjusted current ratio is 90%-110% of the original delta range. Therefore, the second preset range is, for example, 90%-110% of the original delta range in the current ratio, 1:3 in the current ratio, or other ranges that meet actual needs.
[0120] Determine whether the value of the change in metadata in the adjusted current ratio is within the second preset range. For example, if the value of the change in metadata in the adjusted current ratio is 2, it is within the second preset range; if the value of the change in metadata in the adjusted current ratio is 4, it is not within the second preset range.
[0121] If the value of the change in metadata in the adjusted current ratio is within the second preset range, and the adjusted current ratio meets the above constraints, then the adjusted current ratio is used to replace the target ratio in the first part.
[0122] If the change in metadata in the adjusted current ratio is not within the second preset range, and the adjusted current ratio meets the above constraints, then the third preset range is determined based on the change in metadata in the current ratio and the critical value of the second preset range. For example, if the change in metadata in the adjusted current ratio is 4, which is not within the second preset range, and the change in metadata in the current ratio is 2, and the critical value of the second preset range is 3, then the third preset range is 2-3.
[0123] Based on any integer within the third preset range and the current ratio, obtain the first intermediate ratio. For example, if the integer is 3, the first intermediate ratio is 3:5. Replace the target ratio in the first part with the first intermediate ratio.
[0124] In this embodiment, during the adjustment of the current ratio, the value of the change in metadata in the current ratio is constrained by the second preset range or the third preset range, so as to avoid the change in metadata being too large or too small, which would cause the SSD power-on time to be too long or the flash memory erase / write cycles to increase rapidly.
[0125] In some alternative implementations, the method further includes:
[0126] If the third preset range does not contain an integer, then the target ratio in the first part is replaced with the preset ratio, or it is determined whether a ratio setting instruction has been received.
[0127] If a scaling instruction is received, a second intermediate scaling ratio is determined based on the scaling instruction, and the target scaling ratio in the first part is replaced by the second intermediate scaling ratio.
[0128] Specifically, this embodiment establishes a reasonable threshold range for power-on time and threshold ranges for SLC and TLC PE, so that the impact of the adjusted ratio on PE and power-on time is within a reasonable range. The third preset range is, for example, (2,3), (2,4), etc.
[0129] If, during the adjustment of the current ratio, the third preset range does not contain an integer, it means that a reasonable ratio value cannot be found to achieve an optimal lifespan and average power-on time for the SSD. In this case, the initial default ratio will be restored, that is, the target ratio in the first part will be replaced by the preset ratio. For example, if the third preset range is (2,3) and there is no integer, the initial preset ratio can be used as the target ratio. For example, if the preset ratio is 1:3, then 1:3 will be set as the target ratio.
[0130] Alternatively, in this embodiment, the number of delta values for the target ratio can be determined by the user, who can then adjust the ratio based on their preference for disk lifespan and power-on time. When the user makes adjustments, a ratio setting command will be issued. If a ratio setting command is received, a second intermediate ratio is determined based on the command, and this second intermediate ratio replaces the target ratio in the first part.
[0131] In this implementation, if a suitable ratio cannot be determined during the adjustment of the current ratio, the preset ratio is reset as the target ratio or the target ratio is determined according to the ratio setting instruction, so as to avoid continuously adjusting the target ratio and affecting the read and write services of the SSD.
[0132] In some optional implementations, the initial ratio of delta and base is obtained through testing or calculation, and the initial ratio is set to the target ratio by default when the SSD is first powered on. The specific process for obtaining the initial ratio may include steps A1 to A5.
[0133] Step A1: Determine the delta data update amount based on the preset power-on recovery time.
[0134] Specifically, based on the size of the L2P table and the read bandwidth, the time consumed to read the entire L2P table from the Nand is determined; the time consumed to update the L2P table is obtained by subtracting the preset power-on recovery time from the time consumed to read the entire L2P table; based on the time consumed to update the L2P table, the delta data update amount is determined. For example, by constructing a test case, the speed at which the SSD controller randomly accesses DDR at a preset size is obtained; based on the speed and the time consumed to update the L2P table, the delta data update amount is determined.
[0135] Step A2: Determine the amount of user data to be written based on the delta data update amount and the user data unit size.
[0136] Step A3: Determine the ratio based on the delta data update volume and the size of the L2P table.
[0137] Step A4: Calculate the write amplification value based on the delta data update volume, the size of the L2P table, and the amount of user data written.
[0138] Step A5: Determine if the magnification value falls within the target range. If so, use the current scale as the target scale; otherwise, adjust the scale and repeat step A4.
[0139] Specifically, assuming the ratio of delta to base is 1:K, increasing K decreases delta, resulting in faster SSD write buffer speeds, but also increasing write amplification. Conversely, decreasing K increases delta, allowing for the storage of more incremental data. Power-on recovery time is primarily related to the amount of incremental data in L2P type; larger incremental data volumes result in longer power-on recovery times. The value of K affects both write amplification and power-on recovery time.
[0140] In this implementation, the initial ratio of delta and base is obtained through testing or calculation. When the SSD is powered on for the first time, the initial ratio is set to the target ratio by default. When the SSD is powered on for the first time, the initial ratio can balance the power-on recovery time and write amplification requirements, thereby extending the life of the SSD and allowing the SSD to quickly enter the working state after power-on.
[0141] In some optional implementations, a method for dynamically adjusting the amount of metadata changes and the snapshot ratio is provided. This method can solve the same technical problems as steps S101 to S104, such as... Figure 3 As shown, the method includes:
[0142] Upon initial power-on, the buffer ratio is set to the default and saved according to the default ratio. During runtime, the ratio is saved in the buffer header. After power-down and power-on, the ratio is restored according to the ratio recorded in the buffer header. Based on the SLC PE, SLC TLC PE ratio and power-on time, it is determined whether the buffer ratio needs to be adjusted. If so, the ratio is adjusted according to the requirements, adjusting 64 bytes at a time. If not, the new buffer ratio is saved or the ratio is not changed. The new ratio is recorded, and the next adjustment is based on this ratio.
[0143] In this implementation, the ratio of delta to base in the write buffer for storing metadata is dynamically changed, thereby finely adjusting this ratio to obtain a more suitable one, so that the power-on time of SLC PE and SSD reaches an optimal state. Furthermore, as the SSD is used, the average power-on time, SLC PE, and the ratio of SLC PE to TLC PE gradually accumulate, and eventually the ratio of delta to base will also slowly adjust to continuously adapt to the disk's condition.
[0144] This embodiment also provides a metadata storage device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0145] This embodiment provides a metadata storage device, such as... Figure 4 As shown, it includes:
[0146] The parameter acquisition module 401 is used to acquire the average number of flash memory erase / write cycles, the average power-on time, and the current ratio of the hard drives under various hard drive types after the hard drives are powered on again, and to determine the ratio between the average number of flash memory erase / write cycles of the hard drives under different hard drive types. The current ratio is the ratio between the number of metadata changes and the number of metadata snapshots.
[0147] The ratio adjustment module 402 is used to adjust the current ratio according to the average power-on time, the average number of flash memory erase / write cycles, and the cycle ratio to obtain the target ratio;
[0148] The snapshot generation module 403 is used to determine the amount of metadata change based on the metadata of the hard disk under various hard disk types, and generate a metadata snapshot in memory based on the target ratio, the amount of metadata change, and the metadata. The metadata snapshot contains the metadata of the hard disk.
[0149] The snapshot flushing module 404 is used to flush the metadata snapshot in memory to the hard disk corresponding to the metadata in the metadata snapshot.
[0150] In some alternative embodiments, the device further includes:
[0151] Create a module to create a write buffer in memory with a preset data capacity;
[0152] The partitioning module is used to divide the write buffer into a first part, a second part, and a third part. The first part is used to store the target ratio, the second part is used to store the metadata change amount, and the third part is used to store the metadata snapshot.
[0153] In some alternative implementations, the snapshot generation module 403 includes:
[0154] The first writing unit is used to determine the amount of metadata change when the metadata of the hard disk changes under various hard disk types, and write the amount of metadata change into the second part;
[0155] The first determining unit is used to determine the quantity threshold of metadata change based on the target ratio in the first part.
[0156] The second determining unit is used to determine the target metadata in the metadata based on the amount of metadata change when the number of metadata changes in the second part is equal to the quantity threshold.
[0157] The second writing unit is used to create a metadata snapshot based on the target metadata and the first preset order, and write the metadata snapshot to the third part;
[0158] Snapshot flash module 404 includes:
[0159] The write unit is used to write the data in the write buffer from memory to the hard disk corresponding to the metadata in the metadata snapshot, provided that the space occupied by the data in the write buffer is equal to the preset capacity.
[0160] In some alternative implementations, the snapshot generation module 403 further includes:
[0161] The third determining unit is used to obtain the data in the write buffer from the hard disk containing the data in the write buffer, and determine the target number of metadata changes based on the target proportion in the first part of the write buffer.
[0162] The acquisition unit is used to acquire the target number of metadata changes as the target change amount in the second part of the write buffer;
[0163] The metadata recovery unit is used to recover metadata in memory based on a second preset order, the target change amount, and a metadata snapshot in the third part of the write buffer.
[0164] In some alternative implementations, the scaling module 402 includes:
[0165] The first adjustment unit is used to reduce the value of the metadata change in the current ratio by a first preset step size when the average power-on time is greater than or equal to a first preset threshold.
[0166] The second adjustment unit is used to increase the value of the metadata change in the current ratio by a second preset step when the average flash memory erase / write cycles are greater than or equal to a second preset threshold.
[0167] The third adjustment unit is used to increase the value of the metadata change in the current ratio by a third preset step size, provided that the ratio of the number of times is within a first preset range.
[0168] In some optional implementations, the scaling module 402 further includes:
[0169] The judgment unit is used to determine whether the value of the change in metadata in the adjusted current ratio is within the second preset range;
[0170] The first replacement unit is used to replace the target ratio in the first part with the adjusted current ratio when the value of the change in metadata in the adjusted current ratio is within a second preset range.
[0171] The fourth determining unit is used to determine a third preset range based on the value of the change in metadata in the current ratio and the critical value of the second preset range when the value of the change in metadata in the adjusted current ratio is not within the second preset range.
[0172] The second replacement unit is used to obtain a first intermediate ratio based on any integer in the third preset range and the current ratio, and to replace the target ratio in the first part with the first intermediate ratio.
[0173] In some optional implementations, the scaling module 402 further includes:
[0174] The third replacement unit is used to replace the target ratio in the first part with a preset ratio if the third preset range does not contain an integer, or to determine whether a ratio setting instruction has been received.
[0175] The fourth replacement unit is used to determine a second intermediate ratio according to the ratio setting instruction if a ratio setting instruction is received, and to replace the target ratio in the first part with the second intermediate ratio.
[0176] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0177] In this embodiment, the metadata storage device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0178] This invention also provides a computer device having the above-described features. Figure 4 The metadata storage device shown.
[0179] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 5 As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 5 Take a processor 10 as an example.
[0180] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include an integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field-programmable gate array (FPGA), a general-purpose array logic (GPA), or any combination thereof.
[0181] The memory 20 stores instructions executable by at least one processor 10 to cause at least one processor 10 to perform the method shown in the above embodiments.
[0182] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0183] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0184] The computer device also includes a communication interface 30 for communicating with other devices or communication networks.
[0185] This invention also provides a computer non-volatile readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that a computer, processor, microprocessor controller, or programmable hardware includes storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.
[0186] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-nonvolatile readable storage medium or communication medium accessible to a computer.
[0187] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined in this application.
Claims
1. A method for storing metadata, characterized in that, The method includes: After the hard drives are powered on again under various hard drive types, the average number of flash memory erase / write cycles, the average power-on time, and the current ratio of the hard drives under various hard drive types are obtained, and the ratio of the number of average flash memory erase / write cycles under different hard drive types is determined, wherein the current ratio is the ratio between the number of metadata changes and the number of metadata snapshots; The target ratio is obtained by adjusting the current ratio based on the average power-on time, the average number of flash memory erase / write cycles, and the ratio of the number of cycles. The step of adjusting the current ratio based on the average power-on time, the average flash memory erase / write cycles, and the cycle ratio includes: when the average power-on time is greater than or equal to a first preset threshold, decreasing the value of the metadata change in the current ratio by a first preset step; or, when the average flash memory erase / write cycles are greater than or equal to a second preset threshold, increasing the value of the metadata change in the current ratio by a second preset step; or, when the cycle ratio is within a first preset range, increasing the value of the metadata change in the current ratio by a third preset step. Based on the metadata of the hard drives under the various hard drive types, the amount of metadata change is determined, and based on the target ratio, the amount of metadata change, and the metadata, a metadata snapshot is generated in memory, wherein the metadata snapshot contains the metadata of the hard drive; The metadata snapshot in the memory is flushed to the hard disk corresponding to the metadata in the metadata snapshot.
2. The method according to claim 1, characterized in that, The method further includes: Create a write buffer with a preset data capacity in the memory; The write buffer is divided into a first part, a second part, and a third part, wherein the first part is used to store the target ratio, the second part is used to store the metadata change amount, and the third part is used to store the metadata snapshot.
3. The method according to claim 2, characterized in that, The step of determining the metadata change amount based on the metadata of the hard drives under the various hard drive types, and generating the metadata snapshot in memory based on the target ratio, the metadata change amount, and the metadata, includes: When the metadata of a hard drive changes under the various hard drive types, the amount of metadata change is determined, and the amount of metadata change is written into the second part; Based on the target ratio described in the first part, determine the quantity threshold of the metadata change amount; If the number of metadata changes mentioned in the second part is equal to the quantity threshold, the target metadata is determined in the metadata based on the metadata changes. Based on the target metadata and the first preset order, create the metadata snapshot and write the metadata snapshot into the third part; The step of writing the metadata snapshot in the memory to the hard disk corresponding to the metadata in the metadata snapshot includes: If the space occupied by the data in the write buffer is equal to the preset capacity, the data in the write buffer is flushed from the memory to the hard disk corresponding to the metadata in the metadata snapshot.
4. The method according to claim 3, characterized in that, After writing the metadata snapshot in the memory to the hard disk corresponding to the metadata in the metadata snapshot, the method further includes: The data in the write buffer is retrieved from the hard disk containing the data in the write buffer, and the target amount of the metadata change is determined based on the target proportion in the first part of the write buffer; The target number of metadata changes is obtained as the target change amount in the second part of the write buffer; The metadata in memory is restored based on the second preset order, the target change amount, and the metadata snapshot in the third part of the write buffer.
5. The method according to claim 2, characterized in that, The method further includes: Determine whether the value of the change in metadata in the adjusted current ratio is within the second preset range; If the value of the change in metadata in the adjusted current ratio is within the second preset range, the adjusted current ratio is used to replace the target ratio in the first part. If the value of the change in metadata in the adjusted current ratio is not within the second preset range, a third preset range is determined based on the value of the change in metadata in the current ratio and the critical value of the second preset range. A first intermediate ratio is obtained based on any integer in the third preset range and the current ratio, and the target ratio in the first part is replaced by the first intermediate ratio.
6. The method according to claim 5, characterized in that, The method further includes: If the third preset range does not contain an integer, then the target ratio in the first part is replaced by a preset ratio, or it is determined whether a ratio setting instruction has been received. If the ratio setting instruction is received, a second intermediate ratio is determined according to the ratio setting instruction, and the target ratio in the first part is replaced by the second intermediate ratio.
7. A metadata storage device, characterized in that, The device includes: The parameter acquisition module is used to acquire the average number of flash memory erase / write operations, the average power-on time, and the current ratio of the hard drives under various hard drive types after the hard drives are powered on again, and to determine the ratio between the average number of flash memory erase / write operations of the hard drives under different hard drive types, wherein the current ratio is the ratio between the number of metadata changes and the number of metadata snapshots; The ratio adjustment module is used to adjust the current ratio according to the average power-on time, the average flash memory erase / write cycles, and the cycle ratio to obtain the target ratio; The ratio adjustment module includes: a first adjustment unit, used to decrease the value of metadata change in the current ratio by a first preset step size when the average power-on time is greater than or equal to a first preset threshold; a second adjustment unit, used to increase the value of metadata change in the current ratio by a second preset step size when the average flash memory erase / write cycles are greater than or equal to a second preset threshold; and a third adjustment unit, used to increase the value of metadata change in the current ratio by a third preset step size when the cycle ratio is within a first preset range. A snapshot generation module is used to determine the amount of metadata change based on the metadata of the hard disks under the various hard disk types, and generate the metadata snapshot in memory based on the target ratio, the amount of metadata change, and the metadata, wherein the metadata snapshot contains the metadata of the hard disk; The snapshot flushing module is used to flush the metadata snapshot in the memory to the hard disk corresponding to the metadata in the metadata snapshot.
8. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the metadata storage method according to any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the metadata storage method according to any one of claims 1 to 6.
Citation Information
Patent Citations
SSD metadata snapshot storage and recovery method, device and equipment
CN115080454A