Garbage data recycling processing method, electronic device, storage medium and program product
By actively controlling the number of garbage data recycling read requests and performing pre-read operations, the low efficiency caused by overlapping garbage recycling read and write operations is solved, thus improving the garbage recycling efficiency of solid-state drives and the user experience.
Patent Information
- Application Number
- CN202511224536.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-29
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2045-08-29
AI Technical Summary
During the garbage data recycling process of solid-state drives, when the flash memory locations for garbage recycling read and write operations overlap, it can cause reads to wait for writes or writes to wait for reads, resulting in low recycling efficiency.
By actively controlling the number of read requests for garbage data recycling, the efficiency of solid-state drive garbage collection is improved by rate limiting. By using prefetching operations, the next page of multiple page data is prefetched from the first memory to the second memory, shortening the read waiting time.
This improves the efficiency of solid-state drive garbage collection, enhances the user experience under random write operations, and strengthens the product's market competitiveness.
Smart Images

Figure CN120743800B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computers, and in particular to a garbage data recycling processing method, an electronic device, a storage medium, and a program product. BACKGROUND
[0002] Due to physical property limitations, a solid state disk (SSD) flash memory cannot be directly overwritten. When a user updates data, the SSD firmware must first mark the original data as invalid, and then write the new data to other free blocks (the basic unit of SSD erasing). As the use time increases, the fragmented invalid data marked discontinuously will continue to accumulate. When the number of available space blocks is lower than a threshold, the firmware will actively trigger a garbage data recycling (GC) mechanism to release storage space by merging valid data and erasing blocks containing invalid data fragments, thereby maintaining the continuous random write of the SSD. The performance of continuous writing depends on the efficiency of GC. The faster the GC processing is, the higher the performance of user random writing is.
[0003] In the GC processing process, the back-end flash memory management module needs to process GC read requests while processing host write and GC write requests. When there are too many GC read requests on a single physical Lun (the basic unit of flash read / write / erase command execution), the response time of the write request will be increased. Once there is an overlap between the flash locations of the GC read and write operations, there will be a read waiting for write or a write waiting for read problem. During the waiting process, because the read or write cannot be completed, a large amount of software resources will be occupied. In fact, the location of the GC read is controllable. When the read-write waiting scenario occurs, the GC read can be selected to read other physical Luns first. In this way, the software resources wasted due to waiting can be greatly saved, thereby improving the recycling efficiency of GC. SUMMARY
[0004] The present application provides a garbage data recycling processing method, an electronic device, a storage medium, and a program product. The number of garbage data recycling read requests is actively controlled by the solid state disk firmware (FW), the efficiency of solid state disk garbage recycling is improved by limiting the flow, and at least the technical problem of low recycling efficiency caused by the overlap between the flash locations of the garbage recycling read and write operations in the related art is solved.
[0005] The present application provides a garbage data recycling processing method, which includes:
[0006] In response to the flash translation layer sending a garbage data recycling read request to a target flash command execution basic unit, the garbage data recycling read request is sequentially sorted according to time;
[0007] acquiring a number of garbage data recycling read requests being processed in the target flash command execution base unit;
[0008] determining, according to the number of garbage data recycling read requests being processed in the target flash command execution base unit, whether to add the current initiated garbage data recycling read request into a suspension list or send the current initiated garbage data recycling read request to the target flash command execution base unit;
[0009] in response to the target flash command execution base unit receiving a garbage data recycling read request, reading a plurality of page data corresponding to the garbage data recycling read request from the first memory, and determining whether to perform a pre-reading operation according to positions of the plurality of page data;
[0010] in response to performing the pre-reading operation, pre-reading next page data adjacent to the plurality of page data from the first memory to the second memory;
[0011] the target flash command execution base unit reads corresponding page data from the first memory or the second memory according to a new garbage data recycling read request, and performs garbage data erasing processing on the read page data.
[0012] The application further provides an electronic device, comprising a memory for storing a computer program and a processor for executing the computer program to implement the steps of any of the garbage data recycling processing methods.
[0013] in response to the flash translation layer sending a garbage data recycling read request to the target flash command execution base unit, sequentially sorting the garbage data recycling read request according to time;
[0014] acquiring a number of garbage data recycling read requests being processed in the target flash command execution base unit;
[0015] determining, according to the number of garbage data recycling read requests being processed in the target flash command execution base unit, whether to add the current initiated garbage data recycling read request into a suspension list or send the current initiated garbage data recycling read request to the target flash command execution base unit;
[0016] in response to the target flash command execution base unit receiving a garbage data recycling read request, reading a plurality of page data corresponding to the garbage data recycling read request from the first memory, and determining whether to perform a pre-reading operation according to positions of the plurality of page data;
[0017] in response to performing the pre-reading operation, pre-reading next page data adjacent to the plurality of page data from the first memory to the second memory;
[0018] The target flash command execution base unit reads corresponding page data from the first memory or the second memory according to a new garbage data recycling read request, and performs garbage data erasing processing on the read page data.
[0019] The application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program.
[0020] In response to the flash translation layer sending a garbage data recycling read request to the target flash command execution base unit, the garbage data recycling read request is sequentially sorted according to time.
[0021] The number of garbage data recycling read requests being processed in the target flash command execution base unit is acquired.
[0022] According to the number of garbage data recycling read requests being processed in the target flash command execution base unit, it is determined whether the garbage data recycling read request initiated this time is added to a suspension list or sent to the target flash command execution base unit.
[0023] In response to the target flash command execution base unit receiving a garbage data recycling read request, a plurality of page data corresponding to the garbage data recycling read request is read from the first memory, and it is determined whether a pre-reading operation is performed according to the positions of the plurality of page data.
[0024] In response to the pre-reading operation being performed, next page data adjacent to the plurality of page data is pre-read from the first memory to the second memory.
[0025] The target flash command execution base unit reads corresponding page data from the first memory or the second memory according to a new garbage data recycling read request, and performs garbage data erasing processing on the read page data.
[0026] The application further provides a computer program product, which comprises a computer program.
[0027] In response to the flash translation layer sending a garbage data recycling read request to the target flash command execution base unit, the garbage data recycling read request is sequentially sorted according to time.
[0028] The number of garbage data recycling read requests being processed in the target flash command execution base unit is acquired.
[0029] determining the number of garbage data recycling read requests being processed in the target flash command execution unit according to the target flash command execution unit, and determining whether to perform a pre-reading operation according to the position of the page data corresponding to the garbage data recycling read request;
[0030] reading the page data corresponding to the garbage data recycling read request from the first memory or the second memory according to the new garbage data recycling read request, and performing garbage data erasing processing on the read page data.
[0031] performing a pre-reading operation according to the position of the page data corresponding to the garbage data recycling read request.
[0032] performing a pre-reading operation according to the position of the page data corresponding to the garbage data recycling read request.
[0033] According to the present application, by suspending and adding the garbage data recycling read request greater than the first threshold value to the suspension list, the number of garbage data recycling read requests can be actively controlled, and the efficiency of solid state disk garbage recycling can be improved by flow control. In addition, when reading the garbage data recycling read request on each flash command execution unit, it is determined whether to perform a pre-reading operation according to the position of the page data corresponding to the garbage data recycling read request. The pre-reading operation can pre-read the next page of the plurality of page data from the first memory to the second memory. The new garbage data recycling read request can read the corresponding page data from the second memory. In this way, the reading waiting time of a single garbage data recycling read request can be shortened, and the recycling speed of the overall garbage data recycling read request can be ensured. BRIEF DESCRIPTION OF DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0035] Figure 1 The application environment diagram of the garbage data recycling processing method in an embodiment of the present application;
[0036] Figure 2 The flowchart of the garbage data recycling processing method in an embodiment of the present application;
[0037] Figure 3 The principle diagram of controlling the page data read by the second memory in an embodiment of the present application;
[0038] Figure 4 A flowchart of a step of reading a page in a continuous feature group in a read request into a second memory according to a read identifier by a target flash command execution base unit in an embodiment of the present application;
[0039] Figure 5 A structural block diagram of a garbage data recycling processing device in an embodiment of the present application;
[0040] Figure 6 An internal structural diagram of a computer device in an embodiment of the present application. DETAILED DESCRIPTION
[0041] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, any other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0042] It should be noted that, in the description of the present application, the terms “comprise”, “contain” or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such a process, method, article or device. The terms “first”, “second” and the like in the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0043] In order for those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0044] The garbage data recycling processing method provided by the present application can be applied in an application environment as shown in the figure. Figure 1 As shown in the figure, the minimum unit of Nand particle execution instruction is Lun, and Lun is the basic unit of flash read / write / erase command execution. Block is the basic unit of solid state disk erasing. Page is the minimum unit of data writing, usually 16K, and a block contains thousands of pages. In the process of garbage data recycling (GC) processing, the position of the GC read request has the feature of continuous reading from small to large in terms of the number of pages in a single Lun. When the flash management module finds that the continuous N read request messages meet this feature, the flash management module can read the data to be read from the flash next time to the NAND cache in advance. This can shorten the waiting time of a single GC read request message in the back-end management module, thereby further improving the processing efficiency of the GC read message.
[0045] The flash translation layer module (FTL) sets a threshold of the maximum supported number of GC read messages on each lun, and records and manages the number of messages that have been initiated but not completed on each lun when initiating GC read. Once the number of messages recorded on the lun is greater than the set threshold, the flash translation layer module (FTL) no longer initiates GC read on the lun, and stores the GC read messages that have not allocated buff resources on the pending list of the corresponding lun, until the number of unfinished GC read messages on the lun is lower than the threshold, the FTL can process the pending list, and the message processing on the pending list needs to be in order.
[0046] In the GC scenario, if the number of GC read messages of a lun reaches or exceeds the threshold, it means that the GC read waiting time on the lun is too long, that is, the number of write messages executing and queuing on the lun is too large, and controlling the number of GC read messages sent can effectively guarantee the timely processing of GC write messages. At the same time, controlling the number of GC read messages on a single lun can also prevent the problem of occupying too many software resources on a single lun during GC read, causing the flash translation layer module (FTL) to be unable to initiate GC read on other physical luns.
[0047] As shown in Figure 2 The embodiment of the present application provides a garbage data recycling processing method, which comprises the following steps:
[0048] Step S1, in response to the flash translation layer sending a garbage data recycling read request to a target flash command execution basic unit, sequentially sorting the garbage data recycling read request according to time;
[0049] Step S2, acquiring the number of garbage data recycling read requests being processed in the target flash command execution basic unit;
[0050] Step S3, determining whether the garbage data recycling read request initiated this time is added to the pending list or sent to the target flash command execution basic unit according to the number of garbage data recycling read requests being processed in the target flash command execution basic unit;
[0051] Step S4, in response to the target flash command execution basic unit receiving the garbage data recycling read request, reading a plurality of page data corresponding to the garbage data recycling read request from the first memory, and determining whether to perform a pre-reading operation according to the positions of the plurality of page data;
[0052] Step S5, in response to performing the pre-reading operation, pre-reading next page data adjacent to the plurality of page data from the first memory to the second memory;
[0053] In step S6, the target flash command execution base unit reads corresponding page data from the first memory or the second memory according to the new garbage data recycling read request, and performs garbage data erasing processing on the read page data.
[0054] By suspending the garbage data recycling read request greater than the first threshold value and adding it to the suspension list, the number of garbage data recycling read requests can be actively controlled, and the efficiency of solid state disk garbage recycling can be improved. In addition, when reading the garbage data recycling read request on each flash command execution base unit, it is determined whether to perform a pre-reading operation by the plurality of page data positions corresponding to the garbage data recycling read request. The pre-reading operation can pre-read the next page of the plurality of page data from the first memory to the second memory. The new garbage data recycling read request can read corresponding page data from the second memory. In this way, the read waiting time of a single garbage data recycling read request can be shortened to ensure the recycling speed of the overall garbage data recycling read request.
[0055] The application can improve the garbage recycling efficiency of the solid state disk product in the random write scenario, improve the user experience in the random write operation, and improve the market competitiveness of the product.
[0056] In the embodiment, the determination of whether the garbage data recycling read request initiated this time is added to the suspension list or sent to the target flash command execution base unit according to the number of garbage data recycling read requests being processed in the target flash command execution base unit includes:
[0057] In response to the number of garbage data recycling read requests being processed in the target flash command execution base unit being less than or equal to the first threshold value, it is determined whether there is a suspended garbage data recycling read request in the suspension list;
[0058] In response to there being a suspended garbage data recycling read request in the suspension list, one garbage data recycling read request is obtained from the suspension list in a first-in-first-out order and sent to the target flash command execution base unit, and the garbage data recycling read request initiated this time is suspended and added to the suspension list;
[0059] In response to there being no suspended garbage data recycling read request in the suspension list, the garbage data recycling read request initiated this time is sent to the target flash command execution base unit.
[0060] By controlling the number of GC read sent, the utilization efficiency of software cache resources such as CTX, Dram, SRAM, etc. in the random write scenario can be improved. CTX is the context identifier of ipc communication. SRAM is a static random storage unit, which is expensive and generally has only a few MB inside the SSD and can be used to store data read by GC. DRAM is a dynamic random storage unit, which has lower performance than SRAM and can be used to store data read by GC.
[0061] In the embodiment, the garbage data recycling processing method further comprises:
[0062] The order of the plurality of flash command execution basis units that initiate the garbage data recycling read request is set in the flash translation layer, and the flash translation layer initiates the garbage data recycling read request in turn according to the order of the plurality of flash command execution basis units;
[0063] In response to completing a round of garbage data recycling read requests in the plurality of flash command execution basis units, it is determined whether there is buffer resource, if there is buffer resource, the next round of garbage data recycling read request is repeatedly initiated according to the order of the plurality of flash command execution basis units, otherwise, it is determined whether there is buffer resource after a first time period.
[0064] In the embodiment, the garbage data recycling processing method further comprises:
[0065] In the embodiment, the garbage data recycling processing method further comprises:
[0066] A recycling processing array is set in the flash memory corresponding to each flash command execution basis unit, the recycling processing array arranges the garbage data recycling read requests in time sequence, and a queue number is set for the garbage data recycling read requests in the recycling processing array;
[0067] In response to the number of garbage data recycling read requests being processed in the target flash command execution basis unit being less than or equal to a first threshold value, and there being no suspended garbage data recycling read request in the suspension list, the garbage data recycling read request with the smallest queue number in the recycling processing array is sent to the target flash command execution basis unit.
[0068] Specifically, the flash translation layer module (FTL) creates a linked list for each flash command execution basis unit (lun) in the initialization stage, creates a recycling processing array g_gc_read_msg [MAX_LUN] that records the number of garbage data recycling read requests, MAX_LUN is the number of lun, that is, the recycling processing array of the nth flash command execution basis unit (lun) is g_gc_read_msg [n], and the first threshold value of the number of garbage data recycling read requests sent by each lun is MAX_GC_READ_NUMS.
[0069] When initiating a GC read operation, it is first determined whether the value of g_gc_read_msg[lun index] is greater than MAX_GC_READ_NUMS. If it is greater than MAX_GC_READ_NUMS, the GC read message of this time is sequentially added to the list of the corresponding lun, otherwise, the buffer resource is applied, and then the GC read message is sent, and g_gc_read_msg[lun] is incremented.
[0070] When receiving a GC read completion message, g_gc_read_msg[lun] is first decremented, and then it is determined whether the list of the corresponding lun is empty. If it is empty, the data read this time is directly processed. If it is not empty, the message of a list node is sequentially taken, and after applying the buffer resource, it is sent out, and g_gc_read_msg[lun] is incremented, and then the data read this time is processed.
[0071] The garbage data recovery processing array is set to control the garbage data recovery read request greater than the first threshold to be suspended and added to the suspension list, and the garbage data recovery read request added to the suspension list is effectively controlled.
[0072] In the embodiment, the garbage data recovery processing method further comprises:
[0073] In response to the garbage data recovery read request with the smallest queue number in the recovery processing array being sent, the queue number of the garbage data recovery read request in the recovery processing array is updated.
[0074] The queue number is updated in the recovery processing array, so that the value of the queue number will not gradually increase.
[0075] In the embodiment, the determination of whether to perform the pre-reading operation according to the plurality of page data positions comprises:
[0076] The number of garbage data erasing processing execution units in the target flash command execution basic unit in an idle state is obtained, and it is determined whether the target flash command execution basic unit is idle or busy according to the number of garbage data erasing processing execution units in an idle state.
[0077] In response to the target flash command execution basic unit being idle, the pre-reading identifier carried by the garbage data recovery read request is set to the first value when the garbage data recovery read request is sent to the target flash command execution basic unit in the flash translation layer.
[0078] In response to the target flash command execution basic unit being busy, the pre-reading identifier carried by the garbage data recovery read request is set to the second value when the garbage data recovery read request is sent to the target flash command execution basic unit in the flash translation layer.
[0079] in response to detecting that the garbage data recycling read request carries the pre-reading identifier as the first value, not performing the pre-reading operation;
[0080] in response to detecting that the garbage data recycling read request carries the pre-reading identifier as the second value, determining whether to perform the pre-reading operation according to whether the reading position of the page data in the garbage data recycling read request meets a preset rule.
[0081] Specifically, the determining whether to perform the pre-reading operation according to whether the reading position of the page data in the garbage data recycling read request meets the preset rule comprises:
[0082] recording position information of pages read from the first memory for a preset number of times most recently by the target flash memory command execution unit, and determining whether the reading position of the page data in the garbage data recycling read request is continuous;
[0083] in response to the reading position of the page data in the garbage data recycling read request being continuous, stopping recording the position of the garbage data recycling read request, determining that the pre-reading condition is met, and performing the pre-reading operation;
[0084] in response to the reading position of the page data in the garbage data recycling read request being discontinuous, determining that the pre-reading condition is not met, and not performing the pre-reading operation.
[0085] Preferably, the first value is 0, and the second value is 1. Limiting the number of page readings in each flash memory command execution unit can improve the processing efficiency of a single flash memory command execution unit and avoid the overlap of GC read and write operations in the flash memory position.
[0086] As shown in FIG. 2, Figure 3 in the embodiment, the preset number of times is set to three, and in response to detecting that the reading positions in the second memory for three times are continuous three pages, the position of the garbage data recycling read request is stopped from being recorded, and the next page data is pre-read from the second memory to the second memory.
[0087] wherein, if the channel processor detects that three continuous page readings have been performed on a single physical lun, the channel processor will actively send a read message to the second memory to read the next continuous page. In this way, when the next page of the GC read request is read, the page data can be directly obtained from the second memory pre-read, thereby saving the transmission time of the GC read, shortening the waiting time of the single GC read request message in the back-end management module, and further improving the processing efficiency of the GC read request.
[0088] Specifically, the application triggers reading GC when the number of blocks is less than 20, and ends reading GC when the number of blocks is greater than 22. When the number of free blocks is less than the low water line 7, the target flash command execution unit is idle, and when the number of free blocks is greater than the high water line 12, the target flash command execution unit is busy. When the number of free blocks is at the low water line, the GC pressure is extremely large, and the GC read request message sent by the flash translation layer module (FTL) carries a mark indicating that GC pre-reading is required.
[0089] In the embodiment, the target flash command execution unit reads the corresponding page data from the first memory or the second memory according to the new garbage data recycling read request, including:
[0090] determining whether the new garbage data recycling read request hits the page data in the second memory;
[0091] In response to hitting the page data in the second memory, the page data in the second memory is transferred to the flash translation layer, and the next page data is pre-read into the second memory;
[0092] In response to not hitting the page data in the second memory, the data corresponding to the new garbage data recycling read request is sent to the target flash command execution unit from the first memory.
[0093] In the embodiment, the garbage data recycling processing method further includes:
[0094] In response to the read position of the page data in the garbage data recycling read request being continuous, a read request continuous characteristic group is formed according to the page data with continuous reading characteristics identified by the garbage data recycling read request;
[0095] determining whether the target flash command execution unit reads the next page from the current continuous characteristic group, and if so, reading the next page data from the second memory;
[0096] In response to detecting that the second memory does not have the read page, the second memory sends a read message to read the next read request continuous characteristic group;
[0097] In response to detecting that the number of read pages in the second memory is greater than the second threshold, reading pages from the currently read read request continuous characteristic group is suspended;
[0098] In response to detecting that the number of read pages in the second memory is less than or equal to the second threshold, pages are read from the currently read read request continuous characteristic group.
[0099] Whereby controlling the number of pages in the second memory can indirectly affect the read page data pre-read by the single flash command execution base unit from the second memory, so as to shorten the read waiting time of the single GC read request message, thereby further improving the processing efficiency of the GC read message.
[0100] As shown in Figure 4 whether the target flash command execution base unit reads the next page from the current continuous feature group, if yes, then reading the next page data from the second memory includes:
[0101] Obtaining the read identifier set in each read request continuous feature group;
[0102] In response to the read identifier being the second value, the last three read position information of the target flash command execution base unit is started to be recorded, whether the garbage data recycling read request pre-reading condition is met is judged, if yes, then the page in the read request continuous feature group is controlled to be read into the second memory continuously;
[0103] In response to the read identifier being the first value, the page in the read request continuous feature group is controlled not to be read into the second memory.
[0104] Specifically, after receiving the GC read message, if the GC pre-reading mark is found to be set to 1, the last three read position information on each lun is started to be recorded.
[0105] The GC read message is generally a multi-page (multi page) read mode, so if the backend message processing module detects that the three read positions are three consecutive multi pages, it stops recording the position of the GC read request, and pre-reads the next multi page into the second memory.
[0106] When receiving the next read request (including GC read and non-GC read), if it hits the pre-read second memory (nand cache), the backend message processing module continues to actively initiate the read request of the next multi page, if it does not hit the nand cache, the backend message processing module starts to record the last three read positions of each lun again.
[0107] When the number of idle blocks is at the high water line, the GC read message sent by the flash translation layer module (FTL) will not set the pre-reading mark, and the backend message processing module will not pre-read the new position after receiving the GC read request message, and set the pre-reading position number information of the corresponding lun to 0.
[0108] In this embodiment, the garbage data recycling processing method further includes:
[0109] When a bad block is detected in the read request continuity feature group, the physical address of the bad block is recorded and the bad block mapping table is updated;
[0110] Skipping bad block reading adjacent valid pages;
[0111] Recalculating the continuity feature of the read request continuity feature group;
[0112] When the number of consecutive bad blocks exceeds a third threshold, triggering a bad block recycling program.
[0113] Among them, a perfect exception handling process is established to enhance reliability.
[0114] In this embodiment, the garbage data recycling processing method further comprises:
[0115] Monitoring the processing delay time and throughput of the target flash command execution basic unit;
[0116] When the processing delay time exceeds the preset delay threshold, the first threshold and the second threshold are reduced by a first proportion;
[0117] When the throughput is lower than the preset throughput threshold, the first threshold is increased by a second proportion;
[0118] The first proportion and the second proportion are dynamically adjusted according to the remaining space of the second memory.
[0119] Specifically, the garbage data recycling processing method further comprises:
[0120] Recording the processing timestamp when each garbage collection read request (GC) is completed;
[0121] Calculate the average delay of multiple garbage collection read requests in the sliding window;
[0122] When the average delay is greater than the preset delay threshold, delay the garbage collection read request trigger, and reduce the first threshold and the second threshold by a first proportion;
[0123] Record the number of completed requests through a hardware counter;
[0124] Calculate the current throughput;
[0125] When the current throughput is detected to be less than the preset throughput threshold, perform throughput compensation, and increase the first threshold by a second proportion.
[0126] Among them, the mechanism of dynamically adjusting the first threshold and the second threshold can improve the adaptability of the system.
[0127] In this embodiment, the garbage data recycling processing method further comprises:
[0128] Allocating a recycling processing array to the flash command execution basic unit;
[0129] When it is detected that the loads of the plurality of flash command execution base units are unbalanced, the plurality of flash command execution base units are sorted in descending order of load rates, a first number of flash command execution base units in front of the sorted order are taken as high-load units, and a second number of flash command execution base units behind the sorted order are taken as low-load units;
[0130] Part of the garbage data recycling read requests in the recycling processing array of the high-load units are migrated to the low-load units.
[0131] The load balancing strategy is introduced to optimize parallel processing efficiency and improve garbage data recycling read request processing efficiency.
[0132] In the embodiment, the garbage data recycling processing method further includes performance monitoring and feedback.
[0133] The performance monitoring and feedback includes:
[0134] The processing time stamp of each garbage data recycling read request is recorded in real time.
[0135] The number of read requests completed in a unit time and the processing delay distribution are counted.
[0136] According to the statistical results, at least one of the following parameters is dynamically adjusted: the priority strategy of the suspension list, the queue number allocation rule of the recycling processing array, and the trigger condition of the pre-reading.
[0137] The performance monitoring and feedback are added to realize closed-loop optimization and improve the efficiency of garbage data recycling processing.
[0138] In the garbage data recycling processing method, the garbage data recycling read requests greater than the first threshold value are suspended and added to the suspension list, so that the number of garbage data recycling read requests can be actively controlled, and the efficiency of solid state disk garbage recycling is improved. In addition, when reading the garbage data recycling read request on each flash command execution base unit, it is determined whether to perform a pre-reading operation through a plurality of page data positions corresponding to the garbage data recycling read request. The pre-reading operation can pre-read the next page of the plurality of page data from the first memory to the second memory. The new garbage data recycling read request can read the corresponding page data from the second memory. In this way, the reading waiting time of a single garbage data recycling read request can be shortened to ensure the recycling speed of the overall garbage data recycling read request.
[0139] From the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases the former is a better embodiment.
[0140] In one embodiment, asFigure 5 As shown, a garbage data recycling processing apparatus 10 is provided, comprising: a recycling read request management module 1, a processing quantity statistics module 2, a suspension list management module 3, and a garbage data erasing processing module 4.
[0141] The recycling read request management module 1 is configured to sequentially sort the garbage data recycling read requests according to time in response to the flash translation layer sending a garbage data recycling read request to the target flash command execution base unit.
[0142] The processing quantity statistics module 2 is configured to acquire the number of garbage data recycling read requests being processed in the target flash command execution base unit.
[0143] The suspension list management module 3 is configured to determine whether to add the garbage data recycling read request initiated this time to the suspension list or send it to the target flash command execution base unit according to the number of garbage data recycling read requests being processed in the target flash command execution base unit.
[0144] The garbage data erasing processing module 4 is configured to read a plurality of page data corresponding to the garbage data recycling read request from the first memory in response to the target flash command execution base unit receiving the garbage data recycling read request, and determine whether to perform a pre-reading operation according to the positions of the plurality of page data; in response to performing the pre-reading operation, pre-read the next page data adjacent to the plurality of page data from the first memory to the second memory; and the target flash command execution base unit reads the corresponding page data from the first memory or the second memory according to the new garbage data recycling read request, and performs garbage data erasing processing on the read page data.
[0145] In this embodiment, determining whether to add the garbage data recycling read request initiated this time to the suspension list or send it to the target flash command execution base unit according to the number of garbage data recycling read requests being processed in the target flash command execution base unit comprises: in response to the number of garbage data recycling read requests being processed in the target flash command execution base unit being less than or equal to a first threshold value, determining whether there is a suspended garbage data recycling read request in the suspension list; in response to there being a suspended garbage data recycling read request in the suspension list, acquiring one garbage data recycling read request from the suspension list in a first-in-first-out order and sending it to the target flash command execution base unit, and suspending and adding the garbage data recycling read request initiated this time to the suspension list; and in response to there being no suspended garbage data recycling read request in the suspension list, sending the garbage data recycling read request initiated this time to the target flash command execution base unit.
[0146] In this embodiment, the garbage data erasing processing module 4 is configured to:
[0147] In response to the target flash command execution base unit receiving a new garbage data recycling read request, the application buffer resource is applied, and garbage data erasing processing is performed according to the new garbage data recycling read request.
[0148] In the embodiment, the garbage data erasing processing module 4 is configured to:
[0149] The order of the plurality of flash command execution base units initiating the garbage data recycling read request is set in the flash translation layer, and the flash translation layer initiates the garbage data recycling read request in turn according to the order of the plurality of flash command execution base units;
[0150] In response to completing a round of garbage data recycling read requests in the plurality of flash command execution base units, it is determined whether there is a buffer resource, if there is a buffer resource, the next round of garbage data recycling read request is repeatedly initiated according to the order of the plurality of flash command execution base units, otherwise, it is determined whether there is a buffer resource after a first time period.
[0151] In the embodiment, as shown in Figure 5 The recycling processing array management module 5 is configured to:
[0152] A recycling processing array is set in the flash memory corresponding to each flash command execution base unit, the recycling processing array arranges the garbage data recycling read requests in time sequence, and sets a queue number for the garbage data recycling read requests in the recycling processing array;
[0153] In response to the number of garbage data recycling read requests being processed in the target flash command execution base unit being less than or equal to a first threshold value, and there being no suspended garbage data recycling read request in the suspension list, the garbage data recycling read request with the smallest queue number in the recycling processing array is sent to the target flash command execution base unit.
[0154] In the embodiment, the recycling processing array management module 5 is configured to:
[0155] In response to the garbage data recycling read request with the smallest queue number in the recycling processing array being sent, the queue number of the garbage data recycling read request in the recycling processing array is updated.
[0156] In the embodiment, the determination of whether to perform the pre-reading operation according to the plurality of page data positions comprises:
[0157] The number of garbage data erasing processing execution units in the target flash command execution base unit in an idle state is obtained, and the target flash command execution base unit is determined to be idle or busy according to the number of garbage data erasing processing execution units in an idle state.
[0158] In response to the target flash command execution base unit being idle, when the flash translation layer sends a garbage data recycling read request to the target flash command execution base unit, the pre-read flag carried in the garbage data recycling read request is set to the first value;
[0159] In response to the target flash command execution base unit being busy, when the flash translation layer sends a garbage data recycling read request to the target flash command execution base unit, the garbage data recycling read request carries a pre-read flag of the second value.
[0160] In response to the detection of a garbage data recycling read request carrying a pre-read flag of the first value, no pre-read operation is performed;
[0161] In response to the detection that a garbage data recycling read request carries a pre-read identifier of a second value, whether to perform a pre-read operation is determined based on whether the reading position of the page data in the garbage data recycling read request meets a preset rule.
[0162] The step of determining whether to perform a pre-read operation based on whether the reading position of the page data in the garbage data recycling read request meets a preset rule includes:
[0163] Record the location information of the page that the target flash memory command execution base unit has read from the first memory the most recent preset number of times, and determine whether the read positions of the page data in the garbage data reclamation read request are continuous;
[0164] If the page data read position in the garbage data recycling read request is continuous, then stop recording the position of the garbage data recycling read request, determine that the pre-read condition is met, and perform the pre-read operation;
[0165] If the page data read position in the garbage data recycling read request is not continuous, it is determined that the pre-read condition is not met and no pre-read operation is performed.
[0166] In this embodiment, as Figure 5 As shown, the garbage data recycling and processing device 10 also includes a read request rate limiting control module 6, which is used for:
[0167] In response to the continuous reading position of page data in the garbage data recycling read request, pages with continuous reading characteristics are identified based on the garbage data recycling read request to form a continuous feature group of read requests;
[0168] Determine whether the target flash memory command execution base unit has read the next page from the current contiguous feature group; if so, read the next page data from the second memory.
[0169] When the second memory detects that there is no page to be read, the second memory sends a read message to read the next consecutive feature group of read requests;
[0170] In response to detecting that the number of pages read in the second memory is greater than the second threshold, then suspending reading pages from the read request continuous feature group currently being read;
[0171] In response to detecting that the number of pages read in the second memory is less than or equal to the second threshold, then reading pages from the read request continuous feature group currently being read.
[0172] In this embodiment, as shown in Figure 5 The garbage data recycling processing device 10 further comprises an exception handling module 7, which is configured to:
[0173] When a bad block is detected in the read request continuous feature group, record the physical address of the bad block and update the bad block mapping table;
[0174] Skip the bad block and read the adjacent valid pages;
[0175] Recalculate the continuity feature of the read request continuous feature group;
[0176] When the number of continuous bad blocks exceeds a third threshold, trigger a bad block recycling program.
[0177] In this embodiment, as shown in Figure 5 The garbage data recycling processing device 10 further comprises a threshold dynamic adjustment module 8, which is configured to:
[0178] Monitor the processing delay time and throughput of the target flash command execution basic unit;
[0179] When the processing delay time exceeds a preset delay threshold, reduce the first threshold and the second threshold by a first proportion;
[0180] When the throughput is lower than a preset throughput threshold, increase the first threshold by a second proportion;
[0181] Wherein the first proportion and the second proportion are dynamically adjusted according to the remaining space of the second memory.
[0182] In this embodiment, as shown in Figure 5 The garbage data recycling processing device 10 further comprises a parallel processing optimization module 9, which is configured to:
[0183] Assign a recycling processing array to the flash command execution basic unit;
[0184] When it is detected that the load of multiple flash command execution basic units is unbalanced, sort the multiple flash command execution basic units in descending order of load rate, take the first number of flash command execution basic units in the sorting order as high-load units, and take the second number of flash command execution basic units in the sorting order as low-load units;
[0185] Migrate part of the garbage data recycling read requests in the recycling processing array of the high-load unit to the low-load unit.
[0186] In the garbage data recycling processing device, by suspending the garbage data recycling read request greater than the first threshold value and adding it to the suspension list, the number of garbage data recycling read requests can be actively controlled, and the efficiency of solid state disk garbage recycling can be improved by limiting the flow. In addition, when reading the garbage data recycling read request on each flash command execution basic unit, it is determined whether to perform a pre-reading operation by a plurality of page data positions corresponding to the garbage data recycling read request. The pre-reading operation can pre-read the next page of the plurality of page data from the first memory to the second memory. The new garbage data recycling read request can read the corresponding page data from the second memory. In this way, the reading waiting time of a single garbage data recycling read request can be shortened to ensure the recycling speed of the overall garbage data recycling read request.
[0187] The features of the embodiments of the garbage data recycling processing device can be referred to the related descriptions of the embodiments of the garbage data recycling processing method, which will not be repeated here.
[0188] Embodiments of the present application also provide an electronic device, including a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above garbage data recycling processing method embodiments.
[0189] In one embodiment, the electronic device can be a server, and its internal structure diagram can be as shown in Figure 6 The electronic device includes a processor, a memory, a network interface and a database connected through a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The database of the electronic device is used to store garbage data recycling processing data. The network interface of the electronic device is used to communicate with the external terminal through the network connection. The computer program is executed by the processor to implement a garbage data recycling processing method.
[0190] Embodiments of the present application also provide a computer readable storage medium, which stores a computer program, wherein the computer program is configured to run to perform the steps in any of the above garbage data recycling processing method embodiments.
[0191] In an example embodiment, the computer readable storage medium described above can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.
[0192] Embodiments of the present application also provide a computer program product, which comprises a computer program. When the computer program is executed by a processor, the steps in any of the garbage data recycling processing method embodiments described above are implemented.
[0193] Embodiments of the present application also provide another computer program product, which comprises a non-volatile computer readable storage medium. The non-volatile computer readable storage medium stores a computer program. When the computer program is executed by a processor, the steps in any of the garbage data recycling processing method embodiments described above are implemented.
[0194] The skilled in the art can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be realized in electronic hardware, computer software or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in the above description in general terms. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. The skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0195] The above provides a garbage data recycling processing method, an electronic device, a storage medium and a program product. The principles and implementation modes of the present application are described by applying specific examples. The above description of the examples is only applicable to help understand the method and its core idea. It should be pointed out that for those skilled in the art, without departing from the principles of the present application, some improvements and modifications can be made to the present application. These improvements and modifications also fall within the scope of protection of the present application.
Claims
1. A garbage data recycling processing method, characterized by, The method comprises the following steps: in response to the flash translation layer sending a garbage data recovery read request to a target flash command execution unit, sequentially sorting the garbage data recovery read request according to time; obtaining the number of garbage data recovery read requests being processed in the target flash command execution unit; determining whether the garbage data recovery read request initiated this time is added to a suspension list or sent to the target flash command execution unit according to the number of garbage data recovery read requests being processed in the target flash command execution unit; in response to the target flash command execution unit receiving a garbage data recovery read request, reading a plurality of page data corresponding to the garbage data recovery read request from a first memory, and determining whether to perform a pre-reading operation according to the position of the plurality of page data; in response to performing a pre-reading operation, pre-reading the next page data adjacent to the plurality of page data from the first memory to a second memory; the target flash command execution unit reads the corresponding page data from the first memory or the second memory according to a new garbage data recovery read request, and performs garbage data erasure processing on the read page data; wherein, the determination whether the garbage data recovery read request initiated this time is added to the suspension list or sent to the target flash command execution unit according to the number of garbage data recovery read requests being processed in the target flash command execution unit comprises: in response to the number of garbage data recovery read requests being processed in the target flash command execution unit being less than or equal to a first threshold, determining whether there is a suspended garbage data recovery read request in the suspension list; in response to there being a suspended garbage data recovery read request in the suspension list, sending a garbage data recovery read request from the suspension list to the target flash command execution unit in a first-in-first-out order, and suspending and adding the garbage data recovery read request initiated this time to the suspension list; in response to there being no suspended garbage data recovery read request in the suspension list, sending the garbage data recovery read request initiated this time to the target flash command execution unit.
2. The garbage data reclamation processing method according to claim 1, characterized by, Further comprising: setting the order of a plurality of flash command execution units in the flash translation layer for initiating a garbage data recovery read request, and the flash translation layer initiates a garbage data recovery read request in the order of the plurality of flash command execution units; in response to completing a round of garbage data recovery read requests in the plurality of flash command execution units, determining whether there is a buffer resource, if there is a buffer resource, continuing to initiate the next round of garbage data recovery read requests in the order of the plurality of flash command execution units, otherwise, pausing for a first time period and then determining whether there is a buffer resource.
3. The garbage data reclamation processing method according to claim 2, characterized by, Further comprising: setting a recovery processing array in the flash memory corresponding to each flash command execution unit, the recovery processing array arranges the garbage data recovery read requests in time sequence, and sets a queue number for the garbage data recovery read requests in the recovery processing array; In response to the number of garbage data recycling read requests being processed in the target flash command execution base unit being less than or equal to a first threshold value and there being no suspended garbage data recycling read request in the suspension list, a garbage data recycling read request with the smallest queue number in the recycling processing array is sent to the target flash command execution base unit.
4. The garbage data reclamation processing method according to claim 3, characterized by, Also comprising: In response to the garbage data recycling read request with the smallest queue number in the recycling processing array being sent, the queue number of the garbage data recycling read request in the recycling processing array is updated.
5. The garbage data reclamation processing method according to claim 3, characterized by, The determination of whether to perform a pre-reading operation according to the positions of the plurality of page data comprises: The number of garbage data erasing processing execution units in the target flash command execution base unit being in an idle state is obtained, and it is determined whether the target flash command execution base unit is idle or busy according to the number of garbage data erasing processing execution units being in an idle state; In response to the target flash command execution base unit being idle, when the flash translation layer sends a garbage data recycling read request to the target flash command execution base unit, the pre-reading identifier carried by the garbage data recycling read request is set to a first value; In response to the target flash command execution base unit being busy, when the flash translation layer sends a garbage data recycling read request to the target flash command execution base unit, the pre-reading identifier carried by the garbage data recycling read request is set to a second value; In response to detecting that the pre-reading identifier carried by the garbage data recycling read request is the first value, no pre-reading operation is performed; In response to detecting that the pre-reading identifier carried by the garbage data recycling read request is the second value, it is determined whether to perform a pre-reading operation according to whether the reading position of the page data in the garbage data recycling read request meets a preset rule.
6. The garbage data reclamation processing method according to claim 5, characterized by, The determination of whether to perform a pre-reading operation according to whether the reading position of the page data in the garbage data recycling read request meets a preset rule comprises: The position information of the pages read from the first memory by the target flash command execution base unit for a preset number of times recently is recorded, and it is determined whether the reading position of the page data in the garbage data recycling read request is continuous; In response to the reading position of the page data in the garbage data recycling read request being continuous, the recording of the position of the garbage data recycling read request is stopped, it is determined that the pre-reading condition is met, and a pre-reading operation is performed; In response to the reading position of the page data in the garbage data recycling read request not being continuous, it is determined that the pre-reading condition is not met, and no pre-reading operation is performed.
7. The garbage data reclamation processing method according to claim 1, characterized by, The reading of corresponding page data from the first memory or the second memory by the target flash command execution base unit according to a new garbage data recycling read request comprises: It is determined whether the new garbage data recycling read request hits the page data in the second memory; In response to hitting the page data in the second memory, the page data in the second memory is transferred to the flash translation layer, and the next page data is pre-read into the second memory; In response to a page data in the second memory not being hit, data corresponding to the new garbage data recycling read request is sent from the first memory to the target flash command execution base unit.
8. The garbage data reclamation processing method according to claim 6, characterized by, Further comprising: In response to a read position of page data in the garbage data recycling read request being continuous, a page with a continuous read feature is identified from the garbage data recycling read request to form a read request continuous feature group; Judging whether the target flash command execution base unit reads a next page from a current continuous feature group, and if so, reading a next page data from the second memory; In response to detecting that the second memory does not have a read page, the second memory sends a read message to read a next read request continuous feature group; In response to detecting that a number of read pages in the second memory is greater than a second threshold value, reading a page from a currently read read request continuous feature group is suspended; In response to detecting that the number of read pages in the second memory is less than or equal to the second threshold value, a page is read from the currently read read request continuous feature group.
9. The garbage data reclamation processing method according to claim 8, characterized by, Further comprising: When a bad block is detected in the read request continuous feature group, a bad block physical address is recorded and a bad block mapping table is updated; A neighboring valid page is read by skipping the bad block; Continuity features of the read request continuous feature group are recalculated; When a number of continuous bad blocks exceeds a third threshold value, a bad block recycling program is triggered.
10. The garbage data reclamation processing method according to claim 8, characterized by, Further comprising: Processing delay time and throughput of the target flash command execution base unit are monitored; When the processing delay time exceeds a preset delay threshold value, the first threshold value and the second threshold value are reduced by a first proportion; When the throughput is lower than a preset throughput threshold value, the first threshold value is increased by a second proportion; The first proportion and the second proportion are dynamically adjusted according to a remaining space of the second memory.
11. The garbage data reclamation processing method according to claim 1, characterized by, Further comprising: A recycling processing array is allocated to the flash command execution base unit; When it is detected that loads of a plurality of the flash command execution base units are unbalanced, the plurality of the flash command execution base units are sorted in a descending order of load rates, a first number of the flash command execution base units in a front of the sorting order are taken as high-load units, and a second number of the flash command execution base units in a rear of the sorting order are taken as low-load units; Part of garbage data recycling read requests in the recycling processing array of the high-load units are migrated to the low-load units.
12. An electronic device, comprising: Comprising: A memory for storing a computer program; A processor for implementing steps of the garbage data recycling processing method according to any one of claims 1 to 11 when the computer program is executed.
13. A computer-readable storage medium, characterized in that, The computer program is stored in the computer readable storage medium, and when the computer program is executed by the processor, steps of the garbage data recycling processing method according to any one of claims 1 to 11 are implemented.
14. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement steps of the garbage data recycling processing method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Garbage recycling method, device and equipment for solid state disk and storage medium
CN110688325A
Command management method, storage control chip and flash memory device
CN119473139A