Data storage method, memory, medium and product

By statistically analyzing the number of times the mapping table in the flash memory storage medium is recycled and updated, cold data is identified and centrally stored, which solves the problem of shortened storage system lifespan in scenarios where hot and cold data are written together, and improves the durability and lifespan of the storage system.

CN121326256APending Publication Date: 2026-01-13CHENGDU BIWIN STORAGE TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511894018.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-16
Publication Date
2026-01-13

AI Technical Summary

Technical Problem

In flash storage systems, when cold and hot data are mixed and written, frequent movement of cold data can affect write amplification parameters, thereby affecting the lifespan of the storage system.

Method used

The number of times each target mapping table in the storage medium is recycled and updated is counted. Based on the number of recycling and update, target cold data is identified and stored centrally to reduce its participation in garbage collection.

Benefits of technology

By accurately identifying and centrally storing target cold data, the overall write amplification parameters of the storage medium are reduced, thereby improving the durability and lifespan of the storage system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121326256A_ABST
    Figure CN121326256A_ABST
Patent Text Reader

Abstract

The invention discloses a data storage method, a memory, a medium and a product, and relates to the technical field of storage, the data storage method comprises the following steps: counting the recovery and update times of each target mapping table in the storage medium, the recovery and update times being the times of updating the mapping table triggered by data relocation in the garbage recovery process; target cold data in the storage medium is determined according to the number of times of recycling and updating, and the probability that the data mapped by the target mapping table with the number of times of recycling and updating is higher as the target cold data is higher; and performing centralized storage on the target cold data. According to the embodiment, the target cold data can be further screened out from the dimension of updating of the mapping table triggered by garbage collection by considering the condition of passive data relocation, and the determined target cold data are stored in a concentrated manner, so that the participation degree of the target cold data in garbage collection is reduced, the overall write amplification parameter of a storage medium is reduced, and the efficiency of garbage collection is improved. The durability and the service life of the whole storage system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage technology, and in particular to a data storage method, memory, medium and product. Background Technology

[0002] Current flash storage systems often face the challenge of varying data update frequencies. Some data is updated very frequently, leading to frequent overwrites, while other data is stored long-term without updates. In this scenario of mixed hot and cold data writes, frequent movement of cold data can severely impact write amplification parameters, thereby affecting the lifespan of the storage system.

[0003] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0004] The main purpose of this application is to provide a data storage method, memory, medium and product, which aims to solve the technical problem that traditional storage methods of storage systems affect the lifespan of storage systems.

[0005] To achieve the above objectives, this application proposes a data storage method, which includes: The number of times each target mapping table in the storage medium is recycled and updated is counted, wherein the number of times the data migration during garbage collection triggers the updating of the mapping table; The target cold data in the storage medium is determined based on the number of recycling and update cycles, wherein the data mapped by the target mapping table with the more recycling and update cycles is more likely to be regarded as the target cold data. The target cold data is centrally stored.

[0006] In one embodiment, the step of determining the target cold data in the storage medium based on the number of recycling updates includes: For any target mapping table in each target mapping table, a weighted fusion is performed based on different index types of the number of recycling updates corresponding to the target mapping table to obtain the hot / cold coefficient of the data mapped by the target mapping table. The index types include at least two of the following: the historical number of recycling updates of a single mapping table, the real-time number of recycling updates of a single mapping table, and the overall number of recycling updates of the storage medium. Based on the hot / cold coefficient of the data mapped by each target mapping table, target cold data is filtered out from the storage medium, wherein the higher the hot / cold coefficient, the higher the probability that the data will be used as the target cold data.

[0007] In one embodiment, prior to the step of counting the number of times each target mapping table in the statistical storage medium is recycled and updated, the method includes: The reference update count for each mapping table in the storage medium is counted, wherein the reference update count includes the number of times the mapping table update is triggered by normal data updates; The target mapping table is divided from the mapping tables based on the reference update count of each mapping table. The mapping table with fewer reference update counts has a higher probability of being used as the target mapping table.

[0008] In one embodiment, the step of centrally storing the target cold data includes: Target space blocks are selected from the storage medium, wherein the space blocks with a higher number of erase / write cycles in the storage medium have a higher probability of being selected as the target space blocks; The target space block is selected for centralized storage of the target cold data.

[0009] In one embodiment, the data mapped by each target mapping table is cold data, and the cold data is stored in the cold data space of the storage medium; the method further includes: Based on the reference update count of each mapping table in the storage medium, the ratio coefficient of cold data and hot data in the storage medium is determined, wherein the reference update count of the mapping table corresponding to the hot data is greater than the reference update count of the mapping table corresponding to the cold data. The storage medium is divided into spaces based on the aforementioned scaling factor to obtain the cold data space.

[0010] In one embodiment, the storage medium further includes a hot data space, which is configured as a first storage mode and the cold data space is configured as a second storage mode, wherein the unit space erase / write lifetime of the first storage mode is greater than that of the unit space erase / write lifetime of the second storage mode. The step of dividing the storage medium into spaces based on the scaling factor to obtain the cold data space includes: Determine the ratio of the unit space storage volume between the first storage mode and the second storage mode; The cold data space is divided from the storage medium based on the size ratio, so that the actual storage ratio between the cold data space and the hot data space corresponds to the ratio coefficient.

[0011] In one embodiment, the types of indicators for the number of recycling updates include the historical number of recycling updates for a single mapping table, the real-time number of recycling updates for a single mapping table, and the overall number of recycling updates for the storage medium. The historical number of recycling updates is obtained by accumulating the real-time number of recycling updates, and the overall number of recycling updates for the storage medium is obtained by accumulating the historical number of recycling updates for different mapping tables.

[0012] In addition, to achieve the above objectives, this application also proposes a memory comprising a main control chip and a storage chip, wherein the storage chip stores a computer program, and the main control chip can execute the computer program to implement the steps of the data storage method described above.

[0013] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the data storage method described above.

[0014] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the data storage method described above.

[0015] One or more technical solutions proposed in this application have at least the following technical effects: In this embodiment, the number of times each target mapping table in the storage medium is updated during garbage collection is statistically analyzed. This number refers to the number of times data migration triggers mapping table updates during garbage collection. Compared to traditional solutions that directly reference all update counts of the mapping table, this embodiment considers the passive data migration situation by focusing on mapping table updates triggered by garbage collection, thus improving the comprehensiveness of data filtering dimensions. Furthermore, target cold data in the storage medium is determined based on the number of times the target mapping table is updated during garbage collection. Data mapped by a target mapping table with more updates during garbage collection has a higher probability of being identified as target cold data. This target cold data is then centrally stored. Because the passive data migration situation is considered, the selection of target cold data is more accurate, thus improving the accuracy of cold data identification. Centrally storing the identified target cold data reduces its participation in garbage collection, lowers the overall write amplification parameter of the storage medium, and improves the durability and lifespan of the entire storage system. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram of the first process of an embodiment of the data storage method of this application; Figure 2 This is a schematic diagram of the second process in an embodiment of the data storage method of this application; Figure 3 This is a schematic diagram of a scenario in the data storage method of this application; Figure 4 This is a schematic diagram of the third process in an embodiment of the data storage method of this application; Figure 5 This is a schematic diagram of the fourth process in an embodiment of the data storage method of this application; Figure 6 This is a schematic diagram of the memory structure involved in the data storage method in the embodiments of this application.

[0019] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0020] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0021] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0022] Current flash storage systems often face the challenge of varying data update frequencies. Some data is updated very frequently, leading to frequent overwrites, while other data is stored long-term without updates. In this scenario of mixed hot and cold data writes, frequent movement of cold data can severely impact write amplification parameters, thereby affecting the lifespan of the storage system.

[0023] The main solution of this application embodiment is: to count the number of times each target mapping table in the storage medium is recycled and updated, wherein the number of times the data migration during garbage collection triggers the updating of the mapping table; to determine the target cold data in the storage medium based on the number of times the target mapping table is recycled and updated more times, wherein the data mapped by the target mapping table with more recycling and updating times has a higher probability of being regarded as target cold data; and to centrally store the target cold data.

[0024] Compared to traditional solutions that directly reference all update counts of the mapping table, this application considers the passive data migration scenario by focusing on mapping table updates triggered by garbage collection. This allows for further filtering of target cold data, thereby improving the accuracy of cold data identification. The identified target cold data can be centrally stored, reducing its participation in garbage collection, lowering the overall write amplification parameters of the storage medium, and improving the durability and lifespan of the entire storage system.

[0025] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program execution functions, such as a memory, computer, mobile phone, etc., or an electronic device capable of realizing the above functions.

[0026] Reference Figure 1 , Figure 1 This illustration shows a first flowchart of a data storage method provided in an embodiment of this application. In this embodiment, the data storage method includes steps S10 to S30: Step S10: Count the number of times each target mapping table in the storage medium is recycled and updated, where the number of times the data migration during garbage collection triggers the updating of the mapping table; It should be noted that the above data storage method, in this embodiment, can be implemented through the main control chip or firmware module of the storage medium. Optionally, the storage medium can be a solid-state drive, flash memory card, embedded flash memory, or USB flash drive, etc. Different mapping tables are stored in the storage medium, and these mapping tables mainly record the association between logical addresses and physical addresses. When the association between logical addresses and physical addresses changes, it can be considered that the corresponding mapping table has been updated once. Normal data updates or garbage collection processes may trigger updates to the mapping tables. Each target mapping table in the storage medium can refer to all mapping tables stored in the storage medium, or it can refer to a portion of the mapping tables stored in the storage medium. In practical applications, it can be set according to requirements.

[0027] For example, in this embodiment, an independent update record can be set for each target mapping table. This update record is used to record the number of times the mapping table is updated due to data migration during garbage collection. The main goal of garbage collection is to reclaim the space occupied by invalid pages in the old block and merge the valid pages in the old block into the new block to free up space in the old block for subsequent writing. Merging valid pages from the old block into the new block involves data migration, and correspondingly, the mapping table corresponding to the valid page (i.e., valid data) will also be updated. For example, in flash memory storage media, the garbage collection algorithm selects invalid data blocks for erasure and migrates valid data to the new block. Each migration operation causes a mapping table update, and this update event is recorded. Assuming that mapping table A is updated 5 times in 10 garbage collections, its garbage collection update count is 5.

[0028] Step S20: Determine the target cold data in the storage medium based on the number of recycling updates, wherein the data mapped by the target mapping table with the more recycling updates is more likely to be used as target cold data; For example, in an embodiment, based on the statistical number of recycling updates for each target mapping table, a threshold comparison or sorting algorithm can be used to filter out target cold data in the storage medium. Target cold data indicates that the actual update frequency of such data is low. Optionally, a recycling update threshold can be preset (wherein the threshold can also be dynamically adjusted based on historical data). If the recycling update count of a target mapping table exceeds the threshold, the data mapped to it can be marked as target cold data. For example, if the recycling update count threshold is set to 20 times, and the recycling update count of target mapping table B is 25 times, then the data mapped to it (such as file blocks) is determined to be target cold data. Optionally, the target mapping tables can also be sorted in descending order by the recycling update count, and the data corresponding to the top N% of target mapping tables can be selected as cold data. For example, the data corresponding to the top 10% of target mapping tables with the highest recycling update count can be selected as cold data. That is, the data mapped by a target mapping table with more recycling update counts has a higher probability of being designated as target cold data.

[0029] It is understandable that the higher the number of garbage collection updates of a target mapping table, the more times the corresponding data is passively migrated. Therefore, optimization can be performed on such data to minimize the overall number of data migrations. Compared to the reference update count of the reference mapping table, this embodiment considers the passive data migration situation from the perspective of mapping table updates triggered by garbage collection. Therefore, it can further filter out target cold data, thereby improving the accuracy of cold data identification.

[0030] Step S30: Centrally store the target cold data.

[0031] For example, identified target cold data can be migrated to centralized storage. Optionally, the physical address corresponding to the target cold data can be copied to a pre-allocated data space, such as a data space using TLC (Triple-Level Cell) mode. The migration process can be performed asynchronously in the background to avoid impacting foreground I / O performance. After data migration, the relevant target mapping table is updated to reflect the new location. It is understood that centralized storage reduces the participation of target cold data in garbage collection, thereby optimizing data storage strategies, reducing the overall write amplification parameters of the storage medium, and improving the durability and lifespan of the entire storage system.

[0032] In this embodiment, the number of times each target mapping table in the storage medium is updated during garbage collection is statistically analyzed. The number of updates refers to the number of times data migration triggers a mapping table update during garbage collection. Target cold data in the storage medium is determined based on the number of updates, with data mapped by a target mapping table having a higher probability of being considered target cold data. This target cold data is then centrally stored. Compared to traditional solutions that directly reference all update counts of the mapping table, this embodiment considers the passive data migration situation by focusing on mapping table updates triggered by garbage collection. Therefore, it can further filter out target cold data, thereby improving the accuracy of cold data identification. The identified target cold data can be centrally stored, reducing its participation in garbage collection, lowering the overall write amplification parameter of the storage medium, and improving the durability and lifespan of the entire storage system.

[0033] Reference Figure 2 , Figure 2 This illustration shows a second flowchart of the data storage method provided in an embodiment of this application. Contents in this embodiment that are the same as or similar to those in the above embodiments can be referred to the above description and will not be repeated hereafter. The step of determining the target cold data in the storage medium based on the number of recycling and update cycles includes steps S21 to S22: Step S21: For any target mapping table in each target mapping table, perform weighted fusion based on different index types of the number of recycling updates corresponding to the target mapping table to obtain the hot and cold coefficient of the data mapped by the target mapping table. The index types include at least two of the following: the historical number of recycling updates of a single mapping table, the real-time number of recycling updates of a single mapping table, and the overall number of recycling updates of the storage medium. It should be noted that the types of metrics for the number of recycling updates can include various types, such as the historical recycling update count of a single mapping table, the real-time recycling update count of a single mapping table, and the overall recycling update count of the storage medium. In practical applications, any two or three of these can be selected for calculating the hot / cold coefficient. The historical recycling update count of a single mapping table refers to all the recycling update counts of a single mapping table throughout its history. The real-time recycling update count of a single mapping table refers to the update count of a single mapping table within a recent preset time period, such as the update count within the last hour or two hours. The overall recycling update count of the storage medium refers to the sum of the recycling update counts corresponding to each mapping table (or each target mapping table) in the storage medium. Furthermore, since the processing procedures for each target mapping table are basically similar, this embodiment will use one as an example for explanation.

[0034] For example, for any target mapping table among the target mapping tables, a weighted fusion calculation can be performed based on different indicator types of the number of recycling updates corresponding to that target mapping table. The result of the weighted fusion calculation is the "hot / cold coefficient" of the data mapped by that target mapping table. Optionally, the weighted calculation can be performed using two dimensions: the historical recycling update count and the real-time recycling update count of a single mapping table; or two dimensions: the historical recycling update count and the overall recycling update count of the storage medium; or two dimensions: the real-time recycling update count and the overall recycling update count of the storage medium; or three dimensions: the historical recycling update count, the real-time recycling update count, and the overall recycling update count of the storage medium. The more historical, real-time, and overall recycling update counts a target mapping table has, the higher its "hot / cold coefficient" is. The "hot / cold coefficient" is a comprehensive indicator, and a higher coefficient indicates that the data is "colder," meaning it is less frequently updated. Optionally, taking the selection of three indicator dimensions as an example, the formula for calculating the weighted fusion cold / hot coefficient can be: Cold / Hot Coefficient = α × Historical Recycling Update Count + β × Real-Time Recycling Update Count + γ × Overall Recycling Update Count, where α, β, and γ are weighting coefficients (e.g., α = 0.6, β = 0.1, γ = 0.3), and the weighting coefficients can be dynamically adjusted according to actual needs, without limitation here. For example, if the historical recycling update count of target mapping table C is 50, the real-time recycling update count is 5, and the overall recycling update count is 1000, then the cold / hot coefficient = 0.6 × 50 + 0.1 × 5 + 0.3 × 1000 = 30 + 5 + 300 = 335.

[0035] It is understood that in this embodiment, by weighting the number of recycling updates across multiple dimensions, the accuracy and adaptability of hot and cold data identification are improved, and biases from a single indicator are avoided.

[0036] Step S22: Based on the hot / cold coefficient of the data mapped by each target mapping table, target cold data is selected from the storage medium. The higher the hot / cold coefficient, the higher the probability that the data will be selected as target cold data.

[0037] For example, after determining the hot / cold coefficient of the data mapped by each target mapping table in the above manner, the target cold data in the storage medium is then filtered out based on each hot / cold coefficient. Specifically, the higher the hot / cold coefficient of a piece of data, the higher the probability that the corresponding data will be considered as target cold data.

[0038] Optionally, target cold data can also be filtered by sorting or using a threshold. Optionally, all target mapping tables can be sorted in descending order of their heat coefficient, and the data corresponding to mapping tables with heat coefficients higher than a preset threshold (such as based on percentiles or a fixed value) can be selected as target cold data. For example, if the heat coefficient threshold is set to 200, then in the example above, the heat coefficient of target mapping table C, 335, exceeds the threshold, and the data mapped by target mapping table C can be filtered as target cold data.

[0039] In one feasible implementation, the types of indicators for the number of recycling updates include the historical number of recycling updates for a single mapping table, the real-time number of recycling updates for a single mapping table, and the overall number of recycling updates for the storage medium. The historical number of recycling updates is obtained by accumulating the real-time number of recycling updates, and the overall number of recycling updates for the storage medium is obtained by accumulating the historical number of recycling updates for different mapping tables.

[0040] Optionally, the types of metrics for the number of recycling updates can be multiple, and there can be relationships between these different metric types. Optionally, for a given mapping table, the historical number of recycling updates for that mapping table can be the cumulative number of recycling updates since its initialization, for example, it can be obtained by accumulating the real-time recycling updates for that mapping table. The real-time recycling updates for that mapping table are the recycling updates within the most recent time window (such as the last hour, two hours, or twenty-four hours). Accordingly, after the real-time recycling updates within a time window are statistically analyzed, the statistically analyzed real-time recycling updates can be accumulated into the historical recycling updates for that mapping table, and the real-time recycling updates can be reset. The overall number of recycling updates is the sum of the historical recycling updates for all target mapping tables, which can be obtained by accumulating the historical recycling updates for each target mapping table.

[0041] Reference Figure 3 This is a schematic diagram of a scenario in this embodiment, such as... Figure 3As shown, the storage medium can be simply divided into a basic space and a data space. The basic space may include a system area (for storing firmware, system data, etc.), a mapping table, reserved bad blocks (to replace damaged or end-of-life storage blocks), and other necessary management areas. The data space is used to store normal application data. The coefficient threshold refers to the hot / cold coefficient threshold, which is the basis for filtering target cold data based on the hot / cold coefficient. For example, data with a hot / cold coefficient greater than the hot / cold coefficient threshold is considered target cold data. The original space block is the space block where the target cold data was stored, while the target space block is the data block where the target cold data is stored, such as the target space block in subsequent steps.

[0042] Reference Figure 4 , Figure 4 This illustration shows a third flowchart of the data storage method provided in this application embodiment. Contents in this embodiment that are the same as or similar to those in the above embodiments can be referred to the above description and will not be repeated hereafter. Before the step of counting the number of times each target mapping table in the storage medium is recycled and updated, the method includes steps S01 to S02: Step S01: Count the reference update count of each mapping table in the storage medium, where the reference update count includes the number of times the mapping table is updated due to normal data updates; It should be noted that, in this implementation, in order to ensure the effectiveness of the target cold data screening, the target cold data will be initially screened from the mapping tables stored on each storage medium.

[0043] For example, in this embodiment, the reference update count for each mapping table is also counted. The reference update count can include the number of times a normal data update triggers a mapping table update, or it can include the number of times a normal data update triggers a mapping table update and the number of garbage collection updates. Optionally, in practical applications, the reference update count can be based on the number of times a normal data update triggers a mapping table update, or it can be indiscriminate in terms of mapping table update type, i.e., it can cover all update types, such as mapping table updates caused by garbage collection and updates during normal host writes. Optionally, a global counter can be set for each mapping table, and the counter can be incremented each time an entry in the mapping table is modified, to achieve the statistics of the mapping table reference update count. For example, if mapping table D experiences 10 host write updates and 3 garbage collection updates during its lifecycle, then its reference update count can be 10 times the number of host write updates, or 10 host write updates + 3 garbage collection updates = 13 times.

[0044] In addition, the types of metrics for the number of updates can also include the three dimensions of historical, real-time and overall. Therefore, you can refer to the explanation of the number of updates to be recycled, which will not be repeated here.

[0045] Step S02: Based on the reference update count of each mapping table, the target mapping table is divided from each mapping table. Among them, the mapping table with fewer reference update counts has a higher probability of being used as the target mapping table.

[0046] For example, in this embodiment, the target mapping table can also be divided by a threshold or sorting. Optionally, the system presets an upper limit for the number of reference updates (e.g., based on the average or median), and selects mapping tables with a reference update count lower than this upper limit as target mapping tables. For example, if the upper limit for the number of reference updates is 10, and mapping table E has a reference update count of 8, then it is classified as a target mapping table. Optionally, the system can sort the mapping tables in ascending order of the number of reference updates and select the bottom M% of mapping tables as target mapping tables. That is, the fewer the reference update counts in each mapping table, the higher the probability that it will be used as a target mapping table.

[0047] It's understandable that the reference update count of a mapping table reflects the activity level of the data it maps to. In other words, the fewer the reference update counts of a mapping table, the less active the data it maps to. Therefore, we can first determine the target mapping table for mapping cold data based on the reference update counts. Then, we can filter out even less active data—the aforementioned target cold data—by retrieving update counts from the target mapping table.

[0048] Reference Figure 5 , Figure 5 This diagram illustrates the fourth process flow of the data storage method provided in this application embodiment. Contents identical or similar to those in the above embodiments can be referred to the above description and will not be repeated hereafter. The steps for centralized storage of target cold data include steps S31 to S32: Step S31: Select target space blocks from the storage medium, wherein the space blocks with a higher number of erase and write cycles in the storage medium have a higher probability of being selected as target space blocks; For example, target space blocks can be selected from the storage medium based on the number of erase / write cycles. The higher the number of erase / write cycles a space block has, the higher the probability that the space block will be selected as a target space block. Optionally, the algorithm for selecting target space blocks can be based on sorting or a threshold. For example, the top K blocks with the highest number of erase / write cycles in the storage medium can be selected. Alternatively, if block F in the storage medium has 5000 erase / write cycles and block G has 3000 erase / write cycles, then block F will be preferentially selected as the target space block. Step S32: Select target space blocks for centralized storage of target cold data.

[0049] For example, after identifying the target space block, the target cold data can be centrally written into the target space block for centralized storage. Optionally, the target cold data can be copied from its original location to the target space block via controller commands, the mapping table can be updated to point to the new address, and the original space can be marked as reclaimable.

[0050] In this embodiment, target cold data in the storage medium is gradually filtered and distilled by referencing the number of update cycles and the number of garbage collection cycles. This target cold data is then centrally stored, ensuring it is stored in the same block as much as possible. Since the target cold data itself has a low update frequency, and after centralized storage, it is more likely to be stored in the same block, thus reducing the possibility of passive migration due to garbage collection, thereby reducing write amplification parameters and extending the lifespan of the storage system. Simultaneously, space blocks with high erase / write cycle counts are preferentially selected as target space blocks. Because the target cold data has a low update frequency, this slows down the lifespan consumption of the target space blocks, thereby balancing the wear and tear of the storage medium in real time and avoiding triggering a dedicated wear leveling mechanism.

[0051] In one feasible implementation, the data mapped by each target mapping table is cold data, and the cold data is stored in the cold data space of the storage medium; the method further includes steps S310 to S320: Step S310: Based on the reference update count of each mapping table in the storage medium, determine the ratio coefficient of cold data and hot data in the storage medium, wherein the reference update count of the mapping table corresponding to hot data is greater than the reference update count of the mapping table corresponding to cold data. Step S320: Divide the storage medium into spaces based on the scaling factor to obtain the cold data space.

[0052] It should be noted that a cold data space can be partitioned in the storage medium (and a hot data space can also be partitioned at the same time). The cold data space is usually used to store cold data. Optionally, the cold data can be the data mapped by the selected target mapping table. Therefore, after partitioning the cold data space, the mapping table corresponding to the cold data stored in the cold data space can be directly used as the target mapping table mentioned above.

[0053] For example, hot data in a storage medium refers to data with a high update frequency, while cold data is data with a low update frequency. When data is updated, the corresponding mapping table is also updated simultaneously. Therefore, cold and hot data in the storage medium can be distinguished based on the reference update frequency of each mapping table. For example, if the reference update frequency of the mapping table corresponding to hot data is greater than that of the mapping table corresponding to cold data, cold and hot data can be distinguished based on this criterion. Optionally, clustering algorithms (such as K-means) can be used to divide the data mapped by the mapping tables into hot and cold categories, or the division can be directly based on percentiles (e.g., the data corresponding to the 30% of mapping tables with the lowest reference update frequency is cold data). After distinguishing between cold and hot data, the ratio between cold and hot data can be directly calculated to obtain the aforementioned ratio coefficient.

[0054] For example, the storage medium is partitioned based on the obtained ratio to obtain a cold data space. It should be noted that a hot data space can also be partitioned simultaneously with the cold data space, ensuring that the ratio between the sizes of the cold and hot data spaces corresponds to the ratio. For instance, if the ratio of cold to hot data is 1 / 3, then the ratio between the sizes of the cold and hot data spaces should also be 1 / 3.

[0055] Understandably, by determining the ratio of cold to hot data, accurate cold and hot storage space can be partitioned to meet actual data storage needs. Furthermore, partitioning cold and hot data allows for separate storage, reducing the likelihood of data being passively moved during garbage collection and extending the lifespan of the storage system.

[0056] In one feasible implementation, the storage medium further includes a hot data space configured as a first storage mode and a cold data space configured as a second storage mode, wherein the unit space erase / write lifetime of the first storage mode is greater than that of the second storage mode. The steps for dividing the storage medium into spaces based on a scaling factor to obtain the cold data space include steps S321 to S322: Step S321: Determine the size ratio of unit space storage between the first storage mode and the second storage mode; Step S322: Divide the storage medium into cold data space based on the size ratio so that the actual storage ratio between the cold data space and the hot data space corresponds to the ratio coefficient.

[0057] It should be noted that when allocating the cold data space, the hot data space can be allocated simultaneously. The cold data space is used to store cold data, while the hot data space is used to store hot data. It is understood that hot data has a higher data update frequency than cold data; that is, the blocks in the hot data space will be erased and written more frequently. Since each block typically has a limited number of erase and write cycles, this embodiment sets different storage modes for different data spaces.

[0058] For example, in this embodiment, a first storage mode is configured for the hot data space, and a second storage mode is configured for the cold data space, wherein the erase / write lifetime per unit space of the first storage mode is greater than that of the second storage mode. Here, the erase / write lifetime per unit space refers to the erase / write cycle lifetime of a single block. Optionally, the first storage mode can be an SLC (Single-Level Cell) mode, where each cell stores 1 bit of data and has a high erase / write lifetime (e.g., 100,000 erase / write cycles); the second storage mode is a TLC mode, where each cell stores 3 bits of data and has a lower erase / write lifetime (e.g., 3,000 erase / write cycles). For example, in hybrid flash memory, hot data (such as system logs) is stored in SLC blocks, and cold data (such as archived files) is stored in TLC blocks. It is understood that the hot data space uses the SLC mode to withstand frequent writes, while the cold data space uses the TLC mode to save costs and increase capacity.

[0059] For example, the storage efficiency ratio of different storage modes is calculated, that is, the ratio of the storage capacity per unit space between the first storage mode and the second storage mode. It should be noted that the first and second storage modes differ not only in their write / erase lifetime per unit space but also in their storage capacity per unit space. Storage capacity per unit space refers to the amount of data that can be stored per physical unit (e.g., a block). For example, in SLC mode, each unit contains 1 bit, while in TLC mode, each unit contains 3 bits. That is, for the same block, the amount of data that can be stored using TLC mode is three times that of SLC mode, hence the ratio is 1:3. The system can obtain this ratio from the storage controller.

[0060] For example, cold data space is then divided from the storage medium according to the size ratio, and the size ratio is used to compensate for the difference in storage capacity per unit space between different storage modes, so that the actual storage capacity ratio between cold data space and hot data space corresponds to the above ratio coefficient.

[0061] Optionally, in a scenario, the proportionality coefficient is 1 / 3, and the size ratio is also 1 / 3. If the number of cold data space blocks is n and the data volume of hot data space blocks is m, the condition m / (3*n)=1 / 3 needs to be satisfied, where m is equal to n. That is, although the ratio between hot data and cold data is 1:3, actually, when dividing the hot and cold data spaces, the number of blocks in the hot data space and the number of blocks in the cold data space are in a 1:1 relationship.

[0062] Optionally, in another actual scenario, due to the existence of blocks such as GC (Garbage Collection) redundancy, system blocks, and mapping tables during the operation of the storage system itself, the actual usable capacity provided to the host is usually less than its declared capacity, generally in the range of 89%-93%. Now assume that the total number of available blocks provided by the storage system is T, the number of blocks required to meet its declared capacity is R, T is 105%-115% of R, and the number of blocks required to provide capacity to the host is H, H is 89%-93% of R. If the proportion of hot data existing in the evaluation write system is X (0<X<100%), the cold data space adopts the TLC mode, and the hot data space adopts the SLC mode, and the size ratio of the storage capacity per unit space between the SLC mode and the TLC mode is 1:3, then a space of 3*X*H + 3 blocks can be allocated as the hot data space (where +3 is mainly to solve the rounding problem), and the cold data space needs to be (1 - X)*H blocks. The sum of 3*X*H + 3 and (1 - X)*H is (1 + 2*X)*H + 3. Therefore, the number of blocks required to provide capacity to the host becomes (1 + 2*X)*H + 3. So, it is necessary to control the proportion of X to avoid (1 + 2*X)*H + 3>T. In fact, due to the existence of system blocks, mapping table blocks, and GC redundancy in the hot and cold spaces in the storage system, assuming the total number of these blocks is S, so actually (1 + 2*X)*H + 3 < (T - S) needs to be controlled.

[0063] It can be understood that in this embodiment, the differences in the storage capacity per unit space of different storage modes are considered to divide the hot and cold data spaces, so as to ensure that the actual storage amounts of hot and cold data conform to the logical ratio, thereby avoiding waste or shortage of different storage spaces.

[0064] Next, refer to Figure 6 , which is a schematic structural diagram of a memory 400 provided by an embodiment of the present application. The memory 400 includes a main control chip 410 and a storage chip 420. The main control chip 410 and the storage chip 420 are electrically connected directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0065] The storage chip 420 stores a computer program that can be executed by the main control chip 410. The main control chip is used to read / write the data or computer program stored in the storage chip 420 and perform corresponding functions. For example, when the computer program stored in the storage chip 420 is executed by the main control chip 410, the data storage method disclosed in the above embodiments can be implemented. It should be understood that, Figure 6 The structure shown is only a schematic diagram of the memory 400. The memory 400 may also include components such as memory 400. Figure 6 The more or fewer components shown, or having the same Figure 6 The different configurations shown. Figure 6 The components shown can be implemented using hardware, software, or a combination thereof.

[0066] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the data storage method in the above embodiments.

[0067] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0068] The aforementioned computer-readable storage medium may be contained within a memory or may exist independently without being assembled into a memory.

[0069] The aforementioned computer-readable storage medium carries one or more programs, which, when executed by the memory, cause the memory to: The number of times each target mapping table in the storage medium is updated during garbage collection is counted. The number of times the data migration during garbage collection triggers the updating of the mapping table is counted. The target cold data in the storage medium is determined based on the number of recycling and update cycles. The data mapped by the target mapping table with the more recycling and update cycles is more likely to be regarded as target cold data. Centralized storage of target cold data.

[0070] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0071] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0072] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0073] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described data storage method. This solves the technical problem that traditional storage methods in storage systems affect the lifespan of the storage system. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the data storage method provided in the above embodiments, and will not be repeated here.

[0074] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the data storage method steps described above.

[0075] The computer program product provided in this application can solve the technical problem that traditional storage methods in storage systems affect the lifespan of the storage system. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the data storage method provided in the above embodiments, and will not be repeated here.

[0076] The above are only some embodiments of this application and do not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the content of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A data storage method, characterized in that, The data storage method includes: The number of times each target mapping table in the storage medium is recycled and updated is counted, wherein the number of times the data migration during garbage collection triggers the updating of the mapping table; The target cold data in the storage medium is determined based on the number of recycling and update cycles, wherein the data mapped by the target mapping table with the more recycling and update cycles is more likely to be regarded as the target cold data. The target cold data is centrally stored.

2. The data storage method as described in claim 1, characterized in that, The step of determining the target cold data in the storage medium based on the number of recycling updates includes: For any target mapping table in each target mapping table, a weighted fusion is performed based on different index types of the number of recycling updates corresponding to the target mapping table to obtain the hot / cold coefficient of the data mapped by the target mapping table. The index types include at least two of the following: the historical number of recycling updates of a single mapping table, the real-time number of recycling updates of a single mapping table, and the overall number of recycling updates of the storage medium. Based on the hot / cold coefficient of the data mapped by each target mapping table, target cold data is filtered out from the storage medium, wherein the higher the hot / cold coefficient, the higher the probability that the data will be used as the target cold data.

3. The data storage method as described in claim 1, characterized in that, Prior to the step of counting the number of times each target mapping table in the statistical storage medium is recycled and updated, the method includes: The reference update count for each mapping table in the storage medium is counted, wherein the reference update count includes the number of times the mapping table update is triggered by normal data updates; The target mapping table is divided from the mapping tables based on the reference update count of each mapping table. The mapping table with fewer reference update counts has a higher probability of being used as the target mapping table.

4. The data storage method as described in claim 1, characterized in that, The step of centrally storing the target cold data includes: Target space blocks are selected from the storage medium, wherein the space blocks with a higher number of erase / write cycles in the storage medium have a higher probability of being selected as the target space blocks; The target space block is selected for centralized storage of the target cold data.

5. The data storage method as described in claim 1, characterized in that, The data mapped by each target mapping table is cold data, and the cold data is stored in the cold data space of the storage medium; the method further includes: Based on the reference update count of each mapping table in the storage medium, the ratio coefficient of cold data and hot data in the storage medium is determined, wherein the reference update count of the mapping table corresponding to the hot data is greater than the reference update count of the mapping table corresponding to the cold data. The storage medium is divided into spaces based on the aforementioned scaling factor to obtain the cold data space.

6. The data storage method as described in claim 5, characterized in that, The storage medium further includes a hot data space, which is configured as a first storage mode and the cold data space is configured as a second storage mode. The unit space erase / write lifetime of the first storage mode is greater than that of the unit space erase / write lifetime of the second storage mode. The step of dividing the storage medium into spaces based on the scaling factor to obtain the cold data space includes: Determine the ratio of the unit space storage volume between the first storage mode and the second storage mode; The cold data space is divided from the storage medium based on the size ratio, so that the actual storage ratio between the cold data space and the hot data space corresponds to the ratio coefficient.

7. The data storage method according to any one of claims 1-6, characterized in that, The types of indicators for the number of recycling updates include the historical number of recycling updates for a single mapping table, the real-time number of recycling updates for a single mapping table, and the overall number of recycling updates for the storage medium. The historical number of recycling updates is obtained by accumulating the real-time number of recycling updates, and the overall number of recycling updates for the storage medium is obtained by accumulating the historical number of recycling updates for different mapping tables.

8. A memory, characterized in that, The memory includes a main control chip and a storage chip. The storage chip stores a computer program, and the main control chip can execute the computer program to implement the data storage method according to any one of claims 1-7.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed, implements the steps of the data storage method as described in any one of claims 1-7.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the data storage method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Method for aggregating static data and solid-state disk thereof

    CN102609358A

  • Processing method of wear-leveling of solid state disk

    CN106990926A

  • Cold data screening method and device, computer equipment and storage medium

    CN108920108A

  • Heat-based storage management method and system

    CN110968266A