UFS command priority scheduling processing method and device, electronic equipment and medium

By prioritizing and scheduling commands within UFS storage devices, the problem of delayed execution of critical commands is solved, improving system performance and stability and ensuring timely response to critical data.

CN121300927APending Publication Date: 2026-01-09SHENZHEN CITY TECHWIN SEMICONDUCTOR COMPANY LIMITED
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511283776.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-09
Publication Date
2026-01-09

AI Technical Summary

Technical Problem

UFS storage devices fail to effectively distinguish command priorities during command scheduling, resulting in delayed execution of critical commands and affecting system performance and stability.

Method used

By parsing the UFS protocol information unit flag field and device descriptor configuration information, commands are classified according to priority type and logical unit type, and the execution order is determined based on dual priority rules. High-priority commands are processed first, and the waiting time is monitored in real time and the priority is increased when a timeout occurs.

Benefits of technology

This avoids long delays in the execution of critical commands, improves the overall performance and stability of the system, and ensures timely responses to critical data read and write operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121300927A_ABST
    Figure CN121300927A_ABST
Patent Text Reader

Abstract

The invention provides a UFS command priority scheduling processing method and device, electronic equipment and a medium, and relates to the technical field of scheduling processing, and the method comprises the steps: receiving a command from a host; classifying the commands according to priority types and logic unit types and mapping the commands to corresponding command queues based on command attributes obtained by analyzing UFS protocol information unit flag fields of the commands and device descriptor configuration information; determining a command execution sequence based on a preset dual priority rule; and taking out the commands from the command queue based on the command execution sequence and submitting the commands to the flash translation layer for processing. In the mode, the key command is prevented from being delayed to be executed for a long time, so that the overall performance and stability of the system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of scheduling and processing technology, and in particular to a UFS command priority scheduling and processing method, apparatus, electronic device and medium. Background Technology

[0002] In a UFS storage device, multiple commands may be received simultaneously from different hosts or applications. These commands have different levels of importance and urgency. For example, some commands involving critical system data read / write need to be executed as soon as possible to ensure the normal operation of the system; while some non-critical data backup or log recording commands can be processed later.

[0003] In related technologies, UFS storage devices mostly adopt a simple First-Come, First-Served (FCFS) strategy for command scheduling, that is, commands are executed sequentially according to their arrival order. This strategy does not consider command priority, which may cause critical commands to be delayed for a long time, thereby affecting the overall performance and stability of the system. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a UFS command priority scheduling processing method, apparatus, electronic device and medium, which avoids the long-term delay in the execution of critical commands, thereby improving the overall performance and stability of the system.

[0005] In a first aspect, embodiments of the present invention provide a UFS command priority scheduling processing method, the method comprising: receiving a command from a host; classifying the command according to priority type and logical unit type and mapping it to the corresponding command queue based on the command attributes obtained by parsing the UFS protocol information unit identifier field and device descriptor configuration information of the command; determining the command execution order based on a pre-set dual priority rule; and retrieving the command from the command queue based on the command execution order and submitting it to the flash conversion layer for processing.

[0006] In a preferred embodiment of the present invention, the command attributes obtained from the UFS protocol information unit flag field and device descriptor configuration information based on the parsed command, classifying commands according to priority type and logical unit type and mapping them to the corresponding command queue, include: identifying command type priority based on the UFS protocol information unit flag field; identifying logical unit type priority based on the device descriptor configuration; and mapping commands to the corresponding command queue based on command type priority and logical unit type priority.

[0007] In a preferred embodiment of the present invention, the above-mentioned determination of command execution order based on a pre-set dual priority rule includes: comparing the logical unit types of the commands to be scheduled, and prioritizing commands of higher priority logical units; and, under the same logical unit type, executing commands according to command type priority order.

[0008] In a preferred embodiment of the present invention, the command queue includes: a high-priority logic unit queue group and a normal logic unit queue group; the high-priority logic unit queue group includes: a high-priority logic unit head command queue, a high-priority logic unit ordered command queue, a high-priority logic unit command priority queue, and a high-priority logic unit normal command queue; the normal logic unit queue group includes: a head command queue, an ordered command queue, a command priority queue, and a normal command queue.

[0009] In a preferred embodiment of the present invention, the above method further includes: performing read-write separation optimization processing on the ordinary command queue and the command priority queue: splitting the ordinary command queue into an ordinary read command queue and an ordinary write command queue; splitting the command priority queue into a command priority read queue and a command priority write queue; prioritizing the scheduling of commands in the read command queue, and then scheduling commands in the write command queue.

[0010] In a preferred embodiment of the present invention, the above-mentioned process of retrieving commands from the command queue based on the command execution order and submitting them to the flash memory conversion layer for processing includes: storing the retrieved commands in the order of command execution into a queue to be processed; and having the flash memory conversion layer perform physical storage operations according to the order of the queue to be processed.

[0011] In a preferred embodiment of the present invention, the method further includes: upon receiving a command, recording the timestamp of the command arrival and storing it in a timestamp queue; monitoring the waiting time of commands in the timestamp queue in real time; and when the waiting time of the target command exceeds a preset time threshold, forcing the target command to be promoted to the highest priority and executed immediately.

[0012] Secondly, embodiments of the present invention also provide a UFS command priority scheduling processing apparatus, the apparatus comprising: a command receiving module for receiving commands from a host; a command parsing module for classifying commands according to priority type and logical unit type and mapping them to corresponding command queues based on command attributes obtained from parsing the UFS protocol information unit flag field and device descriptor configuration information of the command; a command execution order determination module for determining the command execution order based on a pre-set dual priority rule; and a command processing module for retrieving commands from the command queue based on the command execution order and submitting them to the flash memory translation layer for processing.

[0013] Thirdly, embodiments of the present invention also provide an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the UFS command priority scheduling processing method of the first aspect described above.

[0014] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the UFS command priority scheduling processing method described in the first aspect.

[0015] The embodiments of the present invention bring the following beneficial effects: This invention provides a UFS command priority scheduling method, apparatus, electronic device, and medium. By receiving commands from a host, and based on command attributes obtained from parsing the UFS protocol information unit identifier field and device descriptor configuration information of the commands, the commands are classified according to priority type and logical unit type and mapped to corresponding command queues. The command execution order is determined based on a pre-set dual priority rule. Commands are then retrieved from the command queues based on the execution order and submitted to the flash memory translation layer for processing. This method avoids long delays in executing critical commands, thereby improving the overall performance and stability of the system.

[0016] Other features and advantages of this disclosure will be set forth in the following description, or some features and advantages may be inferred from the description or determined without doubt, or may be learned by practicing the techniques described above.

[0017] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0018] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0019] Figure 1 A flowchart of a UFS command priority scheduling method provided in an embodiment of the present invention; Figure 2 A flowchart of another UFS command priority scheduling processing method provided in an embodiment of the present invention; Figure 3 A schematic diagram of a stack type structure provided in an embodiment of the present invention; Figure 4 A schematic diagram of a scheduling sequence provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of a UFS command priority scheduling processing device provided in an embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0021] In a UFS storage device, multiple commands may be received simultaneously from different hosts or applications. These commands have different levels of importance and urgency. For example, some commands involving critical system data read / write need to be executed as soon as possible to ensure the normal operation of the system; while some non-critical data backup or log recording commands can be processed later.

[0022] In related technologies, UFS storage devices mostly adopt a simple First-Come, First-Served (FCFS) strategy for command scheduling, that is, commands are executed sequentially according to their arrival order. This strategy does not consider command priority, which may cause critical commands to be delayed for a long time, thereby affecting the overall performance and stability of the system.

[0023] Based on this, the present invention provides a UFS command priority scheduling processing method, apparatus, electronic device, and medium. This method receives commands from a host, categorizes the commands according to priority type and logical unit type based on the command attributes obtained by parsing the UFS protocol information unit identifier field and device descriptor configuration information of the commands, and maps them to corresponding command queues. The command execution order is determined based on a pre-set dual priority rule, and commands are retrieved from the command queues based on the execution order and submitted to the flash memory translation layer for processing. This approach avoids long delays in executing critical commands, thereby improving the overall performance and stability of the system.

[0024] To facilitate understanding of this embodiment, a UFS command priority scheduling method disclosed in this embodiment of the invention will first be described in detail.

[0025] Example 1 This invention provides a UFS command priority scheduling method. Figure 1 This is a flowchart illustrating a UFS command priority scheduling method provided in an embodiment of the present invention. Figure 1 As shown, the UFS command priority scheduling method may include the following steps: Step S101: Receive commands from the host.

[0026] Step S102: Based on the command attributes obtained from the UFS protocol information unit flag field and device descriptor configuration information of the parsed command, the commands are classified according to priority type and logical unit type and mapped to the corresponding command queues.

[0027] Specifically, command type priority can be identified based on the UFS protocol information unit flag field; logical unit type priority can be identified based on the device descriptor configuration; and commands can be mapped to the corresponding command queues based on command type priority and logical unit type priority.

[0028] The command queue includes: a high-priority logic unit queue group and a normal logic unit queue group; the high-priority logic unit queue group includes: a high-priority logic unit head command queue, a high-priority logic unit ordered command queue, a high-priority logic unit command priority queue, and a high-priority logic unit normal command queue; the normal logic unit queue group includes: a head command queue, an ordered command queue, a command priority queue, and a normal command queue.

[0029] Furthermore, read-write separation optimization is performed on the ordinary command queue and the command priority queue: the ordinary command queue is split into an ordinary read command queue and an ordinary write command queue; the command priority queue is split into a command priority read queue and a command priority write queue; commands in the read command queue are scheduled first, and then commands in the write command queue are scheduled.

[0030] Step S103: Determine the command execution order based on the pre-set dual priority rules.

[0031] The order of command execution based on a pre-set dual priority rule may include: comparing the logical unit types of the commands to be scheduled and prioritizing commands from higher-priority logical units; and, within the same logical unit type, executing commands according to their priority order.

[0032] Step S104: Retrieve commands from the command queue based on the command execution order and submit them to the flash conversion layer for processing.

[0033] Specifically, retrieving commands from the command queue based on the command execution order and submitting them to the flash memory conversion layer for processing includes: storing the retrieved commands into a pending queue according to the command execution order; and having the flash memory conversion layer perform physical storage operations according to the order of the pending queue.

[0034] The UFS command priority scheduling method provided in this invention can receive commands from the host, classify commands according to priority type and logical unit type based on the command attributes obtained by parsing the UFS protocol information unit identifier field and device descriptor configuration information of the commands, and map them to corresponding command queues. The command execution order is determined based on a pre-set dual priority rule, and commands are retrieved from the command queues according to the execution order and submitted to the flash translation layer for processing. This method avoids long delays in the execution of critical commands, thereby improving the overall performance and stability of the system.

[0035] Example 2 This invention also provides another UFS command priority scheduling method, which is implemented based on the method described in the above embodiments.

[0036] Figure 2 A flowchart of another UFS command priority scheduling processing method provided in an embodiment of the present invention is shown below. Figure 2 As shown, the UFS command priority scheduling method may include the following steps: Step S201: Receive commands from the host, record the timestamp of the command arrival and store it in the timestamp queue.

[0037] Step S202: Based on the command attributes obtained from the UFS protocol information unit flag field and device descriptor configuration information of the parsed command, the commands are classified according to priority type and logical unit type and mapped to the corresponding command queues.

[0038] The UFS protocol defines various command priority levels, such as simple, command priority, ordered, head of queue, and LUN priority levels, such as high priority LUN and normal LUN.

[0039] Among them, cmd priority level: command level priority; lun priority level: logical unit level priority; high priority lun: high priority logical unit; normal lun: normal logical unit; Simple: ordinary command, with the lowest priority level; CP: to a certain extent, schedules Simple type commands, with higher priority than Simple; Ordered: within the cmd queue, simple commands after ordered commands and CP commands are not allowed to be inserted before ordered commands; Head of queue: this command should be inserted at the head of the queue and executed immediately, with the highest priority; commands on the high priority lun have higher priority than commands on the normal lun.

[0040] Multiple command queues can be configured according to the UFS protocol to store or differentiate commands of different priorities. For example: HPL head of queue Queue: a command queue for storing head of queue commands of high-priority logical units; HPL ordered Queue: a command queue for storing ordered commands of high-priority logical units; HPL CP Queue: a command queue for storing CP commands of high-priority logical units; HPL simple Queue: a command queue for storing simple commands of high-priority logical units; head of queue Queue: a command queue for storing head of queue commands of regular logical units; ordered Queue: a command queue for storing ordered commands of regular logical units; CP Queue: a command queue for storing CP commands of regular logical units; simple Queue: a command queue for storing simple commands of regular logical units; Time Stamp Queue: a command queue that sorts received commands by timestamp; pending Queue: a command queue where the FE has finished scheduling and processing commands and is waiting for the FTL to process them.

[0041] Specifically, when the UFS device receives a Host command, it can place all types of commands into the Time Stamp Queue according to the timestamp order of the received commands. Then, it categorizes the commands based on the Flag field in the UPIU (UFS Protocol Information Units) of the received commands and the configuration information of the device descriptor. The information from the Time Stamp Queue is mapped to each command queue. When a command is popped from the Time Stamp Queue, the corresponding mapped queue is also popped synchronously, and vice versa. The pending queue is the queue where the FE has sorted the commands, ready for the FTL to process these tasks.

[0042] Specifically, the HPL head of queue queue and the head of queue queue itself need to be designed as stacks. The UFS protocol requires that each command of type head of queue should be pushed into the head of the queue, meaning it needs to be implemented as a last-in-first-out stack. For ease of understanding, Figure 3 This is a schematic diagram of a stack type structure provided in an embodiment of the present invention.

[0043] Wherein, HOQ: head of queue: a command attribute of UFS; Host: host; Device: device; Firstout: Figure 3 The intended meaning is that the order of dequeueing commands is HOQ2, HOQ1, HOQ0. HOQ2 is the first command to be dequeueed.

[0044] Here, HOST cmd: Commands issued by the host; device descriptor: A table in UFS that records device information, where high-priority logical units are recorded; Mapping: Mapping, the Time Stamp Queue stores all commands, mapping each command to the corresponding command queue; pop cmd: Retrieves a command from the command queue; FE: front-end.

[0045] Step S203: Monitor the waiting time of commands in the timestamp queue in real time.

[0046] Step S204: Determine the command execution order based on the pre-set dual priority rules and waiting time.

[0047] Strictly adhering to the UFS protocol and prioritizing tasks for scheduling inevitably leads to situations where lower-priority commands are indefinitely queued by higher-priority commands. This can result in significant delays for lower-priority commands, or even command starvation causing host platform timeouts. To address host attacks in this scenario, a timeout protection strategy is introduced (this strategy violates the UFS protocol and requires communication with the customer / vendor). This strategy counters unreasonable host ordering behavior and improves compatibility with the host platform. Therefore, when the waiting time for a target command exceeds a pre-set threshold, the target command is forcibly elevated to the highest priority and executed immediately.

[0048] The Time Stamp Queue, upon receiving a command, appends a timestamp attribute to it. Whenever a command is about to be popped from the Queue, it checks how long the last command in the Time Stamp Queue has been pending. When the pending time reaches a certain threshold (this threshold can be configured for different platforms; for example, 30 seconds for SCSI commands on Windows), the command will have the highest priority and be executed immediately to prevent timeouts on the host.

[0049] Specifically, if system resources are sufficient, system overhead can be increased as appropriate, such as splitting SimpleQueue into Simple R / W Queue and CP Queue into CP R / W Queue.

[0050] Since the UFS protocol does not prohibit swapping the execution order of simple and CP commands (commands with the same priority), the device will prioritize processing Read commands before Write commands. Furthermore, LBA order can be used for sorting, facilitating FTL (Flash Translation Layer) processing and avoiding frequent read / write switching on the server side, thus optimizing server-side command processing latency and improving user experience. For ease of understanding, Figure 4 This is a schematic diagram of a scheduling sequence provided in an embodiment of the present invention.

[0051] Wherein, LBA stands for Logical Block Addressing; LEN stands for length, the data length.

[0052] Prioritizing read commands ensures users quickly obtain the data they need, improving the user experience. In applications, blocked read operations can cause UI lag or slow response times. Prioritizing read commands reduces this lag and maintains smooth application operation.

[0053] Step S205: Retrieve commands from the command queue based on the command execution order and submit them to the flash memory conversion layer for processing.

[0054] Example 3 Corresponding to the above method embodiments, this invention provides a UFS command priority scheduling processing device. Figure 5 This is a schematic diagram of the structure of a UFS command priority scheduling processing device provided in an embodiment of the present invention, as shown below. Figure 5 As shown, the UFS command priority scheduling processing device may include: Command receiving module 301 is used to receive commands from the host.

[0055] The command parsing module 302 is used to classify commands according to priority type and logical unit type and map them to the corresponding command queues based on the command attributes obtained from the UFS protocol information unit flag field and device descriptor configuration information of the parsing command.

[0056] The command execution order determination module 303 is used to determine the command execution order based on a pre-set dual priority rule.

[0057] Command processing module 304 is used to retrieve commands from the command queue based on the command execution order and submit them to the flash conversion layer for processing.

[0058] The UFS command priority scheduling processing device provided in this embodiment of the invention can receive commands from the host, classify the commands according to priority type and logical unit type based on the command attributes obtained by parsing the UFS protocol information unit identifier field and device descriptor configuration information of the commands, and map them to the corresponding command queues. The execution order of the commands is determined based on a pre-set dual priority rule, and commands are retrieved from the command queues according to the execution order and submitted to the flash memory translation layer for processing. This method avoids long delays in the execution of critical commands, thereby improving the overall performance and stability of the system.

[0059] In some embodiments, the command parsing module is further configured to identify command type priority based on the UFS protocol information unit flag field; identify logical unit type priority based on the device descriptor configuration; and map commands to corresponding command queues based on command type priority and logical unit type priority.

[0060] In some embodiments, the command execution order determination module is further configured to compare the logical unit types of the commands to be scheduled, and prioritize the commands of higher priority logical units; under the same logical unit type, the commands are executed in order of command type priority.

[0061] In some embodiments, the command queue includes: a high-priority logic unit queue group and a normal logic unit queue group; the high-priority logic unit queue group includes: a high-priority logic unit head command queue, a high-priority logic unit ordered command queue, a high-priority logic unit command priority queue, and a high-priority logic unit normal command queue; the normal logic unit queue group includes: a head command queue, an ordered command queue, a command priority queue, and a normal command queue.

[0062] In some embodiments, the command execution order determination module is further configured to perform read-write separation optimization on the ordinary command queue and the command priority queue: split the ordinary command queue into an ordinary read command queue and an ordinary write command queue; split the command priority queue into a command priority read queue and a command priority write queue; prioritize scheduling commands in the read command queue, and then schedule commands in the write command queue.

[0063] In some embodiments, the command processing module is further configured to store the retrieved commands into a processing queue in the order of command execution; and the flash memory conversion layer performs physical storage operations in the order of the processing queue.

[0064] In some embodiments, the command execution order determination module is further configured to record the timestamp of the command arrival and store it in a timestamp queue when the command is received; monitor the waiting time of the command in the timestamp queue in real time; and force the target command to be promoted to the highest priority and executed immediately when the waiting time of the target command exceeds a preset time threshold.

[0065] The device provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment.

[0066] Example 4 This invention also provides an electronic device for running the above-described UFS command priority scheduling method; see [link to related documentation]. Figure 6 The diagram shows the structure of an electronic device, which includes a memory 400 and a processor 401. The memory 400 is used to store one or more computer instructions, which are executed by the processor 401 to implement the UFS command priority scheduling method described above.

[0067] Furthermore, Figure 6 The electronic device shown also includes a bus 402 and a communication interface 403. The processor 401, the communication interface 403 and the memory 400 are connected via the bus 402.

[0068] The memory 400 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 403 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 402 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 6 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0069] Processor 401 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 401 or by instructions in software form. Processor 401 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 400, and processor 401 reads information from memory 400 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0070] This invention also provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are invoked and executed by a processor, they cause the processor to implement the aforementioned UFS command priority scheduling method. For a detailed implementation, please refer to the method embodiments, which will not be repeated here.

[0071] The computer program product for the UFS command priority scheduling processing method provided in this embodiment of the invention includes a computer-readable storage medium storing non-volatile program code executable by a processor. The instructions included in the program code can be used to execute the methods in the preceding method embodiments. For specific implementation details, please refer to the method embodiments, which will not be repeated here.

[0072] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0073] In the several embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interface; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0074] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0075] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0076] If the functionality is implemented as a software functional unit and sold or used as an independent product, it can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0077] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A UFS command priority scheduling method, characterized in that, The method includes: Receive commands from the host; Based on the command attributes obtained by parsing the UFS protocol information unit flag field and device descriptor configuration information of the command, the command is classified according to priority type and logical unit type and mapped to the corresponding command queue. The command execution order is determined based on a pre-set dual priority rule; Commands are retrieved from the command queue based on the command execution order and submitted to the flash memory conversion layer for processing.

2. The method according to claim 1, characterized in that, The command attributes obtained based on parsing the UFS protocol information unit identifier field and device descriptor configuration information of the command are used to classify the commands according to priority type and logical unit type and map them to the corresponding command queues, including: The command type priority is identified based on the UFS protocol information unit flag field. The priority of the identification logic unit type is configured based on the device descriptor; The command is mapped to the corresponding command queue based on the command type priority and the logical unit type priority.

3. The method according to claim 1, characterized in that, The method of determining the command execution order based on a pre-set dual priority rule includes: Compare the logical unit types of the commands to be scheduled, and prioritize the command from the higher priority logical unit; Within the same logical unit type, commands are executed in order of priority based on command type.

4. The method according to claim 1, characterized in that, The command queue includes: a high-priority logic unit queue group and a normal logic unit queue group; The high-priority logic unit queue group includes: a high-priority logic unit head command queue, a high-priority logic unit ordered command queue, a high-priority logic unit command priority queue, and a high-priority logic unit ordinary command queue. The ordinary logic unit queue group includes: a head command queue, an ordered command queue, a command priority queue, and an ordinary command queue.

5. The method according to claim 4, characterized in that, The method further includes: performing read-write separation optimization on the ordinary command queue and the command priority queue. The ordinary command queue is split into an ordinary read command queue and an ordinary write command queue; The command priority queue is split into a command priority read queue and a command priority write queue; Commands in the read command queue are scheduled first, followed by commands in the write command queue.

6. The method according to claim 1, characterized in that, The step of retrieving commands from the command queue based on the command execution order and submitting them to the flash memory translation layer for processing includes: The retrieved commands are stored in the pending queue in the order they were executed. The flash memory conversion layer performs physical storage operations in the order of the queue to be processed.

7. The method according to claim 1, characterized in that, The method further includes: Upon receiving the command, the timestamp of the command arrival is recorded and stored in the timestamp queue; Real-time monitoring of the waiting time of commands in the timestamp queue; When the waiting time for a target command exceeds a preset time threshold, the target command is forced to be elevated to the highest priority and executed immediately.

8. A UFS command priority scheduling processing device, characterized in that, The device includes: The command receiving module is used to receive commands from the host. The command parsing module is used to classify the command according to priority type and logical unit type and map it to the corresponding command queue based on the command attributes obtained by parsing the UFS protocol information unit flag field and device descriptor configuration information of the command. The command execution order determination module is used to determine the command execution order based on a pre-set dual priority rule. The command processing module is used to retrieve commands from the command queue based on the command execution order and submit them to the flash memory conversion layer for processing.

9. An electronic device, characterized in that, The system includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the UFS command priority scheduling processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the UFS command priority scheduling processing method according to any one of claims 1 to 7.