Method for improving random write stability of solid state disk

By setting thresholds to control the start and stop of GC tasks and adjusting the write data ratio, the problem of poor random write stability of solid-state drives is solved, achieving more stable write performance and higher overall performance of storage devices.

CN120161998APending Publication Date: 2025-06-17MEMBLAZE TECH BEIJING
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510173070.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-17
Publication Date
2025-06-17

AI Technical Summary

Technical Problem

Existing solid-state drives have poor stability during random write operations, which can easily lead to fluctuations in write performance and affect the overall performance of the storage device.

Method used

By setting the thresholds K and L of the number of free physical blocks/large blocks, the garbage collection (GC) task is started or stopped in response to the change of free number, and the ratio of external write data to GC write data is adjusted to stabilize the number of free physical blocks and improve the stability of random writes.

Benefits of technology

It realizes that the solid-state drive enters steady state faster, improves the write performance stability experienced by the host, suppresses performance fluctuations caused by GC task start/stop, and improves the overall performance and QoS of the storage device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120161998A_ABST
    Figure CN120161998A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of storage, in particular to a method for improving random write stability of a solid state disk, which comprises the following steps: starting a GC task in response to the condition that the number of idle physical blocks / large blocks is reduced to a threshold value K; wherein K is a number threshold value of idle physical blocks / large blocks used for controlling start and stop of the GC task, and Kgt; l is the number threshold value of the steady-state free physical blocks / large blocks, and both K and L are integers; in addition, the adjusting proportion of the amount of data externally written into the solid state disk within unit time and the amount of data written into the GC task is set to be (n + x): m; adjusting the amount of data externally written into the solid-state storage device within unit time and the amount of data written into the GC task according to the adjusting proportion; wherein x, n and m are all positive numbers. The random writing stability of the solid state disk can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage technologies, and particularly to a method for improving the random write stability of a solid state drive. Background Art

[0002] Figure 1 A block diagram of a storage device is shown. The storage device 100 is coupled to a host and is used to provide storage capabilities for the host. The host and the storage device 100 can be coupled in a variety of ways, including but not limited to coupling through, for example, SATA (Serial Advanced Technology Attachment), SCSI (Small Computer System Interface), SAS (Serial Attached SCSI), IDE (Integrated Drive Electronics), USB (Universal Serial Bus), PCIE (Peripheral Component Interconnect Express, PCIe), NVMe (NVM Express), Ethernet, Fibre Channel, a wireless communication network, etc., to connect the host and the storage device 100. The host can be an information processing device capable of communicating with the storage device in the above ways, such as, for example, a personal computer, a tablet computer, a server, a portable computer, a network switch, a router, a cellular phone, a personal digital assistant, etc. The storage device 100 includes an interface 110, a control component 120, one or more NVM chips 130, and DRAM (Dynamic Random Access Memory) 140.

[0003] Common NVMs include NAND flash memory, phase change memory, FeRAM (Ferroelectric RAM), MRAM (Magnetic Random Access Memory), RRAM (Resistive Random Access Memory), etc.

[0004] The interface 110 can be adapted to exchange data with the host through, for example, SATA, IDE, USB, PCIE, NVMe, SAS, Ethernet, Fibre Channel, etc.

[0005] The control component 120 is used to control data transmission between the interface 110, the NVM chip 130, and the DRAM 140, and is also used for storage management, mapping of host logical addresses to physical addresses of the NVM chip, wear leveling, bad block management, etc. The control component 120 can be implemented in various ways by software, hardware, firmware, or a combination thereof. For example, the control component 120 can be in the form of an FPGA (Field-programmable gate array), an ASIC (Application Specific Integrated Circuit), or a combination thereof. The control component 120 can also include a processor or a controller, and software is executed in the processor or controller to manipulate the hardware of the control component 120 to process IO (Input / Output) commands. The control component 120 is also coupled to the DRAM 140 and can access the data in the DRAM 140. The FTL table and / or the data of the cached IO commands are stored in the DRAM.

[0006] The control component 120 includes a flash interface controller (also referred to as a media interface, a media interface controller, a flash channel controller), and the flash interface controller is coupled to the NVM chip 130 and issues commands to the NVM chip 130 in a manner that complies with the interface protocol of the NVM chip 130 to operate the NVM chip 130 and receives the command execution results output from the NVM chip 130. Known NVM chip interface protocols include "Toggle", "ONFI", etc.

[0007] A memory target is one or more logical units (LUNs, Logic UNits) that share the chip enable (CE) signal within a NAND flash package. The NAND flash package includes one or more dies. Typically, a logical unit corresponds to a single die. A logical unit can include multiple planes. Multiple planes within a logical unit can be accessed in parallel, and multiple logical units within a NAND flash chip can execute commands and report status independently of each other.

[0008] Data is usually stored and read on the NVM storage medium by page. A block (also referred to as a physical block) on the NVM storage medium contains multiple pages. A page (referred to as a physical page) on the storage medium has a fixed size, such as 17664 bytes. The physical page can also have other sizes.

[0009] In a storage device, the FTL (Flash Translation Layer) is utilized to maintain the mapping information from logical addresses to physical addresses. Logical addresses constitute the storage space of the storage device perceived by upper-layer software such as the operating system. Physical addresses are the addresses used to access the physical storage units of the solid-state storage device. In the prior art, address mapping can also be implemented using an intermediate address form. For example, logical addresses are mapped to intermediate addresses, and then the intermediate addresses are further mapped to physical addresses. Optionally, the host accessing the storage device provides the FTL. The table structure storing the mapping information from logical addresses to physical addresses is referred to as the FTL table. Generally, the data entries of the FTL table record the address mapping relationships in the storage device in units of data pages.

[0010] Figure 2 Shows a schematic diagram of a large block. A large block includes physical blocks from each of multiple logical units (referred to as logical unit groups). Preferably, each logical unit provides one physical block for the large block. By way of example, large blocks are constructed on every 16 logical units (LUNs). Each large block includes 16 physical blocks, one from each of the 16 logical units (LUNs). In Figure 2 the example, large block 0 includes physical block 0 from each of the 16 logical units (LUNs), and large block 1 includes physical block 1 from each logical unit (LUN). There can also be various other ways to construct large blocks.

[0011] As an alternative way, page stripes are constructed in a large block, and the physical pages with the same physical address within each logical unit (LUN) constitute a "page stripe". Figure 2 In, physical pages P0-0, P0-1... and physical page P0-x constitute page stripe 0, where physical pages P0-0, P0-1... P0-14 are used to store user data, and physical page P0-x is used to store parity data calculated based on all the user data within the stripe. Similarly, Figure 2 in, physical pages P2-0, P2-1... and physical page P2-x constitute page stripe 2. Optionally, the physical page used to store parity data can be located at any position within the page stripe.

[0012] When a logical page is repeatedly written with data, the FTL table entry records the correspondence between the logical page address and the latest physical page address. However, the data stored in the physical page addresses that have been written but are no longer referenced (e.g., not recorded in the FTL table) becomes "garbage" (data). The data that has been written and is referenced (e.g., recorded in the FTL table) is called valid data, while the "garbage" is called dirty data. A physical block containing dirty data is called a "dirty physical block", and a physical block that has not been written with data is called a "free physical block". The storage device performs a garbage collection (GC) process to reclaim invalid data.

[0013] The NVM storage medium includes multiple physical blocks (Blocks). Each physical block contains multiple pages, and a page is a relatively small storage unit. In the NVM storage medium, read and write operations can be performed at the page level. However, the erase operation can only be performed at the physical block level. The erase operation may take longer than the read or write operation. To overwrite the data stored in a physical block (i.e., replace the old data with updated data), the entire physical block containing the data to be overwritten must be erased. To overwrite data in the NVM storage medium, the updated data is written to a free page in the NVM storage medium, rather than to the same page containing the old data. The page containing the old data is marked as an invalid page. The invalid page remains in an invalid state until the entire physical block containing the invalid page is erased.

[0014] During the operation of the SSD, garbage collection (Gargebe Collection, abbreviated as GC) is performed to maintain a free block pool. The free block pool contains physical blocks with free pages available for writing new data. Free blocks are reclaimed from physical blocks that may contain both valid and invalid data. The garbage collection process first selects a target physical block for reclamation. Any valid pages (i.e., pages containing data that has not been overwritten yet) located in the target physical block are copied to another physical block, and then the physical block is erased, thus becoming a free physical block in the free block pool.

[0015] Figure 3Shows a schematic diagram of the garbage collection process. Data has been written to physical block 0 and physical block 1. Physical pages 310, 312, 314, and 316 of physical block 0, etc., the physical pages indicated by the grid boxes, have no records in the FTL table, and the data on them is dirty data. Physical pages 330, 332, 334, and 336 of physical block 0, etc., the physical pages indicated by the blank boxes, have records in the FTL table, and the data on them is valid data. Physical pages 320, 322, 324, and 326 of physical block 1, etc., the physical pages indicated by the grid boxes, have dirty data on them. Physical pages 344, 342, 346, and 348 of physical block 1, etc., the physical pages indicated by the blank boxes, have valid data on them. Figure 3 In Figure 3 , the data stored in the physical pages indicated by the grid is dirty data, while the data stored in the physical pages indicated by the blank boxes is valid data.

[0016] For garbage collection, scan the dirty physical blocks (e.g., physical block 0 and physical block 1), read out the valid data in them and write it to the free physical block 2, and record the change of the physical page address of the valid data in the FTL table. After all the valid data in the physical block has been moved to physical block 2, erase the scanned physical block 0 and physical block 1, so that physical block 0 and physical block 1 become free physical blocks.

[0017] Figure 4 Shows a schematic diagram of the garbage collection method. The dirty physical block set 410 includes the dirty physical blocks of some or all of the NVM chips of the storage device. The free physical block set 420 includes the free physical blocks of some or all of the NVM chips of the storage device.

[0018] To implement garbage collection, the "garbage collection" module 430 (e.g., implemented in the control component 120 or the CPU or controller therein) obtains dirty physical blocks from the dirty physical block set 410 and obtains free physical blocks from the free physical block set 420. Scan the dirty physical blocks and write the valid data in them to the free physical blocks. After all the valid data in the obtained dirty physical blocks has been moved to the free physical blocks, erase the dirty physical blocks and record the erased physical blocks in the free physical block set.

[0019] The dirty physical block set 410 and the free physical block set 420 can be linked lists, linear lists, or other data structures for representing sets. Record the addresses of the physical blocks in the set to access the physical blocks.

[0020] Optionally, garbage collection is implemented in units of large blocks (instead of in units of physical blocks).

[0021] The storage device also performs wear leveling operations so that each physical block in the storage device experiences approximately the same number of erasures during use, thereby reducing the adverse impact of the exhaustion of the life of individual physical blocks on the life of the storage device.

[0022] Multiple GC (Garbage Collection) strategies have been provided in Chinese patents or patent applications CN112015667A, CN110554970A, CN111338975A, CN109426436A, CN109558333A, and CN109144885A, enabling excellent steady-state performance of SSDs.

[0023] Figure 5 The schematic diagram of the OP space is shown. To achieve good performance, solid-state storage devices usually provide an over-provisioning (OP) supply, as Figure 5 shown. Its meaning is that the physical storage space of the NVM storage medium actually possessed by the solid-state storage device is usually larger than the nominal logical address space size provided by the solid-state storage device to the host (for example, 1000GB). Generally, denote the physical storage space size actually possessed by the solid-state storage device as Physical_Capacity, and denote the nominal logical address space size provided by the solid-state storage device to the user as Logical Capacity, then OP = (Physical_Capacity – Logical Capacity) / Logical_Capacity. The additional physical storage space provided by OP (denoted as OP area 510) plays a role in GC (Garbage Collection). In the steady state, the GC task continuously works, moving the valid data from the physical storage medium that has been written with data to the blank storage medium, thereby releasing the storage space occupied by the invalid data to achieve the recycling of the storage space. In the steady state, the storage space recovered by the GC task is roughly balanced with the storage space consumed by the host writing data to the storage device during the same period, enabling the process of the host writing data to proceed continuously and stably.

[0024] During the GC operation, the recovered valid data needs to be written to the blank storage medium. The data to be written to the storage medium is called GC write data.

[0025] During the operation of the storage device, it receives the host's IO commands. The host's IO commands also write data to the storage medium. The data to be written to the storage medium is called host write data.

[0026] By using the over-provisioning OP as a parameter to adjust the proportional relationship between the amount (or bandwidth) of host write data and GC write data, better steady-state performance (for example, better QoS (Quality of Service)) can be achieved.

[0027] Figure 6It shows a schematic diagram of controlling the ratio of GC-written data and host-written data to achieve QoS. By controlling the amount of GC-written data and host-written data (such as their maximum values) within a specified time period (such as a unit time), it is avoided that the operation of storing GC-written data in the storage medium preempts the resources of the storage device, causing the host to experience performance fluctuations in writing data to the storage device.

[0028] For example, when writing data to a blank storage device, there are many blank storage media in the storage device. At this time, the GC task does not need to be started. Thus, all the write bandwidth can be used to process host I / O, enabling the host to experience high write performance. As the blank storage media in the storage device are gradually consumed, the GC task starts and generates GC-written data. The GC write preempts part of the write bandwidth of the storage device, causing the write performance experienced by the host to decline. Enterprise-level storage devices need to avoid this situation. The QoS metric reflects the degree of performance fluctuations of the storage device experienced by the host, and it is desired that the performance fluctuations are as small as possible.

[0029] Since the overall write bandwidth of the storage device has an upper limit, which depends on the concurrent capabilities of the control component of the storage device and the connected NVM chips. Therefore, by setting a ratio (the ratio of the amount of GC-written data to the amount of host-written data within a unit time), the amount of GC-written data and host-written data that can be processed within a specified time period is calculated. The set ratio is related to the OP. For example, it is obtained by multiplying the OP by a coefficient.

[0030] Optionally, the GC-written data and the host-written data are written to different physical blocks or large blocks respectively, which is beneficial to making the data recorded on the same storage medium have similar attributes (such as coming from the same application, having the same write time, and being expected to be updated at the same time, etc.). Summary of the Invention

[0031] This application provides a method for improving the random write stability of a solid-state drive to improve the random write stability of the solid-state drive.

[0032] To solve the above technical problems, this application provides the following technical solutions:

[0033] According to a first aspect of the present application, there is provided a first method for improving the random write stability of a solid-state drive according to the first aspect of the present application, including: in response to the number of idle physical blocks / chunks decreasing to a threshold K, starting a garbage collection (GC) task; where K is the threshold of the number of idle physical blocks / chunks for controlling the start and stop of the GC task, K>L, L is the threshold of the number of steady-state idle physical blocks / chunks, and both K and L are integers; and setting the adjustment ratio of the amount of data externally written to the solid-state drive per unit time to the amount of data written by the GC task to (n + x):m; and adjusting the amount of data externally written to the solid-state drive per unit time and the amount of data written by the GC task according to the adjustment ratio; where x, n, and m are all positive numbers.

[0034] According to the first method for improving the random write stability of a solid-state drive according to the first aspect of the present application, there is provided a second method for improving the random write stability of a solid-state drive according to the first aspect of the present application, further including: in response to the number of idle physical blocks / chunks reaching the threshold L, x being 0, and the adjustment ratio being n:m, making the solid-state drive enter a steady state.

[0035] According to the first or second method for improving the random write stability of a solid-state drive according to the first aspect of the present application, there is provided a third method for improving the random write stability of a solid-state drive according to the first aspect of the present application, further including: in response to the number of idle physical blocks / chunks exceeding the threshold K, stopping the GC task.

[0036] According to one of the first to third methods for improving the random write stability of a solid-state drive according to the first aspect of the present application, there is provided a fourth method for improving the random write stability of a solid-state drive according to the first aspect of the present application, where x is proportional to the size of the logical free space of the solid-state drive; or x = A*(d / (K - L)), d is the difference between the number of idle physical blocks / chunks and the threshold L, and A is a specified parameter, A>0.

[0037] According to a second aspect of the present application, there is provided a first method for improving the random write stability of a solid-state drive according to the second aspect of the present application, including: in response to the number of idle physical blocks / chunks decreasing to a threshold K, starting a GC task; where K is the threshold of the number of idle physical blocks / chunks for controlling the start of the GC task, K = L, L is the threshold of the number of steady-state idle physical blocks / chunks, and both K and L are integers; and in response to the number of idle physical blocks / chunks exceeding a threshold E, stopping the GC task; where E is the threshold of the number of idle physical blocks / chunks for controlling the stop of the GC task, E>K.

[0038] According to the first method for improving the random write stability of a solid-state drive according to the second aspect of the present application, a second method for improving the random write stability of a solid-state drive according to the second aspect of the present application is provided, further including: in response to the start of a GC task, setting the adjustment ratio of the amount of data externally written to the solid-state drive per unit time to the amount of data written by GC as n:m, so that the solid-state drive immediately enters a steady state.

[0039] According to the first or second method for improving the random write stability of a solid-state drive according to the second aspect of the present application, a third method for improving the random write stability of a solid-state drive according to the second aspect of the present application is provided, further including: in response to the number of idle physical blocks / chunks being greater than a threshold K, checking whether the number of idle physical blocks / chunks exceeds a threshold E; in response to the number of idle physical blocks / chunks exceeding the threshold E, the GC task is not started, or the GC task is kept not started.

[0040] According to the third method for improving the random write stability of a solid-state drive according to the second aspect of the present application, a fourth method for improving the random write stability of a solid-state drive according to the second aspect of the present application is provided, further including: in response to the number of idle physical blocks / chunks not exceeding the threshold E, obtaining the number of idle physical blocks / chunks; judging whether the obtained number of idle physical blocks / chunks has decreased to the threshold K.

[0041] According to one of the first to third methods for improving the random write stability of a solid-state drive according to the second aspect of the present application, a fifth method for improving the random write stability of a solid-state drive according to the second aspect of the present application is provided, further including: in response to the occurrence of a specified event, performing an operation of judging whether the number of idle physical blocks / chunks has decreased to the threshold K, judging whether the number of idle physical blocks / chunks exceeds the threshold E, and obtaining the number of idle physical blocks / chunks.

[0042] According to one of the fifth methods for improving the random write stability of a solid-state drive according to the second aspect of the present application, a sixth method for improving the random write stability of a solid-state drive according to the second aspect of the present application is provided, and the specified event is every specified time.

[0043] According to one of the first to sixth methods for improving the random write stability of a solid-state drive according to the second aspect of the present application, a seventh method for improving the random write stability of a solid-state drive according to the second aspect of the present application is provided, further including: in response to the stop of the GC task, providing all the write bandwidth to the host for writing data.

[0044] One of the first to seventh methods for improving the random write stability of a solid-state drive according to the second aspect of the present application provides an eighth method for improving the random write stability of a solid-state drive according to the second aspect of the present application, further including: during the startup of the GC task, obtaining the current growth rate of free physical blocks / chunks; if the growth rate of the free physical blocks / chunks is greater than a threshold V1, stealing one or more free physical blocks / chunks of the solid-state drive as hidden physical blocks / chunks; the hidden physical blocks / chunks will not be allocated to carry data externally written to the solid-state drive or GC-written data, and the hidden physical blocks / chunks will not be counted as free physical blocks / chunks.

[0045] The eighth method for improving the random write stability of a solid-state drive according to the second aspect of the present application provides a ninth method for improving the random write stability of a solid-state drive according to the second aspect of the present application, further including: if the growth rate of the free physical blocks / chunks is not greater than the threshold V1, returning the hidden physical blocks / chunks as free physical blocks / chunks.

[0046] The eighth method for improving the random write stability of a solid-state drive according to the second aspect of the present application provides a tenth method for improving the random write stability of a solid-state drive according to the second aspect of the present application, further including: if the growth rate of the free physical blocks / chunks is less than a threshold V2, returning the hidden physical blocks / chunks as free physical blocks / chunks; when the growth rate of the free physical blocks / chunks is between the threshold V1 and the threshold V2, keeping the number of hidden physical blocks / chunks unchanged; where the threshold V1 > the threshold V2.

[0047] One of the eighth to tenth methods for improving the random write stability of a solid-state drive according to the second aspect of the present application provides an eleventh method for improving the random write stability of a solid-state drive according to the second aspect of the present application, further including: the current growth rate of the free physical blocks / chunks is the difference between the currently obtained number of free physical blocks / chunks and the previously obtained number of free physical blocks / chunks.

[0048] One of the eighth to eleventh methods for improving the random write stability of a solid-state drive according to the second aspect of the present application provides a twelfth method for improving the random write stability of a solid-state drive according to the second aspect of the present application. The number of stolen free physical blocks / chunks and the number of returned free physical blocks / chunks both depend on the current growth rate of the obtained free physical blocks / chunks.

[0049] One of the eighth to eleventh methods for improving the random write stability of a solid-state drive according to the second aspect of the present application provides a thirteenth method for improving the random write stability of a solid-state drive according to the second aspect of the present application. The growth rate of the free physical blocks / chunks is classified by size, and each level corresponds to the number of free physical blocks / chunks to be stolen.

[0050] One of the methods for improving the random write stability of a solid-state drive according to the eighth to thirteenth aspects of the second aspect of the present application provides a method for improving the random write stability of a solid-state drive according to the fourteenth aspect of the second aspect of the present application. By stealing free physical blocks / large blocks, the growth rate of the free physical blocks / large blocks perceived by the GC task after stealing is close to the average growth rate of the free physical blocks / large blocks in the steady state or the average value within a specified time range.

[0051] One of the methods for improving the random write stability of a solid-state drive according to the eighth to fourteenth aspects of the second aspect of the present application provides a method for improving the random write stability of a solid-state drive according to the fifteenth aspect of the second aspect of the present application. By stealing free physical blocks / large blocks from the free physical block / large block pool as hidden physical blocks / large blocks, and by returning the free physical blocks / large blocks by putting the hidden physical blocks / large blocks into the free physical block / large block pool; in response to the stealing of free physical blocks / large blocks and / or the return of hidden physical blocks / large blocks, it is determined whether to start and / or stop the GC task according to the number of free physical blocks / large blocks in the free physical block / large block pool.

[0052] One of the methods for improving the random write stability of a solid-state drive according to the eighth to fifteenth aspects of the second aspect of the present application provides a method for improving the random write stability of a solid-state drive according to the sixteenth aspect of the second aspect of the present application. The number of hidden physical blocks / large blocks has an upper limit value.

[0053] According to the method for improving the random write stability of a solid-state drive according to the sixteenth aspect of the second aspect of the present application, a method for improving the random write stability of a solid-state drive according to the seventeenth aspect of the second aspect of the present application is provided. The upper limit value of the hidden physical blocks / large blocks is dynamic and is related to the growth rate of the free physical blocks / large blocks.

[0054] According to the method for improving the random write stability of a solid-state drive according to the sixteenth or seventeenth aspect of the second aspect of the present application, a method for improving the random write stability of a solid-state drive according to the eighteenth aspect of the second aspect of the present application is provided. When the number of hidden physical blocks / large blocks reaches the upper limit, the stealing of free physical blocks / large blocks is no longer executed.

[0055] According to the third aspect of the present application, a storage device according to the first aspect of the third aspect of the present application is provided, including a controller and a non-volatile memory chip, and the controller is used to execute the method described in any one of the above.

[0056] Compared with the above background technology, the method for improving the random write stability of a solid-state drive provided by the present application can make the solid-state drive enter the steady state faster, enabling the host to experience stable write performance, thereby improving the QoS. In addition, the present application also suppresses the performance fluctuations of the storage device caused by the start / stop of the GC task, further ensuring the stability of the storage device performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments recorded in the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.

[0058] Figure 1 Shows a block diagram of a storage device;

[0059] Figure 2 Shows a schematic diagram of a large block;

[0060] Figure 3 Shows a schematic diagram of the garbage collection process;

[0061] Figure 4 Shows a schematic diagram of the garbage collection method;

[0062] Figure 5 Shows a schematic diagram of the OP space;

[0063] Figure 6 Shows a schematic diagram of controlling the ratio of GC-written data and host-written data to achieve QoS;

[0064] Figure 7 Shows a schematic diagram of dirty physical blocks and free physical blocks;

[0065] Figure 8 Shows a GC trigger control threshold relationship diagram;

[0066] Figure 9 Shows a schematic diagram of the trigger / exit GC threshold;

[0067] Figure 10 Shows a schematic diagram of GC start / stop;

[0068] Figure 11 Shows a schematic diagram of another embodiment of GC start / stop;

[0069] Figure 12 Shows a schematic diagram of hidden physical blocks;

[0070] Figure 13 Shows a schematic diagram of monitoring the rate at which the GC task generates free physical blocks;

[0071] Figure 14 Shows a flowchart of free physical block stealing;

[0072] Figure 15 Shows a schematic diagram of the performance distribution of executing random writes;

[0073] Figure 16Shows a schematic diagram of the performance distribution of performing random writes. Detailed implementation manners

[0074] The embodiments of the present invention will be described in detail below. Examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention and should not be construed as limiting the present invention.

[0075] Figure 7 Shows a schematic diagram of dirty physical blocks and free physical blocks.

[0076] The physical blocks of the storage device have, for example, two states: dirty physical blocks 710 that have been written with data and free physical blocks 720 that have not been written with data, as Figure 7 shown. The GC task hopes to maintain the number of free physical blocks 720 of the storage device not less than a certain amount, so that the storage device always has free physical blocks 720 to carry the data written by the host. Thus, as the free physical blocks 720 are used to carry the data written by the host, the number of free physical blocks 720 decreases. In response, the GC task is started to perform garbage collection on the dirty physical blocks 710 and generate new free physical blocks 720. By designing the processing strategy of the GC task (including the ratio adjustment mentioned above), it is realized that under steady state, the consumption of free physical blocks 720 and the generation of new free physical blocks 720 are basically balanced, so that the storage device can continuously work on the premise of enabling the host to experience stable performance. It can be understood that by adjusting the ratio of GC-written data to user-written data, the generation rate of free physical blocks 720 can be changed. For example, a higher proportion of GC-written data will result in a greater generation rate of free physical blocks 720. The ratio adjustment target for steady state is to make the rate at which the host-written data (and the data written by the GC task) consumes free physical blocks 720 basically consistent with the rate at which the GC task generates free physical blocks 720.

[0077] In the prior art, the threshold based on the number of free physical blocks 720 is used as the basis for starting the GC task. When the number of free physical blocks 720 is lower than the threshold, the GC task is started. And the ratio of GC-written data to user-written data of the GC task is controlled to achieve QoS.

[0078] As the GC task is started, the host generates new free physical blocks 720, so that the number of free physical blocks 720 has an increasing trend. Ideally, the new free physical blocks 720 generated by the GC task are consumed by the data written by the host to maintain the number of free physical blocks 720 at a value slightly lower than the threshold.

[0079] However, this stability depends on the stability of the amount of data written by the host. When the amount of data written by the host is large, the amount of host-written data processed by the storage device can be limited to the target level through proportional regulation to maintain the stability of the number of free physical blocks 720. However, when the amount of data written by the host is insufficient, the amount of data written by the host cannot be increased through proportional regulation. Furthermore, since the rate at which the host-written data consumes the free physical blocks 720 is relatively slow, while the rate at which the GC task generates free physical blocks 720 is relatively fast, the number of free physical blocks 720 in the storage device increases. When the number of free physical blocks 720 exceeds the threshold, the GC task stops. At this time, the host-written data can use the entire write bandwidth of the storage device, and the host experiences a rapid improvement in write performance. For the QoS metrics, this situation leads to a decline in the QoS metrics, which is not desirable.

[0080] As a solution, after the GC task stops, the proportional regulation remains in operation, restricting the bandwidth of the host-written data. However, this results in a waste of the storage device performance.

[0081] In some cases, the amount of data written by the host is stable. However, the storage device allocates and releases free physical blocks 720 in units of physical blocks. This makes the change in the number of free physical blocks 720 discrete. Through proportional regulation, the long-term average value of the number of free physical blocks 720 can be made equal to the target value (such as the aforementioned threshold). However, in the short term, the number of free physical blocks 720 fluctuates around the average value, causing the GC task to be frequently started and stopped over time. Consequently, the write performance experienced by the host also fluctuates, leading to a decline in the QoS metrics.

[0082] Figure 8 Shows a GC trigger control threshold relationship diagram.

[0083] As Figure 8 shown, a solution is provided for the problem of frequent GC start / stop caused by the dynamic number of free physical blocks approaching the threshold.

[0084] Figure 8 In, when the storage device operates in a steady state, the target number of free physical blocks is L (referred to as the steady-state free physical block number threshold L). In the steady state, the proportional regulation makes the ratio of the amount of data written by the host to the amount of data written by the GC per unit time be host:gc = n:m.

[0085] Another free physical block number threshold K is provided to control the start or stop of the GC task, and K > L, where both K and L are integers, and both n and m are positive numbers.

[0086] During the operation of the storage device, as the host writes data, the number of free physical blocks decreases. When the number of free physical blocks decreases to the threshold K, the GC task is started. And, in order to gradually change the number of free physical blocks from the threshold K to the threshold L, when the GC task is started, the proportion of the amount of data written by the host is set to a large value to accelerate the consumption of free physical blocks. For example, set host:gc = (n + x):m, where x is a positive number, host represents the amount of data written by the host per unit time, and gc represents the amount of data written by the GC task per unit time. Due to the existence of x, (n + x):m > n:m, thus achieving the setting of the proportion of the amount of data written by the host to a large value.

[0087] With the continuous writing of a relatively large proportion of the host data, the number of free physical blocks in the storage device decreases. When the number of free physical blocks reaches the threshold L, by setting host:gc = n:m, it helps the storage device enter a steady state. Thereafter, in the steady state, the number of free physical blocks generally remains at the threshold L. And, even if the number of free physical blocks fluctuates slightly around the threshold L, since it does not reach the threshold K, the GC task remains enabled. Thus, users experience stable host writing performance.

[0088] When the amount of data written by the host decreases relatively, or the efficiency of the GC task recovery improves relatively, the number of free physical blocks in the storage device increases. When the number of free physical blocks increases and exceeds the threshold K, the GC task stops and all the write bandwidth is provided for the host to write data. Thus, the threshold K is used as the judgment condition for the start or stop of the GC task.

[0089] It can be understood that in the above scheme, when the GC task is enabled, the host writing performance corresponds to (n + x):m, while in the steady state, the host writing performance corresponds to n:m. Obviously, during the process from the start of the GC task to entering the steady state, the host users will experience a decrease in the writing performance of the storage device.

[0090] To smooth the above-mentioned write performance variation, a parameter d representing the difference between the current number of free physical blocks and the threshold L is further introduced, and the value of x is proportional to d. Thus, when d is large, x has a large value, providing a large write performance to the host. As d decreases, the value of x decreases, and the write performance provided to the host also decreases accordingly. For example, when the number of free physical blocks is between the threshold K and the threshold L, through proportional adjustment, the host write performance is set to (n + x):m, where x = A*(d / (K - L)), and A is the maximum value of the value range of x. Thus, when the number of free physical blocks is in the range between the threshold K and the threshold L, and the number of free physical blocks is less than the threshold K, the GC task is started. At this time, the host write performance corresponds to (n + A):m; when the number of free physical blocks is between the threshold K and the threshold L, the host write performance corresponds to (n + A*(d / (K - L))):m; when the storage device enters the steady state and the number of free physical blocks is the threshold L, the host write performance corresponds to n:m.

[0091] There are variant embodiments of the above embodiments. When calculating the value of x for proportional adjustment before, for example, x = A*(d / (K - L)) is used, making x proportional or positively correlated with the difference d between the current number of free physical blocks and the threshold L, so as to promote the current number of physical blocks to quickly approach the threshold L of the steady-state free physical blocks. In an alternative variant scheme, the value of x is calculated based on the usage of the logical address space of the storage device. For example, make x proportional to the size of the space in the logical address space of the storage device that has not been written with data (referred to as the logical free space). When the logical free space of the storage device is larger, and at this time the number of free physical blocks has dropped below the threshold K, it means that the recycling efficiency of the GC task will be higher, and the rate of the GC task generating free physical blocks will be larger. Thus, the write bandwidth provided to the host for writing data in the proportional adjustment can be increased (implemented through (n + x) / m), so as to process more host write data. This can not only let the host experience better performance but also increase the consumption rate of free physical blocks, thereby shortening the time required for the number of free blocks to decrease from K to L and reducing the duration of the above-mentioned stage one to improve QoS.

[0092] After the number of free physical blocks has dropped below the threshold K, if the logical free space of the storage device is small, it means that the recycling efficiency of the GC task will be low, and the rate of the GC task generating free physical blocks will be small. Thus, by setting the ratio (n + x) / m, the bandwidth ratio allocated to the host for writing data is relatively reduced (not necessarily reducing the absolute value, because there is a +x term, only the value of x decreases). On the basis of accelerating the consumption rate of free physical blocks to quickly approach the threshold L, the consumption rate of free physical blocks is moderately reduced to avoid the overconsumption or exhaustion of free blocks.

[0093] In the previous embodiments, the process of the storage device entering the steady state is divided into two stages:

[0094] In Phase 1, the host user experiences a slow decline in the performance of the storage device.

[0095] In Phase 1, when the number of free blocks is less than the threshold K, the GC task is triggered for execution. In this phase, in order to let the number of free physical blocks continue to decrease to the threshold L, the ratio is host:gc = (n + x) / m. Since the actual write volume of the host (host) is more than the expected write volume of the host in the steady state, the number of free physical blocks will slowly decrease to the threshold L as the host writes occur.

[0096] In Phase 2, the host user experiences that the performance of the storage device remains stable. When the number of free physical blocks reaches the threshold L, at this time the ratio of the host write volume to the write bandwidth of the GC task is host:gc = (n + x) / m, where x is 0, and the number of free physical blocks is maintained at the threshold L.

[0097] Thus, during this process, the host will experience a slow reduction in the write performance of the storage device until the steady state. Figure 15 The IOPS line reflects the change process of the write performance of the storage device experienced by the host.

[0098] Figure 15 Shows a schematic diagram of the performance distribution of executing random writes.

[0099] Such as Figure 15 shown, the performance distribution of executing random writes in the traditional way is as follows:

[0100] The vertical axis is the write performance of the host per second, with the unit of K IOPS, and the horizontal axis is time, with the unit of s. It can be seen that in the first 100 s, the random write performance of the host has a downward trend (Phase 1).

[0101] Due to the existence of the stage with a continuous decline in write performance (Phase 1), the QoS index of the storage device will be reduced. Therefore, it is also desired to further solve this problem, improve the consistency of the performance of the storage device changing over time, and improve the QoS index.

[0102] Figure 9 Shows a schematic diagram of the trigger / exit GC threshold according to another embodiment of the present application.

[0103] In the GC scheme of the present application (see Figure 9) Three free physical block parameter thresholds, namely K, E, and L, are provided. When the storage device operates in a steady state, the target number of free physical blocks is the threshold L (referred to as the steady-state free physical block number threshold L). The threshold K is the free physical block number threshold for starting the GC task. When the number of free physical blocks in the storage device decreases to the threshold K, the GC task starts, and the value of the threshold K is determined according to the threshold L, where K = L. The threshold E is the free physical block number threshold for stopping the GC task. When the number of free physical blocks in the storage device is greater than E, the GC task stops, and all the write bandwidth is provided for the host to write data. The value of the threshold E is determined according to the threshold K, where E > K.

[0104] In the steady state, proportional regulation makes the ratio of the amount of data written by the host to the amount of data written by the GC per unit time be host:gc = n:m, rather than (n + x):m.

[0105] Since K = L, during the process where the number of free physical blocks decreases and the GC task starts from stopped to started, once the GC task starts, the storage device operates in a steady state. The amount of data written by the host and the amount of data written by the GC are regulated according to host:gc = n:m. At this time, if the write IO commands from the host are stable, the storage device can continuously operate in the steady state.

[0106] Figure 16 The IOPS line reflects the write performance of the storage device experienced by the host. It is always in a steady state and eliminates the write performance degradation stage of "phase one" in the previous scheme. Thus, better QoS metrics are obtained.

[0107] During the operation of the storage device, as the host writes data, the number of free physical blocks decreases. When the number of free physical blocks decreases to the threshold K, the GC task starts. By setting the regulation ratio to host:gc = n:m, the number of free physical blocks is maintained at the threshold L. Although due to the characteristics of the solid-state drive to allocate and erase storage resources by physical blocks (or large blocks), and the fluctuations in the amount of effective data written by the host and recycled physical blocks, the number of free physical blocks fluctuates, but this fluctuation is around the threshold L, that is, its value does not deviate too much from the threshold L. At this time, the GC task is started and remains started. As long as the number of free physical blocks does not exceed the threshold E, the GC task will not stop. By setting a reasonable interval between the threshold E and the threshold K, the number of free physical blocks in the steady state basically does not become greater than the threshold E. Thus, the fluctuations in the performance of the storage device caused by the frequent start / stop of the GC task are also avoided.

[0108] Subsequently, when the amount of data written by the host decreases relatively, or the efficiency of the GC task recovery increases relatively, the number of free physical blocks in the storage device increases. When the number of free physical blocks increases and exceeds the threshold E, the GC task stops, and all the write bandwidth is provided for the host to write data. Thus, in this embodiment, the threshold K is used as the judgment condition for the start of the GC task, and the threshold E is used as the judgment condition for the stop of the GC task.

[0109] Furthermore, the host starts writing data again, and the free physical blocks of the storage device are gradually consumed, and their number first decreases to the threshold E. The threshold E is not the condition for starting the GC task, so the GC task is not started. Furthermore, the host can utilize all the write performance of the storage device when writing data (because there is no GC task to share the write performance). Thus, compared with the previous scheme that uses (n + x):m to control the proportion of the write performance provided for the host to write data, the scheme of this application has a faster consumption speed of free physical blocks at this stage, so the time required for the number of free physical blocks to drop from the threshold E to the threshold K is shorter (shorter than the time from the threshold K to the threshold L in the previous embodiment). And, during this period, the write performance experienced by the host is stable, the same as the write performance when the number of free physical blocks is greater than the threshold E. Therefore, compared with the previous scheme, the scheme of this application also shortens the time of unstable write performance, thereby improving QoS.

[0110] Next, as the number of free physical blocks decreases to the threshold K, the GC task starts, and the number of free physical blocks remains near the threshold K.

[0111] Figure 10 Shows a schematic diagram of GC start and stop.

[0112] As an example, the storage device repeatedly executes Figure 10 the method to control the start / stop of GC and adjust the bandwidth provided for the host to write data and the possible GC write data.

[0113] In the initial state, the storage device has more free physical blocks (the number of free physical blocks > E). The host writes data to the storage device at full pressure. At this time, in the Figure 10 process, at step A, since the number of free physical blocks > K, it turns to step B. Since (the number of free physical blocks > E) does not meet the condition for starting the GC task, step B1 is executed. It can be understood that at this time, the GC task is not started, and the state of not starting the GC task is maintained at step B1, and all the write bandwidth is provided for the host to write data. At this time, the storage device gives full play to its maximum write performance to process the data written by the host, and the number of free physical blocks decreases.

[0114] As the host continues to write data, when the number of free physical blocks drops to the threshold E, in the Figure 10In this case, steps A and B are still adopted. Although the number of free physical blocks <= E at this time, in step B, the process turns to step C and loops among steps A, B, and C, so the GC task is not started. It can be understood that this loop does not have to continue continuously, but is executed, for example, once every specified time (such as 1 s). It still needs to be understood that the GC task itself does not belong to Figure 10 the component of the Figure 10 process. Starting the GC task in step A1 represents the start of the GC task, and the execution of the GC task itself occurs in parallel with Figure 10 the process. The execution of the GC task does not impede

[0115] Figure 11 FIG. shows a schematic diagram of another embodiment of GC start and stop.

[0116] Figure 11 Another control structure is given. It has the same Figure 10 effect as Figure 11 In this case, the process does not need to be executed in a loop, but an exit step B2 is set to represent the completion of one execution of the process. And the process of Figure 11 is "executed" under specified conditions or periodically.

[0117] Returning to refer to Figure 10 , as the host continues to write data, when the number of free physical blocks drops to K, in Figure 10 , at step A, it turns to step A1 to start the GC task. And the bandwidth ratio of host-written data to GC-written data is still set to n:m, and then one execution of the process is completed.

[0118] At this time, the storage device operates in a steady state. Next, there are multiple possibilities:

[0119] (1) The host continuously writes data under high pressure or full pressure (greater than or equal to the bandwidth of host-written data provided by ratio adjustment). In this case, the storage device remains in a steady-state operation, and the bandwidth of host-written data is limited to the value determined by the ratio n:m. The number of free physical blocks remains near K (= L), and the GC task remains continuously started.

[0120] (2) The amount of data written by the host decreases (less than the bandwidth of host-written data provided by ratio adjustment). In this case, the storage device remains in a steady-state operation, the bandwidth of host-written data is limited by the ratio n:m, but the write performance obtained by the host is the actual bandwidth of host-written data, and the number of free physical blocks gradually increases. Before the number of free physical blocks exceeds the threshold E, the GC task remains continuously started.

[0121] At this time, regardless of the pressure of the host writing data, the GC task remains enabled and will not be frequently turned off / on due to external influences.

[0122] (3) It should be understood that the host writing data consumes free physical blocks. And the enabled GC task continuously generates free physical blocks. The speed at which the GC task generates free physical blocks generally remains stable, but it also varies with the amount of valid data in the dirty physical blocks. At this time, even if the speed at which the GC task generates free physical blocks fluctuates, the GC task will remain enabled for a period of time and will not change frequently.

[0123] Since the bandwidth of the host writing data and the GC writing data is limited to the ratio n:m, the number of free physical blocks generally remains stable at this time. Even if the host writing data occurs continuously, the number of free physical blocks can be maintained at the quantity L. The implicit condition here is that the host writing data occurs in the logical address space of the storage device. The host continuously writing data to the storage device is a write to the logical address space. The logical address space may have all been written with data, but the host can repeatedly write data to the logical address space to maintain the continuous writing of the host. Due to the existence of OP, the storage device can always generate free physical blocks through the GC task.

[0124] When the amount of data written by the host further decreases, remains at a low pressure for a long time (such as less than the bandwidth of the host writing data provided by the ratio adjustment) or the host stops writing data, and Figure 10 the process of Figure 10 repeats between step A, step B, and step C. But as the number of free physical blocks further increases to exceed the threshold E, Figure 10 the process of

[0125] (1) The write pressure from the host to the storage device remains low (or the host writing data disappears). In this case, Figure 10 the process of

[0126] (2) The write pressure from the host to the storage device increases. In this case, for a period of time, Figure 10The process repeats between step A, step B, and step B1 because the number of free physical blocks > K. Since the GC task is not enabled at this time, the host will experience the full write performance of the storage device, and the experienced write performance is stable. At this time, if the host does not maintain a large write pressure for a long time, but increases the write pressure due to short-term task demand fluctuations, the number of free physical blocks will not significantly drop below the threshold K, the GC task of the storage device will not be enabled, and the host will experience stable high write performance.

[0127] If the true intention of the host is to maintain a large write pressure for a long time, after a period of time, the number of free physical blocks drops to the threshold K. At this time Figure 10 The process repeats between step A and step A1. Accordingly, the GC task is enabled, and the bandwidth of the host-written data and the GC-written data is limited to the ratio n:m. And the storage device operates in a steady state. The host can still experience stable write performance from the storage device under the subsequent long-term large write pressure state.

[0128] Therefore, the embodiments of the present application, compared with the background art, further suppress the performance fluctuations of the storage device caused by the start / stop of the GC task. The stability of the storage device performance is improved in various host write pressure scenarios and scenarios with changing write pressures.

[0129] The embodiments of the present application described above work well in most cases. However, there are also some special cases. For example, during steady-state operation, the GC task suddenly generates a large number of free physical blocks in a short period of time, causing the number of free physical blocks to rise rapidly and exceed the threshold E, and resulting in the GC task stopping. And the situation where the GC task generates a large number of free physical blocks in a short period is not common and usually does not last long. After the GC task resumes the normal free physical block production rate, as the host write task progresses, the number of free physical blocks will drop to the threshold K again, resulting in the GC task being enabled. Although the embodiments of the present application described above do not cause the GC task to start / stop very frequently, in special cases, the switching of the GC task start / stop still exists.

[0130] The situation where the GC task generates a large number of free physical blocks in a short period usually stems from a large amount of invalid data in the dirty data blocks recycled by the GC task, and causes the amount of GC-written data to decrease. Thus, on the basis of the GC-written data bandwidth limited by ratio adjustment, more dirty physical blocks are recycled within the same time. There are various strategies or subtasks in the GC task, and their respective rates of generating free physical blocks are also different, resulting in changes in the overall rate of the GC task generating free physical blocks.

[0131] Figure 12 Shows a schematic diagram of hidden physical blocks.

[0132] In this embodiment, the rate at which the GC task generates free physical blocks is also monitored through another processing flow. Refer to Figure 13 .

[0133] Figure 13 FIG. shows a schematic diagram of monitoring the rate at which the GC task generates free physical blocks.

[0134] This process, the process of the previous embodiment, and the GC task are processed in parallel respectively. In this embodiment, outside the storage medium managed by the GC task ( Figure 12 ), some physical blocks are temporarily taken out of the management of the GC task, which is called "physical block stealing". As Figure 12 shown, the physical blocks obtained through "physical block stealing" are called "hidden physical blocks" 1210. The hidden physical blocks 1210 are free physical blocks (existing or recovered by the GC task), but the hidden physical blocks 1210 will not be allocated to carry host-written data or GC-written data. The hidden physical blocks 1210 will not be counted as free physical blocks either, thus affecting the judgment of the free physical block threshold E / K in the previous embodiments of this application.

[0135] Optionally, the GC task also does not use the hidden physical blocks 1210, so the number of hidden physical blocks 1210 may affect the bandwidth ratio (n:m) of host-written data and GC-written data at steady state. Since the existence of the hidden physical blocks 1210 makes the number of free blocks perceived by the GC task decrease, the bandwidth ratio of GC-written data may be appropriately increased at steady state to promote the GC task to generate more physical blocks. On the other hand, when using the hidden physical blocks 1210, usually because the number of free physical blocks grows too fast, when the number of free physical blocks is already large, the actual value of the bandwidth ratio of host-written data and GC-written data may not be affected or not be significantly affected.

[0136] Continue to refer to Figure 13 , and the processing flow of Figure 13 is executed periodically or when a specified situation occurs. Usually, the processing flow of Figure 13 is only executed during the startup of the GC task.

[0137] In Figure 13In the processing flow, obtain the current growth rate (1310) of free physical blocks. Determine whether the growth rate of free physical blocks is greater than the threshold V1 (1320). If the growth rate of free physical blocks is greater than the threshold V1, steal one or more free physical blocks reclaimed by the GC task (1330). The threshold V1 is greater than the rate at which the GC task generates free physical blocks in the steady state. Steal free physical blocks by, for example, obtaining free physical blocks from the free physical block pool as hidden physical blocks. After the free physical blocks are stolen, the number of current free physical blocks changes immediately. Thus, in the flow of the previous embodiments of this application, determine whether to start / stop the GC task based on the changed number of free physical blocks. And optionally calculate the x value for adjusting the ratio. When periodically executing Figure 13 the process, the acquisition of the growth rate of free physical blocks can be replaced by the difference in the number of free physical blocks between this execution Figure 13 of the process and the last execution Figure 13 of the process.

[0138] The number of stolen free physical blocks is generally not too many. For example, 1, 2, or a few. Optionally, the number of stolen free physical blocks depends on the obtained growth rate of free physical blocks. For example, classify the growth rate of free physical blocks by size, and each level corresponds to the number of free physical blocks to be stolen. As an optional goal, by stealing free physical blocks, make the growth rate of free physical blocks perceived by the GC task after stealing close to the average growth rate of free physical blocks in the steady state, or the average value within a specified time range.

[0139] Specifically, maintain a free physical block pool. To perform the stealing of free physical blocks, after the GC task generates new free physical blocks, do not put the free physical blocks into the free physical block pool to achieve this, and additionally maintain a set of hidden physical blocks. In the flow of the previous embodiments of this application, the number of current free physical blocks is also affected by the stealing of free physical blocks. The number of current free physical blocks does not include the number of hidden physical blocks.

[0140] Continue to refer to Figure 13 In Figure 13 a certain execution of the process, if the growth rate of free physical blocks is not greater than the threshold V1, return the stolen free physical blocks (1340). Return the free physical blocks by, for example, putting the hidden physical blocks into the free physical block pool. After the free physical blocks are returned, the number of current free physical blocks changes immediately. Thus, in the flow of the previous embodiments of this application, determine whether to start / stop the GC task based on the changed number of free physical blocks. And optionally calculate the x value for adjusting the ratio.

[0141] Optionally, when returning free physical blocks, one, several, or all free physical blocks can be returned. The number of free physical blocks returned can depend on the growth rate of the currently acquired free physical blocks.

[0142] Figure 14 The flowchart of free physical block stealing is shown.

[0143] Figure 14 The processing flow of optional free physical block stealing is provided. Compared with Figure 13 the flowchart, it also uses the threshold V2 as the judgment condition for whether to return free physical blocks.

[0144] In Figure 14 the processing flow, the current growth rate of free physical blocks (1410) is acquired. It is judged whether the growth rate of free physical blocks is greater than the threshold V1 (1420). When the growth rate of free physical blocks is greater than the threshold V1, free physical block stealing is executed (1430). When the growth rate of free physical blocks is not greater than the threshold V1, it is judged whether the growth rate of free physical blocks is less than the threshold V2 (1440). When the growth rate of free physical blocks is less than the threshold V2, free physical block return is executed (1420), where V1 > V2. When the growth rate of free physical blocks is between the threshold V1 and the threshold V2, the number of hidden physical blocks remains unchanged. It should be understood that although free physical blocks are stolen, not all newly added free physical blocks may be stolen. At this time, as the GC task is executed, new free physical blocks will still appear and cause changes in the current number of free physical blocks.

[0145] Optionally, the number of hidden physical blocks has an upper limit value. The upper limit value is, for example, 1, 2, or a few. By restricting the number of hidden physical blocks to avoid significantly changing the number of physical blocks managed by the GC, this may disrupt the existing working strategy of the GC task.

[0146] Still optionally, the upper limit value of hidden physical blocks can be dynamic and related to the growth rate of free physical blocks. For example, the hidden physical blocks are usually 1 or 2, and according to the significant increase in the current growth rate of free physical blocks, the upper limit of hidden physical blocks is correspondingly adjusted to 3 or 4, and free physical block stealing is executed as new free physical blocks are generated by the GC task. When the number of hidden physical blocks reaches the upper limit, free physical block stealing is no longer executed.

[0147] By introducing free physical block stealing on the basis of the foregoing embodiments, it further suppresses the trend of the GC task to start / stop in some special scenarios (such as a rapid increase in free physical blocks), thereby making the consistency of the storage device performance of the host experience better and improving the QoS index of the storage device.

[0148] In the embodiments of the present application, each processing procedure is described in units of physical blocks.

[0149] In some storage devices, large blocks are used as the units for allocating storage media and GC recycling storage media. The same applies to the present application.

[0150] Figure 16 The schematic diagram of the performance distribution of the random write executed by the present application is shown.

[0151] Same Figure 15 Compared with [the comparison object not specified in the original text], it can be seen that the trend of performance decline in the first 100s no longer exists, and the performance becomes more stable. Therefore, the present application can improve the stability of disk random write.

[0152] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above-described exemplary embodiments, and without departing from the spirit or basic characteristics of the present invention, the present invention can be implemented in other specific forms. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be encompassed within the present invention. Any reference signs in the claims should not be construed as limiting the claimed rights.

[0153] In addition, it should be understood that although this specification is described in terms of embodiments, not every embodiment only contains an independent technical solution. This narrative manner of the specification is only for clarity. Those skilled in the art should regard the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

Claims

1. A method for improving the random write stability of a solid state drive, characterized in that: include: In response to the number of free physical blocks / large blocks decreasing to a threshold value K, a GC task is started; Where K is the number threshold of free physical blocks / large blocks used to control the start and stop of GC tasks, K>L, L is the number threshold of free physical blocks / large blocks in a steady state, and both K and L are integers; Furthermore, the adjustment ratio of the amount of data externally written to the solid state drive and the amount of data written by the GC task per unit time is set to (n+x):m; and the amount of data externally written to the solid state drive and the amount of data written by the GC task per unit time are adjusted according to the adjustment ratio; Among them, x, n and m are all positive numbers.

2. The method for improving random write stability of a solid state drive according to claim 1, characterized in that: Also includes: In response to the number of free physical blocks / large blocks reaching the threshold value L, x is 0, and the adjustment ratio is n:m, so that the solid state drive enters a steady state.

3. The method for improving random write stability of a solid state drive according to claim 1 or 2, characterized in that: Also includes: In response to the number of free physical blocks / large blocks exceeding a threshold value K, the GC task stops.

4. The method for improving random write stability of a solid state drive according to any one of claims 1 to 3, characterized in that: x is proportional to the size of the logical free space of the solid state drive; or x=A*(d / (KL)), d is the difference between the number of free physical blocks / large blocks and the threshold L, A is a specified parameter, A>0.

5. A method for improving the random write stability of a solid state drive, characterized in that: include: In response to the number of free physical blocks / large blocks decreasing to a threshold value K, a GC task is started; Wherein, K is the number threshold of free physical blocks / large blocks for controlling the start of the GC task, K=L, L is the number threshold of free physical blocks / large blocks in a steady state, and both K and L are integers; and In response to the number of free physical blocks / large blocks exceeding a threshold value E, the GC task stops; Wherein, E is a threshold value of the number of free physical blocks / large blocks for controlling the stop of the GC task, and E>K.

6. The method for improving random write stability of a solid state drive according to claim 5, characterized in that: Also includes: In response to the GC task being started, the adjustment ratio of the amount of data externally written to the solid state drive and the amount of data written by GC per unit time is set to n:m, so that the solid state drive immediately enters a steady state.

7. The method for improving random write stability of a solid state drive according to claim 5 or 6, characterized in that: Also includes: In response to the number of free physical blocks / large blocks being greater than a threshold value K, checking whether the number of free physical blocks / large blocks exceeds a threshold value E; In response to the number of free physical blocks / large blocks exceeding the threshold E, the GC task is not started, or the GC task is kept not started.

8. The method for improving random write stability of a solid state drive according to any one of claims 5 to 7, characterized in that: Also includes: During the GC task startup, get the current growth rate of free physical blocks / large blocks; If the growth rate of the free physical blocks / large blocks is greater than the threshold value V1, one or more free physical blocks / large blocks of the solid state drive are stolen as hidden physical blocks / large blocks; The hidden physical block / large block will not be allocated to carry data written externally to the solid state drive or data written by GC, and the hidden physical block / large block will not be counted as a free physical block / large block.

9. The method for improving random write stability of a solid state drive according to claim 8, characterized in that: Also includes: If the growth rate of the free physical block / large block is less than the threshold value V2, the hidden physical block / large block is returned to the free physical block / large block; The growth rate of free physical blocks / large blocks is between threshold V1 and threshold V2, and the number of hidden physical blocks / large blocks remains unchanged; Among them, threshold V1>threshold V2.

10. A storage device, characterized in that: The invention comprises a controller and a non-volatile memory chip, wherein the controller is used to execute the method as claimed in any one of claims 1 to 9.