A solid state hard disk data management method and system

By analyzing the historical operation data of files and the update frequency of associated files, calculating the estimated modification probability and optimizing the data management of solid-state drives, the performance degradation and storage life shortening caused by frequent modification of files in the garbage collection mechanism is solved, and more efficient resource allocation and storage management.

CN118963680BActive Publication Date: 2025-01-03SEMICONTEST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411449833.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-01-03
Estimated Expiration
2044-10-17

AI Technical Summary

Technical Problem

When the existing solid-state drive garbage collection mechanism processes frequently modified files, it leads to frequent erasing and writing of blocks, reducing system performance and storage life, and cannot accurately distinguish files with high probability of modification in the future, resulting in unoptimized resource allocation. .

Method used

By analyzing the historical operation data of the file and the update frequency of the associated file, calculate the estimated modification probability of the file, set files with high estimated modification probability as stable and effective files, and copy them to the same block to reduce garbage collection Operation and improve storage space utilization.

Benefits of technology

It improves the intelligence of data management of solid-state drives, reduces the frequency of garbage collection operations, extends the service life of storage devices, and improves storage performance and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118963680B_ABST
    Figure CN118963680B_ABST
Patent Text Reader

Abstract

The present invention is applicable to the technical field of solid-state hard disk data management, and provides a solid-state hard disk data management method and system, which determines a target source block in a target solid-state hard disk that contains both valid files and invalid files, and sets the valid files in the target source block as designated valid files; identifies designated valid files, determines the number of reads and modifications of the designated valid files within a first preset time period, and calculates a first evaluation parameter. By comprehensively analyzing the historical operation data of the file and the dynamic update of the associated files, the future estimated modification probability of the designated valid file can be scientifically and objectively evaluated. Specifically, the first evaluation parameter is based on the number of modifications and reads of the file within a preset time period, reflecting the activeness of the file's use; the second evaluation parameter captures the data modification trend related to the designated valid file by analyzing the update frequency of the associated files.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of solid state hard disk data management, and in particular relates to a solid state hard disk data management method and system. Background Art

[0002] In solid-state drives (SSDs), garbage collection (GC) is a key process to ensure efficient use of storage space. Data in SSDs is written in pages, but can only be erased in blocks. When a file is deleted or modified, the data stored in some pages will become invalid, and the blocks containing these pages will contain invalid data and valid data. In order to make more available space, the garbage collection mechanism will migrate the valid data in these blocks to new free blocks, and then erase the entire source block containing invalid data to free up its storage space. During this process, the system must ensure that valid files are not lost due to block erasure, so these valid files need to be copied to new free blocks first. This copying process ensures data integrity, but it will also affect the performance and life of the system, especially when there are frequently modified files.

[0003] However, the existing garbage collection mechanism has some technical defects when processing valid files. In particular, when valid files are frequently modified, the system may migrate these files from one block to another multiple times, which causes the same file to participate in garbage collection operations multiple times. If the modification frequency of multiple valid files is high, the blocks where these files are located need to be repeatedly cleaned up, increasing the number of times the blocks are erased and written. This frequent block processing operation not only reduces the write efficiency of the system, but also accelerates the wear of the SSD storage unit, leading to the emergence of the write amplification effect, thereby significantly shortening the service life of the SSD. Existing technologies are often unable to accurately distinguish which files have a higher probability of being modified in the future, and therefore cannot take effective management measures to reduce the frequency of garbage collection operations. Summary of the invention

[0004] The purpose of the present invention is to provide a solid state hard disk data management method and system, aiming to solve the problems raised in the background technology.

[0005] The present invention is implemented as follows: a solid state hard disk data management method, the method comprising:

[0006] Determine a target source block in the target solid state drive that contains both valid files and invalid files, and set the valid files in the target source block as designated valid files;

[0007] Identify a designated valid file, determine the number of times the designated valid file is read and the number of times it is modified within a first preset period of time, and calculate a first evaluation parameter;

[0008] Identify the associated files of the specified valid file, and calculate the comprehensive update frequency of all the associated files to obtain a second evaluation parameter, and calculate the estimated modification probability of the specified valid file according to the first evaluation parameter and the second evaluation parameter;

[0009] The specified valid files with estimated modification probability greater than a preset threshold are set as stable valid files, and a set of stable valid files with a total size close to a complete block in the target solid-state drive is copied into the same target free block.

[0010] As a further limitation of the technical solution of the embodiment of the present invention, the steps of identifying a specified valid file, determining the number of times the specified valid file is read and modified within a first preset time period, and calculating a first evaluation parameter include:

[0011] Identify the specified valid file and retrieve the historical usage log corresponding to the specified valid file;

[0012] Determine the number of times the specified valid file is read and modified within a first preset time period according to the historical usage log corresponding to the specified valid file;

[0013] The first evaluation parameter is calculated by dividing the number of times a specified valid file is modified within the first preset time period by the number of times it is read.

[0014] As a further limitation of the technical solution of the embodiment of the present invention, the steps of identifying the associated files of the specified valid file and calculating the comprehensive update frequency of all the associated files to obtain the second evaluation parameter, and calculating the estimated modification probability of the specified valid file according to the first evaluation parameter and the second evaluation parameter include:

[0015] Identify associated files in the target solid state drive that are associated with the specified valid file, and determine the number of updates of each associated file within a second preset time period;

[0016] Dividing the number of updates of each associated file by the length of the second preset period of time to obtain an update frequency, calculating the average of the update frequencies of all associated files to obtain a comprehensive update frequency, and setting the value of the comprehensive update frequency as a second evaluation parameter;

[0017] An estimated modification probability of a specified valid file is calculated according to the first evaluation parameter and the second evaluation parameter.

[0018] As a further limitation of the technical solution of the embodiment of the present invention, the step of calculating the estimated modification probability of the specified valid file according to the first evaluation parameter and the second evaluation parameter includes:

[0019] Assigning a first weight to a first evaluation parameter, and obtaining a product of the first evaluation parameter and the first weight;

[0020] assigning a second weight to a second evaluation parameter, and obtaining a product of the second evaluation parameter and the second weight;

[0021] The sum of the product of the first evaluation parameter and the first weight and the product of the second evaluation parameter and the second weight is obtained to calculate the estimated modification probability of the specified valid file.

[0022] As a further limitation of the technical solution of the embodiment of the present invention, the steps of setting a specified valid file with an estimated modification probability greater than a preset threshold as a stable valid file, and copying a stable valid file set with a total size close to a complete block in the target solid-state hard disk into the same target free block include:

[0023] The specified valid files with estimated modification probability greater than a preset threshold are set as stable valid files;

[0024] Identify the required storage size of different stable and valid files in the target SSD;

[0025] Select several stable and valid files whose total storage size is close to a complete block, combine these stable and valid files to form a stable and valid file set, and copy the stable and valid file set into the same target free block.

[0026] A solid state drive data management system, the system comprising: a designated valid file determination module, a first evaluation parameter calculation module, an estimated modification probability calculation module and a stable valid file set replication module, wherein:

[0027] A designated valid file determination module is used to determine a target source block in a target solid state drive that contains both valid files and invalid files, and set the valid files in the target source block as designated valid files;

[0028] A first evaluation parameter calculation module, used to identify a specified valid file, determine the number of times the specified valid file is read and modified within a first preset time period, and calculate a first evaluation parameter;

[0029] An estimated modification probability calculation module is used to identify the associated files of the specified valid file, and calculate the comprehensive update frequency of all associated files to obtain a second evaluation parameter, and calculate the estimated modification probability of the specified valid file according to the first evaluation parameter and the second evaluation parameter;

[0030] The stable and valid file set copy module is used to set the specified valid files with an estimated modification probability greater than a preset threshold as stable and valid files, and copy the stable and valid file set with a total size close to a complete block in the target solid-state hard disk into the same target free block.

[0031] As a further limitation of the technical solution of the embodiment of the present invention, the first evaluation parameter calculation module specifically includes:

[0032] A log retrieval unit, used to identify a specified valid file and retrieve a historical usage log corresponding to the specified valid file;

[0033] A log reading unit, used to determine the number of times the specified valid file is read and the number of times it is modified within a first preset time period according to the historical use log corresponding to the specified valid file;

[0034] The first evaluation parameter calculation unit is used to calculate the first evaluation parameter by dividing the number of modifications of a specified valid file within a first preset time period by the number of reads.

[0035] As a further limitation of the technical solution of the embodiment of the present invention, the estimated modification probability calculation module specifically includes:

[0036] An associated file identification unit, used to identify associated files in the target solid state drive that are associated with the specified valid file, and determine the number of updates of each associated file within a second preset time period;

[0037] A second evaluation parameter acquisition unit, configured to divide the number of updates of each associated file by the length of the second preset period to obtain an update frequency, calculate an average of the update frequencies of all associated files to obtain a comprehensive update frequency, and set the value of the comprehensive update frequency as a second evaluation parameter;

[0038] The estimated modification probability calculation unit is used to calculate the estimated modification probability of a specified valid file according to the first evaluation parameter and the second evaluation parameter.

[0039] As a further limitation of the technical solution of the embodiment of the present invention, the stable and effective file set replication module specifically includes:

[0040] A stable and valid file determination unit, used to set a designated valid file with an estimated modification probability greater than a preset threshold as a stable and valid file;

[0041] A stable and effective file identification unit, used for identifying the required storage size of different stable and effective files in the target solid state drive;

[0042] The stable and valid file set copying unit is used to select a number of stable and valid files whose total storage size is close to a complete block, combine these stable and valid files to form a stable and valid file set, and copy the stable and valid file set into the same target free block.

[0043] Compared with the prior art, the present invention has the following beneficial effects:

[0044] By comprehensively analyzing the historical operation data of the file and the dynamic update of the associated files, the estimated future modification probability of the specified valid file can be scientifically and objectively evaluated. Specifically, the first evaluation parameter is based on the number of modifications and reads of the file within a preset period of time, reflecting the activeness of the file's use; the second evaluation parameter captures the data modification trend related to the specified valid file by analyzing the update frequency of the associated files. By combining these two evaluation parameters and assigning appropriate weights, the system can more accurately predict the future modification probability of the file and avoid relying solely on a single modification history for evaluation. This multi-dimensional analysis method ensures a more accurate prediction of the file modification probability, which helps to improve the intelligence of data management and migration in SSDs, thereby optimizing resource allocation in the garbage collection mechanism.

[0045] In addition, this solution effectively improves the utilization of storage space and the write efficiency of the system by collecting files with lower estimated modification probabilities into the same free block. When multiple stable files are stored in the same block, the system can reduce the frequent garbage collection and erase operations on the blocks where these files are located, thereby reducing the write amplification effect and extending the service life of the SSD. This precise data allocation method solves the problem of unnecessary storage operations and performance waste caused by the mixed storage of frequently modified files and stable files in traditional storage management. Ultimately, the present invention not only improves storage performance, but also reduces the wear of storage devices through intelligent management, providing a more efficient and sustainable solution. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A flowchart of a method provided by an embodiment of the present invention;

[0047] Figure 2 A flowchart of calculating a first evaluation parameter in a method provided in an embodiment of the present invention;

[0048] Figure 3 A flowchart of calculating a second evaluation parameter in a method provided in an embodiment of the present invention;

[0049] Figure 4 A flowchart of calculating the estimated modification probability in the method provided in an embodiment of the present invention;

[0050] Figure 5 A flow chart of copying a stable and valid file set into the same target free block in the method provided by an embodiment of the present invention;

[0051] Figure 6 An application architecture diagram of a system provided by an embodiment of the present invention;

[0052] Figure 7 A structural block diagram of a first evaluation parameter calculation module in a system provided by an embodiment of the present invention;

[0053] Figure 8 A structural block diagram of a module for calculating the estimated modification probability in a system provided by an embodiment of the present invention;

[0054] Fig. 9 This is a structural block diagram of a stable and effective file set replication module in a system provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0056] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but unless otherwise specified, these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first xx script may be referred to as a second xx script, and similarly, a second xx script may be referred to as a first xx script.

[0057] Figure 1 A flow chart of a method provided by an embodiment of the present invention is shown.

[0058] Specifically, a solid state drive data management method comprises the following steps:

[0059] Step S100, determining a target source block in a target solid state drive that contains both valid files and invalid files, and setting the valid files in the target source block as designated valid files.

[0060] In an embodiment of the present invention, during the garbage collection process of a solid state drive (SSD), the system will identify that some blocks contain both valid files and invalid files. These blocks are called target source blocks. In order to optimize the use of storage space, the SSD needs to process these source blocks through a garbage collection mechanism (Garbage Collection).

[0061] Garbage cleaning is an automatic maintenance mechanism in SSDs, which aims to reclaim storage space and improve write efficiency. Since the flash storage structure of SSDs can only be erased in "blocks", but data is written in "pages", when the data in a page is modified or deleted, the block where the page is located may still contain valid data that has not been modified. At this time, this block is regarded as a mixed block containing invalid files and valid files, that is, the target source block. The main task of garbage cleaning is to clean up these blocks containing invalid data to make more available space.

[0062] During the garbage cleaning process, valid files in the target source block are designated as "designated valid files" and copied and transferred. This is because in SSDs, block-level erase operations clear all data in the entire block at the same time. To ensure that valid files are not lost due to garbage cleaning operations, the system must first copy these valid files from the source block to the new target block to ensure their integrity. After the valid files are copied and transferred, the target source block can be safely erased to free up space for new data to be written.

[0063] The reason why there are both valid and invalid files in the target source block is due to the data modification mechanism. When a file is updated, the SSD does not directly overwrite the original file, but writes the updated data to a new page, and the old page is marked as invalid data. Therefore, as time goes by, many blocks will appear in this partially invalid and partially valid state, which is why the target source block contains both valid and invalid files.

[0064] By copying valid files to new free blocks during the garbage cleaning process, SSDs can avoid frequent erase and write operations, extend device life, and increase write speed. This mechanism ensures data security while maintaining stable storage performance.

[0065] Furthermore, the solid state drive data management method further includes the following steps:

[0066] Step S200, identifying a designated valid file, determining the number of times the designated valid file is read and the number of times it is modified within a first preset period of time, and calculating a first evaluation parameter.

[0067] Specifically, Figure 2 A flow chart for calculating the first evaluation parameter is shown.

[0068] The steps of identifying a designated valid file, determining the number of times the designated valid file is read and modified within a first preset period of time, and calculating a first evaluation parameter specifically include the following steps:

[0069] Step S201, identifying a specified valid file, and retrieving a historical usage log corresponding to the specified valid file;

[0070] Step S202, determining the number of times the specified valid file is read and the number of times it is modified within a first preset period of time according to the historical usage log corresponding to the specified valid file;

[0071] Step S203: The number of modification times of the specified valid file in the first preset time period is divided by the number of read times to calculate a first evaluation parameter.

[0072] In an embodiment of the present invention, during the management of the target solid-state drive, the system will identify designated valid files through the metadata management and log tracking technology of the file system. Designated valid files are files that have been identified by the system as still available and not deleted. After identifying these files, the system will retrieve the corresponding historical usage logs. The historical usage logs are operation records automatically generated by the file system, which record in detail the access behavior of each file within a specific time period, including the number of reads, the number of modifications, and the specific operation time and user information.

[0073] Based on the log data, the system analyzes the number of reads and modifications of the specified valid file within the first preset period of time, and calculates a first evaluation parameter by dividing the number of modifications of the specified valid file by the number of reads, which is used to reflect the usage pattern of the file.

[0074] Specifically, when the ratio of modification times to read times is high, it indicates that the file is frequently modified during this period, the modification activity is high, and it may continue to be modified in the future. When the ratio is low, it means that the file is more used for reading and the number of modifications is relatively small, indicating that the file is relatively stable and the probability of being modified in the future is low.

[0075] In the process of managing the target SSD, the first preset time period is set mainly based on the file usage pattern and business needs. First, usage pattern analysis helps identify the activity of files during critical periods, while the business operation cycle affects the modification frequency and stability of files. By referring to historical data, a representative time range can be selected to accurately evaluate the activity of files. In addition, considering system performance optimization, if certain time periods are peak file update periods, setting this period can improve the evaluation effect. Combined with the user's operating habits, it can ensure that the collected data is more effective and representative.

[0076] Furthermore, the solid state drive data management method further includes the following steps:

[0077] Step S300, identifying the associated files of the designated valid file, and calculating the comprehensive update frequency of all associated files to obtain a second evaluation parameter, and calculating the estimated modification probability of the designated valid file according to the first evaluation parameter and the second evaluation parameter.

[0078] Specifically, Figure 3 A flow chart for calculating the second evaluation parameter is shown.

[0079] The associated files of the specified valid file are identified, and the comprehensive update frequency of all associated files is calculated to obtain the second evaluation parameter. The estimated modification probability of the specified valid file is calculated according to the first evaluation parameter and the second evaluation parameter, which specifically includes the following steps:

[0080] Step S301, identifying associated files in the target solid state drive that are associated with the specified valid file, and determining the number of updates of each associated file within a second preset period;

[0081] Step S302, dividing the number of updates of each associated file by the length of the second preset period of time to obtain an update frequency, calculating the average of the update frequencies of all associated files to obtain a comprehensive update frequency, and setting the value of the comprehensive update frequency as a second evaluation parameter;

[0082] Step S303: Calculate the estimated modification probability of the specified valid file according to the first evaluation parameter and the second evaluation parameter.

[0083] In the embodiment of the present invention, the implementation of step S301 usually relies on the metadata management and reference tracking technology of the file system. Specifically, the operating system maintains the metadata of the file, which may contain reference information pointing to other files. By analyzing these metadata, the system can identify all files related to the specified valid file. In addition, using the log system (historical use log), the update times of these associated files in the second preset period can be extracted.

[0084] The second preset period is usually set based on the file usage pattern and business needs. Selecting an appropriate time period helps capture the activity and frequency of file updates. This period can be a few weeks or months in the past, and the specific length of time depends on the life cycle and operational characteristics of the file.

[0085] Next, the system divides the number of updates of each associated file by the length of the second preset period to calculate the update frequency of each file, and further calculates the average update frequency of all associated files to obtain the comprehensive update frequency. This value is set as the second evaluation parameter, which can indirectly reflect the dynamics and activity of the file. If the comprehensive update frequency is high, it means that these associated files are frequently updated during this period, which may affect the stability of the specified valid files.

[0086] Specifically, Figure 4 A flow chart for calculating the estimated modification probability is shown.

[0087] Calculating the estimated modification probability of a specified valid file according to the first evaluation parameter and the second evaluation parameter specifically includes the following steps:

[0088] Step S3031, assigning a first weight to a first evaluation parameter, and obtaining a product of the first evaluation parameter and the first weight;

[0089] Step S3032, assigning a second weight to the second evaluation parameter, and obtaining a product of the second evaluation parameter and the second weight;

[0090] Step S3033: Obtain the sum of the product of the first evaluation parameter and the first weight and the product of the second evaluation parameter and the second weight, so as to calculate the estimated modification probability of the specified valid file.

[0091] In the embodiment of the present invention, in the management of the target solid-state drive, in order to calculate the estimated modification probability of a specified valid file, it is first necessary to assign a first weight to the first evaluation parameter. The basis of this process is the degree of influence of the evaluation parameter on the stability of the file, and the weight allocation can be adjusted according to factors such as the importance of the file, the frequency of use, and the impact on the overall storage management. Then, by obtaining the product of the first evaluation parameter and the first weight, the system can quantify the contribution of the parameter in the estimated modification probability.

[0092] Subsequently, a second weight is assigned to the second evaluation parameter, also taking into account the importance of the evaluation parameter in reflecting the dynamic nature of the file. By calculating the product of the second evaluation parameter and the second weight, the system can quantify the impact of the update frequency of the associated file on the estimated modification probability of the specified valid file. Finally, by adding the product of the first evaluation parameter and the first weight to the product of the second evaluation parameter and the second weight, the system will obtain the estimated modification probability of the specified valid file.

[0093] The benefit of this combination is that it can provide a multi-dimensional assessment. By comprehensively considering different assessment parameters and their weights, the system can analyze the probability of file modification from multiple perspectives and improve the accuracy of the prediction. At the same time, the flexibility of the weights allows system administrators to adjust them according to actual needs to enhance the adaptability of the system.

[0094] Furthermore, the solid state drive data management method further includes the following steps:

[0095] Step S400, setting the designated valid files with estimated modification probability greater than a preset threshold as stable valid files, and copying the stable valid file set with a total size close to a complete block in the target solid state drive into the same target free block.

[0096] Specifically, Figure 5 A flow chart of copying a stable and valid file set into the same target free block is shown.

[0097] The method of setting a specified valid file with an estimated modification probability greater than a preset threshold as a stable valid file, and copying a stable valid file set with a total size close to a complete block in the target solid-state drive into the same target free block specifically includes the following steps:

[0098] Step S401, setting a designated valid file whose estimated modification probability is greater than a preset threshold as a stable valid file;

[0099] Step S402, identifying the required storage size of different stable and valid files in the target solid state drive;

[0100] Step S403, select a number of stable and valid files whose total storage size is close to a complete block, combine these stable and valid files to form a stable and valid file set, and copy the stable and valid file set into the same target free block.

[0101] In an embodiment of the present invention, the preset threshold is a standard value set by the system when evaluating the probability of future modification of a file, which is used to distinguish the modification activity and stability of the file. When the estimated modification probability of a file is greater than this threshold, the file is considered to have a high modification frequency; when the estimated modification probability of a file is lower than or equal to the threshold, the file is classified as a stable and valid file. The basis for setting the threshold may include a variety of factors, such as the historical modification frequency, reading frequency, business needs, and system performance requirements of the file. By combining these factors, the system can dynamically adjust the threshold according to different application scenarios to make it more adaptable, ensuring that in actual operation, it can not only optimize storage space, but also effectively reduce frequent garbage collection operations, thereby improving the overall efficiency and life of the solid-state drive.

[0102] In the process of managing the target SSD, identifying the required storage size of different stable and valid files in the target SSD mainly depends on the metadata and management functions of the file system. The metadata of each file usually contains the file size information, which can be directly used to calculate the required storage space for each stable and valid file. The system will traverse the files that have been identified as stable and valid, and extract the size of each file from its metadata, and then generate a list of all stable and valid files and their corresponding storage sizes.

[0103] After obtaining this information, the system can evaluate and combine multiple stable and valid files as needed to achieve efficient storage management. There are several reasons for selecting several stable and valid files whose total storage size is close to a complete block. First, such a choice can effectively utilize the storage space of the SSD. The storage unit of the SSD is erased in blocks. If the total size of multiple files can be made as close to a complete block as possible when writing, the waste of unused space can be avoided and storage efficiency can be improved. Secondly, by combining multiple stable and valid files into a set, the number of subsequent garbage collection operations can be reduced. Because multiple files are stored in the same block, it means that the block may be processed together when cleaning, thereby improving the efficiency of data management.

[0104] In addition, the benefits of this method are also reflected in performance optimization. When multiple stable and valid files are stored in the same block, the system can reduce addressing and positioning time when performing read and write operations, thereby improving overall storage performance. Data writing operations also become more efficient because writing operations only need to be performed on one block, which not only improves speed but also reduces the occurrence of write amplification effects.

[0105] In summary, by identifying the storage size of stable and valid files, selecting a combination of files whose total size is close to a complete block, and copying them to the same target free block, the storage efficiency of the SSD can be effectively improved, the frequency of garbage collection can be reduced, and the overall performance can be optimized. This not only enhances the flexibility of data management, but also provides more stable support for long-term use.

[0106] Furthermore, Figure 6 The application architecture diagram of the system provided by the embodiment of the present invention is shown.

[0107] In another preferred embodiment of the present invention, a solid state drive data management system includes:

[0108] The designated valid file determination module 100 is used to determine a target source block in a target solid state drive that contains both valid files and invalid files, and set the valid files in the target source block as designated valid files.

[0109] In an embodiment of the present invention, during the garbage collection process of a solid state drive (SSD), the system will identify that some blocks contain both valid files and invalid files. These blocks are called target source blocks. In order to optimize the use of storage space, the SSD needs to process these source blocks through a garbage collection mechanism (Garbage Collection).

[0110] Garbage cleaning is an automatic maintenance mechanism in SSDs, which aims to reclaim storage space and improve write efficiency. Since the flash storage structure of SSDs can only be erased in "blocks", but data is written in "pages", when the data in a page is modified or deleted, the block where the page is located may still contain valid data that has not been modified. At this time, this block is regarded as a mixed block containing invalid files and valid files, that is, the target source block. The main task of garbage cleaning is to clean up these blocks containing invalid data to make more available space.

[0111] During the garbage cleaning process, valid files in the target source block are designated as "designated valid files" and copied and transferred. This is because in SSDs, block-level erase operations clear all data in the entire block at the same time. To ensure that valid files are not lost due to garbage cleaning operations, the system must first copy these valid files from the source block to the new target block to ensure their integrity. After the valid files are copied and transferred, the target source block can be safely erased to free up space for new data to be written.

[0112] The reason why there are both valid and invalid files in the target source block is due to the data modification mechanism. When a file is updated, the SSD does not directly overwrite the original file, but writes the updated data to a new page, and the old page is marked as invalid data. Therefore, as time goes by, many blocks will appear in this partially invalid and partially valid state, which is why the target source block contains both valid and invalid files.

[0113] By copying valid files to new free blocks during the garbage cleaning process, SSDs can avoid frequent erase and write operations, extend device life, and increase write speed. This mechanism ensures data security while maintaining stable storage performance.

[0114] Furthermore, the solid state drive data management system also includes:

[0115] The first evaluation parameter calculation module 200 is used to identify a designated valid file, determine the number of times the designated valid file is read and the number of times it is modified within a first preset period of time, and calculate a first evaluation parameter.

[0116] Specifically, Figure 7 It shows a structural block diagram of the first evaluation parameter calculation module 200 in the system provided by the embodiment of the present invention.

[0117] Among them, in the preferred embodiment provided by the present invention, the first evaluation parameter calculation module 200 specifically includes:

[0118] The log retrieval unit 201 is used to identify a specified valid file and retrieve a historical usage log corresponding to the specified valid file;

[0119] The log reading unit 202 is used to determine the number of times the specified valid file is read and the number of times it is modified within a first preset period of time according to the historical use log corresponding to the specified valid file;

[0120] The first evaluation parameter calculation unit 203 is used to calculate a first evaluation parameter by dividing the number of modifications of a specified valid file within a first preset period by the number of reads.

[0121] In an embodiment of the present invention, during the management of the target solid-state drive, the system will identify designated valid files through the metadata management and log tracking technology of the file system. Designated valid files are files that have been identified by the system as still available and not deleted. After identifying these files, the system will retrieve the corresponding historical usage logs. The historical usage logs are operation records automatically generated by the file system, which record in detail the access behavior of each file within a specific time period, including the number of reads, the number of modifications, and the specific operation time and user information.

[0122] Based on the log data, the system analyzes the number of reads and modifications of the specified valid file within the first preset period of time, and calculates a first evaluation parameter by dividing the number of modifications of the specified valid file by the number of reads, which is used to reflect the usage pattern of the file.

[0123] Specifically, when the ratio of modification times to read times is high, it indicates that the file is frequently modified during this period, the modification activity is high, and it may continue to be modified in the future. When the ratio is low, it means that the file is more used for reading and the number of modifications is relatively small, indicating that the file is relatively stable and the probability of being modified in the future is low.

[0124] In the process of managing the target SSD, the first preset time period is set mainly based on the file usage pattern and business needs. First, usage pattern analysis helps identify the activity of files during critical periods, while the business operation cycle affects the modification frequency and stability of files. By referring to historical data, a representative time range can be selected to accurately evaluate the activity of files. In addition, considering system performance optimization, if certain time periods are peak file update periods, setting this period can improve the evaluation effect. Combined with the user's operating habits, it can ensure that the collected data is more effective and representative.

[0125] Furthermore, the solid state drive data management system also includes:

[0126] The estimated modification probability calculation module 300 is used to identify the associated files of the specified valid file and calculate the comprehensive update frequency of all associated files to obtain the second evaluation parameter, and calculate the estimated modification probability of the specified valid file according to the first evaluation parameter and the second evaluation parameter.

[0127] Specifically, Figure 8 It shows a structural block diagram of the estimated modification probability calculation module 300 in the system provided by an embodiment of the present invention.

[0128] Among them, in the preferred implementation mode provided by the present invention, the estimated modification probability calculation module 300 specifically includes:

[0129] The associated file identification unit 301 is used to identify the associated files associated with the specified valid file in the target solid state drive, and determine the number of updates of each associated file within the second preset time period;

[0130] The second evaluation parameter acquisition unit 302 is used to divide the update times of each associated file by the length of the second preset period to obtain the update frequency, calculate the average update frequency of all associated files to obtain the comprehensive update frequency, and set the value of the comprehensive update frequency as the second evaluation parameter;

[0131] The estimated modification probability calculation unit 303 is used to calculate the estimated modification probability of a specified valid file according to the first evaluation parameter and the second evaluation parameter.

[0132] In the embodiment of the present invention, the associated file identification unit 301 usually relies on the metadata management and reference tracking technology of the file system. Specifically, the operating system maintains the metadata of the file, which may contain reference information pointing to other files. By analyzing these metadata, the system can identify all files related to the specified valid file. In addition, using the log system (historical use log), the update times of these associated files in the second preset period can be extracted.

[0133] The second preset period is usually set based on the file usage pattern and business needs. Selecting an appropriate time period helps capture the activity and frequency of file updates. This period can be a few weeks or months in the past, and the specific length of time depends on the life cycle and operational characteristics of the file.

[0134] Next, the system divides the number of updates of each associated file by the length of the second preset period to calculate the update frequency of each file, and further calculates the average update frequency of all associated files to obtain the comprehensive update frequency. This value is set as the second evaluation parameter, which can indirectly reflect the dynamics and activity of the file. If the comprehensive update frequency is high, it means that these associated files are frequently updated during this period, which may affect the stability of the specified valid files.

[0135] In the management of the target SSD, in order to calculate the estimated modification probability of a specified valid file, it is first necessary to assign a first weight to the first evaluation parameter. The basis of this process is the degree of influence of the evaluation parameter on the stability of the file. The weight allocation can be adjusted according to factors such as the importance of the file, the frequency of use, and the impact on the overall storage management. Then, by obtaining the product of the first evaluation parameter and the first weight, the system can quantify the contribution of the parameter in the estimated modification probability.

[0136] Subsequently, a second weight is assigned to the second evaluation parameter, also taking into account the importance of the evaluation parameter in reflecting the dynamic nature of the file. By calculating the product of the second evaluation parameter and the second weight, the system can quantify the impact of the update frequency of the associated file on the estimated modification probability of the specified valid file. Finally, by adding the product of the first evaluation parameter and the first weight to the product of the second evaluation parameter and the second weight, the system will obtain the estimated modification probability of the specified valid file.

[0137] The benefit of this combination is that it can provide a multi-dimensional assessment. By comprehensively considering different assessment parameters and their weights, the system can analyze the probability of file modification from multiple perspectives and improve the accuracy of the prediction. At the same time, the flexibility of the weights allows system administrators to adjust them according to actual needs to enhance the adaptability of the system.

[0138] Furthermore, the solid state drive data management system also includes:

[0139] The stable and valid file set copy module 400 is used to set the specified valid files with an estimated modification probability greater than a preset threshold as stable and valid files, and copy the stable and valid file set with a total size close to a complete block in the target solid state drive into the same target free block.

[0140] Specifically, Fig. 9 It shows a structural block diagram of a stable and effective file set replication module 400 in a system provided by an embodiment of the present invention.

[0141] Among them, in the preferred implementation mode provided by the present invention, the stable and effective file set replication module 400 specifically includes:

[0142] A stable and valid file determining unit 401, configured to set a designated valid file with an estimated modification probability greater than a preset threshold as a stable and valid file;

[0143] A stable and valid file identification unit 402, used to identify the required storage size of different stable and valid files in the target solid state drive;

[0144] The stable and valid file set copying unit 403 is used to select a number of stable and valid files whose total storage size is close to a complete block, combine these stable and valid files to form a stable and valid file set, and copy the stable and valid file set into the same target free block.

[0145] In an embodiment of the present invention, the preset threshold is a standard value set by the system when evaluating the probability of future modification of a file, which is used to distinguish the modification activity and stability of the file. When the estimated modification probability of a file is greater than this threshold, the file is considered to have a high modification frequency; when the estimated modification probability of a file is lower than or equal to the threshold, the file is classified as a stable and valid file. The basis for setting the threshold may include a variety of factors, such as the historical modification frequency, reading frequency, business needs, and system performance requirements of the file. By combining these factors, the system can dynamically adjust the threshold according to different application scenarios to make it more adaptable, ensuring that in actual operation, it can not only optimize storage space, but also effectively reduce frequent garbage collection operations, thereby improving the overall efficiency and life of the solid-state drive.

[0146] In the process of managing the target SSD, identifying the required storage size of different stable and valid files in the target SSD mainly depends on the metadata and management functions of the file system. The metadata of each file usually contains the file size information, which can be directly used to calculate the required storage space for each stable and valid file. The system will traverse the files that have been identified as stable and valid, and extract the size of each file from its metadata, and then generate a list of all stable and valid files and their corresponding storage sizes.

[0147] After obtaining this information, the system can evaluate and combine multiple stable and valid files as needed to achieve efficient storage management. There are several reasons for selecting several stable and valid files whose total storage size is close to a complete block. First, such a choice can effectively utilize the storage space of the SSD. The storage unit of the SSD is erased in blocks. If the total size of multiple files can be made as close to a complete block as possible when writing, the waste of unused space can be avoided and storage efficiency can be improved. Secondly, by combining multiple stable and valid files into a set, the number of subsequent garbage collection operations can be reduced. Because multiple files are stored in the same block, it means that the block may be processed together when cleaning, thereby improving the efficiency of data management.

[0148] In addition, the benefits of this method are also reflected in performance optimization. When multiple stable and valid files are stored in the same block, the system can reduce addressing and positioning time when performing read and write operations, thereby improving overall storage performance. Data writing operations also become more efficient because writing operations only need to be performed on one block, which not only improves speed but also reduces the occurrence of write amplification effects.

[0149] In summary, by identifying the storage size of stable and valid files, selecting a combination of files whose total size is close to a complete block, and copying them to the same target free block, the storage efficiency of the SSD can be effectively improved, the frequency of garbage collection can be reduced, and the overall performance can be optimized. This not only enhances the flexibility of data management, but also provides more stable support for long-term use.

[0150] It should be understood that, although each step in the flow chart of each embodiment of the present invention is shown in sequence according to the indication of the arrow, these steps are not necessarily performed in sequence according to the order indicated by the arrow. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in each embodiment may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.

[0151] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0152] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0153] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

[0154] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A solid state hard disk data management method, characterized in that: The method comprises: Determine a target source block in the target solid state drive that contains both valid files and invalid files, and set the valid files in the target source block as designated valid files; Identify a designated valid file, determine the number of times the designated valid file is read and the number of times it is modified within a first preset period of time, and calculate a first evaluation parameter; The steps of identifying a designated valid file, determining the number of times the designated valid file is read and modified within a first preset period of time, and calculating a first evaluation parameter include: Identify the specified valid file and retrieve the historical usage log corresponding to the specified valid file; Determine the number of times the specified valid file is read and modified within a first preset time period according to the historical usage log corresponding to the specified valid file; The number of times a specified valid file is modified within a first preset period of time is divided by the number of times it is read to calculate a first evaluation parameter; Identify the associated files of the specified valid file, and calculate the comprehensive update frequency of all the associated files to obtain a second evaluation parameter, and calculate the estimated modification probability of the specified valid file according to the first evaluation parameter and the second evaluation parameter; The steps of identifying the associated files of the designated valid file and calculating the comprehensive update frequency of all the associated files to obtain the second evaluation parameter, and calculating the estimated modification probability of the designated valid file according to the first evaluation parameter and the second evaluation parameter include: Identify associated files in the target solid state drive that are associated with the specified valid file, and determine the number of updates of each associated file within a second preset time period; Dividing the number of updates of each associated file by the length of the second preset period of time to obtain an update frequency, calculating the average of the update frequencies of all associated files to obtain a comprehensive update frequency, and setting the value of the comprehensive update frequency as a second evaluation parameter; Calculate an estimated modification probability of a specified valid file according to a first evaluation parameter and a second evaluation parameter; The step of calculating the estimated modification probability of a specified valid file according to the first evaluation parameter and the second evaluation parameter comprises: Assigning a first weight to a first evaluation parameter, and obtaining a product of the first evaluation parameter and the first weight; assigning a second weight to a second evaluation parameter, and obtaining a product of the second evaluation parameter and the second weight; Obtaining the sum of the product of the first evaluation parameter and the first weight and the product of the second evaluation parameter and the second weight, so as to calculate the estimated modification probability of the specified valid file; The specified valid files with estimated modification probability greater than a preset threshold are set as stable valid files, and a set of stable valid files with a total size close to a complete block in the target solid-state drive is copied into the same target free block.

2. The solid state drive data management method according to claim 1, characterized in that: The steps of setting a specified valid file with an estimated modification probability greater than a preset threshold as a stable valid file, and copying a stable valid file set with a total size close to a complete block in the target solid state drive into the same target free block include: The specified valid files with estimated modification probability greater than a preset threshold are set as stable valid files; Identify the required storage size of different stable and valid files in the target SSD; Select several stable and valid files whose total storage size is close to a complete block, combine these stable and valid files to form a stable and valid file set, and copy the stable and valid file set into the same target free block.

3. A solid state hard disk data management system, characterized in that: The system comprises: a designated valid file determination module, a first evaluation parameter calculation module, an estimated modification probability calculation module and a stable valid file set replication module, wherein: A designated valid file determination module is used to determine a target source block in a target solid state drive that contains both valid files and invalid files, and set the valid files in the target source block as designated valid files; A first evaluation parameter calculation module, used to identify a specified valid file, determine the number of times the specified valid file is read and modified within a first preset time period, and calculate a first evaluation parameter; The first evaluation parameter calculation module specifically includes: A log retrieval unit, used to identify a specified valid file and retrieve a historical usage log corresponding to the specified valid file; A log reading unit, used to determine the number of times the specified valid file is read and the number of times it is modified within a first preset time period according to the historical use log corresponding to the specified valid file; A first evaluation parameter calculation unit, configured to calculate a first evaluation parameter by dividing the number of modifications of a specified valid file within a first preset period by the number of reads; An estimated modification probability calculation module is used to identify the associated files of the specified valid file, and calculate the comprehensive update frequency of all associated files to obtain a second evaluation parameter, and calculate the estimated modification probability of the specified valid file according to the first evaluation parameter and the second evaluation parameter; The estimated modification probability calculation module specifically includes: An associated file identification unit, used to identify associated files in the target solid state drive that are associated with the specified valid file, and determine the number of updates of each associated file within a second preset time period; A second evaluation parameter acquisition unit, configured to divide the number of updates of each associated file by the length of the second preset period to obtain an update frequency, calculate an average of the update frequencies of all associated files to obtain a comprehensive update frequency, and set the value of the comprehensive update frequency as a second evaluation parameter; An estimated modification probability calculation unit, used to calculate an estimated modification probability of a specified valid file according to a first evaluation parameter and a second evaluation parameter; Assigning a first weight to a first evaluation parameter, and obtaining a product of the first evaluation parameter and the first weight; assigning a second weight to a second evaluation parameter, and obtaining a product of the second evaluation parameter and the second weight; Obtaining the sum of the product of the first evaluation parameter and the first weight and the product of the second evaluation parameter and the second weight, so as to calculate the estimated modification probability of the specified valid file; The stable and valid file set copy module is used to set the specified valid files with an estimated modification probability greater than a preset threshold as stable and valid files, and copy the stable and valid file set with a total size close to a complete block in the target solid-state hard disk into the same target free block.

4. The solid state drive data management system according to claim 3, characterized in that: The stable and effective file set replication module specifically includes: A stable and valid file determination unit, used to set a designated valid file with an estimated modification probability greater than a preset threshold as a stable and valid file; A stable and effective file identification unit, used for identifying the required storage size of different stable and effective files in the target solid state drive; The stable and valid file set copying unit is used to select a number of stable and valid files whose total storage size is close to a complete block, combine these stable and valid files to form a stable and valid file set, and copy the stable and valid file set into the same target free block.