Traffic control method, device, storage medium, and program product

By offloading the storage space reclamation operation to a separate thread in ZNS SSD and using target water level information for flow control, the latency problem of the storage space reclamation process on the foreground read and write process is solved, and the flow control efficiency and storage engine IO capability are improved.

WO2026129984A1PCT designated stage Publication Date: 2026-06-25CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PTE LTD
Filing Date
2025-11-18
Publication Date
2026-06-25

AI Technical Summary

Technical Problem

During the storage space reclamation process of ZNS SSD, there is resource competition between the foreground read/write process and the storage space reclamation process, which leads to increased latency. Existing technologies are unable to effectively reduce the impact of the storage space reclamation process on the foreground read/write process.

Method used

The storage space reclamation operation is offloaded from the first thread that performs foreground write operations to an independent second thread. The target water level information of the target partition is obtained through the first and second threads to determine the target write speed threshold and the target reclamation speed threshold, and flow control is performed on the write operation and the storage space reclamation operation respectively.

Benefits of technology

It reduces the code complexity of flow control, improves flow control efficiency, reduces the latency impact of storage space reclamation on the front-end read and write process, and enhances the front-end IO capabilities of the storage engine.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025135733_25062026_PF_FP_ABST
    Figure CN2025135733_25062026_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a traffic control method, a device, a storage medium, and a program product. In the embodiments of the present disclosure, in a storage space recycling and unloading scenario, by means of either of a first thread and a second thread, a target zone resource is accessed, and a target write speed threshold of a write operation and a target recycling speed threshold of a storage space recycling operation are calculated, wherein the first thread can perform traffic control on a foreground write operation on the basis of the target write speed threshold, and the second thread can perform traffic control on the storage space recycling operation on the basis of the target recycling speed threshold, thereby implementing traffic control on the foreground write operation and the storage space recycling operation in the storage space recycling and unloading scenario. In addition, because only one thread accesses the target zone resource and data such as the target write speed threshold and the target recycling speed threshold, additional mutually exclusive logic does not need to be provided, thereby reducing code complexity of traffic control, and improving traffic control efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Flow control methods, devices, storage media and software products

[0001] This disclosure claims priority to Chinese Patent Application No. 202411883996.5, filed with the China Patent Office on December 19, 2024, entitled "Flow Control Method, Apparatus, Storage Medium and Program Product", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This disclosure relates to the field of computer technology, and in particular to a flow control method, device, storage medium, and program product. Background Technology

[0003] A Zoned Namespace Solid State Drive (ZNS SSD) is a type of solid state drive based on the Non-Volatile Memory Express (NVMe) standard. It divides the storage space into multiple fixed-size zones, and data within each zone must be written sequentially. This design optimizes write performance and improves the SSD's durability.

[0004] The standalone storage engine corresponding to the ZNS SSD can receive user read and write requests and read and write data to the ZNS SSD. The storage engine's response to user read and write requests and its subsequent reading and writing of data to the ZNS SSD is called foreground read / write. In addition to implementing basic foreground read / write functions, the storage engine also needs to recycle storage space on the ZNS SSD. The storage space recycling process and the foreground read / write process compete for resources, which has a certain impact on the latency of foreground read / write operations.

[0005] To reduce the impact of storage reclamation on foreground read / write operations, the storage reclamation process is typically offloaded to a separate thread. The thread performing foreground read / write operations is independent of the thread performing storage reclamation, reducing resource contention between the two processes and thus minimizing latency. This offloading approach also requires flow control for both the foreground read / write and storage reclamation processes. Summary of the Invention

[0006] This disclosure provides a flow control method, device, storage medium, and program product for implementing flow control during the foreground read / write process and the storage space reclamation process in a ZZS SSD storage space reclamation unloading scenario.

[0007] This disclosure provides a flow control method applicable to the processor of an electronic device, the electronic device further comprising: a partitioned namespace hard disk (ZNS SSD); the processor running a first thread and a second thread; the first thread being used to perform a write operation in response to a write request received by the electronic device to write data to the ZNS SSD; the second thread being used to perform a storage space reclamation operation on the ZNS SSD;

[0008] The method includes:

[0009] The target water level information of the target partition in the ZNS SSD, which is in the target state, is obtained by either the first thread or the second thread; the target state is either an available state or an unavailable state.

[0010] The target write speed threshold for the write operation and the target reclamation speed threshold for the storage space reclamation operation are determined by any one of the threads based on the target water level information.

[0011] The target recycling speed threshold or the target writing speed threshold is sent to another thread through any one of the threads; the other thread is a thread other than either of the first thread and the second thread.

[0012] The first thread performs flow control on the write operation based on the target write speed threshold; and the second thread performs flow control on the storage space reclamation operation based on the target reclamation speed threshold.

[0013] This disclosure also provides a flow control method applicable to the processor of an electronic device, the electronic device further comprising: a partitioned namespace hard disk (ZNS SSD); the processor running a first thread and a second thread; the first thread being used to execute a write operation to write data to the ZNS SSD based on a request received by the electronic device; the second thread being used to execute a storage space reclamation operation for the ZNS SSD;

[0014] The method includes:

[0015] The target water level information of the target partition in the ZNS SSD, which is in the target state, is obtained by either the first thread or the second thread; the target state is either an available state or an unavailable state.

[0016] The target water level information is sent to another thread through any one of the threads; the other thread is a thread other than either of the first thread and the second thread.

[0017] The first thread determines the target write speed threshold for the write operation based on the target water level information.

[0018] The second thread determines the target recycling speed threshold for the storage space recycling operation based on the target water level information.

[0019] The first thread performs flow control on the write operation based on the target write speed threshold; and the second thread performs flow control on the storage space reclamation operation based on the target reclamation speed threshold.

[0020] This disclosure also provides an electronic device, including: a memory and a processor; wherein the memory is used to store a computer program;

[0021] The processor is coupled to the memory and is used to execute the computer program for performing the steps of the aforementioned flow control methods.

[0022] This disclosure also provides a computer-readable storage medium storing computer instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the aforementioned flow control methods.

[0023] This disclosure also provides a computer program product, including a computer program that, when executed by one or more processors, causes the one or more processors to perform the steps of the aforementioned flow control methods.

[0024] In this embodiment, the storage space reclamation operation of the ZNS SSD is offloaded from the first thread performing the foreground write operation to an independent second thread, which then performs the storage space reclamation operation. In this storage space reclamation offloading scenario, by calculating the target partition resource accessed by either the first or second thread, the target write speed threshold for the write operation, and the target reclamation speed threshold for the storage space reclamation operation, the first thread can perform flow control on the foreground write operation based on the target write speed threshold, and the second thread can perform flow control on the storage space reclamation operation based on the target reclamation speed threshold. This achieves flow control for both foreground write operations and storage space reclamation operations in the storage space reclamation offloading scenario. Since only one thread accesses the target partition resource and the target write speed threshold and target reclamation speed threshold for the write operation and storage space reclamation operation, there is no need to lock the partition resource management logic of the partition manager or the target write speed threshold and target reclamation speed threshold for the write operation and storage space reclamation operation, i.e., no additional mutual exclusion logic is required. Therefore, the code complexity of flow control can be reduced, and the efficiency of flow control can be improved. Attached Figure Description

[0025] The accompanying drawings, which are included to provide a further understanding of this disclosure and form part of this disclosure, illustrate exemplary embodiments of the present disclosure and are used to explain the disclosure, but do not constitute an undue limitation of the disclosure. In the drawings:

[0026] Figure 1 is a schematic diagram of the structure of the ZNS SSD provided in an embodiment of this disclosure;

[0027] Figure 2 is a schematic diagram of the partition state transition process in the ZNS SSD provided in the embodiments of this disclosure;

[0028] Figure 3 is a schematic flowchart of the storage space reclamation process provided in the embodiments of this disclosure.

[0029] Figure 4 is a flowchart illustrating the flow control method provided in an embodiment of this disclosure;

[0030] Figure 5 is a schematic diagram of the specific flow control process in the storage space reclamation process unloading scenario provided in the embodiments of this disclosure;

[0031] Figure 6 is a schematic diagram of the write speed function curve and the recycling speed function curve provided in the embodiments of this disclosure;

[0032] Figure 7 is a flowchart illustrating another flow control method provided in an embodiment of this disclosure;

[0033] Figure 8 is a schematic diagram of the structure of the electronic device provided in the embodiment of this disclosure. Detailed Implementation

[0034] To make the objectives, technical solutions, and advantages of this disclosure clearer, the technical solutions of this disclosure will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.

[0035] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0036] The concepts and terms involved in the embodiments of this disclosure will be explained below.

[0037] Zoned Namespace Solid State Drive (ZNS SSD): As shown in Figure 1, ZNS SSD divides the storage space into multiple fixed-size zones according to the Logical Block Address (LBA) range. Figure 1 shows partitions 1-X. Data within each zone must be written sequentially. Once a zone is full, it must be erased before it can be written to again.

[0038] As shown in Figure 1, the write pointer manages data write operations within each zone. The write pointer indicates the current position where data can be written, ensuring that data is written to the zone sequentially. Each zone has a write pointer pointing to the current position where data can be written. The write pointer starts at the beginning of the zone and moves forward gradually as data is written. The movement of the write pointer is continuous until it reaches the end of the zone. When the write pointer reaches the end of the zone, the zone is considered full. At this point, no new data can be written to the zone unless an erase operation is performed first.

[0039] Foreground read / write: In ZNS SSD, foreground read / write refers to the interaction between the user and the ZNS SSD's storage engine to perform read or write operations on the ZNS SSD.

[0040] ZNS SSD partition status: Partition status reflects the status of the partition and can include: Free, Open, Closed and Garbage status.

[0041] In this context, the "Free" state refers to a partition that has not yet been written to, with the write pointer positioned at the beginning of the partition's path. A partition in the Free state can be selected by an application or the operating system for new write operations.

[0042] The "Open" state indicates that the partition is accepting new write operations, and the write pointer points to the current writable position. A partition in the "Open" state may have some space already written to, and the write pointer moves forward gradually from the beginning. A partition in the "Open" state can continue to receive new write operations until the write pointer reaches the end of the partition. Partitions in the "Open" state support append writes and random reads.

[0043] The Closed state means that the partition has been filled with data, the write pointer has reached the end of the partition, and the partition is closed. A partition in the Closed state cannot accept any more write operations, but random access is supported. The partition needs to undergo a storage space reclamation (Recycle) process before it can be reused.

[0044] The "Garbage" state refers to a partition that has undergone a recycling process, where invalid data has been removed and valid data has been moved to other free partitions. A partition in the Garbage state indicates that it no longer contains valid data and needs to be reset for reuse. A partition in the Garbage state cannot accept new write operations or perform read operations.

[0045] The partition states can be transitioned between each other. Specifically, as shown in Figure 2, for a partition in the Free state, the OpenZone operation can be used to change the partition from Free to Open. For a partition in the Open state, the CloseZone operation can be used to change the partition from Open to Close. For a partition in the Close state, the Recycle operation can be used to change the partition from Close to Garbage. For a partition in the Garbage state, the Reset operation can be used to reset the partition's write pointer, changing the partition from Garbage to Free.

[0046] The recycling process of this disclosure is described below as an example.

[0047] Due to the hardware limitations of ZNS SSDs, data within a partition (Zone) cannot be deleted or modified in-place. Therefore, the deletion operation only marks the logical address corresponding to the data to be deleted as stale. The actual storage space occupied by the stale data needs to be reclaimed through the garbage collection (GC) process, i.e., the storage space reclamation operation. The storage space reclamation process mainly includes the following steps:

[0048] 1. Select Source Zone: The storage engine selects a partition (Source Zone) containing a large amount of invalid data for reclamation. If the proportion of invalid data in the partition to the total space of the partition is greater than or equal to the set proportion threshold, then the partition is determined as the source partition.

[0049] 2. Read valid data: Read all valid data from the source partition.

[0050] 3. Write to Destination Zone: Select a free partition from the ZNS SSD partitions as the destination partition, and open the destination partition by performing an open partition operation. Then, write the valid data to the destination partition.

[0051] 4. After steps 1-3 above, the source partition no longer contains valid data and becomes a garbage partition. Then, all data in the garbage partition can be erased, restoring it to a free state, where it can continue to accept new write requests. Data can be written to a free partition starting from the initial LBA.

[0052] The above-mentioned storage space recycling process involves: task preparation, input / output (IO) operations, and metadata updates. Among them, task preparation refers to the operations of selecting the source partition, selecting the destination partition, and converting the destination partition to an open state. Input / output (IO) operations refer to the operations of reading valid data and writing valid data to the destination partition. Metadata updates include: (1) updating the logical address to physical address (L2P) mapping table, that is, when valid data is copied from the source partition to the destination partition, the L2P mapping table is updated to associate the new physical address with the logical address; (2) updating the partition status table, such as changing the status of the source partition from Close to Garbage, changing the status of the Garbage partition from Garbage to Free, and changing the status of the destination partition from Free to Open; (3) partition usage statistics: recording the usage of each partition, such as the used space and the remaining space. When copying valid data from the source partition to the destination partition, the used space of the source partition can be reduced, while the used space of the destination partition can be increased.

[0053] As described in the Recycle process, the Recycle process competes with the foreground read / write process for computing device resources, such as processor resources and ZNS SSD I / O resources. Therefore, the storage space reclamation (Recycle) process and the foreground read / write process compete for resources, which has a certain impact on the latency of foreground read / write operations, potentially increasing latency or causing a long tail in foreground read / write operations. The long tail of read / write operations refers to a phenomenon where most read / write operations have short response times, but a small portion of operations have significantly longer response times, forming a long-tailed distribution.

[0054] To reduce the impact of the storage reclamation process on the foreground read / write process, the storage reclamation process is generally offloaded to a separate thread. The thread executing foreground read / write is independent of the thread executing storage reclamation, which reduces resource contention between the storage reclamation process and the foreground read / write process, thereby reducing the latency of the storage reclamation process on the foreground read / write process.

[0055] The traditional storage space reclamation (Recycle) unloading process is illustrated below with reference to Figure 3. For ease of description and distinction, the IO thread performing foreground read / write operations is defined as the first thread, and the thread performing storage space reclamation operations is defined as the second thread. The first and second threads are independent of each other, using independent processor cores for IO processing. As shown in Figure 3, the foreground IO read / write process is completed independently by the first thread. The Recycle unloading process is mainly completed by the second thread. As shown in Figure 3, the traditional Recycle unloading process mainly includes the following steps:

[0056] 1. Select Source Zone: The first thread selects a partition (Source Zone) containing a large amount of invalid data for storage space reclamation. For example, the first thread can select a partition from the ZNS SSD partitions where the proportion of invalid data in the total space of the partition is greater than or equal to the set proportion threshold as the source partition.

[0057] 2. Send the identifier of the selected source partition to the second thread that performs the storage space reclamation operation. The second thread then starts the storage space reclamation task.

[0058] 3. The second thread performs a CloseZone operation on the source partition to change its state to Close. A source partition in the Close state stops receiving new write requests. The second thread is also used to open new partitions. Specifically, it performs an OpenZone operation on the selected destination partition, changing it to the Open state so that new data can be written to it, and it can be used to store the valid data copied from the source partition.

[0059] 4. The second thread prepares for the I / O task: This may include: (1) Identifying valid data in the source partition; for example, using an invalid data bitmap to determine which data blocks are valid. (2) Allocating system resources for the upcoming I / O operation to ensure the task can proceed smoothly. (3) Generating specific I / O requests, including read and write operations. For example, generating a read request to read valid data from the source partition, which can specify the starting address and length of the read; and generating a write request to write valid data to the destination partition, which specifies the starting address and length of the write. (4) Registering callback functions to handle subsequent operations after the I / O operation is completed.

[0060] 5. The second thread performs I / O operations related to storage space reclamation: specifically, it reads valid data from the source partition and writes the valid data to the destination partition.

[0061] Specifically, the second thread can submit read and write requests to write valid data to the destination partition. The read request is used to request the reading of valid data from the source partition, and the write request is used to request the writing of valid data to the destination partition. The second thread also starts polling, waiting for the I / O operation to complete.

[0062] 6. The second thread updates the data structure—the Chunk Segment. A Chunk Segment is a group of contiguous data chunks, typically used to manage and organize the storage and access of multiple chunks within a zone. Updating a Chunk Segment includes updating the status, location, and other metadata information of the multiple data chunks contained within it. The location of a data chunk can be represented using its LBA (Local Basic Architecture).

[0063] 7. The second thread notifies the first thread that the storage space reclamation task is complete.

[0064] 8. The first thread updates the metadata of the partition and the metadata of the data block corresponding to the valid data to reflect the new location and status changes of the valid data.

[0065] In this scheme, the storage space reclamation process is offloaded from the first thread performing foreground read / write operations to another thread (i.e., the second thread). The second thread can be dedicated to storage space reclamation operations. The first and second threads are independent of each other, which reduces resource contention between the storage space reclamation process and the foreground read / write process. Therefore, the impact of the storage space reclamation process on the processing latency (such as average latency and / or long-tail latency) of the first thread's foreground read / write operations can be reduced. On the other hand, since the impact of the storage space reclamation process on the processing latency of foreground read / write operations is reduced, the storage engine's processing of foreground read / write operations is correspondingly faster, which can improve the storage engine's foreground IO capabilities, such as increasing the storage engine's Input / Output Operations Per Second (IOPS) capability.

[0066] In storage space reclamation scenarios, both foreground read / write operations and storage space reclamation processes consume ZNS SSD I / O capabilities. Furthermore, both foreground write (LiveWrite) operations and storage space reclamation operations involve the consumption and creation of partition resources. Partition resource consumption refers to the transition of a partition from a Free state to a Closed state; partition resource creation refers to the transition of a partition from a Closed state to a Free state. Therefore, under different storage levels and I / O loads, specific flow control strategies are needed for foreground write operations and storage space reclamation operations. These strategies aim to control the interference of background processes like storage space reclamation on foreground read / write operations, maintain a balance between partition resource consumption and creation, and prevent ZNS SSDs from becoming unusable due to partition storage resource exhaustion.

[0067] In storage space reclamation and unloading scenarios, the flow control method required differs from that in non-storage space reclamation and unloading scenarios because the first thread (IO main thread) performing foreground read / write operations and the second thread performing storage space reclamation operations simultaneously perform IO operations and consume partition resources. Therefore, how to implement flow control in storage space reclamation and unloading scenarios is a pressing technical problem to be solved in this field.

[0068] In some embodiments of this disclosure, the storage space reclamation operation of the ZNS SSD is offloaded from the first thread performing the foreground write operation to an independent second thread, which then performs the storage space reclamation operation. In this storage space reclamation offloading scenario, by calculating the target partition resource accessed by either the first or second thread, the target write speed threshold for the write operation, and the target reclamation speed threshold for the storage space reclamation operation, the first thread can perform flow control on the foreground write operation based on the target write speed threshold, and the second thread can perform flow control on the storage space reclamation operation based on the target reclamation speed threshold. This achieves flow control for both the foreground write operation and the storage space reclamation operation in the storage space reclamation offloading scenario. Since only one thread accesses the target partition resource and the target write speed threshold and target reclamation speed threshold for the write operation and storage space reclamation operation, there is no need to lock the partition resource management logic of the partition manager and the target write speed threshold and target reclamation speed threshold for the write operation and storage space reclamation operation, i.e., no additional mutual exclusion logic is required. Therefore, the code complexity of flow control can be reduced, and the efficiency of flow control can be improved.

[0069] The technical solutions provided by the embodiments of this disclosure are described in detail below with reference to the accompanying drawings.

[0070] It should be noted that the same reference numerals in the following figures and embodiments denote the same object or the same step. Therefore, once an object or step is defined in one figure or embodiment, it does not need to be discussed further in subsequent figures and embodiments.

[0071] Figure 4 is a flowchart illustrating the flow control method provided in this embodiment. This method is applicable to a processor in an electronic device, which further includes a ZNS SSD. The processor runs a first thread and a second thread. The first thread is used to perform a write operation on a write request received by the electronic device to write data to the ZNS SSD; that is, the first thread performs a foreground write operation. The second thread is used to perform a storage space reclamation (Recycle) operation on the ZNS SSD. As shown in Figure 4, the method mainly includes:

[0072] 401. Obtain the target water level information of the target partition in the ZNS SSD that is in the target state through either thread A of the first thread or the second thread. The target state is either available or unavailable.

[0073] 402. Based on the target water level information, determine the target write speed threshold for write operations and the target reclamation speed threshold for storage space reclamation operations using any thread A.

[0074] 403. Send the target recycling speed threshold or target writing speed threshold to another thread B through any thread A; the other thread B is the thread other than either the first thread or the second thread.

[0075] 404. The first thread performs flow control on write operations based on the target write speed threshold.

[0076] 405. The second thread performs flow control on the storage space reclamation operation based on the target reclamation speed threshold.

[0077] In this embodiment of the disclosure, a partition in the ZNS SSD that is in an available state can be referred to as an AvailableZone. An AvailableZone refers to a partition in the ZNS SSD that can be written to without performing garbage collection (GC) operations (i.e., storage space reclamation). Such a partition can be converted into an Open partition without introducing additional internal I / O operations, accepting foreground write operations, that is, accepting write operations corresponding to write requests received by the electronic device to write data to the ZNS SSD. Therefore, an AvailableZone may include partitions in a Free state and / or partitions in a Garbage state. Specifically, a Free partition can be written to after an OpenZone operation, and a Garbage partition can be written to after an EraseZone operation and an OpenZone operation. Correspondingly, a partition in an unavailable state can be referred to as an UnavailableZone, which refers to a partition that requires GC operations to write data. It refers to partitions other than AvailableZones and may include OpenZone and CloseZone partitions.

[0078] The availability of partitions can be represented by the number of available partitions or the percentage of available partitions. The percentage of available partitions refers to the proportion of available partitions in the ZNS SSD out of the total number of partitions in the ZNS SSD. Similarly, the availability of partitions can be represented by the number of unavailable partitions or the percentage of unavailable partitions. The percentage of unavailable partitions refers to the proportion of unavailable partitions in the ZNS SSD out of the total number of partitions in the ZNS SSD.

[0079] In a ZNS SSD, a higher number of available partitions and a larger percentage of available partitions indicate a higher availability level. This means the ZNS SSD has more partition resources that can directly handle new foreground writes, and the need for generating new available partitions through storage space recycling is less. Conversely, a fewer number of available partitions and a larger percentage of available partitions indicate a lower availability level. This necessitates limiting the rate at which foreground writes consume partition resources and accelerating the rate at which storage space recycling generates new available partitions to ensure that available partitions are not exhausted and unable to handle new foreground write operations. Therefore, a higher availability level in a ZNS SSD results in a lower rate of throttling for storage space recycling and a higher rate of throttling for foreground write operations. Conversely, a lower availability level in a ZNS SSD results in a higher rate of throttling for storage space recycling and a lower rate of throttling for foreground write operations.

[0080] Similarly, for unavailable partitions in a ZNS SSD, the higher the water level of the unavailable partition, the greater the rate limiting speed of storage space reclamation, and the smaller the rate limiting speed of foreground write operations. Conversely, the lower the water level of the unavailable partition, the smaller the rate limiting speed of storage space reclamation, and the greater the rate limiting speed of foreground write operations.

[0081] Based on this, when performing flow control on foreground write operations and storage space reclamation operations, it is necessary to obtain the water level information of the target partition in the ZNS SSD that is in the target state, which is defined as the target water level information M.

[0082] Therefore, in step 401, the target water level information M of the target partition in the ZNS SSD, which is in the target state, can be obtained through either the first thread or the second thread, thread A. The target state can be either an available state or an unavailable state.

[0083] In this configuration, any thread A is one of the first thread and the second thread. Preferably, as shown in Figure 5, if thread A is the first thread, then correspondingly, the other thread B is the second thread. This is mainly because the frequency of storage space reclamation (Recycle) in ZNS SSD is much lower than the frequency of foreground writes. Therefore, as shown in step 2 of Figure 5, having the first thread performing the foreground write operation as the main thread to obtain the water level information M of the target partition in the ZNS SSD can improve the timeliness and accuracy of the obtained water level information M.

[0084] In some embodiments, the electronic device includes a ZoneManager. This ZoneManager is a component used to manage the multiple partitions (Zones) contained in the ZNS SSD, and can be implemented as a software functional module. The ZoneManager records and maintains the status of the multiple partitions (Zones) contained in the ZNS SSD. Accordingly, as shown in step 2 of Figure 5, the total water level of the free and garbage partitions can be obtained from the ZoneManager through any thread A, and used as the target water level information M for the target partition. Figure 5 only illustrates thread A as the first thread, but this is not intended to limit the scope.

[0085] In this embodiment, by using one of the first and second threads to access the target partition resources and obtain the target partition resource level, multi-threaded access to the target partition resources can be avoided. Because only one thread accesses the target partition resources, there is no need to lock the partition resource management logic of the partition manager, which reduces the code complexity of flow control and improves flow control efficiency.

[0086] Furthermore, in step 402 and step 3 of Figure 5, thread A can determine the target write speed threshold for the write operation and the target reclamation speed threshold for the storage space reclamation operation based on the target water level information M of the target partition. Here, the write operation refers to the write operation corresponding to the write request received by the electronic device for the ZNS SSD, i.e., the foreground write operation.

[0087] In this disclosure, the specific implementation of determining the target write speed threshold for write operations and the target recycling speed threshold for storage space reclamation operations based on the target water level information M of the target partition is not limited. In some embodiments, the target state is an available state. Therefore, the higher the water level of the available partitions in the ZNS SSD (the more available partitions or the larger the proportion of available partitions), the lower the rate limiting speed of storage space reclamation (Recycle), and the higher the rate limiting speed of foreground write operations. Conversely, the lower the water level of the available partitions in the ZNS SSD, the higher the rate limiting speed of storage space reclamation (Recycle), and the lower the rate limiting speed of foreground write operations. Thus, the write speed of write operations is positively correlated with the water level of available partitions; that is, the lower the water level of available partitions, the higher the write speed of write operations. The recycling speed of storage space reclamation operations is inversely correlated with the water level of available partitions; that is, the higher the water level of available partitions, the lower the recycling speed of storage space reclamation operations. Based on this, a positive correlation function between the write speed of the write operation and the available partition level can be obtained through thread A, and an inverse correlation function between the reclamation speed of the storage space reclamation operation and the available partition level can be obtained through thread A.

[0088] In some embodiments, a positive correlation function between the write speed of write operations and the available partition level can be preset, and an inverse correlation function between the reclamation speed of space reclamation operations and the available partition level can be preset. The preset positive correlation function can be obtained by fitting a function to the historical available partition level and the corresponding historical foreground write speed when the storage engine writes data to the ZNS SSD. The preset inverse correlation function can be obtained by fitting a function to the historical available partition level and the corresponding historical storage space reclamation speed.

[0089] In other embodiments, multiple water level thresholds Qi for available partitions and corresponding write speed thresholds WRi for each water level threshold can be preset. That is, multiple write speed thresholds WRi correspond to multiple water level thresholds Qi, with each water level threshold corresponding to a write speed threshold. The multiple write speed thresholds WRi are positively correlated with the multiple water level thresholds Qi. That is, a larger water level threshold corresponds to a larger write speed threshold. In the embodiments of this disclosure, "multiple" refers to two or more (including two). For embodiments that use the number of available partitions to characterize the water level of available partitions, the water level threshold is the same as the number threshold, and each water level threshold is less than or equal to the total number of partitions (Zones) contained in the ZNS SSD. i = 1, 2, ..., N. N represents the number of number thresholds, N ≥ 2, and is an integer. For example, N = 3, 4, or 5, or even more. For embodiments that use the proportion of available partitions to characterize the water level of available partitions, each water level threshold is less than or equal to 1. The multiple water level thresholds Qi for available partitions can be determined according to the water level of available partitions corresponding to a preset flow control level. The higher the flow control level, the smaller the water level threshold Qi for available partitions.

[0090] Multiple water level thresholds Qi and corresponding recycling rate thresholds GCRi can be pre-set for available partitions. Each water level threshold Qi corresponds to a single recycling rate threshold GCRi. The recycling rate thresholds GCRi are inversely correlated with the water level thresholds Qi; that is, a larger water level threshold corresponds to a smaller recycling rate threshold.

[0091] The write speed threshold WRi and the reclamation speed threshold GCRi corresponding to each water level threshold Qi can be obtained by stress testing the ZNS SSD when the available partition water level is Qi. For example, when the available partition water level is Qi, the foreground write speed is gradually increased until the load on the ZNS SSD reaches a set load requirement, such as the load on the ZNS SSD being greater than or equal to a set load threshold. The foreground write speed at which the write load on the ZNS SSD reaches the set load requirement is then used as the write speed threshold WRi corresponding to the available partition water level threshold Qi. Similarly, when the available partition water level is Qi, the reclamation speed can be gradually decreased until the load on the ZNS SSD reaches the set load requirement. The reclamation speed at which the write load on the ZNS SSD reaches the set load requirement is then used as the reclamation speed threshold GCRi corresponding to the available partition water level threshold Qi.

[0092] Based on multiple water level thresholds Qi and multiple write speed thresholds WRi corresponding to the multiple water level thresholds Qi, the multiple water level thresholds Qi and multiple write speed thresholds WRi corresponding to the multiple water level thresholds Qi can be obtained through any of the aforementioned threads A. Then, thread A determines the positive correlation function between the write speed of the write operation and the water level of the available partition based on the multiple water level thresholds Qi and multiple write speed thresholds WRi corresponding to the multiple water level thresholds Qi.

[0093] Optionally, a functional relationship between the write speed of the write operation and the water level of the target partition can be preset; the coefficients of this functional relationship are unknown. Multiple water level thresholds Qi and corresponding write speed thresholds WRi are substituted into the aforementioned functional relationship to obtain a mathematical model where the coefficients of the functional relationship are unknown. This mathematical model is then solved to obtain the coefficients of the functional relationship. Substituting the coefficients of the functional relationship into the functional relationship yields a positive correlation function between the write speed and the water level of the target partition. In this positive correlation function, the water level of the available partition is the independent variable, and the write speed is the dependent variable. By establishing a positive correlation function between the write speed and the water level of the available partition, the write speed can be dynamically adjusted under different conditions to adapt to the current state of the storage system. For example, the write speed can be reduced when the water level of the available partition is low to avoid performance degradation due to frequent garbage collection.

[0094] In other embodiments, multiple water level thresholds Qi can define multiple water level threshold ranges. Each water level threshold range may include at least two water level thresholds. Among two adjacent water level threshold ranges, the upper limit of the smaller water level threshold range is the lower limit of the larger water level threshold range. Then, thread A can determine at least two target water level thresholds corresponding to the target water level threshold range to which the target water level information M belongs from the multiple water level thresholds Qi. Subsequently, thread A can obtain at least two write speed thresholds corresponding to the aforementioned at least two target water level thresholds from the multiple write speed thresholds WRi corresponding to the multiple water level thresholds Qi. Further, thread A can determine the positive correlation function within the target water level threshold range based on the aforementioned at least two target water level thresholds and the at least two write speed thresholds corresponding to the aforementioned at least two target water level thresholds. Specifically, a functional relationship between the write speed of the write operation and the water level of the target partition can be pre-defined; the coefficients of this functional relationship are unknown. Substituting the aforementioned at least two target water level thresholds and the corresponding at least two write speed thresholds into the aforementioned functional relationship yields a mathematical model where the coefficients of the functional relationship are unknowns. This mathematical model is then solved to obtain the coefficients of the functional relationship. Substituting these coefficients back into the functional relationship yields a positive correlation function within the target water level threshold range. In this positive correlation function, the water level of the available partition is the independent variable, and the write speed is the dependent variable. This method of determining the positive correlation function reduces the computational load of the constructed mathematical model and improves the speed of determining the positive correlation function.

[0095] In this embodiment, the functional relationship between the write speed of the write operation and the available partition level can be a linear function, such as a piecewise linear function or a non-piecewise linear function. Alternatively, the functional relationship can be a non-linear function. Since linear functions have fewer unknowns, it is preferable to use a linear function to determine the positive correlation function, thereby improving the efficiency of subsequently determining the target write speed threshold for current limiting.

[0096] As shown in Figure 6, "Write Speed ​​Function Curve," the linear function relationship between the write speed of the write operation and the available partition level can be a piecewise linear function. Correspondingly, the positive correlation function is a piecewise linear function. Specifically, multiple level thresholds Qi define multiple level threshold ranges; each level threshold range includes at least two level thresholds; each level threshold range corresponds to a positive proportional linear function. For example, as shown in Figure 6, the level thresholds Qi have three levels, namely Q1, Q2, and Q3, and Q1 < Q2 < Q3. Accordingly, the level threshold ranges can include [Q1, Q2) and [Q2, Q3).

[0097] The slope of the proportional linear function corresponding to the same water level threshold range is the same. The slope of the proportional linear function corresponding to different water level threshold ranges is different. Optionally, as shown in Figure 6, the slope of multiple proportional linear functions corresponding to multiple water level threshold ranges increases with the increase of the water level of the target partition. For example, the slope of the proportional linear function corresponding to [Q1, Q2) is less than the slope of the proportional linear function corresponding to [Q2, Q3). In this way, the more water levels available in the partition, that is, the more partition resources that can support front-end writes, the faster the write speed increases. When there are sufficient available partition resources, the front-end write speed can be improved as much as possible, and the processing latency of front-end write IO can be reduced.

[0098] In some embodiments, a proportional linear function can be pre-determined within each water level threshold range based on at least two water level thresholds included in each water level threshold range and the write speed thresholds corresponding to each of these at least two water level thresholds. For example, as shown in Figure 6, for the water level threshold range [Q1, Q2), the corresponding proportional linear function relationship can be expressed as y = k1*x + b1; where x represents the water level of the available partition and y represents the write speed. Accordingly, substituting the water level threshold Q1 and the write speed threshold WR1 corresponding to water level threshold Q1; and the water level threshold Q2 and the write speed threshold WR2 corresponding to water level threshold Q2 into y = k1*x + b1, a system of linear equations can be obtained:

[0099] Solving equation (1) above, we can obtain the values ​​of k1 and b1. That is, k1 = (WR2 - WR1) / (Q2 - Q1); b1 = (WR2 * Q1 - WR1 * Q2) / (Q2 - Q1).

[0100] Furthermore, substituting the values ​​of k1 and b1 into y = k1*x + b1, we can obtain the direct proportional linear function corresponding to the water level threshold range [Q1, Q2) as: y = (WR2 - WR1) / (Q2 - Q1)*x + (WR2*Q1 - WR1*Q2) / (Q2 - Q1).

[0101] Using the same method, the direct proportional linear function corresponding to the water level threshold range [Q2, Q3) can be calculated as: y=(WR3-WR2) / (Q3-Q2)*x+(WR3*Q2-WR2*Q3) / (Q3-Q2).

[0102] Using the same method, multiple proportional linear functions corresponding to different water level threshold ranges can be obtained. After obtaining these functions, the target water level threshold range to which the target water level information M belongs in the current target partition can be determined. By substituting the target water level information M into the proportional linear function corresponding to the target water level threshold range, the write speed of the target water level information M in the proportional linear function can be obtained. This write speed is the target write speed threshold corresponding to the target water level information M.

[0103] In other embodiments, a proportional linear function within each water level threshold range can be pre-determined based on at least two water level thresholds included in each water level threshold range and the corresponding write speed thresholds for each of these at least two water level thresholds. Further, thread A can obtain at least two target water level thresholds corresponding to the target water level threshold range to which the target water level information M belongs from multiple water level thresholds; then, thread A can obtain at least two write speed thresholds corresponding to the aforementioned at least two target water level thresholds from multiple write speed thresholds WRi corresponding to multiple water level thresholds Qi. Further, thread A can determine a proportional linear function within the target water level threshold range based on the aforementioned at least two target water level thresholds and the at least two write speed thresholds corresponding to the aforementioned at least two target water level thresholds, as the proportional function within the target water level threshold range. This implementation only requires calculating the proportional linear function within the target water level threshold range to which the target water level information belongs, without needing to calculate the proportional linear function corresponding to all water level threshold ranges, thus reducing computational load and improving computational speed.

[0104] The foregoing embodiments exemplify how to determine the positive correlation function between write speed and the availability partition level, and are not intended to limit the scope of the solution. After determining the positive correlation function between write speed and availability partition level, the target level information M can be substituted into the positive correlation function to obtain the write speed corresponding to the target level information M in the proportional function, which serves as the target write speed threshold corresponding to the target level information M.

[0105] For example, as shown in Figure 6, assuming that the target water level information M of the target partition (i.e., the usable partition) in the available state satisfies the following relationship: Q2>M>Q1, then the write speed corresponding to the target water level information M can be: (WR2-WR1) / (Q2-Q1)*M+(WR2*Q1-WR1*Q2) / (Q2-Q1).

[0106] Similarly, based on the multiple water level thresholds Qi of the available partition and the multiple recycling speed thresholds GCRi corresponding to the multiple water level thresholds Qi, the multiple water level thresholds Qi of the available partition and the multiple recycling speed thresholds GCRi corresponding to the multiple water level thresholds Qi can be obtained through any of the aforementioned threads A. Then, thread A can determine the inverse correlation function between the write speed of the write operation and the water level of the available partition based on the multiple water level thresholds Qi of the available partition and the multiple recycling speed thresholds GCRi corresponding to the multiple water level thresholds Qi.

[0107] Optionally, a functional relationship between the recycling rate and the water level of the available partition can be pre-defined; the coefficients of this functional relationship are unknown. Multiple water level thresholds Qi and their corresponding recycling rate thresholds GCRi are substituted into the aforementioned functional relationship to obtain a mathematical model where the coefficients of the functional relationship are unknowns. This mathematical model is then solved to obtain the coefficients of the functional relationship. Substituting these coefficients into the functional relationship yields an inverse correlation function between the recycling rate and the water level of the available partition. In this inverse correlation function, the water level of the available partition is the independent variable, and the recycling rate is the dependent variable.

[0108] In other embodiments, multiple water level thresholds Qi can define multiple water level threshold ranges. Each water level threshold range may include at least two water level thresholds. Among two adjacent water level threshold ranges, the upper limit of the smaller water level threshold range is the lower limit of the larger water level threshold range. Then, thread A can determine at least two target water level thresholds corresponding to the target water level threshold range to which the target water level information M belongs from the multiple water level thresholds Qi. Subsequently, thread A can obtain at least two recovery rate thresholds corresponding to the aforementioned at least two target water level thresholds from the multiple recovery rate thresholds GCRi corresponding to the multiple water level thresholds Qi. Further, thread A can determine the inverse correlation function within the target water level threshold range based on the aforementioned at least two target water level thresholds and the at least two recovery rate thresholds corresponding to the aforementioned at least two target water level thresholds.

[0109] Specifically, a functional relationship between the recovery rate and the water level of the target zone can be pre-defined; the coefficients of this functional relationship are unknown. Substituting the aforementioned at least two target water level thresholds and the corresponding at least two recovery rate thresholds into the functional relationship yields a mathematical model with the coefficients of the functional relationship as unknowns. Solving this mathematical model yields the coefficients of the functional relationship. Substituting these coefficients back into the functional relationship yields an inverse correlation function within the target water level threshold range. In the positive correlation function, the number of available zones is the independent variable, and the recovery rate is the dependent variable. This method of determining the inverse correlation function reduces the computational load of the constructed mathematical model and improves the speed of determining the positive correlation function.

[0110] In this embodiment, the functional relationship between the recovery rate and the water level of the available zone can be a linear function, such as a piecewise linear function or a non-piecewise linear function. Alternatively, the functional relationship between the recovery rate and the water level of the available zone can be a non-linear function. Since linear functions have fewer unknowns, it is preferable that the functional relationship between the recovery rate and the water level of the available zone be a linear function. This improves the speed of determining the inverse correlation function, thereby contributing to the efficiency of subsequently determining the target recovery rate threshold for flow restriction.

[0111] As shown in Figure 6, “Recovery Rate Function Curve,” the linear functional relationship between the recovery rate and the water level of the available zone can be a piecewise linear function. Correspondingly, the inverse correlation function is also a piecewise linear function. Specifically, multiple water level thresholds Qi define multiple water level threshold ranges; each water level threshold range includes at least two water level thresholds; each water level threshold range corresponds to an inverse proportional linear function. For example, as shown in Figure 6, the water levels of the water level thresholds Qi are three, namely Q1, Q2, and Q3, and Q1 < Q2 < Q3. Accordingly, the water level threshold ranges can include [Q1, Q2) and [Q2, Q3).

[0112] The slope of the inverse proportional linear function corresponding to the same water level threshold range is the same. The slope of the inverse proportional linear function corresponding to different water level threshold ranges is different. Optionally, as shown in Figure 6, the slope of multiple inverse proportional linear functions corresponding to multiple water level threshold ranges increases with the increase of the available partition water level. For example, the slope of the inverse proportional linear function corresponding to [Q1, Q2) is less than the slope of the direct proportional linear function corresponding to [Q2, Q3). In this way, the more available partition water levels there are, that is, the more partition resources that can be received by the front end, the less demand there is on generating available partitions through the storage space reclamation process, and the faster the reclamation speed decreases. This can minimize the resource consumption of the storage space reclamation process when there are sufficient available partition resources.

[0113] In some embodiments, the inverse proportional linear function within each water level threshold range can be determined in advance based on at least two water level thresholds included in each water level threshold range and the corresponding recovery rate thresholds for each of these at least two water level thresholds. For example, as shown in Figure 6, for the water level threshold range [Q1, Q2), the corresponding inverse proportional linear function relationship can be expressed as y = k2*x + b2; where x represents the water level of the available zone and y represents the recovery rate. Accordingly, by substituting the water level threshold Q1 and the recovery rate threshold GCR1 corresponding to water level threshold Q1, and the water level threshold Q2 and the recovery rate threshold GCR2 corresponding to water level threshold Q2 into y = k2*x + b2, the values ​​of k2 and b2 can be obtained.

[0114] Furthermore, substituting the values ​​of k1 and b1 into y = k2*x + b2, we can obtain the inverse proportional linear function corresponding to the water level threshold range [Q1, Q2). The inverse proportional linear function corresponding to the water level threshold range [Q2, Q3) can be calculated using the same method.

[0115] Using the same method, inverse proportional linear functions corresponding to multiple water level threshold ranges can be obtained. After obtaining the inverse proportional linear functions corresponding to multiple water level threshold ranges, the target water level information M of the current available partition can be determined to belong to the target water level threshold range. By substituting the target water level information M into the inverse proportional linear function corresponding to the target water level threshold range for solving, the recovery rate of the target water level information M in the inverse proportional linear function can be obtained. This write rate is the target recovery rate threshold corresponding to the target water level information M.

[0116] In other embodiments, an inverse linear function within each water level threshold range can be pre-determined based on at least two water level thresholds included in each water level threshold range and the corresponding recovery rate thresholds for each of these at least two water level thresholds. Further, thread A can obtain at least two target water level thresholds corresponding to the target water level threshold range to which the target water level M belongs from multiple water level thresholds; then, thread A can obtain at least two recovery rate thresholds corresponding to the aforementioned at least two target water level thresholds from multiple recovery rate thresholds GCRi corresponding to multiple water level thresholds Qi. Further, thread A can determine an inverse linear function within the target water level threshold range based on the aforementioned at least two target water level thresholds and at least two write recovery thresholds corresponding to the aforementioned at least two target water level thresholds, and use this as the inverse linear function within the target water level threshold range. This implementation only requires calculating the inverse linear function within the target water level threshold range to which the target water level belongs, instead of calculating the inverse linear function corresponding to the entire water level threshold range, thus reducing computational load and improving computational speed.

[0117] The foregoing embodiments exemplify how to determine the inverse correlation function between the recovery rate and the water level of the available zone, and are not intended to limit the scope of the problem. After determining the inverse correlation function between the recovery rate and the water level of the available zone, the target water level information M can be substituted into the inverse proportional function to obtain the recovery rate corresponding to the target water level M in the inverse correlation function, which serves as the target recovery rate threshold corresponding to the target water level information M.

[0118] For example, as shown in Figure 6, assuming that the target water level information M of the available partition satisfies the following relationship: Q2>M>Q1, then the recovery rate corresponding to the target water level threshold M can be: (GCR2-GCR1) / (Q2-Q1)*M+(GCR2*Q1-GCR1*Q2) / (Q2-Q1).

[0119] Similarly, in some other embodiments, the target state in step 402 is an unavailable state. Correspondingly, the target partition is an unavailable partition. The target water level information M of the target partition is the number of unavailable partitions or the proportion of unavailable partitions. In this embodiment, step 402 can be implemented as follows: obtaining the inverse correlation function between the write speed and the water level information of the unavailable partition through any thread A; determining the write speed corresponding to the target water level information M in the inverse correlation function through thread A, as the target write speed threshold; and obtaining the positive correlation function between the recycling speed and the water level of the available partition through thread A; determining the recycling speed corresponding to the target water level information M in the positive correlation function through thread A, as the target recycling speed threshold.

[0120] In some embodiments, an inverse correlation function between the write speed of write operations and the water level of unavailable partitions can be preset, and a positive correlation function between the reclamation speed of space reclamation operations and the water level of unavailable partitions can be preset. The preset inverse correlation function can be obtained by fitting a function to the historical water level of unavailable partitions and the corresponding historical foreground write speed when the storage engine writes data to the ZNS SSD. The preset positive correlation function can be obtained by fitting a function to the historical water level of unavailable partitions and the corresponding historical storage space reclamation speed.

[0121] In other embodiments, multiple water level thresholds Qj for unavailable partitions and corresponding write speed thresholds WRj can be pre-set. That is, multiple write speed thresholds WRj correspond to multiple water level thresholds Qj, with each water level threshold corresponding to a single write speed threshold. The multiple write speed thresholds WRj are inversely correlated with the multiple water level thresholds Qj; that is, a larger water level threshold corresponds to a smaller write speed threshold. The multiple water level thresholds Qj for unavailable partitions can be determined based on the water level of the unavailable partition corresponding to a pre-set flow control level. The higher the flow control level, the larger the water level thresholds Qj for the unavailable partition.

[0122] Multiple water level thresholds Qj for unavailable zones and corresponding recovery rate thresholds GCRj can be pre-set. That is, multiple water level thresholds Qj correspond to multiple recovery rate thresholds GCRj, with each water level threshold corresponding to one recovery rate threshold. The multiple recovery rate thresholds GCRj are positively correlated with the multiple water level thresholds Qj; that is, a larger water level threshold corresponds to a larger recovery rate threshold.

[0123] Based on multiple water level thresholds Qj and multiple write speed thresholds WRj corresponding to the multiple water level thresholds Qj, the multiple water level thresholds Qj and multiple write speed thresholds WRj corresponding to the multiple water level thresholds Qj can be obtained through any of the aforementioned threads A. Then, thread A determines the inverse correlation function between the write speed of the write operation and the water level of the unavailable partition based on the multiple water level thresholds Qj and multiple write speed thresholds WRj corresponding to the multiple water level thresholds Qj.

[0124] Optionally, a pre-defined functional relationship can be established between the write speed of the write operation and the water level of the target partition; the coefficients of this functional relationship are unknown. Multiple water level thresholds Qj and corresponding write speed thresholds WRj are substituted into the aforementioned functional relationship to obtain a mathematical model where the coefficients of the functional relationship are unknowns. This mathematical model is then solved to obtain the coefficients of the functional relationship. Substituting these coefficients into the functional relationship yields an inverse correlation function between the write speed and the water level of the unavailable partition. In the positive correlation function, the water level of the unavailable partition is the independent variable, and the write speed is the dependent variable.

[0125] In other embodiments, multiple water level thresholds Qj can define multiple water level threshold ranges. Each water level threshold range may include at least two water level thresholds. Among two adjacent water level threshold ranges, the upper limit of the smaller water level threshold range is the lower limit of the larger water level threshold range. Then, thread A can determine, from the multiple water level thresholds Qj, at least two target water level thresholds corresponding to the target water level threshold range to which the target water level information M belongs. Subsequently, thread A can obtain, from the multiple write speed thresholds WRj corresponding to the multiple water level thresholds Qj, at least two write speed thresholds corresponding to the aforementioned at least two target water level thresholds. Further, thread A can determine the inverse correlation function within the target water level threshold range based on the aforementioned at least two target water level thresholds and the at least two write speed thresholds corresponding to the aforementioned at least two target water level thresholds. Specifically, a pre-defined functional relationship can be established between the write speed of the write operation and the water level of the target partition; the coefficients of this functional relationship are unknown. Substituting the aforementioned at least two target water level thresholds and the corresponding at least two write speed thresholds into the functional relationship yields a mathematical model where the coefficients of the functional relationship are unknowns. This mathematical model is then solved to obtain the coefficients of the functional relationship. Substituting these coefficients back into the functional relationship yields an inverse correlation function within the target water level threshold range. In this inverse correlation function, the water level of the unusable partition is the independent variable, and the write speed is the dependent variable. This method of determining the inverse correlation function reduces the computational load of the constructed mathematical model and improves the speed of determining the inverse correlation function.

[0126] In this embodiment, the functional relationship between the write speed of the write operation and the water level of the unavailable partition can be a linear function, such as a piecewise linear function or a non-piecewise linear function. Alternatively, the functional relationship can be a non-linear function. Since linear functions have fewer unknowns, it is preferable to use a linear function to determine the positive correlation function, thereby improving the efficiency of subsequently determining the target write speed threshold for current limiting.

[0127] The slope of the inverse proportional linear function corresponding to the same water level threshold range is the same. The slope of the direct proportional linear function corresponding to different water level threshold ranges is different. Optionally, the slope of multiple inverse proportional linear functions corresponding to multiple water level threshold ranges decreases as the water level of unavailable partitions increases. In this way, the fewer the water levels of unavailable partitions, the more available partitions there are, that is, the more partition resources can accommodate foreground writes, and the faster the write speed increases. When available partition resources are sufficient, the foreground write speed can be maximized, and the processing latency of foreground write IO can be reduced.

[0128] In some embodiments, an inverse proportional linear function within each water level threshold range can be pre-determined based on at least two water level thresholds included in each water level threshold range and the write speed threshold corresponding to each of these at least two water level thresholds. The same method can be used to obtain the direct proportional linear functions corresponding to multiple water level threshold ranges. After obtaining the direct proportional linear functions corresponding to multiple water level threshold ranges, the target water level threshold range to which the target water level information M of the current target partition belongs can be determined. The target water level information M is then substituted into the direct proportional linear function corresponding to the target water level threshold range for solution, thereby obtaining the write speed of the target water level information M within the direct proportional linear function. This write speed is the target write speed threshold corresponding to the target water level information M.

[0129] In other embodiments, a direct proportional linear function within each water level threshold range can be pre-determined based on at least two water level thresholds included in each water level threshold range and the corresponding write speed thresholds for each of these at least two water level thresholds. Further, thread A can obtain at least two target water level thresholds corresponding to the target water level threshold range to which the target water level information M belongs from multiple water level thresholds; then, thread A can obtain at least two write speed thresholds corresponding to the aforementioned at least two target water level thresholds from multiple write speed thresholds WRj corresponding to multiple water level thresholds Qj. Further, thread A can determine an inverse proportional linear function within the target water level threshold range based on the aforementioned at least two target water level thresholds and the at least two write speed thresholds corresponding to the aforementioned at least two target water level thresholds, and use this as the inverse proportional function within the target water level threshold range. This implementation only requires calculating the inverse proportional linear function within the target water level threshold range to which the target water level information belongs, instead of calculating the inverse proportional linear function corresponding to the entire water level threshold range, thus reducing computational load and improving computational speed.

[0130] The foregoing embodiments exemplify how to determine the inverse correlation function between write speed and the level of unavailable partitions, and are not intended to limit the scope of the problem. After determining the inverse correlation function between write speed and the level of unavailable partitions, the target level information M can be substituted into the positive correlation function to obtain the write speed corresponding to the target level information M in the proportional function, which serves as the target write speed threshold corresponding to the target level information M.

[0131] Similarly, based on multiple water level thresholds Qj and multiple recovery speed thresholds GCRj corresponding to the multiple water level thresholds Qj in the pre-set unavailable partition, multiple water level thresholds Qj and multiple recovery speed thresholds GCRj corresponding to the multiple water level thresholds Qj in the pre-set unavailable partition can be obtained through any of the aforementioned threads A. Then, thread A can determine the positive correlation function between the write speed of the write operation and the water level of the unavailable partition based on the multiple water level thresholds Qj and multiple recovery speed thresholds GCRj corresponding to the multiple water level thresholds Qj in the unavailable partition.

[0132] Optionally, a pre-defined functional relationship between the recovery rate and the water level of the unusable zone can be established; the coefficients of this functional relationship are unknown. Multiple water level thresholds Qj and their corresponding recovery rate thresholds GCRj are substituted into the aforementioned functional relationship to obtain a mathematical model where the coefficients of the functional relationship are unknowns. This mathematical model is then solved to obtain the coefficients of the functional relationship. Substituting these coefficients into the functional relationship yields an inverse correlation function between the recovery rate and the water level of the unusable zone. In this inverse correlation function, the water level of the unusable zone is the independent variable, and the recovery rate is the dependent variable.

[0133] In other embodiments, multiple water level thresholds Qj can define multiple water level threshold ranges. Each water level threshold range may include at least two water level thresholds. Among two adjacent water level threshold ranges, the upper limit of the smaller water level threshold range is the lower limit of the larger water level threshold range. Then, thread A can determine, from the multiple water level thresholds Qj, at least two target water level thresholds corresponding to the target water level threshold range to which the target water level information M belongs. Subsequently, thread A can obtain, from the multiple recovery rate thresholds GCRj corresponding to the multiple water level thresholds Qj, at least two recovery rate thresholds corresponding to the aforementioned at least two target water level thresholds. Further, thread A can determine the positive correlation function within the target water level threshold range based on the aforementioned at least two target water level thresholds and the at least two recovery rate thresholds corresponding to the aforementioned at least two target water level thresholds.

[0134] Specifically, a functional relationship between the recovery rate and the water level of the target zone can be pre-defined; the coefficients of this functional relationship are unknown. Substituting the aforementioned at least two target water level thresholds and the corresponding at least two recovery rate thresholds into the functional relationship yields a mathematical model with the coefficients of the functional relationship as unknowns. Solving this mathematical model yields the coefficients of the functional relationship. Substituting these coefficients back into the functional relationship yields a positive correlation function within the target water level threshold range. In this positive correlation function, the number of unusable zones is the independent variable, and the recovery rate is the dependent variable. This method of determining the positive correlation function reduces the computational load of the constructed mathematical model and improves the speed of determining the positive correlation function.

[0135] In this embodiment, the functional relationship between the recovery rate and the water level of the unavailable zone can be a linear function, such as a piecewise linear function or a non-piecewise linear function. Alternatively, the functional relationship between the recovery rate and the water level of the unavailable zone can be a non-linear function. Since linear functions have fewer unknowns, it is preferable that the functional relationship between the recovery rate and the water level of the unavailable zone be a linear function. This improves the speed of determining the positive correlation function, thereby contributing to the efficiency of subsequently determining the target recovery rate threshold for flow restriction.

[0136] The slope of the direct proportional linear function corresponding to the same water level threshold range is the same. The slope of the inverse proportional linear function corresponding to different water level threshold ranges is different. The slope of the multiple direct proportional linear functions corresponding to multiple water level threshold ranges decreases as the water level of unavailable partitions increases. Thus, the fewer the water levels of unavailable partitions, the more available partitions there are, meaning more partition resources can be handled by front-end writes. This reduces the need to generate available partitions through the storage space reclamation process, and the reclamation speed decreases faster. Therefore, when available partition resources are sufficient, the resource consumption of the storage space reclamation process can be minimized.

[0137] In some embodiments, a direct proportional linear function can be pre-determined within each water level threshold range based on at least two water level thresholds included in each water level threshold range and the corresponding recovery rate threshold for each of these at least two water level thresholds. The same method can be used to obtain inverse proportional linear functions corresponding to multiple water level threshold ranges. After obtaining the inverse proportional linear functions corresponding to multiple water level threshold ranges, the target water level threshold range to which the target water level information M of the currently unavailable partition belongs can be determined. The target water level information M is then substituted into the direct proportional linear function corresponding to the target water level threshold range for solution, thereby obtaining the recovery rate of the target water level information M within the inverse proportional linear function. This write rate is the target recovery rate threshold corresponding to the target water level information M.

[0138] In other embodiments, a direct proportional linear function within each water level threshold range can be pre-determined based on at least two water level thresholds included in each water level threshold range and the corresponding recovery rate thresholds for each of these at least two water level thresholds. Further, thread A can obtain at least two target water level thresholds corresponding to the target water level threshold range to which the target water level M belongs from multiple water level thresholds; then, thread A can obtain at least two recovery rate thresholds corresponding to the aforementioned at least two target water level thresholds from multiple recovery rate thresholds GCRj corresponding to multiple water level thresholds Qj. Further, thread A can determine a direct proportional linear function within the target water level threshold range based on the aforementioned at least two target water level thresholds and at least two write recovery thresholds corresponding to the aforementioned at least two target water level thresholds, and use this as the direct proportional function within the target water level threshold range. This implementation only requires calculating the inverse proportional linear function within the target water level threshold range to which the target water level belongs, without needing to calculate the inverse proportional linear function corresponding to the entire water level threshold range, thus reducing computational load and improving computational speed.

[0139] The foregoing embodiments exemplify how to determine the positive correlation function between the recovery rate and the water level of unusable zones, and are not intended to limit the scope of the problem. After determining the positive correlation function between the recovery rate and the water level of unusable zones, the target water level information M can be substituted into the positive correlation function to solve for the recovery rate corresponding to the target water level M in the positive correlation function, which is then used as the target recovery rate threshold corresponding to the target water level information M.

[0140] Through the above implementation method, thread A can determine the target write speed threshold for write operations and the target reclamation speed threshold for storage space reclamation operations. Further, in step 403, thread A can send the target reclamation speed threshold or the target write speed threshold to another thread B. The other thread B is a thread other than thread A among the first and second threads. For example, if thread A is the first thread, then thread B is the second thread; if thread A is the second thread, then thread B is the first thread. As shown in step 4 of Figure 5, if thread A is the first thread, then the target reclamation speed threshold is sent to the second thread through the first thread. Correspondingly, if thread A is the second thread, then the target write speed threshold is sent to the second thread through the second thread (not shown in Figure 5).

[0141] In some embodiments, thread A may periodically send a target recovery speed threshold or a target write speed threshold to another thread B according to a set sending period. The sending period may be a unit of time corresponding to the target recovery speed threshold or the target write speed threshold. For example, if the unit of time corresponding to the target recovery speed threshold or the target write speed threshold is seconds, then the sending period is 1 second.

[0142] In step 403, the first thread can obtain the target write speed threshold, and the second thread can obtain the target reclamation speed threshold. Further, in steps 404 and 405, the first thread can perform flow control on the write operation based on the target write speed threshold (corresponding to step 5.1 in Figure 5), and the second thread can perform flow control on the storage space reclamation operation based on the target reclamation speed threshold (corresponding to step 5.2 in Figure 5).

[0143] In this embodiment, by offloading the storage space reclamation operation of the ZNS SSD from the first thread performing the foreground write operation to an independent second thread, the resource contention between the storage space reclamation operation and the foreground write operation is reduced. This reduces the impact of the storage space reclamation operation on the processing latency of the foreground write operation, thus helping to reduce the processing latency of the foreground write operation. On the other hand, by calculating the target partition resources, the target write speed threshold for the write operation, and the target reclamation speed threshold for the storage space reclamation operation by either the first thread or the second thread, the first thread can perform flow control on the foreground write operation based on the target write speed threshold, and the second thread can perform flow control on the storage space reclamation operation based on the target reclamation speed threshold. This achieves flow control for both the foreground write operation and the storage space reclamation operation in the storage space reclamation offloading scenario.

[0144] On the other hand, having either the first thread or the second thread access the target partition resources and calculate the target write speed threshold and target reclamation speed threshold avoids multi-threaded access to the target partition resources and data such as the target write speed threshold and target reclamation speed threshold. Because only one thread accesses the target partition resources and data such as the target write speed threshold and target reclamation speed threshold, there is no need to lock the partition manager's partition resource management logic or the target write speed threshold and target reclamation speed threshold, thus eliminating the need for additional mutual exclusion logic. This reduces the code complexity of flow control and improves flow control efficiency.

[0145] In this embodiment of the disclosure, as shown in FIG5, a first current limiter is configured on a first thread, and a second current limiter is configured on a second thread. Both the first and second current limiters are computer program modules. The first current limiter is used to execute the flow control operation performed by the first thread; the second current limiter is used to execute the flow control operation performed by the second thread. In this embodiment of the disclosure, the first and second current limiters have a logical "master-slave relationship," wherein the current limiter configured on thread A is the master current limiter, and the current limiter configured on thread B is the slave current limiter. As shown in step 1 of FIG5, during the initialization process of the electronic device, the current limiter configured on thread B can send registration information to the current limiter configured on thread A to register the current limiter configured on thread B as a slave current limiter of the current limiter configured on thread A. The registration information may include the memory address information of the current limiter configured on thread B. Thus, after determining the target write speed threshold for write operations and the target reclamation speed threshold for memory reclamation operations, the current limiter set in thread A can send the target reclamation speed threshold or the target write speed threshold to the current limiter set in thread B based on the memory address information of the current limiter set in thread B. Figure 5 illustrates this only with thread A as the first thread and thread B as the second thread, but it does not constitute a limitation.

[0146] In Figure 5, the first flow limiter in the first thread accesses the target partition resources and calculates the target write speed threshold and the target reclamation speed threshold. This avoids multiple threads accessing the target partition resources and the target write speed threshold and target reclamation speed threshold data. Because only one thread accesses the target partition resources and the target write speed threshold and target reclamation speed threshold data, there is no need to lock the partition manager's partition resource management logic and the target write speed threshold and target reclamation speed threshold data. This eliminates the need for additional mutual exclusion logic, reducing the code complexity of flow control and improving flow control efficiency.

[0147] If the first thread and the second thread share the same rate limiter, the corresponding flow control logic can implement the following steps:

[0148] 1. The current limiter in the first thread can access the partition manager to obtain the target water level information M of the target partition in the target state. The target state is either available or unavailable.

[0149] 2. Based on the target water level information M, calculate the target write speed threshold for write operations and the target reclamation speed threshold for storage space reclamation operations.

[0150] 3. Based on the target write speed threshold and the target reclamation speed threshold, update the write speed threshold and the target reclamation speed threshold stored in the target memory space shared by the first thread and the second thread.

[0151] 4. The first thread accesses the target memory space and reads the target write speed threshold; the second thread accesses the target memory space and reads the target reclamation speed threshold.

[0152] 5. The first thread performs flow control on write operations based on the target write speed threshold; the second thread performs flow control on storage space reclamation operations based on the target reclamation speed threshold.

[0153] In the flow control method shown in Figure 7, the foreground write process and the storage space reclamation process share the same flow limiter, inevitably resulting in a multi-threaded access and sharing structure. For example, in step 3, the target memory space is used to store data structures for the target write speed threshold and the target reclamation speed threshold. To maintain data consistency, locking the data structures in the target memory space is required, i.e., adding extra mutual exclusion logic, which undoubtedly increases the complexity of the flow control code. The flow control method provided in this embodiment allows only one thread to access the target partition resources and data such as the target write speed threshold and the target reclamation speed threshold, thus eliminating the need for additional mutual exclusion logic, reducing the code complexity of flow control, and improving flow control efficiency.

[0154] In this disclosure, the specific implementation of flow control for storage space reclamation operations based on a target reclamation rate threshold via a second thread is not limited. In some embodiments, time slices can be performed on the unit time corresponding to the target reclamation rate threshold to obtain multiple time slices. Each time slice corresponds to multiple initial storage space reclamation thresholds. The sum of the multiple initial storage space reclamation thresholds is equal to the storage space reclamation threshold corresponding to the unit time. For example, assuming the target reclamation rate threshold is 500MB / s, then the unit time is 1s, and the storage space reclamation threshold corresponding to the unit time is 500MB. Accordingly, the sum of the multiple initial storage space reclamation thresholds is 500MB.

[0155] In some embodiments, the storage space reclamation threshold corresponding to a unit time can be evenly distributed across multiple time slices to obtain multiple initial storage space reclamation thresholds corresponding to multiple time slices. For example, assuming a time slice is 100 microseconds (μs), then a unit time (i.e., 1s) can be divided into 10,000 time slices. If the target reclamation speed threshold is 500MB / s, then the initial storage space reclamation threshold corresponding to each time slice is 0.05MB, or 51.2KB.

[0156] In some embodiments, the reclaimed storage space for each time segment can be controlled to not exceed the initial storage space reclamation threshold corresponding to that time segment, based on the initial storage space reclamation threshold corresponding to multiple time segments. This flow control method is logically simple and easy to implement. However, this flow control method may lead to a waste of storage space reclamation bandwidth resources, failing to fully utilize the bandwidth resources for storage space reclamation. For example, assuming that the reclaimed storage space for the i-th time segment does not reach the initial storage space reclamation threshold corresponding to that time segment, it will result in a waste of the storage space reclamation bandwidth for the i-th time segment.

[0157] In other embodiments, in order to reduce the waste of bandwidth resources in storage space reclamation, for the first time segment among multiple time segments, the storage space reclaimed in the first time segment can be controlled to be less than or equal to the initial storage space reclamation threshold corresponding to the first time segment.

[0158] Furthermore, if the storage space reclaimed in the first time slice is less than the initial storage space reclamation threshold corresponding to the first time slice, a target difference between the initial storage space reclamation threshold and the reclaimed storage space in the first time slice can be calculated, i.e., the unused bandwidth in the first time slice is calculated. Further, the target difference can be added to the initial storage space reclamation threshold corresponding to the second time slice, serving as the storage space reclamation threshold for the second time slice, effectively reallocating the unused bandwidth from the first time slice to the second time slice. Thus, in the second time slice, the second thread can control the reclaimed storage space to be less than or equal to the storage space reclamation threshold corresponding to the second time slice. Furthermore, if the storage space reclaimed in the second time slice is less than the storage space reclamation threshold corresponding to the second time slice, a target difference between the storage space reclamation threshold and the reclaimed storage space in the second time slice can be calculated, i.e., the unused bandwidth in the second time slice is calculated. Further, the target difference can be added to the initial storage space reclamation threshold corresponding to the third time slice, serving as the storage space reclamation threshold for the third time slice, effectively reallocating the unused bandwidth from the second time slice to the third time slice. Thus, in the third time slice, the second thread can control the reclaimed storage space to be less than or equal to the storage space reclamation threshold. By sequentially advancing according to time slices and reallocating the unused bandwidth from the previous time slice to the next, the waste of storage space reclamation bandwidth resources can be reduced.

[0159] The flow control method for the aforementioned storage space reclamation operation can be summarized as follows: for any two adjacent time slices, namely the i-th time slice and the (i+1)-th time slice, the storage space reclaimed by the i-th time slice can be controlled to be less than or equal to the storage space reclamation threshold corresponding to the i-th time slice.

[0160] Wherein, if the i-th time slice is the 1-th time slice, then the storage space reclamation threshold corresponding to the 1-th time slice is the initial storage space reclamation threshold corresponding to the 1-th time slice. If the i-th time slice is any other time slice besides the 1-th time slice, then the storage space reclamation threshold corresponding to the i-th time slice may be the initial storage space reclamation threshold corresponding to the i-th time slice, or it may be obtained by adjusting the initial storage space reclamation threshold corresponding to the i-th time slice.

[0161] Whether the storage space reclamation threshold corresponding to the i-th time slice is the initial storage space reclamation threshold corresponding to the i-th time slice, or the result obtained by adjusting the initial storage space reclamation threshold corresponding to the i-th time slice, depends on whether the storage space reclaimed by the (i-1)-th time slice is less than the storage space reclamation threshold corresponding to the (i-1)-th time slice, that is, whether the storage space reclamation bandwidth of the (i-1)-th time slice has been fully utilized. If the storage space reclaimed by the (i-1)-th time slice is less than the storage space reclamation threshold corresponding to the (i-1)-th time slice, it means that the storage space reclamation bandwidth of the (i-1)-th time slice has not been fully utilized, and the storage space reclamation threshold corresponding to the i-th time slice is obtained by adjusting the initial storage space reclamation threshold corresponding to the i-th time slice. For the specific adjustment method, please refer to the relevant content of the aforementioned embodiments, which will not be repeated here. If the storage space reclaimed by the (i-1)th time segment is equal to the storage space reclamation threshold corresponding to the (i-1)th time segment, it means that the storage space reclamation bandwidth of the (i-1)th time segment has been used up. Then the storage space reclamation threshold corresponding to the i-th time segment is the initial storage space reclamation threshold corresponding to the i-th time segment.

[0162] Furthermore, if the storage space reclaimed in the i-th time slice is less than the storage space reclamation threshold corresponding to the i-th time slice, a target difference between the storage space reclamation threshold and the reclaimed storage space in the i-th time slice can be calculated, i.e., the unused bandwidth of the i-th time slice can be calculated. Further, the target difference can be added to the initial storage space reclamation threshold corresponding to the (i+1)-th time slice, serving as the storage space reclamation threshold for the (i+1)-th time slice, effectively reallocating the unused bandwidth of the i-th time slice to the (i+1)-th time slice. Furthermore, a second thread controls the storage space reclaimed in the (i+1)-th time slice to be less than or equal to the storage space reclamation threshold. In this way, reallocating the unused bandwidth of the previous time slice to the next time slice reduces the waste of storage space reclamation bandwidth resources.

[0163] As shown in Figure 5, the adjustment of the initial storage space reclamation threshold corresponding to the (i+1)th time slice can be performed by thread A (corresponding to step 7 in Figure 5, "Adjusting the storage space reclamation threshold corresponding to the (i+1)th time slice"). Since thread A is the first thread in Figure 5, as shown in step 6, the first thread can obtain the reclaimed storage space of the i-th time slice and, in step 7, adjust the storage space reclamation threshold corresponding to the (i+1)th time slice. The specific adjustment method can be found in the relevant content of the aforementioned implementation, and will not be repeated here. Further, in step 8 of Figure 5, the first thread can send the storage space reclamation threshold corresponding to the (i+1)th time slice to the second thread. Further, as shown in step 9 of Figure 5, the second thread controls the storage space reclaimed in the (i+1)th time slice to be less than or equal to the storage space reclamation threshold corresponding to the (i+1)th time slice. Of course, thread A can also be the second thread, which performs the adjustment operation on the initial storage space reclamation threshold corresponding to the (i+1)th time slice.

[0164] In addition to the above-described flow control method, this disclosure also provides another flow control method. As shown in Figure 7, this flow control method mainly includes the following steps:

[0165] 701. Obtain the target water level information M of the target partition in ZNS SSD through either the first thread or the second thread A.

[0166] 702. Thread A sends the target water level information M of the target partition in the target state to another thread B; the other thread B is any one of the first and second threads except for either of them. The target state is either available or unavailable.

[0167] 703. The first thread determines the target write speed threshold for the write operation based on the target water level information M of the target partition.

[0168] 704. The second thread determines the target reclamation speed threshold for the storage space reclamation operation based on the target water level information M of the target partition.

[0169] 705. The first thread performs flow control on the write operation based on the target write speed threshold.

[0170] 706. The second thread performs flow control on the storage space reclamation operation based on the target reclamation speed threshold.

[0171] For descriptions of threads A and B, and the description of thread A obtaining the target water level information M of the target partition in the target state, please refer to the relevant content in the foregoing embodiments, which will not be repeated here. For the description and specific implementation of the first thread determining the target write speed threshold for the write operation based on the target water level information M of the target partition in the target state, please refer to the relevant content in the foregoing description of thread A determining the target write speed threshold for the write operation based on the target water level information M of the target partition in the target state. For the second thread determining the target reclamation speed threshold for the storage space reclamation operation based on the target water level information M of the target partition in the target state, please also refer to the relevant content in the foregoing description of thread A determining the target write speed threshold for the write operation based on the target water level information M of the target partition in the target state.

[0172] In this embodiment, by offloading the storage space reclamation operation of the ZNS SSD from the first thread performing the foreground write operation to an independent second thread, the resource contention between the storage space reclamation operation and the foreground write operation is reduced. This reduces the impact of the storage space reclamation operation on the processing latency of the foreground write operation, thus helping to reduce the processing latency of the foreground write operation. On the other hand, by having either the first thread or the second thread access the target partition resource, and by having the first thread and the second thread respectively calculate the target write speed threshold for the write operation and the target reclamation speed threshold for the storage space reclamation operation, respectively, the first thread can perform flow control on the foreground write operation based on the target write speed threshold, and the second thread can perform flow control on the storage space reclamation operation based on the target reclamation speed threshold. This achieves flow control for both the foreground write operation and the storage space reclamation operation in the storage space reclamation offloading scenario.

[0173] On the other hand, allowing either the first or second thread to access the target partition resources avoids multi-threaded access to these resources and data such as the target write speed threshold and target reclamation speed threshold. Because only one thread accesses the target partition resources and these data, there's no need to lock the partition manager's partition resource management logic or these data, thus eliminating the need for additional mutual exclusion logic. This reduces the code complexity of flow control and improves its efficiency.

[0174] It should be noted that the execution subject of each step of the method provided in the above embodiments can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 401 and 402 can be device A; or the execution subject of step 401 can be device A, and the execution subject of step 402 can be device B; and so on.

[0175] Furthermore, some processes described in the above embodiments and accompanying drawings include multiple operations that appear in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear herein, or they may be executed in parallel. The operation numbers, such as 401, 402, etc., are merely used to distinguish different operations and do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel.

[0176] Accordingly, this disclosure also provides a computer-readable storage medium storing computer instructions, which, when executed by one or more processors, cause one or more processors to perform the steps in the flow control methods provided in the foregoing embodiments.

[0177] This disclosure also includes a computer program product comprising a computer program that, when executed by one or more processors, causes the one or more processors to perform the steps in the flow control methods provided in the foregoing embodiments.

[0178] In this disclosure, the specific implementation form of the computer program product is not limited. In some embodiments, the computer program product may be implemented as an application (APP), a mini-program, a computer-side client, a program module, a plug-in, an installation package, a software development kit (SDK), an image file of an optical disc (such as an ISO file), a plug-in, or software in the form of Software as a Service (SaaS), etc., but is not limited thereto.

[0179] Figure 8 is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. As shown in Figure 8, the electronic device includes a memory 80a and a processor 80b. The memory 80a is used to store computer programs.

[0180] Processor 80b is coupled to memory 80a and is used to execute computer programs to perform the steps in the flow control methods provided in the foregoing embodiments. Specific implementation details of each step can be found in the relevant descriptions of the foregoing embodiments, and will not be repeated here.

[0181] In some alternative embodiments, as shown in FIG8, the electronic device may further include optional components such as a communication component 80c, a power supply component 80d, a display component 80e, and an audio component 80f. FIG8 only schematically shows some components and does not mean that the electronic device must include all the components shown in FIG8, nor does it mean that the electronic device can only include the components shown in FIG8.

[0182] Furthermore, the components within the dashed boxes in Figure 8 are optional, not mandatory, and their specific requirements depend on the product form of the electronic device. The electronic device in this embodiment can be a desktop computer, laptop computer, mobile phone, or IoT device; it can also be a traditional server, cloud server, or server cluster, or other server equipment.

[0183] In embodiments of this disclosure, the memory is used to store computer programs and can be configured to store various other data to support operation on its host device. The processor can execute the computer programs stored in the memory to implement corresponding control logic. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Electrically Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0184] In this embodiment of the disclosure, the processor can be any hardware processing device capable of executing the above-described method logic. Optionally, the processor can be a central processing unit (CPU), a graphics processing unit (GPU), or a microcontroller unit (MCU); it can also be a programmable device such as a field-programmable gate array (FPGA), a programmable array logic (PAL), a general array logic (GAL), or a complex programmable logic device (CPLD); or it can be an advanced RISC machine (ARM) or a system on chip (SoC), etc., but is not limited thereto.

[0185] In embodiments of this disclosure, the communication component is configured to facilitate wired or wireless communication between its host device and other devices. The device housing the communication component can access wireless networks based on communication standards, such as Wireless Fidelity (WiFi), 2G or 3G, 4G, 5G, or combinations thereof. In one exemplary embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In another exemplary embodiment, the communication component may also be implemented based on Near Field Communication (NFC), Radio Frequency Identification (RFID), Infrared Data Association (IrDA), Ultra Wide Band (UWB), Bluetooth (BT), or other technologies.

[0186] In embodiments of this disclosure, the display component may include a liquid crystal display (LCD) and a touch panel (TP). If the display component includes a touch panel, the display component may be implemented as a touchscreen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.

[0187] In embodiments of this disclosure, a power supply component is configured to provide power to various components of the device in which it resides. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply component resides.

[0188] In embodiments of this disclosure, the audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as call mode, recording mode, or voice recognition mode. The received audio signals can be further stored in memory or transmitted via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals. For example, in devices with voice interaction capabilities, voice interaction with a user can be achieved through the audio component.

[0189] It should be noted that the terms "first" and "second" in this article are used to distinguish different messages, devices, modules, etc., and do not represent a chronological order, nor do they limit "first" and "second" to different types.

[0190] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, compact disc read-only memory (CD-ROM), optical storage, etc.) containing computer-usable program code.

[0191] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams.

[0192] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.

[0193] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.

[0194] In a typical configuration, a computing device includes one or more processors (CPU, etc.), input / output interfaces, network interfaces, and memory.

[0195] Memory may include non-persistent storage in computer-readable media, such as random-access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0196] Computer storage media are readable storage media, also known as removable media. Removable and non-removable media can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, Digital Video Disc (DVD) or other optical storage, magnetic tape, disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient media, such as modulated data signals and carrier waves.

[0197] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the aforementioned element.

[0198] The above description is merely an embodiment of this disclosure and is not intended to limit the scope of this disclosure. Various modifications and variations can be made to this disclosure by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of the claims of this disclosure.

Claims

1. A flow control method, applicable to a processor of an electronic device, wherein, The electronic device further comprises a zone namespace hard disk (ZNS) SSD; the processor runs a first thread and a second thread; the first thread is configured to perform a write operation on a write request received by the electronic device for writing data to the ZNS SSD; and the second thread is configured to perform a storage space recycling operation on the ZNS SSD; The method comprises: obtaining, by any one of the first thread and the second thread, target water level information of a target zone in a target state in the ZNS SSD; the target state is an available state or an unavailable state; determining, by the any one thread, a target write speed threshold of the write operation and a target recycling speed threshold of the storage space recycling operation according to the target water level information; sending, by the any one thread, the target recycling speed threshold or the target write speed threshold to another thread; the another thread is a thread other than the any one thread among the first thread and the second thread; controlling, by the first thread, the write operation according to the target write speed threshold; and controlling, by the second thread, the storage space recycling operation according to the target recycling speed threshold.

2. The method of claim 1, wherein, The target state is an available state; and the target water level information is a number of the target zone or a proportion of the target zone; determining, by the any one thread, a target write speed threshold of the write operation according to the target water level information, comprises: obtaining, by the any one thread, a positive correlation function between a write speed and water level information of an available zone; determining, by the any one thread, a write speed corresponding to the target water level information in the positive correlation function as the target write speed threshold.

3. The method of claim 2, wherein, The obtaining, by the any one thread, a positive correlation function between a write speed and water level information, comprises: obtaining, by the any one thread, a plurality of water level thresholds of an available zone and a plurality of write speed thresholds corresponding to the plurality of water level thresholds; each water level threshold corresponds to a write speed threshold; the plurality of write speed thresholds are positively correlated with the plurality of water level thresholds; determining, by the any one thread, the positive correlation function according to the plurality of water level thresholds and the plurality of write speed thresholds.

4. The method of claim 3, wherein, The positive correlation function is a piecewise linear function; the plurality of water level thresholds define a plurality of water level threshold ranges; each water level threshold range includes at least two water level thresholds; and each water level threshold range corresponds to a positive proportional linear function; The determining, by the any one thread, the positive correlation function according to the plurality of water level thresholds, comprises: obtaining, by the any one thread, at least two target water level thresholds corresponding to a target water level threshold range to which the target water level information belongs from the plurality of water level thresholds; obtaining, by the any one thread, at least two write speed thresholds corresponding to the at least two target water level thresholds from the plurality of write speed thresholds; The thread determines a proportional linear function within the target water level threshold range based on the at least two target water level thresholds and the at least two write speed thresholds.

5. The method of claim 4, wherein, The slopes of the multiple proportional linear functions corresponding to the multiple water level threshold ranges are positively correlated with the water level of the target partition.

6. The method according to any one of claims 1 to 5, wherein, The target state is an available state; the water level information of the target partition is the number of target partitions or the proportion of the target partitions; The target reclamation speed threshold for the storage space reclamation operation is determined by any one of the threads based on the water level information of the target partition, including: The inverse correlation function between the recycling speed and the available partition level is obtained through any of the aforementioned threads; The target water level information is determined by any one of the threads, and the corresponding recovery speed in the inverse correlation function is used as the target recovery speed threshold.

7. The method of claim 6, wherein, The method of obtaining the inverse correlation function between the recycling speed and the available partition level through any of the threads includes: The thread obtains multiple water level thresholds for the available partition and multiple recovery speed thresholds corresponding to the water level thresholds; each water level threshold corresponds to a recovery speed threshold; the multiple recovery speed thresholds are inversely correlated with the multiple water level thresholds. The inverse correlation function is determined by any one of the threads based on the plurality of water level thresholds and the plurality of recovery speed thresholds.

8. The method of claim 7, wherein, The inverse correlation function is a piecewise linear function; the multiple water level thresholds define multiple water level threshold ranges; each water level threshold range includes at least two water level thresholds; each water level threshold range corresponds to an inverse proportional linear function. The step of determining the inverse correlation function by any thread based on the multiple water level thresholds and the multiple recovery speed thresholds includes: The target water level is obtained from the plurality of water level thresholds by any one thread, corresponding to at least two target water level threshold ranges to which the target water level belongs. At least two recovery speed thresholds corresponding to the at least two target water level thresholds are obtained from the plurality of recovery speed thresholds using any one of the thread thresholds; The inverse proportional linear function within the target water level threshold range is determined by any one of the threads based on the at least two target water level thresholds and the at least two recovery speed thresholds.

9. The method of claim 8, wherein, The slopes of the multiple inverse proportional linear functions corresponding to the multiple water level threshold ranges are positively correlated with the water level of the target zone.

10. The method of any one of claims 1-9, wherein, The first thread is one of the threads mentioned above; the second thread is the other thread mentioned above.

11. The method of claim 10, wherein, The target recycling speed threshold is divided into multiple time segments, and the multiple time segments correspond to multiple initial storage space recycling thresholds. The sum of the multiple initial storage space reclamation thresholds is equal to the storage space reclamation threshold corresponding to the unit time. The method further includes: For any two adjacent time slices, the storage space reclaimed by the previous time slice is obtained through the first thread; If the storage space reclaimed in the previous time segment is less than the storage space reclamation threshold corresponding to the previous time segment, then the first thread calculates the target difference between the storage space reclamation threshold corresponding to any time segment and the storage space reclaimed in the previous time segment; wherein, if the previous time segment is the first time segment among the plurality of time segments, the storage space reclamation threshold corresponding to any time segment is the initial storage space threshold corresponding to the first time segment; if the previous time segment is any other time segment besides the first time segment, the storage space reclamation threshold corresponding to the previous time segment is the initial storage space reclamation threshold corresponding to the previous time segment, or is obtained by adjusting the initial storage space reclamation threshold corresponding to the previous time segment; The target difference is added to the initial storage space reclamation threshold corresponding to the next time segment by the first thread, and this difference is used as the storage space reclamation threshold corresponding to the next time segment. The first thread sends the storage space reclamation threshold corresponding to the next time segment to the second thread. The second thread controls the storage space reclaimed in the next time segment to be less than or equal to the storage space reclamation threshold corresponding to the next time segment.

12. The method of any one of claims 1-11, wherein, The target state is the unavailable state; the target water level information is the number of target partitions or the proportion of target partitions; Determining the target write speed threshold for the write operation using any one of the threads based on the target water level information includes: The inverse correlation function between write speed and unavailable partition water level information is obtained through any of the aforementioned threads; The write speed corresponding to the target water level information in the inverse correlation function is determined by any one of the threads and used as the target write speed threshold.

13. The method of claim 12, wherein, The function that obtains the inverse correlation between write speed and unavailable partition water level information through any of the threads includes: The thread obtains multiple water level thresholds for the unavailable partition and multiple write speed thresholds corresponding to the multiple water level thresholds. The inverse correlation function is determined by any one of the threads based on the multiple water level thresholds and the multiple write speed thresholds; Each water level threshold corresponds to a write speed threshold, and the plurality of write speed thresholds are inversely correlated with the plurality of water level thresholds.

14. The method of claim 13, wherein, The inverse correlation function is a piecewise linear function; the multiple water level thresholds define multiple water level threshold ranges; each water level threshold range includes at least two water level thresholds; each water level threshold range corresponds to an inverse proportional linear function. Determining the inverse correlation function includes: The target water level information is obtained from the target water level threshold range corresponding to the target water level threshold range by any one of the multiple water level thresholds through any one of the threads; The at least two write speed thresholds corresponding to the at least two target water level thresholds are obtained from the plurality of write speed thresholds by any one of the threads; The inverse linear function within the target water level threshold range is determined by any one of the threads based on the at least two target water level thresholds and the at least two write speed thresholds.

15. The method of claim 14, wherein, The slopes of the multiple inverse proportional linear functions corresponding to the multiple water level threshold ranges are negatively correlated with the water level of the target partition.

16. The method of any one of claims 1-15, wherein, The target state is an unavailable state; the target water level information is the number of target partitions or the proportion of target partitions; Determining the target reclamation speed threshold for the storage space reclamation operation using any one of the threads based on the target water level information includes: The positive correlation function between the recycling speed and the water level information of unavailable partitions is obtained through any of the aforementioned threads; The target water level information is determined by any one of the threads, and the corresponding recovery rate in the positive correlation function is used as the target recovery rate threshold.

17. A flow control method, adapted for a processor of an electronic device, wherein, The electronic device further includes: a partitioned namespace hard disk (ZNS SSD); the processor runs a first thread and a second thread; the first thread is used to execute a write operation to write data to the ZNS SSD based on a request received by the electronic device; the second thread is used to execute a storage space reclamation operation for the ZNS SSD; The method includes: The target water level information of the target partition in the ZNS SSD, which is in the target state, is obtained by either the first thread or the second thread; the target state is either an available state or an unavailable state. The target water level information is sent to another thread through any one of the threads; the other thread is a thread other than either of the first thread and the second thread. The first thread determines the target write speed threshold for the write operation based on the target water level information. The second thread determines the target recycling speed threshold for the storage space recycling operation based on the target water level information. The first thread performs flow control on the write operation based on the target write speed threshold; and the second thread performs flow control on the storage space reclamation operation based on the target reclamation speed threshold.

18. An electronic device, comprising: include: A memory and a processor; wherein the memory is used to store computer programs; The processor is coupled to the memory for executing the computer program to perform the steps of the method according to any one of claims 1-17.

19. A computer readable storage medium having stored thereon computer instructions, wherein, When the computer instructions are executed by one or more processors, the one or more processors are caused to perform the steps of the method according to any one of claims 1-17.

20. A computer program product, wherein, Includes a computer program that, when executed by one or more processors, causes the one or more processors to perform the steps of the method according to any one of claims 1-17.