Solid state disk data storage method, device and equipment and storage medium
By dynamically adjusting the ratio of TLC and SLC areas in the solid-state drive according to the flash memory block life value and data access frequency, automatic tiered storage is achieved, which solves the problems of limited erase and write times and internal write amplification of TLC flash memory, and improves the service life and storage efficiency of the hard drive.
Patent Information
- Application Number
- CN202510795473.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-09-16
AI Technical Summary
In the existing technology, solid-state drives have a high unit storage price and limited erase and write times due to the physical characteristics of TLC flash memory when storing data. In addition, traditional SLC and TLC hybrid hard drive solutions cause internal write amplification, which reduces the service life of the hard drive.
By obtaining the life value of each flash memory block in the solid-state drive, dynamically dividing the TLC area and SLC area, adjusting the partition ratio according to data access frequency and space utilization, migrating hot data to the SLC area and cold data to the TLC area, automatic tiered storage is achieved.
It optimizes the storage resource utilization and performance of the solid-state drive, extends the service life of the drive, and avoids unnecessary internal write amplification.
Smart Images

Figure CN120653202A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of hard disk management, and in particular to a solid-state hard disk data storage method, device, equipment and storage medium. Background Art
[0002] An SSD (Solid State Disk) is a hard drive built using an array of NAND FLASH (semiconductor flash memory) chips as its storage medium. It offers numerous advantages, including high performance, low power consumption, and excellent shock resistance. SSDs are often used as high-speed storage media in applications requiring high performance and frequently accessed data (hot data). However, the physical characteristics of SSD flash memory result in a high unit storage price and a limited number of Program / Erase Count (PE) cycles.
[0003] NAND FLASH chips are categorized by the amount of data stored per cell: SLC (Single Level Cell), MLC (Multi-Level Cell, 2 bits / cell), TLC (Trinary Level Cell), and QLC (Quad-Level Cell). In terms of read / write performance and lifespan, SLC > MLC > TLC > QLC. However, in terms of cost per unit storage capacity, SLC is the most expensive, followed by MLC, while TLC and QLC are relatively inexpensive. Currently, TLC is the mainstream choice for consumer SSDs, offering a competitive price. The three bits of data stored in a TLC flash cell are called the LSB (Least Significant Bit), CSB (Central Significant Bit), and MSB (Most Significant Bit). These three bits of data, stored together, actually belong to three different physical flash pages: the LSB page, CSB page, and MSB page. To achieve higher read / write performance at the same cost, the TLC LSB page write mode can be used, achieving write speeds comparable to SLC flash memory. In traditional SLC and TLC hybrid hard drive solutions, when processing user write requests, all user data is written to the SLC cache. This operation consumes a large amount of backend bandwidth, causes unnecessary internal write amplification, and significantly reduces the service life of the hard drive.
[0004] It can be seen that how to more reasonably store data in a solid-state hard disk to extend the service life of the hard disk is a problem that those skilled in the art need to solve. Summary of the Invention
[0005] The purpose of the embodiments of the present invention is to provide a solid-state hard drive data storage method, apparatus, device, and storage medium that can rationally allocate hard drive data storage space and implement automatic tiered storage during the allocation of flash memory blocks during data writing, thereby extending the hard drive's service life. The specific solution is as follows:
[0006] In a first aspect, the present application discloses a solid-state hard drive data storage method, comprising:
[0007] Obtaining a lifespan value corresponding to each flash memory block in the target solid-state drive, and dividing each flash memory block into a reserve TLC area and a reserve SLC area based on the lifespan value;
[0008] Determine a target partition ratio of the TLC area and the SLC area based on the current space utilization rate of the target solid-state drive, the current data ratio of hot data to cold data, and the access ratio of the number of cold data write accesses to the total number of write accesses, and determine the current TLC area and the current SLC area from the prepared TLC area and the prepared SLC area respectively based on the target partition ratio;
[0009] Based on the data access frequencies corresponding to the first current storage data in the current TLC area and the second current storage data in the current SLC area, the hot data in the first current storage data is migrated and stored to the current SLC area, and the cold data in the second current storage data is migrated and stored to the current TLC area.
[0010] Optionally, obtaining a lifespan value corresponding to each flash memory block in the target solid-state drive and dividing each flash memory block into a reserve TLC area and a reserve SLC area based on the lifespan value includes:
[0011] Obtaining lifespan-related calculation values corresponding to each flash memory block in the target solid-state drive; lifespan-related calculation values include the number of erases, the number of errors, and SSD parameter indicator information;
[0012] Use a preset regression model or deep learning model to process the life-related calculated values to obtain an initial life-span prediction value;
[0013] Normalizing the initial life prediction value to a preset value range to obtain the life value corresponding to each flash memory block;
[0014] Setting a first warning threshold and a second warning threshold; the first warning threshold is smaller than the second warning threshold;
[0015] The flash memory blocks whose corresponding lifespan values are less than a first warning threshold are divided into a reserve SLC area;
[0016] The flash memory blocks whose corresponding lifespan values are greater than the first warning threshold and less than the second warning threshold in each flash memory block are divided into a reserve TLC area.
[0017] Optionally, determining a target partition ratio of the TLC area to the SLC area based on the current space utilization of the target solid-state drive, the current ratio of hot data to cold data, and the ratio of cold data write access times to total write access times includes:
[0018] Determining a current space utilization rate of the target solid-state drive based on a current valid data volume of the target solid-state drive and a physical storage capacity of the solid-state drive;
[0019] Determine the LSB page of the TLC area as the SLC area to obtain the adjusted solid-state hard disk physical storage capacity of the target solid-state hard disk;
[0020] Obtaining a first data volume of current hot data and a second data volume of current cold data of a target solid-state drive;
[0021] Determine the data ratio of current hot data and cold data of the target solid-state drive based on the first data volume and the second data volume;
[0022] Determine a first space utilization ratio of the TLC area and a second space utilization ratio of the SLC area according to the adjusted physical storage capacity of the solid-state hard disk and the current data ratio of hot data to cold data;
[0023] Determining a numerical range corresponding to the partition ratio of the TLC area and the SLC area based on a preset value range of the current space utilization, the first space utilization, and the second space utilization;
[0024] The target partition ratio of the TLC area and the SLC area is determined based on the access ratio of the cold data write access count to the total write access count of the target solid state drive, the current space utilization rate, and the value range.
[0025] Optionally, determining the current TLC area and the current SLC area from the prepared TLC area and the prepared SLC area respectively based on the target partition ratio includes:
[0026] Determine the number of first flash memory blocks corresponding to the current TLC area and the number of second flash memory blocks corresponding to the current SLC area based on the target partition ratio;
[0027] Selecting a first number of flash memory blocks from the prepared TLC area to form a current TLC area;
[0028] A second number of flash memory blocks is selected from the prepared SLC area to form the current SLC area.
[0029] Optionally, selecting a first number of flash memory blocks from the prepared TLC area to form the current TLC area includes:
[0030] If the first number of flash memory blocks is greater than the current number of flash memory blocks of all flash memory blocks in the reserve TLC area, determining a preset borrowing number based on a difference between the first number of flash memory blocks and the current number of flash memory blocks;
[0031] Selecting a preset number of target flash memory blocks to be borrowed from the reserve SLC area; the lifespan value of the target flash memory blocks is greater than the lifespan values of other flash memory blocks in the reserve SLC area;
[0032] The current TLC area is determined based on all flash memory blocks in the prepared TLC area and the target flash memory block.
[0033] Optionally, based on data access frequencies corresponding to first current storage data in the current TLC area and second current storage data in the current SLC area, migrating hot data in the first current storage data to the current SLC area, and migrating cold data in the second current storage data to the current TLC area, includes:
[0034] Determine data write frequencies corresponding to first current storage data in the current TLC area and second current storage data in the current SLC area respectively;
[0035] Determining hot data from the first currently stored data and determining cold data from the second currently stored data based on a data write frequency; the data write frequency of the hot data is greater than or equal to a preset data access threshold; and the data write frequency of the cold data is less than the preset data access threshold;
[0036] Determining whether a first free storage space in the current TLC area is greater than a first required storage space for cold data;
[0037] If the first free storage space is larger than the first free storage space, the cold data is migrated and stored in the current TLC area;
[0038] determining whether a second free storage space in the current SLC area is greater than a second required storage space for hot data;
[0039] If the second free storage space is larger than the second free storage space, the hot data is migrated and stored in the current TLC area.
[0040] Optionally, the method further includes:
[0041] Initialize and start the target solid-state drive to obtain the initial access data sent by the user end;
[0042] Storing the mapping table entries in the initial access data in a preset SLC area, and storing the user data in the initial access data in a preset TLC area;
[0043] Determine whether the operating time of the target solid-state drive reaches a preset detection period;
[0044] If the running time reaches the preset detection period, the process jumps to the step of obtaining the life value corresponding to each flash memory block in the target solid state drive, and dividing each flash memory block into a reserve TLC area and a reserve SLC area based on the life value.
[0045] In a second aspect, the present application discloses a solid-state hard disk data storage device, comprising:
[0046] A flash memory block partitioning module is used to obtain the life value corresponding to each flash memory block in the target solid-state drive, and divide each flash memory block into a reserve TLC area and a reserve SLC area based on the life value;
[0047] a hard disk partitioning module for determining a target partition ratio of the TLC area and the SLC area based on the current space utilization of the target solid-state hard disk, the current data ratio of hot data to cold data, and the access ratio of the number of cold data write accesses to the total number of write accesses, and determining the current TLC area and the current SLC area from the prepared TLC area and the prepared SLC area respectively based on the target partition ratio;
[0048] A data migration storage module is used to migrate and store hot data in the first current storage data to the current SLC area, and to migrate and store cold data in the second current storage data to the current TLC area based on the data access frequencies corresponding to the first current storage data in the current TLC area and the second current storage data in the current SLC area.
[0049] In a third aspect, the present application discloses an electronic device, comprising:
[0050] Memory, used to store computer programs;
[0051] The processor is used to execute a computer program to implement the aforementioned solid state hard disk data storage method.
[0052] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, which implements the aforementioned solid-state hard disk data storage method when executed by a processor.
[0053] It can be seen that in the present invention, the life value corresponding to each flash memory block in the target solid-state hard disk is obtained, and each flash memory block is divided into a preliminary TLC area and a preliminary SLC area based on the life value; the target partition ratio of the TLC area and the SLC area is determined based on the current space utilization of the target solid-state hard disk, the data ratio of current hot data to cold data, and the access ratio of the number of cold data write accesses to the total number of write accesses, and the current TLC area and the current SLC area are determined from the preliminary TLC area and the preliminary SLC area respectively based on the target partition ratio; based on the data access frequencies corresponding to the first current storage data of the current TLC area and the second current storage data of the current SLC area, the hot data in the first current storage data is migrated and stored to the current SLC area, and the cold data in the second current storage data is migrated and stored to the current TLC area.
[0054] It can be seen from the above technical solution that the present invention combines the life value corresponding to each flash memory block in the solid-state drive and the ratio of the hard disk usage space to adaptively adjust the TLC and SLC ratio, thereby realizing automatic tiered storage in the process of allocating flash memory blocks to write data. By writing part of the TLC only to the LSB page, it switches to the SLC working mode, stores frequently accessed "hot data" in the higher-performance simulated SLC area, and stores infrequently accessed "cold data" in the TLC area, thereby optimizing the utilization and performance of the solid-state drive storage resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the embodiments of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0056] Figure 1 This is a flow chart of a solid state hard disk data storage method disclosed in the present invention;
[0057] Figure 2 This is a flow chart of a specific solid-state hard disk data storage method disclosed in the present invention;
[0058] Figure 3 This is a structural schematic diagram of a solid-state hard disk data storage device disclosed in the present invention;
[0059] Figure 4 This is a structural diagram of an electronic device disclosed in the present invention. DETAILED DESCRIPTION
[0060] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0061] The terms "including" and "having," as used in the present description and accompanying drawings, and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements and may include steps or elements that are not listed.
[0062] In order to enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0063] The traditional SLC and TLC hybrid hard drive solution writes all user data into the SLC cache when processing user write requests. SLC has better read and write performance and a longer lifespan than TLC, so it can be used as a cache; however, when the SLC cache is full, the valid data in the SLC needs to be migrated in batches to the TLC, which takes up a large amount of backend bandwidth. In addition, this solution will cause all write data to be written at least twice. If there is a large amount of data in the SLC that needs to be frequently modified, the data exchange between the SLC and TLC will be more frequent. This behavior will cause unnecessary internal write amplification, greatly reducing the service life of the hard drive. Therefore, the present invention will specifically introduce a solid-state hard drive data storage method that can solve the defects of the above-mentioned technology.
[0064] See also Figure 1 As shown, the embodiment of the present application discloses a solid state hard disk data storage method, including:
[0065] Step S11: obtaining the life value corresponding to each flash memory block in the target solid state drive, and dividing each flash memory block into a reserve TLC area and a reserve SLC area based on the life value.
[0066] In this embodiment, first, when the solid-state drive is first started or initialized, the target solid-state drive is initialized and started to obtain the initial access data sent by the user terminal; the mapping table entries in the initial access data are stored in the preset SLC area, and the user data in the initial access data is stored in the preset TLC area; it is determined whether the operating time of the target solid-state drive has reached the preset detection period; if the operating time has reached the preset detection period, the process jumps to the step of obtaining the life value corresponding to each flash memory block in the target solid-state drive, and based on the life value, each flash memory block is divided into a preliminary TLC area and a preliminary SLC area. Specifically, when the solid-state drive is first started or initialized, a default ratio of TLC area to SLC area is set, for example, it can be set to 7:3 (TLC:SLC). When the initial write request has no access frequency, the user data is stored in the TLC partition and the mapping table entries are stored in the SLC partition. Then, the solid-state drive begins to operate normally, and after a certain period of time, the storage device can start detecting the hard drive.
[0067] In this embodiment, a life value corresponding to each flash memory block in a target solid-state hard disk is obtained, and each flash memory block is divided into a preliminary TLC area and a preliminary SLC area based on the life value, including: obtaining a life-related calculated value corresponding to each flash memory block in the target solid-state hard disk; the life-related calculated value includes the number of erase times, the number of errors, and SSD parameter index information; using a preset regression model or a deep learning model to process the life-related calculated value to obtain an initial life prediction value; normalizing the initial life prediction value to a preset value range to obtain a life value corresponding to each flash memory block; setting a first warning threshold and a second warning threshold; the first warning threshold is less than the second warning threshold; dividing the flash memory blocks whose corresponding life values are less than the first warning threshold into the preliminary SLC area; dividing the flash memory blocks whose corresponding life values are greater than the first warning threshold and not greater than the second warning threshold into the preliminary TLC area.
[0068] It's important to note that during SSD use, each erase operation causes wear on the flash memory. As the number of erases increases, its lifespan decreases. Therefore, PE can be used to measure the lifespan of flash memory blocks. SSDs are manufactured with a predetermined total number of erases. When the number of erases approaches this predetermined total, SSD performance degrades, making it more susceptible to failure.
[0069] Specifically, relevant lifespan information includes, but is not limited to, the number of erase cycles, the number of errors, and SSD parameter indicators. This information, combined with a regression model or deep learning method, can be used to predict the expected lifespan of a flash memory block. The result is then normalized within a preset range (0-100). A higher lifespan value (Lsc) indicates a higher likelihood of failure. Furthermore, SSDs with a long remaining useful lifespan have a lower lifespan value, while SSDs nearing the end of their lifespan have a higher lifespan value. A first warning threshold, thr1, and a second warning threshold, thr2, are pre-set, where thr2 is greater than thr1. Flash memory blocks with an Lsc less than thr1 are designated as spare SLC areas, while flash memory blocks with an Lsc greater than or equal to thr1 and less than thr2 are designated as spare TLC areas. Flash memory blocks with a lifespan value greater than thr2 indicate that their erase and write cycles have reached or exceeded the manufacturer's preset value, necessitating replacement of the SSD.
[0070] Step S12: Determine the target partition ratio of the TLC area and the SLC area based on the current space utilization of the target solid-state hard disk, the current data ratio of hot data to cold data, and the access ratio of the number of cold data write accesses to the total number of write accesses, and determine the current TLC area and the current SLC area from the prepared TLC area and the prepared SLC area respectively based on the target partition ratio.
[0071] In this embodiment, a target partition ratio of the TLC area and the SLC area is determined based on a current space utilization rate of a target solid-state drive, a current data ratio of hot data to cold data, and an access ratio of cold data write access times to total write access times. The method includes: determining the current space utilization rate of the target solid-state drive based on a current valid data volume of the target solid-state drive and a physical storage capacity of the solid-state drive; determining an LSB page of the TLC area as an SLC area to obtain an adjusted physical storage capacity of the solid-state drive; obtaining a first data volume of current hot data and a second data volume of current cold data of the target solid-state drive; determining a data ratio of current hot data to cold data of the target solid-state drive based on the first data volume and the second data volume; determining a first space utilization rate of the TLC area and a second space utilization rate of the SLC area based on the adjusted physical storage capacity of the solid-state drive and the current data ratio of hot data to cold data; determining a numerical range corresponding to the partition ratio of the TLC area and the SLC area based on a preset value range of the current space utilization rate, the first space utilization rate, and the second space utilization rate; and determining a target partition ratio of the TLC area and the SLC area based on the access ratio of cold data write access times to total write access times of the target solid-state drive, the current space utilization rate, and the numerical range.
[0072] Specifically, in order to avoid storage resource waste or performance bottlenecks caused by fixed ratio allocation, this embodiment provides a method for adjusting the ratio of TLC partitions to SLC partitions based on the amount of hot and cold data. This embodiment sets the physical storage capacity of the solid-state drive to , the current amount of valid data is N, and the proportion of hot data is , the proportion of cold data is , then the effective thermal data volume is , the effective cold data volume is , the ratio of TLC partition to SLC partition is , that is, the initial physical capacity of the TLC partition is , the physical capacity of the SLC partition is .
[0073] Among them, the solid state drive space utilization is the ratio of the used storage space to the total storage space of the SSD. for:
[0074] .
[0075] Since the present invention uses TLC flash memory as the underlying storage medium, and SLC partition is achieved by using only its LSB page, the capacity of the flash memory block of a unit SLC partition is only 1 / 3 of the capacity of the flash memory block of a TLC partition. The adjusted physical storage capacity of the solid-state hard disk is for:
[0076] ;
[0077] Can calculate the space utilization of the current SLC partition and TLC partition and They are:
[0078] ;
[0079] .
[0080] Since the range of space utilization is [0,1], based on space utilization and , you can get the TLC partition ratio The adjustable range is:
[0081] ;
[0082] SSD space utilization has a great impact on read and write performance and service life. High space utilization means more frequent data writing and erasing operations, especially when there is not much remaining space. Repeated writing of data will lead to an aggravated write amplification effect and accelerate the consumption of PE times of flash memory chips, thus shortening the overall service life of the SSD to a certain extent. It is best to keep it at 70%~80%.
[0083] The TLC partition is used to store cold data. Assume that the ratio of cold write data to the total write access times is , then the TLC partition ratio It can be expressed as:
[0084] ;
[0085] Achieve the ratio of cold data to be written When it increases, Synchronously increase, divide more flash memory blocks into TLC partitions. When the number of hot write data increases, By adjusting the ratio of TLC partition to SLC partition, more flash blocks can be divided into SLC mode. Keep the space utilization of each partition within a reasonable range as much as possible.
[0086] It should be noted that the present application sets a threshold value Tr. If the data access frequency is greater than the threshold value Tr, the data is determined to be hot data and written to the SLC partition, otherwise it is cold data and stored in the TLC partition. Moreover, at this time, the determination of hot data is mainly based on write-hot, including the read-hot-write-hot type where the data read times exceed the read threshold and the write times exceed the write threshold, and the read-cold-write-hot type where the data read times are lower than the read threshold and the write times exceed the write threshold; the determination of cold data is mainly based on write-cold, including the read-hot-write-cold type where the data read times exceed the read threshold and the write times are lower than the write threshold, and the read-cold-write-cold type where the data read times are lower than the read threshold and the write times are lower than the write threshold. Here, a counter can be added to the target solid-state drive to automatically record the number of data accesses. When the data access times exceed the threshold value Tr, the data can be marked accordingly. The data can be marked according to the above four situations. In this way, when determining hot and cold data, the data situation can be directly determined based on the corresponding mark of the data, thereby further improving the efficiency of subsequent data migration.
[0087] In this embodiment, the current TLC area and the current SLC area are determined from the reserve TLC area and the reserve SLC area respectively based on the target partition ratio, including: determining a first number of flash memory blocks corresponding to the current TLC area and a second number of flash memory blocks corresponding to the current SLC area based on the target partition ratio; selecting flash memory blocks of the first number of flash memory blocks from the reserve TLC area to form the current TLC area; and selecting flash memory blocks of the second number of flash memory blocks from the reserve SLC area to form the current SLC area. Specifically, the first number of flash memory blocks is selected from the reserve TLC area to form the current TLC area, including: if the first number of flash memory blocks is greater than the current number of flash memory blocks of all flash memory blocks in the reserve TLC area, determining a preset borrowing number based on the difference between the first number of flash memory blocks and the current number of flash memory blocks; selecting a preset number of target flash memory blocks from the reserve SLC area; the lifespan value of the target flash memory blocks is greater than the lifespan values of other flash memory blocks in the reserve SLC area; and determining the current TLC area based on all flash memory blocks in the reserve TLC area and the target flash memory blocks.
[0088] That is, Figure 2 As shown, determine the ratio of TLC area to SLC area Then, from the SLC reserve area, press the total flash memory block The ratio is determined as SLC partition. If the SLC reserve area flash memory blocks are insufficient, the flash memory blocks with smaller life value are selected from the TLC partition and divided into SLC partition; the flash memory blocks from the TLC reserve area are divided into SLC partition according to the total flash memory blocks. The ratio is determined as TLC partition. If the TLC reserve area flash memory blocks are insufficient, flash memory blocks with high life values are selected from the SLC partition and divided into the TLC partition.
[0089] Furthermore, it's important to note that the lifespan of an SLC partition storing hot data increases after a period of use and wear. When the lifespan becomes greater than thr1 and less than thr2, the SLC partition is converted to a TLC partition during the next storage area rezoning. Because the data originally stored was hot data, the system checks whether the free space in other SLC partitions is sufficient to store the hot data before the conversion. If so, the hot data is migrated to the other SLC partition. Otherwise, the hot data is temporarily held until the free space in the other SLC partitions is sufficient to store the hot data. The same principle applies to the conversion of TLC partitions to SLC partitions, allowing frequently accessed hot data to be stored in the higher-performance SLC partitions and less frequently accessed cold data to be stored in the TLC partitions. For flash blocks with a lifespan greater than or equal to thr2, data from the secondary SSD is preemptively migrated to other TLC partitions to prevent data loss. If the free space in the TLC partition is insufficient, an alarm can be issued, prompting the user to replace the SSD or manually migrate the data.
[0090] Step S13: Based on the data access frequencies corresponding to the first current storage data in the current TLC area and the second current storage data in the current SLC area, the hot data in the first current storage data is migrated and stored to the current SLC area, and the cold data in the second current storage data is migrated and stored to the current TLC area.
[0091] In this embodiment, based on the data access frequencies corresponding to the first current storage data in the current TLC area and the second current storage data in the current SLC area, hot data in the first current storage data is migrated and stored to the current SLC area, and cold data in the second current storage data is migrated and stored to the current TLC area, including: determining the data write frequencies corresponding to the first current storage data in the current TLC area and the second current storage data in the current SLC area; determining the hot data from the first current storage data according to the data write frequencies, and determining the cold data from the second current storage data; the data write frequency of the hot data is greater than or equal to a preset data access threshold; the data write frequency of the cold data is less than the preset data access threshold; judging whether the first free storage space of the current TLC area is greater than the first required storage space of the cold data; if the first free storage space is greater than the first free storage space, migrating the cold data to the current TLC area; judging whether the second free storage space of the current SLC area is greater than the second required storage space of the hot data; if the second free storage space is greater than the second free storage space, migrating the hot data to the current TLC area. Specifically, the system first checks whether the data type stored on the TLC partition is still a cold data type. If not, then when the remaining space in the SLC partition is greater than the storage space required for the data to be processed, the data is stored in the SLC partition and the mapping table is modified. If the remaining space in the SLC partition is insufficient, the data is temporarily retained in the original storage location. The system then checks whether the data type stored on the SLC partition is a hot data type. If not, then when the remaining space in the TLC partition is greater than the storage space required for the data to be processed, the data is stored in the TLC partition and the mapping table is modified. If the remaining space in the TLC partition is insufficient, the data is temporarily retained in the original storage location.
[0092] It can be seen that in this embodiment, the life value corresponding to each flash memory block in the target solid-state hard disk is obtained, and each flash memory block is divided into a preliminary TLC area and a preliminary SLC area based on the life value; the target partition ratio of the TLC area and the SLC area is determined based on the current space utilization of the target solid-state hard disk, the data ratio of current hot data to cold data, and the access ratio of cold data write access times to total write access times, and the current TLC area and the current SLC area are determined from the preliminary TLC area and the preliminary SLC area respectively based on the target partition ratio; based on the data access frequencies corresponding to the first current storage data of the current TLC area and the second current storage data of the current SLC area, the hot data in the first current storage data is migrated and stored to the current SLC area, and the cold data in the second current storage data is migrated and stored to the current TLC area.
[0093] It can be seen from the above technical solution that the present invention periodically obtains the relevant life information of the SSD in the storage system to calculate the life value, and dynamically divides the storage reserve area with different characteristics according to the set warning threshold. Then, the partition is determined in combination with the TLC partition ratio. After the partition is updated, it is checked whether the current data type is consistent with the storage partition. Under the condition of sufficient space, the inconsistent data is migrated to realize automatic tiered storage of data. In other words, by combining the life value corresponding to each flash memory block in the solid-state hard disk and the ratio of hard disk usage space, a method of adaptively adjusting the TLC and SLC ratio is performed, and automatic tiered storage is realized in the process of allocating flash memory blocks to write data. By writing part of the TLC only to the LSB page, it switches to the SLC working mode, and stores frequently accessed "hot data" in the higher-performance simulated SLC area, while storing infrequently accessed "cold data" in the TLC area, thereby optimizing the utilization and performance of the solid-state hard disk storage resources.
[0094] refer to Figure 3 , the embodiment of the present application also correspondingly discloses a solid state hard disk data storage device, comprising:
[0095] The flash memory block division module 11 is used to obtain the life value corresponding to each flash memory block in the target solid state drive, and divide each flash memory block into a reserve TLC area and a reserve SLC area based on the life value;
[0096] a hard disk partitioning module 12 for determining a target partition ratio of the TLC area to the SLC area based on the current space utilization of the target solid-state hard disk, the current data ratio of hot data to cold data, and the access ratio of the number of cold data write accesses to the total number of write accesses, and determining the current TLC area and the current SLC area from the prepared TLC area and the prepared SLC area, respectively, based on the target partition ratio;
[0097] The data migration storage module 13 is used to migrate and store the hot data in the first current storage data to the current SLC area, and to migrate and store the cold data in the second current storage data to the current TLC area based on the data access frequencies corresponding to the first current storage data in the current TLC area and the second current storage data in the current SLC area.
[0098] It can be seen that in this embodiment, by combining the life value corresponding to each flash memory block in the solid-state drive and the proportion of hard disk usage space, a method of adaptively adjusting the TLC and SLC ratio is performed, and automatic tiered storage is achieved in the process of allocating flash memory blocks to write data. By writing part of the TLC only to the LSB page, the SLC working mode is switched to the SLC working mode, and frequently accessed "hot data" is stored in the higher-performance simulated SLC area, while infrequently accessed "cold data" is stored in the TLC area, thereby optimizing the utilization and performance of the solid-state drive storage resources.
[0099] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 4 This is a structural diagram of an electronic device according to an exemplary embodiment. The content in the diagram should not be considered as any limitation on the scope of use of this application. The electronic device may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the solid-state hard disk data storage method disclosed in any of the aforementioned embodiments. In addition, the electronic device in this embodiment may specifically be an electronic computer.
[0100] In this embodiment, the power supply 23 is used to provide operating voltage for various hardware devices on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and external devices. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0101] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0102] The operating system 221 is used to manage and control the hardware devices on the electronic device and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of implementing the solid-state hard disk data storage method performed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 may further include a computer program capable of implementing other specific tasks.
[0103] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when executed by a processor, the computer program implements the aforementioned solid-state hard drive data storage method. The specific steps of this method can be referred to the corresponding contents disclosed in the aforementioned embodiments and will not be repeated here.
[0104] Furthermore, this application also discloses a computer program product, including a computer program / instructions; wherein, when executed by a processor, the computer program / instructions implement the aforementioned disclosed alarm aggregation method. The specific steps of this method can be referred to the corresponding contents disclosed in the aforementioned embodiments and will not be repeated here.
[0105] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0106] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0107] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0108] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0109] The above is a detailed introduction to the technical solution provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A solid state hard disk data storage method, characterized in that: include: Obtaining a lifespan value corresponding to each flash memory block in the target solid-state drive, and dividing each flash memory block into a reserve TLC area and a reserve SLC area based on the lifespan value; determining a target partition ratio of the TLC area and the SLC area based on a current space utilization rate of the target solid-state drive, a current data ratio of hot data to cold data, and an access ratio of cold data write access times to total write access times, and determining a current TLC area and a current SLC area from the prepared TLC area and the prepared SLC area, respectively, based on the target partition ratio; Based on the data access frequencies corresponding to the first current storage data of the current TLC area and the second current storage data of the current SLC area, the hot data in the first current storage data is migrated and stored to the current SLC area, and the cold data in the second current storage data is migrated and stored to the current TLC area.
2. The solid state hard disk data storage method according to claim 1, characterized in that: The obtaining of a lifespan value corresponding to each flash memory block in the target solid state drive and dividing each flash memory block into a reserve TLC area and a reserve SLC area based on the lifespan value includes: Obtaining lifespan-related calculation values corresponding to each flash memory block in the target solid-state drive; the lifespan-related calculation values include the number of erases, the number of errors, and SSD parameter indicator information; Processing the life-related calculated values using a preset regression model or a deep learning model to obtain an initial life-prediction value; Normalizing the initial life prediction value to a preset value range to obtain a life value corresponding to each flash memory block; Setting a first warning threshold and a second warning threshold; the first warning threshold is smaller than the second warning threshold; Classifying the flash memory blocks whose corresponding lifespan values are less than the first warning threshold value into a reserve SLC area; The flash memory blocks whose corresponding lifespan values are greater than the first warning threshold and less than the second warning threshold are divided into a reserve TLC area.
3. The solid state hard disk data storage method according to claim 1, wherein: The determining of the target partition ratio of the TLC area and the SLC area based on the current space utilization rate of the target solid-state hard disk, the current data ratio of hot data to cold data, and the access ratio of the number of cold data write accesses to the total number of write accesses includes: Determining a current space utilization rate of the target solid-state drive based on a current valid data volume of the target solid-state drive and a physical storage capacity of the solid-state drive; Determining the LSB page of the TLC area as the SLC area to obtain the adjusted solid-state hard disk physical storage capacity of the target solid-state hard disk; Obtaining a first data volume of current hot data and a second data volume of current cold data of the target solid state drive; Determine the data ratio of current hot data and cold data of the target solid-state drive based on the first data volume and the second data volume; Determining a first space utilization ratio of the TLC area and a second space utilization ratio of the SLC area according to the adjusted physical storage capacity of the solid-state hard disk and the data ratio of the current hot data to the cold data; Determining a numerical range corresponding to the partition ratio of the TLC area to the SLC area based on a preset value range of the current space utilization, the first space utilization, and the second space utilization; A target partition ratio of the TLC area and the SLC area is determined based on an access ratio of cold data write access times to a total write access time of the target solid state drive, the current space utilization rate, and the numerical range.
4. The solid state hard disk data storage method according to claim 1, wherein: The determining the current TLC area and the current SLC area from the prepared TLC area and the prepared SLC area respectively based on the target partition ratio includes: Determine, based on the target partition ratio, the number of first flash memory blocks corresponding to the current TLC area and the number of second flash memory blocks corresponding to the current SLC area; Selecting the first number of flash memory blocks from the prepared TLC area to form a current TLC area; The second number of flash memory blocks is selected from the prepared SLC area to form a current SLC area.
5. The solid state hard disk data storage method according to claim 4, characterized in that: The step of selecting the first number of flash memory blocks from the prepared TLC area to form a current TLC area includes: If the first number of flash memory blocks is greater than the current number of flash memory blocks of all flash memory blocks in the reserve TLC area, determining a preset borrowing number based on a difference between the first number of flash memory blocks and the current number of flash memory blocks; Selecting the preset borrowed number of target flash memory blocks from the prepared SLC area; the lifespan value of the target flash memory blocks is greater than the lifespan values of other flash memory blocks in the prepared SLC area; The current TLC area is determined according to all flash memory blocks in the prepared TLC area and the target flash memory block.
6. The solid state hard disk data storage method according to claim 1, characterized in that: The step of migrating and storing hot data in the first current storage data to the current SLC area and migrating and storing cold data in the second current storage data to the current TLC area based on data access frequencies corresponding to first current storage data in the current TLC area and second current storage data in the current SLC area, respectively, includes: Determining data write frequencies corresponding to first current stored data in the current TLC area and second current stored data in the current SLC area respectively; determining hot data from the first currently stored data according to the data write frequency, and determining cold data from the second currently stored data; the data write frequency of the hot data is greater than or equal to a preset data access threshold; and the data write frequency of the cold data is less than the preset data access threshold; determining whether a first free storage space of the current TLC area is greater than a first required storage space of the cold data; If the first free storage space is larger than the first free storage space, migrating the cold data to the current TLC area; determining whether a second free storage space of the current SLC area is greater than a second required storage space of the hot data; If the second free storage space is larger than the second free storage space, the hot data is migrated and stored in the current TLC area.
7. The solid state hard disk data storage method according to any one of claims 1 to 6, characterized in that: Also includes: Initializing and starting the target solid-state drive to obtain initial access data sent by the user terminal; Storing the mapping table entries in the initial access data in a preset SLC area, and storing the user data in the initial access data in a preset TLC area; Determine whether the operating time of the target solid-state drive reaches a preset detection period; If the operating time reaches the preset detection period, jump to the step of obtaining the life value corresponding to each flash memory block in the target solid state drive, and divide the each flash memory block into a preliminary TLC area and a preliminary SLC area based on the life value.
8. A solid state hard disk data storage device, characterized in that: include: a flash memory block division module, configured to obtain a lifespan value corresponding to each flash memory block in the target solid-state drive, and divide each flash memory block into a reserve TLC area and a reserve SLC area based on the lifespan value; a hard disk partitioning module, configured to determine a target partition ratio of the TLC area and the SLC area based on a current space utilization rate of the target solid-state hard disk, a current data ratio of hot data to cold data, and an access ratio of cold data write access times to total write access times, and to determine a current TLC area and a current SLC area from the prepared TLC area and the prepared SLC area, respectively, based on the target partition ratio; A data migration storage module is used to migrate and store hot data in the first current storage data of the current TLC area to the current SLC area, and to migrate and store cold data in the second current storage data to the current TLC area based on the data access frequencies corresponding to the first current storage data of the current TLC area and the second current storage data of the current SLC area.
9. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the solid-state hard disk data storage method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the solid-state hard disk data storage method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Data distribution method and device, equipment, storage medium and product
CN120891983A
A data distribution method, apparatus, device, storage medium, and product
CN120891983B
File storage method and device and related equipment
CN121578954A