Metadata storage method and device, computer equipment and storage medium

By obtaining and adjusting the metadata storage ratio of SSD and generating and writing metadata snapshots, the problem of the service life and power-on time of SSD is not optimal, and a metadata storage strategy that is more suitable for the SSD state is realized.

CN119960687AActive Publication Date: 2025-05-09INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202510037821.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-09
Publication Date
2025-05-09
Estimated Expiration
2045-01-09

AI Technical Summary

Technical Problem

In the prior art, when SSD saves metadata, the ratio of delta and base is difficult to adapt to the current state of the SSD, resulting in the service life and average power-on time of the SSD cannot reach the optimal state.

Method used

By obtaining the average number of flash erases, average power-on time, and current proportion of the hard disk, adjusting the current proportion to obtain the target proportion, generating a metadata snapshot, and flashing it to the hard disk to adapt to the state changes of the SSD.

Benefits of technology

By dynamically adjusting the ratio of delta and base, the service life and average power-on time of the SSD can reach the best state, solving the problem that the proportion in the prior art is difficult to adapt to the current state of the SSD.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119960687A_ABST
    Figure CN119960687A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a metadata storage method and device, computer equipment and a storage medium. Obtaining the current proportion among the average flash memory erasing times of the hard disk, the average power-on time of the hard disk, the metadata variation quantity and the metadata snapshot quantity, and determining the times proportion among the average flash memory erasing times; according to the average power-on time, the average flash memory erasing frequency and the frequency ratio, adjusting the current ratio to obtain a target ratio; determining a metadata variation, and generating a metadata snapshot in the memory according to the target proportion, the metadata variation and the metadata; and flashing the metadata snapshot in the memory to a hard disk corresponding to the metadata in the metadata snapshot. The problems that when metadata are stored, the proportion of delta and base is difficult to adapt to the current state of the SSD, and the service life and the average power-on time of the SSD cannot reach the optimal state are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a metadata storage method, device, computer equipment and storage medium. Background Art

[0002] Saving metadata is very important for SSD (Solid State Disk). It determines whether all metadata can be correctly saved every time the SSD is powered off, whether the SSD can be restored to a normal state when it is powered on, and whether the SSD can process the host's commands in a timely manner. Currently, in order to ensure that the latest metadata can be saved to Nand in time when the SSD loses power abnormally, the metadata will be saved in a snapshot manner. That is, during the operation of the SSD, the metadata change (delta) is saved in the write buffer. When the change accumulates to a certain amount, a part of the metadata is copied to the write buffer as the snapshot part (base), and finally the base and delta are saved together in Nand.

[0003] For this method of saving snapshots, it is necessary to determine the ratio of delta to base, that is, after saving a certain number of deltas, a base is added and Nand is written. When the number of bases in the ratio is small and the number of deltas is large, the amount of deltas that need to be restored when the SSD is powered on and restored is very large, and they need to be restored in a certain order, so the power-on time of the SSD is long. If the number of bases in the ratio is large and the number of deltas is small, although the power-on time of the SSD will be reduced, the Nand will be written once for each small amount of delta accumulated, which will cause a high frequency of block (data block) erasure, which has a great impact on the service life of the SSD. At present, when saving metadata, a static and fixed ratio is used. During the use of the SSD, the average power-on time and PE (P / Ecycle, the number of times the flash memory is erased and written) of the SSD are constantly changing. PE will affect the service life of the SSD. The current ratio of delta to base is difficult to adapt to the current state of the SSD, balance the service life of the SSD and the average power-on time, and make the service life and average power-on time of the SSD reach the best state.

[0004] Therefore, the related technology has the problem that when saving metadata, the ratio of delta to base is difficult to adapt to the current state of the SSD, and the service life and average power-on time of the SSD cannot reach the optimal state. Summary of the invention

[0005] In view of this, the present invention provides a metadata preservation method, apparatus, computer device and storage medium to solve the problem that when preserving metadata, the ratio of delta and base is difficult to adapt to the current state of the SSD, and the service life and average power-on time of the SSD cannot reach the optimal state.

[0006] In a first aspect, the present invention provides a metadata storage method, the method comprising:

[0007] After the hard disk is powered on again under multiple hard disk types, the average flash memory erase times, the average power-on time of the hard disk and the current ratio of the hard disk under multiple hard disk types are obtained, and the ratio of the average flash memory erase times of the hard disk under different hard disk types is determined, wherein the current ratio is the ratio between the number of metadata changes and the number of metadata snapshots;

[0008] According to the average power-on time, the average number of flash memory erase and write times and the ratio of the times, the current ratio is adjusted to obtain the target ratio;

[0009] According to the metadata of the hard disks under the multiple hard disk types, the metadata change amount is determined, and according to the target ratio, the metadata change amount and the metadata, a metadata snapshot is generated in the memory, wherein the metadata snapshot includes the metadata of the hard disk;

[0010] Write the metadata snapshot in the memory to the hard disk corresponding to the metadata in the metadata snapshot.

[0011] The metadata saving method provided in this embodiment adjusts the current ratio according to the average power-on time of the hard disk, the average flash memory erase and write times of the hard disk under multiple hard disk types, and the ratio between the average flash memory erase and write times, and saves the metadata of the hard disk according to the adjusted current ratio. By continuously adjusting the current ratio to continuously adapt to the state of the SSD, a more suitable target ratio is obtained, so that the service life and average power-on time of the SSD reach an optimal state. This solves the problem that when saving metadata, the ratio of delta and base is difficult to adapt to the current state of the SSD, and the service life and average power-on time of the SSD cannot reach the optimal state.

[0012] In some optional embodiments, the method further comprises:

[0013] Create a write buffer in the memory with a data capacity equal to a preset capacity;

[0014] The write buffer is divided into a first part, a second part and a third part, wherein the first part is used to save the target ratio, the second part is used to save the metadata change, and the third part is used to save the metadata snapshot.

[0015] In this embodiment, a write buffer is created in the memory, and the target ratio, metadata change amount and metadata snapshot are saved in the write buffer. On the one hand, when power is restored, the target ratio can be quickly read from the first part, and the metadata of the SSD can be restored according to the target ratio; on the other hand, when power is restored, the metadata change amount and metadata snapshot can be obtained from the second part and the third part to complete the metadata recovery.

[0016] In some optional implementations, determining the metadata change amount according to the metadata of hard disks of multiple hard disk types, and generating a metadata snapshot in the memory according to the target ratio, the metadata change amount and the metadata, includes:

[0017] When the metadata of the hard disk changes under multiple hard disk types, determining the metadata change amount, and writing the metadata change amount into the second part;

[0018] According to the target ratio in the first part, determining a threshold value of the amount of metadata change;

[0019] When the number of metadata changes in the second part is equal to the quantity threshold, determining target metadata in the metadata according to the metadata changes;

[0020] Creating a metadata snapshot according to the target metadata and the first preset order, and writing the metadata snapshot into the third part;

[0021] Write the metadata snapshot in the memory to the hard disk corresponding to the metadata in the metadata snapshot, including:

[0022] When 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.

[0023] In this embodiment, according to the target ratio in the first part, a metadata snapshot is created, and the metadata change amount and the metadata snapshot are written to the second part and the third part of the write buffer respectively, so as to facilitate the subsequent recovery of the metadata of the SSD. In addition, the metadata preservation strategy can be adjusted by modifying the target ratio in the first part.

[0024] In some optional implementations, after writing the metadata snapshot in the memory to the hard disk corresponding to the metadata in the metadata snapshot, the method further includes:

[0025] Obtaining data in the write buffer from a hard disk containing the data in the write buffer, and determining a target amount of metadata change based on a target ratio in a first portion of the write buffer;

[0026] Obtaining a target number of metadata changes in the second part of the write buffer as a target change;

[0027] The metadata in the memory is restored according to the second preset sequence, the target change amount, and the metadata snapshot in the third part of the write buffer.

[0028] In some optional implementations, adjusting the current ratio according to the average power-on time, the average number of flash memory erase and write times, and the ratio of the numbers includes:

[0029] When the average power-on time is greater than or equal to the first preset threshold, the value of the metadata change amount in the current ratio is reduced by a first preset step size;

[0030] Alternatively, when the average number of flash memory erase and write times is greater than or equal to a second preset threshold, a second preset step length is added to the value of the metadata change amount in the current ratio;

[0031] Alternatively, when the number ratio is within the first preset range, a third preset step is added to the value of the metadata change amount in the current ratio.

[0032] In this embodiment, the average power-on time, the average number of flash memory erase and write times, and the ratio of the times are compared with the corresponding preset thresholds to determine whether the current ratio needs to be adjusted and how to adjust the current ratio. By continuously adjusting the current ratio to continuously adapt to the state of the SSD, a more appropriate target ratio is obtained, so that the service life and average power-on time of the SSD reach an optimal state.

[0033] In some optional embodiments, the method further comprises:

[0034] Determine whether the value of the metadata change amount in the adjusted current ratio is within a second preset range;

[0035] When the value of the metadata change amount in the adjusted current ratio is within a second preset range, replacing the target ratio in the first part with the adjusted current ratio;

[0036] When the adjusted value of the metadata change amount in the current ratio is not within the second preset range, determining the third preset range according to the value of the metadata change amount in the current ratio and the critical value of the second preset range;

[0037] A first intermediate ratio is obtained according to 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.

[0038] In this embodiment, in the process of adjusting the current ratio, the second preset range or the third preset range is used to constrain the value of the metadata change in the current ratio to avoid the value of the metadata change being too large or too small, resulting in the SSD power-on time being too long or causing the number of flash memory erases and writes to increase rapidly.

[0039] In some optional embodiments, the method further comprises:

[0040] If there is no integer in the third preset range, replacing the target ratio in the first part with the preset ratio, or determining whether a ratio setting instruction is received;

[0041] If a 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.

[0042] In this embodiment, if a suitable ratio cannot be determined during the process of adjusting the current ratio, the preset ratio is reset as the target ratio or the target ratio is determined according to the ratio setting instruction to avoid constantly 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 obtain the average flash memory erase times, average power-on time and current ratio of the hard disks under various hard disk types after the hard disks are powered on again under various hard disk types, and determine the ratio between the average flash memory erase times of the hard disks under different hard disk types, wherein the current ratio is the ratio between the number of metadata changes and the number of metadata snapshots;

[0045] A ratio adjustment module is used to adjust the current ratio according to the average power-on time, the average number of flash memory erase and write times, and the ratio of the times to obtain a target ratio;

[0046] A snapshot generation module, used to determine the metadata change amount according to the metadata of the hard disk under multiple hard disk types, and generate a metadata snapshot in the memory according to the target ratio, the metadata change amount and the metadata, wherein the metadata snapshot includes the metadata of the hard disk;

[0047] The snapshot writing module is used to write the metadata snapshot in the memory to the hard disk corresponding to the metadata in the metadata snapshot.

[0048] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the metadata preservation method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0049] In a fourth aspect, the present invention provides a computer non-volatile readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the metadata preservation method of the first aspect or any corresponding embodiment thereof.

[0050] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, wherein the computer instructions are used to enable a computer to execute the metadata preservation method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0052] Figure 1 is a schematic diagram of a process of a metadata storage method according to an embodiment of the present invention;

[0053] Figure 2 is a schematic diagram of a process of a metadata storage method according to an embodiment of the present invention;

[0054] Figure 3 is a flow chart of a method for dynamically adjusting the amount of metadata changes and snapshot ratios saved according to an embodiment of the present invention;

[0055] Figure 4 is a structural block diagram of a metadata storage device according to an embodiment of the present invention;

[0056] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0058] The current method of saving the metadata of the solid-state drive is to save the metadata changes (delta) in the write buffer during the operation of the SSD. When the changes accumulate to a certain amount, a part of the metadata is copied to the buffer as the snapshot part (base), and finally the snapshot of the metadata and the changes are saved together in the Nand. When an abnormal power failure occurs, since the capacitor only supplies power for tens of milliseconds, only a small amount of data needs to be written through the above method to save the complete metadata, so that all the latest metadata can be saved quickly and completely. When the power is turned on, it is only necessary to restore the snapshot and restore the changes in a certain order. The current ratio of delta to base is static and fixed. During the product development stage, a suitable ratio is determined through calculation and testing. Once this ratio is determined, it remains unchanged in subsequent use until the disk enters read-only mode and becomes unavailable.

[0059] In addition, in order to flush all metadata to Nand as quickly as possible when the power is turned off, a part of the particles in Nand are used in the form of SLC (Single-Level Cell), and the metadata is stored in this part of the block. The number of blocks in this part is limited, and a large number of flushes will cause a high frequency of block erasure. Although the upper limit of SLC's PE (number of flash memory erases) is higher than that of TLC (Trinary-Level Cell), due to the limited number and high frequency of writing, SLC's PE rises very quickly. When SLC reaches the upper limit of PE, SLC enters an unstable state, and some read and write errors may occur, resulting in inaccurate recorded data. The SSD needs to enter read-only mode and cannot continue to write data, which has a greater impact on the service life of the SSD.

[0060] Based on the above content, an embodiment of the present invention provides a metadata preservation method, which sets the ratio obtained by testing or calculation as the default ratio when powered on for the first time. Add a variable to record the ratio of delta and base when powered on next time, and save the variable in Nand. After power-on, read this variable to confirm the ratio of delta and base in the write buffer. The size of this ratio is recorded in the form of how many changes are recorded, and when each buffer is written, this ratio is recorded in the buffer header. When entering the buffer adjustment process, adjust this variable based on the ratio of SLC PE to TLC PE, the number of SLC PEs and the average power-on time of the SSD as a reference to achieve the purpose of adjusting the ratio of delta and base in the write buffer. When restoring metadata, confirm the number of deltas that need to be restored based on the ratio of delta and base recorded in the buffer header. In order to achieve the technical effect of adjusting the ratio of delta and base in the write buffer, constantly adapting to the state of the SSD, and balancing the service life of the SSD and the average power-on time.

[0061] According to an embodiment of the present invention, a metadata preservation embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer device with data processing capabilities, such as a computer, a server, etc., and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0062] In this embodiment, a metadata storage method is provided. Figure 1 is a flowchart of a metadata storage method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0063] Step S101, after the hard disk is powered on again under multiple hard disk types, the average flash memory erase times, the average power-on time of the hard disk and the current ratio of the hard disk under multiple hard disk types are obtained, and the ratio between the average flash memory erase times of the hard disks under different hard disk types is determined, wherein the current ratio is the ratio between the number of metadata changes and the number of metadata snapshots.

[0064] Specifically, the overall process of saving metadata in this embodiment is as follows: when the SSD is running, metadata is generated in the memory (DDR) and saved in the memory. The metadata includes L2P (Logical To Physical Table, a mapping table of logical blocks to physical blocks), i.e., FTL mapping table, bad block management (BBM) information, garbage collection (GC) information, etc. According to the above metadata, the computer operating system (OS) can query the required data in the hard disk. In addition, the metadata saving method can adopt a snapshot saving method. When the metadata change amount reaches a certain value, a snapshot is generated and temporarily stored in the DDR. When the SSD is powered off, the metadata in the DDR needs to be flushed to the Nand flash memory of the SSD, i.e., the snapshot is flushed to the Nand flash memory. The SSD includes a main control chip, a Nand flash memory, etc. The Nand flash memory is a non-volatile storage medium, and the Nand flash memory is used to store data. Afterwards, when the SSD is powered on, it is necessary to read the metadata snapshot in the Nand, and restore the metadata in the metadata snapshot to the DDR. In addition, if there is a metadata change (delta) in Nand, the metadata corresponding to the delta needs to be determined and restored to the DDR.

[0065] The hard disk is classified according to the type of Nand flash memory in the hard disk. At this time, the hard disk type is, for example, TLC, SLC, etc. Since L2P has the largest amount among all kinds of metadata and has the greatest impact on SLC PE and power-on time, this embodiment takes L2P as an example for metadata description.

[0066] Based on the above content, after the hard disk is powered on again under various hard disk types, the average power-on time of the SSD under each hard disk type is obtained. The average flash memory erase times of the hard disk under the hard disk type (such as TLC and SLC) are obtained, for example: the average PE times of SLC, the average PE times of TLC, etc. And the ratio between the average flash memory erase times is obtained, for example: the ratio of the average PE times of SLC to the average PE times of TLC.

[0067] The ratio of the metadata change (delta) and the metadata snapshot (base) obtained by testing or calculation is set as the default ratio when the device is powered on for the first time. At this time, the ratio is the current ratio. After that, this embodiment adds a variable to record the ratio of delta and base at the next power-on, and saves the variable in Nand. At this time, the ratio recorded in the variable is the current ratio.

[0068] Step S102, adjusting the current ratio according to the average power-on time, the average number of flash memory erase and write times, and the ratio of the numbers, to obtain a target ratio.

[0069] Specifically, the current ratio is adjusted according to the average power-on time, the average flash memory erase times and the ratio of times. For example, if the average power-on time is too long, the delta part of the current ratio is reduced, such as reducing 2:5 to 1:5; if the average PE times of the SLC is about to reach the upper limit, or the ratio of the average PE times of the SLC to the average PE times of the TLC is too large, the delta part of the current ratio is increased, such as increasing 2:5 to 3:5. The adjusted current ratio is used as the target ratio.

[0070] Since the SSD will record the average PE times of the SLC, the average PE times of the TLC, and the average power-on time of the SSD, as the SSD is used longer, the average power-on time will tend to be stable, the ratio of the average PE times of the SLC to the average PE times of the TLC will tend to be stable, and the ratio of the write buffer will gradually tend to be stable. Ultimately, as the average PE times of the SLC will eventually become larger and larger, the delta ratio of the write buffer will gradually increase, and the frequency of the refresh will eventually be reduced, which will also help to extend the life of the SSD.

[0071] Step S103, determining the metadata change amount according to the metadata of the hard disks under the multiple hard disk types, and generating a metadata snapshot in the memory according to the target ratio, the metadata change amount and the metadata, wherein the metadata snapshot includes the metadata of the hard disk.

[0072] Specifically, when the content of an L2P entry changes during SSD operation, the variable needs to be saved as a metadata change. This process is performed by a JM (Journal Manager).

[0073] When the SSD is running, when the number of deltas accumulates to the number in the target ratio, a part of the metadata is copied to the buffer as a metadata snapshot (base), and finally the deltas and bases are saved together in Nand. For example: if the target ratio of deltas to bases is 1:3, then when the number of deltas is equal to 1, the bases corresponding to these deltas are generated.

[0074] Step S104: writing the metadata snapshot in the memory to the hard disk corresponding to the metadata in the metadata snapshot.

[0075] Specifically, the metadata snapshot in the memory can be written to the hard disk corresponding to the metadata in the metadata snapshot in a variety of ways, and specifically needs to be written to the flash memory in the hard disk. For example, a time interval such as 5s, 10s, etc. can be set, and every time the time interval passes, the metadata snapshot in the memory is written to the Nand flash memory in the SSD; an upper limit can be set, and every time the number of metadata snapshots in the memory reaches the upper limit, the metadata snapshot in the memory is written to the Nand flash memory in the SSD... The specific method can be adjusted according to actual needs.

[0076] The metadata saving method provided in this embodiment adjusts the current ratio according to the average power-on time of the hard disk, the average flash memory erase and write times of the hard disk under multiple hard disk types, and the ratio between the average flash memory erase and write times, and saves the metadata of the hard disk according to the adjusted current ratio. By continuously adjusting the current ratio to continuously adapt to the state of the SSD, a more suitable target ratio is obtained, so that the service life and average power-on time of the SSD reach an optimal state. This solves the problem that when saving metadata, the ratio of delta and base is difficult to adapt to the current state of the SSD, and the service life and average power-on time of the SSD cannot reach the optimal state.

[0077] In some optional embodiments, the method further comprises:

[0078] Create a write buffer in the memory with a data capacity equal to a preset capacity;

[0079] The write buffer is divided into a first part, a second part and a third part, wherein the first part is used to save the target ratio, the second part is used to save the metadata change, and the third part is used to save the metadata snapshot.

[0080] Specifically, when saving the changed L2P, it is necessary to consider whether all the changed deltas can be saved to Nand within a limited time during normal power on and off and abnormal power off, and whether the entire L2P can be restored to the state before power off at the next power on. At the same time, L2P cannot be saved too frequently. On the one hand, frequent flashing will affect the life of Nand. The number of times Nand can be erased and written is upper bounded. Once the upper bound is reached, Nand will become unstable, and the SSD will not be able to guarantee the integrity and accuracy of the written data. On the other hand, frequent flashing will increase write amplification.

[0081] Therefore, when the SSD is running, the JM creates a write buffer with a space size equal to the preset capacity in the memory (DDR) using SLC when saving L2P. The preset capacity is, for example, 16KB, 32KB, etc., which are values ​​that meet actual needs.

[0082] The write buffer is divided into the first part, the second part and the third part, for example: the header part, the delta part and the base part. Figure 2 As shown in the figure, the Header part is used to save the target ratio, the Delta part is used to save the metadata change, and the Base part is used to save the metadata snapshot. The Delta part and the Header part occupy 4KB in total, and the Base part occupies 12KB.

[0083] In this embodiment, a write buffer is created in the memory, and the target ratio, metadata change amount and metadata snapshot are saved in the write buffer. On the one hand, when power is restored, the target ratio can be quickly read from the first part, and the metadata of the SSD can be restored according to the target ratio; on the other hand, when power is restored, the metadata change amount and metadata snapshot can be obtained from the second part and the third part to complete the metadata recovery.

[0084] In some optional implementations, determining the metadata change amount according to the metadata of hard disks of multiple hard disk types, and generating a metadata snapshot in the memory according to the target ratio, the metadata change amount and the metadata, includes:

[0085] When the metadata of the hard disk changes under multiple hard disk types, determining the metadata change amount, and writing the metadata change amount into the second part;

[0086] According to the target ratio in the first part, determining a threshold value of the amount of metadata change;

[0087] When the number of metadata changes in the second part is equal to the quantity threshold, determining target metadata in the metadata according to the metadata changes;

[0088] Creating a metadata snapshot according to the target metadata and the first preset order, and writing the metadata snapshot into the third part;

[0089] Write the metadata snapshot in the memory to the hard disk corresponding to the metadata in the metadata snapshot, including:

[0090] When 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.

[0091] Specifically, the metadata is L2P as an example. When the content of the L2P entry changes, the variable needs to be saved as the metadata change amount, and the metadata change amount is written into the second part. This process is performed by JM (JournalManager).

[0092] When the SSD is powered on for the first time, the size of Delta and base is confirmed according to the default ratio of 1:3, and when flashing, the amount of change in the buffer in the second part is recorded in the first part, that is, the target ratio is saved in the first part. After the SSD is powered on this time, the target ratio in the first part remains unchanged to ensure a stable state during operation. According to the target ratio in the first part, the threshold value of the amount of metadata change is determined. For example, if the target ratio of Delta and base is 1:3, the threshold value of the amount of metadata change is 1.

[0093] When the number of metadata changes in the second part is equal to the quantity threshold, it means that the number of deltas accumulated to the target ratio fills the second part of the entire write buffer, and the metadata corresponding to the delta in the metadata is used as the target metadata. JM takes 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 the metadata snapshot (base). The first preset order is, for example: write the target data corresponding to the delta into the third part according to the order in which the deltas are created.

[0094] The space size of the write buffer is the 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 flushes the entire write buffer and writes the data in the write buffer from the memory to the Nand in the SSD.

[0095] Since the SSD records the SLC PE and the average power-on time of the SSD, as the SSD usage time increases, the average power-on time will tend to be stable, the ratio of SLC to TLC PE will tend to be stable, and the target ratio in the write cache area will gradually tend to be stable.

[0096] In this embodiment, according to the target ratio in the first part, a metadata snapshot is created, and the metadata change amount and the metadata snapshot are written to the second part and the third part of the write buffer respectively, so as to facilitate the subsequent recovery of the metadata of the SSD. In addition, the metadata preservation strategy can be adjusted by modifying the target ratio in the first part.

[0097] In some optional implementations, after writing the metadata snapshot in the memory to the hard disk corresponding to the metadata in the metadata snapshot, the method further includes:

[0098] Obtaining data in the write buffer from a hard disk containing the data in the write buffer, and determining a target amount of metadata change based on a target ratio in a first portion of the write buffer;

[0099] Obtaining a target number of metadata changes in the second part of the write buffer as a target change;

[0100] The metadata in the memory is restored according to the second preset sequence, the target change amount, and the metadata snapshot in the third part of the write buffer.

[0101] Specifically, after JM flushes the data in the write buffer from the memory to the hard disk, the SSD is powered off and then powered on again, and the metadata of the memory can be restored according to the data in the write buffer in the SSD, and the metadata can be restored according to the target ratio recorded in the first part of the write buffer.

[0102] The data in the write buffer is obtained from the hard disk containing the data in the write buffer, and the target number of metadata changes is determined according to the target ratio in the first part of the write buffer, for example, if the target ratio of delta to base is 2:5, the target number of metadata changes (delta) is 2. The target number of metadata changes is obtained in the second part of the write buffer as the target change.

[0103] The second preset order is the order of restoring metadata according to the target variation, for example: restoring corresponding metadata according to the order of data generated by the target variation, and reading the metadata snapshot in the third part of the write buffer to perform metadata restoration.

[0104] In some optional implementations, adjusting the current ratio according to the average power-on time, the average number of flash memory erase and write times, and the ratio of the numbers includes:

[0105] When the average power-on time is greater than or equal to the first preset threshold, the value of the metadata change amount in the current ratio is reduced by a first preset step size;

[0106] Alternatively, when the average number of flash memory erase and write times is greater than or equal to a second preset threshold, a second preset step length is added to the value of the metadata change amount in the current ratio;

[0107] Alternatively, when the number ratio is within the first preset range, a third preset step is added to the value of the metadata change amount in the current ratio.

[0108] Specifically, taking an 8T SSD as an example, the size of Delta and base is confirmed according to the default ratio of 1:3. The longest power-on time of the SSD is about 9.1s. Without delta, in the case of full base, the power-on time of the SSD is about 4.1s. According to the above content, the first preset threshold is set, for example: 6.5s, 7s, 7.5s, etc. The first preset step size is, for example, 1, 2, ..., etc., which meet the actual needs. The second preset step size is, for example, 1, 2, ..., etc., which meet the actual needs. The third preset step size is, for example, 1, 2, ..., etc., which meet the actual needs. The first preset step size, the second preset step size, and the third preset step size may be the same or different.

[0109] When the average power-on time is greater than or equal to the first preset threshold, the value of the metadata change in the current ratio is reduced by a first preset step size, and the number of deltas 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 part of the current ratio is reduced, such as reducing 2:5 to 1:5.

[0110] The second preset threshold is the upper limit of PE of SSD, for example, the second preset threshold of the average PE number of SLC is 90000, the second preset threshold of the average PE number of TLC is 9000, etc. When the average flash memory erase and write times is greater than or equal to the second preset threshold, the second preset step is increased for the value of the metadata change amount in the current ratio, and the number of deltas in the current ratio is gradually adjusted. For example, when the average PE number of SLC reaches 90000, the delta part in the current ratio is increased, such as increasing 1:3 to 2:3.

[0111] The upper limit of the average PE number of TLC is about 10,000, while the upper limit of the average PE number of SLC is about 100,000. To ensure the accuracy of metadata preservation, the usage of SLC block is designed based on the scenario with the greatest impact on SLC PE, so that the ratio of TLC to SLC PE is maintained at about 1:10. However, in actual use, it is generally not used in the life cycle in the way that the SLC PE number is the largest. Therefore, the ratio of TLC PE to SLC PE will not reach 1:10, and the first preset range is generated to be 1:9 to 1:10.

[0112] When the ratio of times is within the first preset range, if the ratio of the average PE times of SLC to the average PE times of TLC is too large, increase the delta part of the current ratio, for example, if the ratio of times is within the first preset range, increase 1:5 to 2:5.

[0113] In this embodiment, the average power-on time, the average number of flash memory erase and write times, and the ratio of the times are compared with the corresponding preset thresholds to determine whether the current ratio needs to be adjusted and how to adjust the current ratio. By continuously adjusting the current ratio to continuously adapt to the state of the SSD, a more appropriate target ratio is obtained, so that the service life and average power-on time of the SSD reach an optimal state.

[0114] In some optional embodiments, the method further comprises:

[0115] Determine whether the value of the metadata change amount in the adjusted current ratio is within a second preset range;

[0116] When the value of the metadata change amount in the adjusted current ratio is within a second preset range, replacing the target ratio in the first part with the adjusted current ratio;

[0117] When the adjusted value of the metadata change amount in the current ratio is not within the second preset range, determining the third preset range according to the value of the metadata change amount in the current ratio and the critical value of the second preset range;

[0118] A first intermediate ratio is obtained according to 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.

[0119] Specifically, this embodiment sets a constraint condition for modifying the current ratio, for example: whether increasing or decreasing the delta size in the current ratio, the total amount of adjustment does not exceed 10% of the original delta size, that is, the range of the delta in the adjusted current ratio is 90%-110% of the original delta range. Therefore, the second preset range is, for example: the range of the delta in the current ratio is 90%-110% of the original delta range, the range of the delta in the current ratio is 1:3, or other ranges that meet actual needs.

[0120] It is determined whether the value of the metadata change amount in the adjusted current ratio is within the second preset range. For example, if the value of the metadata change amount in the adjusted current ratio is 2, it is within the second preset range; if the value of the metadata change amount in the adjusted current ratio is 4, it is not within the second preset range.

[0121] When the value of the metadata change amount in the adjusted current ratio is within the second preset range and the adjusted current ratio meets the above constraint condition, the target ratio in the first part is replaced by the adjusted current ratio.

[0122] When the value of the metadata change amount in the adjusted current ratio is not within the second preset range, the adjusted current ratio meets the above constraint condition, and the third preset range is determined according to the value of the metadata change amount in the current ratio and the critical value of the second preset range. For example, the value of the metadata change amount in the adjusted current ratio is 4, which is not within the second preset range. The value of the metadata change amount in the current ratio is 2, the critical value of the second preset range is 3, and the third preset range is 2-3.

[0123] According to any integer in the third preset range and the current ratio, a first intermediate ratio is obtained, for example, if any integer is selected as 3, the first intermediate ratio is 3:5. The target ratio in the first part is replaced by the first intermediate ratio.

[0124] In this embodiment, in the process of adjusting the current ratio, the second preset range or the third preset range is used to constrain the value of the metadata change in the current ratio to avoid the value of the metadata change being too large or too small, resulting in the SSD power-on time being too long or causing the number of flash memory erases and writes to increase rapidly.

[0125] In some optional embodiments, the method further comprises:

[0126] If there is no integer in the third preset range, replacing the target ratio in the first part with the preset ratio, or determining whether a ratio setting instruction is received;

[0127] If a 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.

[0128] Specifically, this embodiment formulates a reasonable threshold range of power-on time, and a threshold range of SLC and TLC PE, so that the influence 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 there is no integer in the third preset range during the adjustment of the current ratio, it means that a reasonable ratio value cannot be found to make the service life and average power-on time of the SSD reach an optimal state, then the initial default ratio is restored, that is, the target ratio in the first part is replaced by the preset ratio. For example: the third preset range is (2,3), and there is no integer. The initial preset ratio can be used as the target ratio. If the preset ratio is 1:3, 1:3 is set as the target ratio.

[0130] Alternatively, the number of deltas of the target ratio in this embodiment can also be determined by the user, who confirms the focus on the service life of the disk and the power-on time and makes corresponding adjustments. When the user makes adjustments, a ratio setting instruction will be issued. 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.

[0131] In this embodiment, if a suitable ratio cannot be determined during the process of adjusting the current ratio, the preset ratio is reset as the target ratio or the target ratio is determined according to the ratio setting instruction to avoid constantly adjusting the target ratio and affecting the read and write services of the SSD.

[0132] In some optional implementations, the initial ratio of delta to base is obtained by testing or calculation, and the initial ratio is set as the target ratio by default when the SSD is powered on for the first time. The specific process of obtaining the initial ratio may include steps A1 to A5.

[0133] Step A1, determining the delta data update amount according to the preset power-on recovery time.

[0134] Specifically, according to the size and read bandwidth of the L2P table, 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 and the time consumed to read the entire L2P table; according to the time consumed to update the L2P table, the delta data update amount is determined, for example: by constructing a test case, the speed of the SSD controller randomly accessing the DDR with a preset size is obtained; according to 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 according to the delta data update amount and the user data unit size.

[0136] Step A3: Determine the ratio according to the delta data update amount and the size of the L2P table.

[0137] Step A4, calculating the write amplification value according to the delta data update amount, the size of the L2P table, and the write amount of user data.

[0138] Step A5, determining whether the write amplification value falls within the target range, if so, taking the current ratio as the target ratio; otherwise, adjusting the ratio and re-executing step A4.

[0139] Specifically, let the ratio of delta to base = 1:K. If K is increased, delta will be reduced accordingly, and the speed of SSD writing writebuffer will be faster, but write amplification will also increase. On the contrary, if K is reduced, delta will be increased accordingly, and more incremental data can be stored. The power-on recovery time is mainly related to the number of L2P type incremental data. The larger the incremental data, the longer the power-on recovery time. The value of K affects write amplification and power-on recovery time.

[0140] In this embodiment, the initial ratio of delta and base is obtained by testing or calculation, and the initial ratio is set to the target ratio by default when the SSD is powered on for the first time. When 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 powering on.

[0141] In some optional implementations, a method for dynamically adjusting the amount of metadata changes and snapshot ratios is provided, which can solve the same technical problems as steps S101 to S104, such as Figure 3 As shown, the method includes:

[0142] When powered on for the first time, the buffer ratio is set to the default and saved according to the default ratio; when saving during runtime, the ratio is saved in the buffer header; after powering off and then on, the ratio recorded in the buffer header is restored; according to 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 as required, 64 bytes at a time, if not, it is saved according to the new buffer ratio or the ratio is not changed; the new ratio is recorded and the next adjustment is made based on this.

[0143] In this embodiment, the ratio of delta to base of the write buffer stored in the metadata is changed dynamically, so as to adjust the ratio more finely and obtain a more appropriate ratio, so that the power-on time of SLC PE and SSD reaches an optimal state. And as the average power-on time, SLC PE and the ratio of SLC PE to TLC PE gradually accumulate during the use of the SSD, the ratio of delta to base will also be slowly adjusted to continuously adapt to the state of the disk.

[0144] In this embodiment, a metadata storage device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0145] This embodiment provides a metadata storage device, such as Figure 4 As shown, including:

[0146] The parameter acquisition module 401 is used to obtain the average flash memory erase times, average power-on time and current ratio of the hard disks under the multiple hard disk types after the hard disks are powered on again under the multiple hard disk types, and determine the ratio between the average flash memory erase times of the hard disks under the different hard disk types, wherein 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 and write times and the ratio of the times to obtain a target ratio;

[0148] The snapshot generation module 403 is used to determine the metadata change amount according to the metadata of the hard disks under the multiple hard disk types, and generate a metadata snapshot in the memory according to the target ratio, the metadata change amount and the metadata, wherein the metadata snapshot includes the metadata of the hard disk;

[0149] The snapshot writing module 404 is used to write the metadata snapshot in the memory to the hard disk corresponding to the metadata in the metadata snapshot.

[0150] In some optional embodiments, the device further comprises:

[0151] A creation module is used to create a write buffer with a data capacity of a preset capacity in the memory;

[0152] The partitioning module is used to divide the write buffer into a first part, a second part and a third part, wherein the first part is used to save the target ratio, the second part is used to save the metadata change, and the third part is used to save the metadata snapshot.

[0153] In some optional implementations, the snapshot generation module 403 includes:

[0154] A first writing unit, used for determining the metadata change amount when the metadata of the hard disk changes under multiple hard disk types, and writing the metadata change amount into the second part;

[0155] A first determining unit, configured to determine a quantity threshold of a metadata change amount according to a target ratio in the first part;

[0156] a second determining unit, configured to determine target metadata in the metadata according to the metadata changes when the number of metadata changes in the second part is equal to the quantity threshold;

[0157] A second writing unit, used for creating a metadata snapshot according to the target metadata and the first preset sequence, and writing the metadata snapshot into the third part;

[0158] The snapshot flashing module 404 includes:

[0159] The flushing unit is used to flush the data in the write buffer from the memory to the hard disk corresponding to the metadata in the metadata snapshot when the space occupied by the data in the write buffer is equal to the preset capacity.

[0160] In some optional implementations, the snapshot generation module 403 further includes:

[0161] a third determining unit, configured to obtain the data in the write buffer from the hard disk containing the data in the write buffer, and determine a target amount of metadata change according to a target ratio in the first part of the write buffer;

[0162] An acquisition unit, used for acquiring a target number of metadata changes in the second part of the write buffer as a target change;

[0163] The metadata recovery unit is used to recover the metadata in the memory according to the second preset sequence, the target variation, and the metadata snapshot in the third part of the write buffer.

[0164] In some optional implementations, the ratio adjustment module 402 includes:

[0165] A first adjustment unit, configured to reduce a first preset step length for a value of a metadata variation in a current ratio when the average power-on time is greater than or equal to a first preset threshold;

[0166] A second adjustment unit, configured to increase a second preset step length for the value of the metadata change amount in the current ratio when the average number of flash memory erase and write times is greater than or equal to a second preset threshold;

[0167] The third adjustment unit is used to increase a third preset step length for the value of the metadata change amount in the current ratio when the number ratio is within the first preset range.

[0168] In some optional implementations, the ratio adjustment module 402 further includes:

[0169] A judging unit, used to judge whether the value of the metadata change amount in the adjusted current ratio is within a second preset range;

[0170] A first replacement unit, configured to replace the target ratio in the first part with the adjusted current ratio when the value of the metadata change amount in the adjusted current ratio is within a second preset range;

[0171] A fourth determining unit, configured to determine a third preset range according to the value of the metadata change amount in the current ratio and a critical value of the second preset range when the value of the metadata change amount 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 according to any integer in the third preset range and the current ratio, and replace the target ratio in the first part with the first intermediate ratio.

[0173] In some optional implementations, the ratio adjustment module 402 further includes:

[0174] A third replacing unit, configured to replace the target ratio in the first part with a preset ratio if no integer exists in the third preset range, or to determine whether a ratio setting instruction is received;

[0175] The fourth replacement unit is configured to determine a second intermediate ratio according to the ratio setting instruction if a ratio setting instruction is received, and replace the target ratio in the first part with the second intermediate ratio.

[0176] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0177] The metadata storage device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0178] The embodiment of the present invention also provides a computer device having the above Figure 4 The metadata storage device shown.

[0179] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.

[0180] The processor 10 may be a central processing unit, a network processor or a combination thereof. The 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 logic gate array, a general purpose array logic or any combination thereof.

[0181] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0182] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0183] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0184] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0185] The embodiment of the present invention also provides a computer non-volatile readable storage medium. The above method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or downloaded through a network and originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.

[0186] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable non-volatile storage medium or communication medium accessible to the computer.

[0187] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined in this application.

Claims

1. A metadata storage method, characterized in that: The method comprises: After the hard disk is powered on again under multiple hard disk types, the average flash memory erase times of the hard disk under the multiple hard disk types, the average power-on time of the hard disk and the current ratio are obtained, and the ratio between the average flash memory erase times of the hard disk under different hard disk types is determined, wherein the current ratio is the ratio between the number of metadata changes and the number of metadata snapshots; According to the average power-on time, the average number of flash memory erase and write times and the ratio of the times, the current ratio is adjusted to obtain a target ratio; Determining the metadata change amount according to the metadata of the hard disks under the multiple hard disk types, and generating the metadata snapshot in the memory according to the target ratio, the metadata change amount and the metadata, wherein the metadata snapshot includes the metadata of the hard disk; The metadata snapshot in the memory is written 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 comprises: Creating a write buffer with a data capacity equal to a preset 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 save the target ratio, the second part is used to save the metadata change, and the third part is used to save the metadata snapshot.

3. The method according to claim 2, characterized in that The step of determining the metadata change amount according to the metadata of the hard disks of the multiple hard disk types, and generating the metadata snapshot in the memory according to the target ratio, the metadata change amount and the metadata, includes: When the metadata of the hard disks of the multiple hard disk types changes, determining the metadata change amount, and writing the metadata change amount into the second part; Determining a quantity threshold of the metadata change amount according to the target ratio in the first part; When the number of the metadata changes in the second part is equal to the quantity threshold, determining target metadata in the metadata according to the metadata changes; Creating the metadata snapshot according to the target metadata and the first preset order, and writing the metadata snapshot into the third part; Writing the metadata snapshot in the memory to the hard disk corresponding to the metadata in the metadata snapshot includes: When 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: Acquire the data in the write buffer from a hard disk containing the data in the write buffer, and determine a target amount of the metadata change according to the target ratio in the first portion of the write buffer; Acquire a target number of metadata changes in the second part of the write buffer as a target change; The metadata in the memory is restored according to a second preset order, the target change amount, and the metadata snapshot in the third portion of the write buffer.

5. The method according to claim 2, characterized in that: The adjusting the current ratio according to the average power-on time, the average number of flash memory erase and write times, and the ratio of the times includes: When the average power-on time is greater than or equal to a first preset threshold, the value of the metadata change in the current ratio is reduced by a first preset step size; Alternatively, when the average number of flash memory erase and write times is greater than or equal to a second preset threshold, a second preset step length is added to the value of the metadata change amount in the current ratio; Alternatively, when the number ratio is within the first preset range, a third preset step size is added to the value of the metadata change amount in the current ratio.

6. The method according to claim 5, characterized in that The method further comprises: Determine whether the value of the metadata change amount in the adjusted current ratio is within a second preset range; When the value of the metadata change amount in the adjusted current ratio is within the second preset range, replacing the target ratio in the first part with the adjusted current ratio; When the value of the metadata change amount in the adjusted current ratio is not within the second preset range, determining a third preset range according to the value of the metadata change amount in the current ratio and a critical value of the second preset range; A first intermediate ratio is obtained according to 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.

7. The method according to claim 6, characterized in that The method further comprises: If there is no integer in the third preset range, replacing the target ratio in the first part with a preset ratio, or determining whether a ratio setting instruction is 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.

8. A metadata storage device, characterized in that: The device comprises: A parameter acquisition module, for acquiring, after the hard disk is powered on again, the average flash memory erase times of the hard disks under the multiple hard disk types, the average power-on time of the hard disks and the current ratio, and determining the ratio between the average flash memory erase times of the hard disks under different hard disk types, wherein the current ratio is the ratio between the number of metadata changes and the number of metadata snapshots; A ratio adjustment module, used to adjust the current ratio according to the average power-on time, the average number of flash memory erase and write times and the ratio of the times to obtain a target ratio; a snapshot generation module, configured to determine the metadata change amount according to the metadata of the hard disks under the multiple hard disk types, and generate the metadata snapshot in the memory according to the target ratio, the metadata change amount and the metadata, wherein the metadata snapshot includes the metadata of the hard disk; The snapshot writing module is used to write the metadata snapshot in the memory to the hard disk corresponding to the metadata in the metadata snapshot.

9. A computer device, characterized in that: include: 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 metadata preservation method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the metadata storage method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • SSD metadata snapshot storage and recovery method, device and equipment

    CN115080454A

  • Mapping table metadata recovery method and device, equipment and storage medium

    CN118427012A

  • Data writing method and data recording equipment of solid state disk

    CN118466834A

  • Data storage method based on hard disk, product, device and medium

    CN119201009A

  • Incremental restore for volumes using object-based snapshots

    US11544156B1

Cited By

  • Solid state disk data recovery method and device, medium and computer program product

    CN120610853A

  • Dynamic adjustment method of metadata block, electronic equipment and storage medium

    CN120743194A

  • Method for dynamically adjusting metadata block, electronic device and storage medium

    CN120743194B

  • Flash memory device performance optimization method, terminal device and computer readable storage medium

    CN122090911A