Method and system for managing flash translation layer based on stream-aware cache
Patent Information
- Application Number
- CN202610800655.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-04
- Publication Date
- 2026-08-28
AI Technical Summary
[0009]针对现有闪存转换层在复杂负载下存在的热点识别不足、冷热混写、GC迁移页数较多和局部磨损失衡的问题,本申请提供一种基于流感知缓存的闪存转换层管理方法及系统
[0064]本申请的有益效果,本申请通过在FTL写路径中加入流识别与分类,使SSD控制器能够感知不同访问流的地址局部性、顺序性和热度差异。本申请通过写穿透DRAMCache和LRU-K替换策略,提高热点读请求命中率,减少重复热点读进入NAND路径的次数。本申请通过SLC/HOT/WARM/COLD多级Zone和独立写指针,将不同类别数据写入不同物理区域,降低冷热混写。本申请通过Zone感知GC阈值和victim选择策略,降低垃圾回收中的有效页迁移量,减少写放大和时延波动。本申请通过HOT/COLD磨损均衡机制抑制热区擦除次数过快增长,缓解分区写入带来的局部寿命瓶颈。
Smart Images

Figure CN122654032A_ABST
Abstract
Description
Technical Field
[0001] This application relates to a flash translation layer management method and system based on stream-aware caching, belonging to solid-state drive controllers and flash translation layer management technology. Background Technology
[0002] NAND flash memory, with its non-volatility, high storage density, and low power consumption, has become the primary storage medium for solid-state drives (SSDs). However, NAND flash memory has physical constraints such as page read / write, block erase, pre-write erase, limited erase / write lifetime, and latency differences for different page types. To shield these physical characteristics from the host, SSDs typically incorporate a Flash Translation Layer (FTL) to handle logical address to physical address mapping, off-site updates, garbage collection, and wear leveling.
[0003] Existing FTLs typically employ a unified mapping and unified space management strategy, which is relatively straightforward when sequential access or when the load is simple. However, in scenarios involving mixed read / write, multi-stream concurrency, coexistence of hot and cold data, and high-pressure garbage collection, the following problems still exist.
[0004] (1) Insufficient hot spot identification: Traditional FTL usually does not distinguish the address proximity, order and access frequency of different access streams in the write path, making it difficult to identify high-hot sequential streams, high-hot random streams and stable cold streams.
[0005] (2) Mixed writing of hot and cold data: If high-frequency updated data and long-term stable data are mixed in the same physical recycling unit, a large number of still valid cold pages will be migrated during subsequent garbage collection, increasing write amplification.
[0006] (3) The garbage collection strategy lacks partition awareness: the global unified threshold and unified victim selection cannot combine the spatial pressure of different data areas, the effective page ratio and the erasure status to perform differentiated collection.
[0007] (4) Local wear imbalance: Hot areas accumulate a high number of erases due to frequent writing and recycling, while cold areas have a lower number of erases, resulting in premature aging of some blocks and the overall lifespan not being fully utilized.
[0008] (5) Lack of coordination between caching, placement and background maintenance: Existing solutions are mostly optimized for a single link in caching, hot and cold separation, garbage collection or wear leveling, and lack a complete mechanism for coordinated execution in the same FTL path. Summary of the Invention
[0009] To address the problems of insufficient hotspot identification, mixed hot and cold writes, excessive GC page migrations, and local wear imbalance in existing flash translation layers under complex loads, this application provides a flash translation layer management method and system based on stream-aware caching.
[0010] This application discloses a flash translation layer management method based on stream-aware caching, applied to a solid-state drive controller, comprising:
[0011] Upon receiving a write request, the system determines the target flow based on the logical address of the write request, compares the difference between the most recently accessed logical address of the target flow and the current logical address, determines whether the current access is sequential or random, and updates the sequential or random count to obtain the sequential access ratio. Based on the statistical information of the target flow and the sequential access ratio, the system determines the category of the target flow; the category includes at least hot flow, warm flow, and cold flow.
[0012] Select a physical partition based on the category of the target stream, write the data to be written to the corresponding physical partition, update the mapping table, and insert the mapping information into the cache; physical partitions include at least SLC partitions, hot partitions, warm partitions, and cold partitions;
[0013] Upon receiving a read request, it first reads from the cache; if the cache is not found, it queries the mapping table and reads from flash memory.
[0014] Based on the comparison results of the free page ratio of each physical partition with the corresponding threshold, a request for partitions to be reclaimed is generated and queued by priority; garbage collection is performed in order of priority, and different sacrificial block reclamation strategies are selected according to the physical partition type;
[0015] Monitor the difference in the number of erases between hot and cold partitions. When the difference in the number of erases exceeds a preset threshold, migrate the data from the high-wear blocks in the hot partition to the low-wear blocks in the cold partition.
[0016] Preferably, the statistical information of the target stream includes at least the number of visits, the most recent visit time, and the sliding window access count;
[0017] Methods for determining the category of a target flow based on its statistical information and sequential access ratio include:
[0018] Based on the time interval between the target flow's most recent access time and the current logical address Calculate the historical impact of decay over time intervals. ;
[0019] The sliding window access strength is obtained from the sliding window access count. This includes: counting the total number of times the target flow is accessed within the most recent sliding window, dividing the total number of accesses by the product of the sliding window length and the heat flow reference access threshold to obtain the normalized access intensity; when the normalized access intensity is greater than 1, its value is restricted to 1;
[0020] Calculate the overall popularity score :
[0021]
[0022] The historical popularity value of the target stream. Historical weighting;
[0023] Based on overall popularity rating Based on the comparison results with the preset heat threshold and temperature threshold, and combined with the sequential access ratio, the target flow is classified into one of the following six types: hot sequential flow, hot random flow, temperature sequential flow, temperature random flow, cold flow, or system flow.
[0024] Preferably, the method of selecting a physical partition based on the category of the target stream, writing the data to be written to the corresponding physical partition, updating the mapping table, and inserting the mapping information into the cache includes:
[0025] Based on the category of the target flow, select the target physical partition according to the following mapping rules:
[0026] If the target stream is a system stream, then select the SLC partition;
[0027] If the target flow is a hot sequential flow or a hot random flow, then select a hot partition;
[0028] If the target flow is a warm sequential flow or a warm random flow, then select the warm partition;
[0029] If the target flow is a cold flow, then select the cold partition;
[0030] Check the free page status of the target physical partition:
[0031] If the proportion of free pages is lower than the preset garbage collection threshold of the target physical partition, a corresponding garbage collection request will be triggered.
[0032] Within the target physical partition, a new physical page is allocated based on the maintained independent write pointers;
[0033] Write the data to be written to the allocated physical page, update the logical page to physical page mapping table and the reverse mapping table, and insert the mapping information of the logical page to physical page mapping table and the reverse mapping table into the cache.
[0034] As a preferred approach, the system employs a write penetration strategy and an LRU-K replacement strategy in the write request path.
[0035] Preferably, the method of first reading from the cache, and then querying the mapping table and reading from flash memory if the cache is not found includes:
[0036] Receive a read request and obtain the logical address to be read;
[0037] Search for the cache entry corresponding to the logical address in DRAMCache;
[0038] If the cache is hit, then:
[0039] Update the access count and the time of the last K accesses for the corresponding cached entries;
[0040] Move the corresponding cache entry to the head of the LRU list;
[0041] Return the data stored in the cache to complete the read request;
[0042] If the cache is not hit, then:
[0043] Query the mapping table from logical address to physical address to obtain the target physical page address;
[0044] Access the flash memory, read data from the target physical page address, and complete the read request;
[0045] Based on the storage unit type and page type corresponding to the physical partition to which the target physical page belongs, the read operation latency is returned in the unified latency realization interface.
[0046] Preferably, the method of generating requests for reclaimed partitions based on the comparison between the proportion of free pages in each physical partition and the corresponding threshold, and queuing them by priority; performing garbage collection in priority order, and selecting different sacrificial block reclamation strategies according to the physical partition type includes:
[0047] Physical partitions with a free page ratio lower than the preset garbage collection threshold will generate garbage collection requests and insert them into the queue in the priority order of urgent garbage collection requests, cold partitions, warm partitions, hot partitions, and SLC partitions.
[0048] The background thread retrieves recycling requests according to priority and selects the sacrificial block based on the partition type: for SLC partitions, it selects the block with the fewest erases; for hot and cold partitions, it selects the block with the fewest valid pages.
[0049] Perform valid page migration and block erasure on the sacrificed block.
[0050] Preferably, the process of writing the data to be written to the corresponding physical partition also includes:
[0051] Check whether the proportion of free pages in the target physical partition is lower than the preset garbage collection threshold for the corresponding physical partition;
[0052] If the value is below the garbage collection threshold, submit a regular garbage collection request.
[0053] If the target physical partition fails to allocate physical pages, an emergency garbage collection request is submitted.
[0054] Preferably, the method for monitoring the difference in the number of erases between hot and cold zones, and migrating data from high-wear blocks in the hot zone to low-wear blocks in the cold zone when the difference in the number of erases exceeds a preset threshold, includes:
[0055] Calculate the relative difference rate of the average number of wipes between the hot zone and the cold zone. When the relative difference rate exceeds 0.3, select the high wear block as the source block in the hot zone and the low wear block as the target block in the cold zone.
[0056] Migrate valid pages from the source block to the target block, update the mapping table, and erase the source block.
[0057] The number of blocks migrated in a single operation shall not exceed 0.1% of the total number of blocks.
[0058] This application also provides a flash translation layer management system based on stream-aware caching, applied to a solid-state drive controller, comprising:
[0059] The flow identification module is used to receive write requests, determine the target flow to which the write request belongs based on the logical address of the write request, compare the difference between the most recently accessed logical address of the target flow and the current logical address, determine whether the current access is a sequential access or a random access, and update the sequential count or random count to obtain the sequential access ratio; and determine the category of the target flow based on the statistical information of the target flow and the sequential access ratio; the category includes at least hot flow, warm flow and cold flow.
[0060] The multi-level hot and cold zone module is used to select physical partitions based on the type of the target stream. The physical partitions include at least SLC partitions, hot partitions, warm partitions, and cold partitions. The data to be written is written to the corresponding physical partition, the mapping table is updated, and the mapping information is inserted into the cache.
[0061] The DRAMCache module is used to insert the mapping information after a write request is completed into the cache. It is also used to receive read requests, read from the cache first, and if the cache is not hit, it queries the mapping table and reads from the flash memory.
[0062] The Stream-Aware GC module generates requests for partitions to be reclaimed based on the comparison between the proportion of free pages in each physical partition and the corresponding threshold, and queues them by priority; it then performs garbage collection in priority order and selects different sacrificial block reclamation strategies based on the physical partition type.
[0063] The wear leveling module is used to monitor the difference in the number of erases between hot and cold partitions. When the difference in the number of erases exceeds a preset threshold, the data is migrated from the high-wear blocks in the hot partition to the low-wear blocks in the cold partition.
[0064] The beneficial effects of this application are as follows: First, by incorporating flow identification and classification into the FTL write path, this application enables the SSD controller to perceive the address locality, sequentiality, and hotness differences of different access flows. Second, by using write-through DRAMCache and LRU-K replacement strategies, this application improves the hit rate of hot read requests and reduces the number of times repeated hot reads enter the NAND path. Third, by using SLC / HOT / WARM / COLD multi-level zones and independent write pointers, this application writes different types of data to different physical regions, reducing mixed hot and cold writes. Fourth, by using zone-aware GC thresholds and victim selection strategies, this application reduces the effective page migration amount during garbage collection, reducing write amplification and latency fluctuations. Fifth, by using a HOT / COLD wear leveling mechanism, this application suppresses the excessively rapid increase in the number of hot zone erases, alleviating the local lifespan bottleneck caused by partition writes. Attached Figure Description
[0065] Figure 1 This is a diagram illustrating the overall architecture of a flash translation layer management method based on stream-aware caching.
[0066] Figure 2 Here are the SAC-FTL read / write request processing flowcharts, where (a) is the read request execution flowchart and (b) is the write request execution flowchart.
[0067] Figure 3 Flowchart for access flow identification and classification;
[0068] Figure 4 Diagram of the DRAMCache mechanism;
[0069] Figure 5 Flowchart for assigning pages within a Zone;
[0070] Figure 6 The flowchart for Zone-aware garbage collection includes (a) the victim selection flowchart and (b) the GC background thread workflow.
[0071] Figure 7 The flowcharts for HOT / COLD wear leveling are shown, where (a) is the flowchart for hot and cold block selection and (b) is the flowchart for page migration and mapping.
[0072] Figure 8 This is a call chain graph for key functions. Detailed Implementation
[0073] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0074] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other.
[0075] The present application will be further described below with reference to the accompanying drawings and specific embodiments, but this is not intended to limit the scope of the application.
[0076] This implementation provides a flash translation layer management method based on a flow-aware cache to address the problems of insufficient hotspot identification, mixed hot and cold data writing, large effective page migration volume during garbage collection, and wear leveling between hot and cold partitions in existing FTLs under complex loads. This implementation is executed through the FTL firmware in the solid-state drive controller. The overall process includes: host write request processing, host read request processing, background garbage collection, and background wear leveling. In write request processing, the controller identifies the access flow's affiliation, determines its sequential / random characteristics, updates statistics, and identifies the flow category (at least including hot, warm, and cold flows). Then, it writes the data to the corresponding physical partition according to the category. After writing, it updates the mapping table and inserts the mapping information into the cache. Read request processing prioritizes accessing the cache; if a cache miss occurs, it queries the mapping table and reads the flash memory. The background process generates garbage collection requests based on the comparison between the free page ratio of each partition and a threshold, queues them by priority, and executes garbage collection in priority order, selecting different sacrifice blocks based on partition type. Background wear leveling monitors the difference in average erase counts between hot and cold partitions. When the relative difference rate exceeds a preset threshold, data is migrated from high-wear blocks in the hot partition to low-wear blocks in the cold partition. Each step in this method is executed in strict order, and all parameters, thresholds, and judgment logic are described in a reproducible manner.
[0077] The flash translation layer management method based on stream-aware caching in this embodiment is applied to a solid-state drive controller and includes:
[0078] Step 1, Stream Identification:
[0079] Upon receiving a write request, the system determines the target flow based on the logical address of the write request, compares the difference between the most recently accessed logical address of the target flow and the current logical address, determines whether the current access is sequential or random, and updates the sequential or random count to obtain the sequential access ratio. Based on the statistical information of the target flow and the sequential access ratio, the system determines the category of the target flow; the category includes at least hot flow, warm flow, and cold flow.
[0080] Specifically:
[0081] Receive write requests from the host and obtain the logical page number, request size, and current timestamp.
[0082] The target flow is determined based on the distance between the logical address and the existing flow address range. If the distance exceeds a preset threshold, a flow with a lighter load or an idle flow state is selected.
[0083] The statistical information of the target stream includes at least the number of accesses, the most recent access time, and the sliding window access count, and may also include the total number of bytes accessed and the address range;
[0084] Compare the time interval between the most recent access time of the target stream and the current logical address. It determines whether the current visit is a sequential or random visit, updates the corresponding count, and calculates the historical impact that decays over time. .
[0085] The sliding window access strength is obtained from the sliding window access count. This includes: counting the total number of times the target flow is accessed within the most recent sliding window, dividing the total number of accesses by the product of the sliding window length and the heat flow reference access threshold to obtain the normalized access intensity; when the normalized access intensity is greater than 1, its value is restricted to 1;
[0086] Update the stream's access count, total access bytes, address range, most recent access time, and sliding window access count.
[0087] Based on sliding window access intensity A comprehensive popularity score is calculated based on the historical popularity values of the target stream. :
[0088]
[0089] The historical popularity value of the target stream. Historical weighting;
[0090] And combine the sequential access ratio to obtain the stream category:
[0091] Based on overall popularity rating Based on the comparison results with the preset heat threshold and temperature threshold, and combined with the sequential access ratio, the target flow is classified into one of the following six types: hot sequential flow, hot random flow, warm sequential flow, warm random flow, cold flow, or system flow. For example: based on the comparison results of the H value with the preset heat threshold (0.7) and temperature threshold (0.3), and combined with the sequential access ratio calculated in step 2, the target flow is classified into one of the following categories:
[0092] If H ≥ 0.7 and the sequential access ratio ≥ 0.5, then the category is hot sequential flow.
[0093] If H ≥ 0.7 and sequential access ratio < 0.5, then the category is hot random flow.
[0094] If 0.3 ≤ H < 0.7 and the sequential access ratio ≥ 0.5, then the category is warm sequential flow.
[0095] If 0.3 ≤ H < 0.7 and the sequential access ratio < 0.5, then the category is warm random flow.
[0096] If H < 0.3, then the category is cold flow.
[0097] If the LBA corresponding to the write request belongs to the system reserved scope (such as the FTL metadata area or a special identifier), then the category is system stream. The final output target stream category is determined by this.
[0098] Step 2, Multi-level Hot and Cold Zones:
[0099] Select a physical partition based on the type of the target stream, write the data to be written to the corresponding physical partition, update the mapping table, and insert the mapping information into the cache; physical partitions include at least SLC partitions, hot partitions, warm partitions, and cold partitions; specifically including:
[0100] Based on the category of the target flow, select the target physical partition according to the following mapping rules:
[0101] If the target stream is a system stream, then select the SLC partition;
[0102] If the target flow is a hot sequential flow or a hot random flow, then select a hot zone.
[0103] If the target flow is a warm sequential flow or a warm random flow, then select a warm zone.
[0104] If the target flow is a cold flow, then select the cold zone (COLDZone).
[0105] Check the free page status of the target physical partition:
[0106] If the proportion of free pages is lower than the preset garbage collection threshold of the target physical partition, a corresponding garbage collection request will be triggered:
[0107] If the value is below the preset garbage collection threshold, a normal garbage collection request (normal GC request) is submitted; if the target physical partition allocation fails, an emergency garbage collection request (emergency GC request) is submitted.
[0108] Within the target physical partition, a new physical page is allocated based on the maintained independent write pointers. If the target physical partition is temporarily unavailable, other physical partitions can be tried according to the preset rollback order.
[0109] Write the data to be written to the allocated physical page to complete the NAND write; update the mapping table from logical page to physical page and the reverse mapping table, invalidate the old page and make the new page valid, and insert the written logical address, physical page address, stream number and access history into the DRAMCache.
[0110] Step 3, Read Request Processing:
[0111] Upon receiving a read request, the system obtains the logical address to be read, searches for the cache entry corresponding to the target logical address in the DRAMCache. If a cache hit occurs, the system updates the access count and the last K access times of the cache entry, moves the entry to the head of the LRU list, and returns the cache hit result. If a cache miss occurs, the system queries the mapping table to read the target physical page address and reads the data from the flash memory.
[0112] Based on the SLC / TLC region and page type of the target physical page, the read operation latency is returned in the unified latency realization interface.
[0113] Step 4, Background garbage collection process:
[0114] The write path or background thread detects the proportion of free pages in the physical partitions. Based on the comparison between the proportion of free pages in each physical partition and the corresponding threshold, requests for partitions to be reclaimed are generated and queued according to priority.
[0115] When the proportion of free pages is below the threshold, GC requests that include physical partition type, whether forced reclamation is required, and request time will be inserted into the priority queue.
[0116] Garbage collection is performed in priority order, and garbage collection requests are inserted into the queue in priority order: urgent garbage collection requests, cold partitions, warm partitions, hot partitions, and SLC partitions.
[0117] Different sacrificial block reclamation strategies are selected based on the physical partition type. SLC physical partitions tend to select lines with fewer erase cycles, while hot / cold partitions tend to select lines with fewer valid pages.
[0118] Perform effective page migration, block erasure, line status update, and GC statistics update for the sacrificial block reclamation strategy.
[0119] Step 4: Background Wear Leveling Process
[0120] The background wear leveling thread periodically reads the erase count statistics for hot and cold partitions.
[0121] Calculate the average number of erasures and the relative difference rate between the two areas, which is used as the difference in the number of erasures.
[0122] When the difference in the number of erases exceeds a preset threshold, the data is migrated from the high-wear block in the hot partition to the low-wear block in the cold partition. That is, the high-wear source block is selected in the hot partition, and the low-wear target block is selected in the cold partition.
[0123] Traverse the valid pages of the source block, read their reverse mapping information, construct the target physical page address, migrate the valid pages, and update the mapping table and page state. After migration, erase the source block and update the hot / cold partition erase statistics and migration statistics. Adjust the next check interval based on whether load balancing is triggered.
[0124] This embodiment also provides a flash translation layer management system based on stream-aware caching, such as... Figure 1 As shown, it includes a host I / O interface, an FTL management module, a NAND Flash physical model, and a background maintenance thread. The host I / O interface receives NVMe read / write commands and converts them into FTL read / write requests. The FTL management module includes a stream identification module, a DRAM cache module, a multi-level hot / cold zone module, a stream-aware GC module, and a wear leveling module. The NAND Flash physical model is used to simulate the hierarchical structure of physical pages, blocks, planes, LUNs / dies, and channels, and a unified latency interface reflects the latency of read, write, and erase operations.
[0125] The stream identification module is located at the front end of the write path and is used to convert host write requests into stream categories with heat and order attributes;
[0126] The DRAMCache module is located at the front of the read path and is used to provide a fast access path for hot data;
[0127] The multi-level hot and cold zone module is located in the data placement stage and is used to map the stream type to different physical zones;
[0128] The flow-aware GC module and wear leveling module run in the background to perform maintenance operations based on Zone space status and erase statistics. Specifically:
[0129] The flow identification module in this embodiment receives write requests, determines the target flow to which the write request belongs based on its logical address, compares the difference between the most recently accessed logical address of the target flow and its current logical address to determine whether the access is sequential or random, and updates the sequential or random count to obtain the sequential access ratio. Based on the statistical information of the target flow and the sequential access ratio, the system determines the category of the target flow; the category includes at least hot flow, warm flow, and cold flow. Specifically, when a write request arrives, the system first infers the target flow based on the distance between the request logical address and the existing flow address range. If the current LBA is adjacent to or close to the address range of a certain first flow, the request is assigned to that flow; if the distance to all flows exceeds a preset threshold, the system selects to access a flow with a lighter load or reuses an idle flow state.
[0130] After identifying the target flow, the system compares the current LBA with the most recently accessed LBA of that flow. If the difference is not greater than a sequence threshold, the sequential access count is incremented; otherwise, the random access count is incremented. The system also updates the total number of accesses, the most recent access time, the address range, and the sliding window statistics. This is based on the access intensity within the sliding window. A comprehensive popularity score is calculated based on the historical popularity values of the target stream. Based on popularity scores and sequential access ratios, the system categorizes access flows into hot sequential flow, hot random flow, warm sequential flow, warm random flow, cold flow, or system flow.
[0131] The DRAMCache module in this embodiment is used to insert the mapping information after a write request is completed into the cache. It also receives read requests, prioritizes reading from the cache, and if a cache miss occurs, queries the mapping table and reads from the flash memory. Specifically, in the read request path, the system first queries the DRAMCache for the target logical address. Cache entries may include the logical address, physical page address, stream number, valid bit, dirty bit, access count, and the time of the last K accesses. If the query is successful, the system updates the access history and the LRU list, and directly returns the cache hit result. If a cache miss occurs, the system continues to query the FTL mapping table and access the NAND Flash.
[0132] In the write request path, the system employs a write penetration strategy: the write request first completes the NAND write and mapping table update, and then inserts the written logical address, physical page address, and stream number into the cache. If the cache space is insufficient, the LRU-K replacement strategy is invoked to select the victim entry. The LRU-K strategy does not only compare the most recent access time, but also combines the number of accesses and the Kth most recent access time, prioritizing the removal of infrequently accessed data and retaining stable, hot data as much as possible.
[0133] The multi-level hot and cold zone module in this embodiment is used to select physical partitions according to the category of the target stream. The physical partitions include at least SLC partitions, hot partitions, warm partitions, and cold partitions; write the data to be written to the corresponding physical partition, update the mapping table, and insert the mapping information into the cache;
[0134] The Stream-Aware GC module generates requests for partitions to be reclaimed based on the comparison between the proportion of free pages in each physical partition and the corresponding threshold, and queues them by priority; it then performs garbage collection in priority order and selects different sacrificial block reclamation strategies based on the physical partition type.
[0135] Specifically, this embodiment divides the SSD physical space into four regions: SLCZone, HOTZone, WARMZone, and COLDZone. Each zone maintains states such as start block number, end block number, current block number, current page number, number of free pages, number of pages written, and erase count arrays. The system selects a target zone based on the stream type and allocates physical pages within the target zone using independent write pointers. Each zone has an independent GC trigger threshold. The system calculates the proportion of free pages in the target zone.
[0136] ;
[0137] And compare it with the Zone threshold. When the threshold is below the minimum trigger interval, the system inserts the GC request into the background queue.
[0138] For example, system streams or high-priority data are written to SLCZone; hot sequential streams and hot random streams are written to HOTZone; warm sequential streams and warm random streams are written to WARMZone; and cold streams are written to COLDZone. If the target zone has insufficient space, the system first triggers a GC request for the corresponding zone; if allocation is still not possible after emergency reclamation, it can fall back to other zones in a preset order to avoid long-term blocking of foreground write requests. The GC request queue can be organized according to priorities such as emergency requests, COLDZone, WARMZone, HOTZone, and SLCZone. The background thread retrieves requests according to priority and performs one reclamation. The victim selection strategy is related to the zone type: SLCZone prioritizes lines with fewer erase cycles, HOTZone and COLDZone prioritize lines with fewer valid pages, and WARMZone uses the default or balanced strategy. After selecting the victim, the system migrates valid pages, erases blocks, updates line status, and GC statistics.
[0139] The wear leveling module monitors the difference in erase counts between hot and cold partitions. When the difference exceeds a preset threshold, data is migrated from high-wear blocks in the hot partition to low-wear blocks in the cold partition. Specifically,
[0140] Because HOTZone carries frequently updated data and COLDZone carries low-frequency, stable data, the average number of erases between the two zones may differ significantly after prolonged operation. The background wear leveling thread periodically calculates the average number of erases for HOTZone. Average number of erases with COLDZone And calculate the relative difference rate:
[0141]
[0142] When the relative difference rate exceeds a preset threshold, the system selects a source block with a high number of erases and containing valid pages in HOTZone, and a target block with a low number of erases in COLDZone. Valid pages from the source block are migrated to the target block, and the mapping is updated. After migration, the source block is erased, and the erase statistics for both HOT and COLD zones are updated. To avoid excessive background migration impacting foreground I / O, the system limits the maximum number of blocks migrated per round.
[0143] Table 1. Values for the Examples
[0144]
[0145] Functional verification and applicable boundaries:
[0146] This implementation method can be embedded in the FEMU platform for verification. It generates sequential read / write, random read / write, mixed read / write, multi-stream hot / cold distribution, and GC pressure load through FIO, and verifies the effectiveness of the method through indicators such as cache hit rate, IOPS, average latency, tail latency, GC count, and erase count differences.
[0147] Experimental results show the following: in hot read scenarios, DRAM cache hit rate and read performance are improved; in multi-stream hot and cold write scenarios, different types of data are mainly written to their corresponding zones; in write-intensive and mixed hot / cold scenarios, zone-aware GC reduces the amount of effective page migration; and in long-term skewed write scenarios, the difference in HOT / COLD wear is suppressed. It should be noted that in scenarios with simple access patterns such as pure sequential read and write, the basic FTL path is relatively short, and the stream identification, cache maintenance, and zone selection introduced by this method will incur a small amount of additional overhead. Therefore, its main applicable scenarios are complex workloads with significant background garbage collection pressure, including hot revisit scenarios, mixed hot and cold write scenarios, multi-stream concurrency, and hot / cold write scenarios.
[0148] While this application has been described herein with reference to specific embodiments, it should be understood that these embodiments are merely examples of the principles and applications of this application. Therefore, it should be understood that many modifications can be made to the exemplary embodiments, and other arrangements can be designed without departing from the spirit and scope of this application as defined by the appended claims. It should be understood that different dependent claims and features herein can be combined in ways different from those described in the original claims. It is also understood that features described in conjunction with individual embodiments can be used in other embodiments.
Claims
1. A flash memory translation layer management method based on stream-aware caching, applied to a solid-state drive controller, characterized in that, include: Upon receiving a write request, the system determines the target flow based on the logical address of the write request, compares the difference between the most recently accessed logical address and the current logical address of the target flow, determines whether the current access is a sequential or random access, and updates the sequential or random count to obtain the sequential access ratio. Based on the statistical information of the target flow and the sequential access ratio, the system determines the category of the target flow. The category includes at least hot flow, warm flow, and cold flow. Select the physical partition based on the category of the target stream, write the data to be written to the corresponding physical partition, update the mapping table, and insert the mapping information into the cache; The physical partitions include at least SLC partitions, hot partitions, warm partitions, and cold partitions; Upon receiving a read request, it first reads from the cache; if the cache is not found, it queries the mapping table and reads from flash memory. Based on the comparison results of the free page ratio of each physical partition with the corresponding threshold, requests for partitions to be reclaimed are generated and queued according to priority. Garbage collection is performed in order of priority, and different sacrificial block collection strategies are selected based on the physical partition type; Monitor the difference in the number of erases between hot and cold partitions. When the difference in the number of erases exceeds a preset threshold, migrate the data from the high-wear blocks in the hot partition to the low-wear blocks in the cold partition.
2. The flash memory translation layer management method based on stream-aware caching according to claim 1, characterized in that, The statistical information of the target flow includes at least the number of accesses, the most recent access time, and the sliding window access count; The method for determining the category of the target flow based on the statistical information and sequential access ratio of the target flow includes: Based on the time interval between the most recent access time of the target flow and the current logical address Calculate the historical impact of decay over time intervals. ; The sliding window access strength is obtained based on the sliding window access count. This includes: counting the total number of times the target flow is accessed within the most recent sliding window, dividing the total number of accesses by the product of the sliding window length and the heat flow reference access threshold to obtain the normalized access intensity; when the normalized access intensity is greater than 1, its value is restricted to 1; Calculate the overall popularity score : ; The historical heat value of the target stream. Historical weighting; Based on the comprehensive popularity score Based on the comparison results with the preset heat threshold and temperature threshold, and combined with the sequential access ratio, the target flow is classified into one of the following six types: hot sequential flow, hot random flow, temperature sequential flow, temperature random flow, cold flow, or system flow.
3. The flash memory translation layer management method based on stream-aware caching according to claim 1, characterized in that, The methods for selecting a physical partition based on the category of the target stream, writing the data to be written to the corresponding physical partition, updating the mapping table, and inserting the mapping information into the cache include: Based on the category of the target flow, the target physical partition is selected according to the following mapping rules: If the target stream is a system stream, then select the SLC partition; If the target flow is a hot sequential flow or a hot random flow, then select a hot partition; If the target flow is a warm sequential flow or a warm random flow, then select a warm partition; If the target flow is a cold flow, then select the cold zone; Check the free page status of the target physical partition: If the proportion of free pages is lower than the preset garbage collection threshold of the target physical partition, a corresponding garbage collection request will be triggered. Within the target physical partition, a new physical page is allocated based on the maintained independent write pointers; Write the data to be written to the allocated physical page, update the logical page to physical page mapping table and the reverse mapping table, and insert the mapping information of the logical page to physical page mapping table and the reverse mapping table into the cache.
4. The flash memory translation layer management method based on stream-aware caching according to claim 3, characterized in that, In the write request path, the system employs a write penetration strategy and an LRU-K replacement strategy.
5. The flash memory translation layer management method based on stream-aware caching according to claim 1, characterized in that, The method of prioritizing reading from the cache, and if the cache is not found, querying the mapping table and reading from flash memory includes: Receive a read request and obtain the logical address to be read; Locate the cache entry corresponding to the logical address in the DRAM cache; If the cache is hit, then: Update the access count and the time of the last K accesses for the corresponding cached entries; Move the corresponding cache entry to the head of the LRU list; Return the data stored in the cache to complete the read request; If the cache is not hit, then: Query the mapping table from logical address to physical address to obtain the target physical page address; Access the flash memory, read data from the target physical page address, and complete the read request; Based on the storage unit type and page type corresponding to the physical partition to which the target physical page belongs, the read operation latency is returned in the unified latency realization interface.
6. The flash memory translation layer management method based on stream-aware caching according to claim 1, characterized in that, Based on the comparison results of the free page ratio of each physical partition with the corresponding threshold, requests for partitions to be reclaimed are generated and queued according to priority. Methods for performing garbage collection in priority order and selecting different sacrificial block reclamation strategies based on physical partition type include: Physical partitions with a free page ratio lower than the preset garbage collection threshold will generate garbage collection requests and insert them into the queue in the priority order of urgent garbage collection requests, cold partitions, warm partitions, hot partitions, and SLC partitions. The background thread retrieves recycling requests according to priority and selects the sacrificial block based on the partition type: for SLC partitions, it selects the block with the fewest erases; for hot and cold partitions, it selects the block with the fewest valid pages. Perform valid page migration and block erasure on the sacrificed block.
7. The flash memory translation layer management method based on stream-aware caching according to claim 6, characterized in that, The process of writing the data to be written to the corresponding physical partition also includes: Check whether the proportion of free pages in the target physical partition is lower than the preset garbage collection threshold for the corresponding physical partition; If the value is below the garbage collection threshold, a regular garbage collection request is submitted. If the target physical partition fails to allocate physical pages, an emergency garbage collection request is submitted.
8. The flash memory translation layer management method based on stream-aware caching according to claim 1, characterized in that, The method for monitoring the difference in the number of erasers between hot and cold zones, and migrating data from high-wear blocks in the hot zone to low-wear blocks in the cold zone when the difference in the number of erasers exceeds a preset threshold, includes: Calculate the relative difference rate of the average number of wipes between the hot zone and the cold zone. When the relative difference rate exceeds 0.3, select the high wear block as the source block in the hot zone and the low wear block as the target block in the cold zone. Migrate valid pages from the source block to the target block, update the mapping table, and erase the source block. The number of blocks migrated in a single operation shall not exceed 0.1% of the total number of blocks.
9. A flash translation layer management apparatus based on stream-aware caching, comprising a storage device, a processor, and a computer program stored in the storage device and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the flash translation layer management method based on stream-aware cache as described in any one of claims 1 to 8.
10. A flash translation layer management system based on stream-aware caching, applied to a solid-state drive controller, characterized in that: include: The flow identification module is used to receive write requests, determine the target flow to which the write request belongs based on the logical address of the write request, compare the difference between the most recently accessed logical address of the target flow and the current logical address, determine whether the current access is a sequential access or a random access, and update the sequential count or random count to obtain the sequential access ratio; and determine the category of the target flow based on the statistical information of the target flow and the sequential access ratio; the category includes at least hot flow, warm flow and cold flow. The multi-level hot and cold zone module is used to select physical partitions according to the category of the target stream. The physical partitions include at least SLC partitions, hot partitions, warm partitions, and cold partitions. The data to be written is written to the corresponding physical partition, the mapping table is updated, and the mapping information is inserted into the cache. The DRAM Cache module is used to insert the mapping information after the write request is completed into the cache. It is also used to receive read requests, read from the cache first, and if the cache is not hit, it queries the mapping table and reads from the flash memory. The Stream-Aware GC module is used to generate requests for reclaimed partitions based on the comparison results of the proportion of free pages in each physical partition with the corresponding threshold, and to queue them by priority. Garbage collection is performed in order of priority, and different sacrificial block collection strategies are selected based on the physical partition type; The wear leveling module is used to monitor the difference in the number of erases between hot and cold partitions. When the difference in the number of erases exceeds a preset threshold, the data is migrated from the high-wear blocks in the hot partition to the low-wear blocks in the cold partition.