Disclosure of Invention
In view of this, an object of the present invention is to provide a method, a system, and a device for implementing optimization management of a command queue, which can enable a host device to run to an optimized state, and can ensure that commands in the command queue are processed in time.
According to one aspect of the present invention, a method for implementing command queue optimization management is provided, including:
the host equipment sends command queue buffer information;
the controller receives command queue buffer information sent by the host equipment;
the controller carries out logical address mapping conversion on the received command queue buffer information to obtain a mapping table related to the command queue buffer information;
the controller calculates the required storage resource according to the command queue buffer information recorded by the mapping table obtained by conversion;
and the controller detects whether the current storage state of the host equipment meets the calculated required storage resource or not, and controls the host equipment to orderly process each single command in the command queue buffer information associated with the mapping table when detecting that the current storage state of the host equipment meets the calculated required storage resource.
The method for calculating the required storage resource by the controller according to the command queue buffer information recorded by the mapping table obtained by conversion comprises the following steps:
the controller decomposes the command queue buffer information according to the converted command queue buffer information recorded by the mapping table to obtain each single command, and calculates the storage resource required by each single command according to each single command obtained by decomposition.
Wherein the controller detects whether the current storage state of the host device satisfies the calculated required storage resource, and controls the host device to process each single command in the command queue buffer information associated with the mapping table in order when detecting that the current storage state of the host device satisfies the calculated required storage resource, further comprising:
the controller detects whether the current storage state of the host device meets the calculated required storage resource, and when the current storage state of the host device is detected not to meet the calculated required storage resource, the controller recycles the storage resource cached by the host device until the current storage state of the host device can meet the calculated required storage resource.
Wherein the controller detects whether the current storage state of the host device satisfies the calculated required storage resource, and when detecting that the current storage state of the host device satisfies the calculated required storage resource, controls the host device to process each single command in the command queue buffer information associated with the mapping table in order, and further includes:
the controller detects whether the current storage state of the host device meets the calculated required storage resource, when the current storage state of the host device is detected to be not meeting the calculated required storage resource, the controller traverses whether the same command in the command queue associated with the mapping table exists in the storage resource cached by the host device, deletes the same command from the mapping table when the same command in the command queue associated with the mapping table exists in the storage resource cached by the host device, and recovers the storage resource cached by the host device and not associated with the deleted command.
Wherein, after the controller detects whether the current storage state of the host device satisfies the calculated required storage resource and controls the host device to process each single command in the command queue buffer information associated with the mapping table in order when detecting that the current storage state of the host device satisfies the calculated required storage resource, the method further includes:
and the host equipment processes each single command in the command queue buffer information associated with the mapping table in order according to the control of the controller.
According to another aspect of the present invention, there is provided a system for implementing command queue optimization management, including:
a host device and a controller;
the host device is used for sending command queue buffer information;
the controller is configured to receive command queue buffer information sent by the host device, perform logical address mapping conversion on the received command queue buffer information to obtain a mapping table associated with the command queue buffer information, calculate a required storage resource according to the command queue buffer information recorded in the mapping table obtained by the conversion, detect whether a current storage state of the host device satisfies the calculated required storage resource, and control the host device to process each single command in the command queue buffer information associated with the mapping table in order when it is detected that the current storage state of the host device satisfies the calculated required storage resource.
Wherein, the controller is specifically configured to:
and decomposing the command queue buffer information according to the converted command queue buffer information recorded by the mapping table to obtain each single command, and calculating the storage resource required by each single command according to each single command obtained by decomposition.
Wherein, the controller is specifically configured to:
detecting whether the current storage state of the host device meets the calculated required storage resource, and when the current storage state of the host device is detected not to meet the calculated required storage resource, recycling the cached storage resource of the host device until the current storage state of the host device can meet the calculated required storage resource.
Wherein, the controller is specifically configured to:
detecting whether the current storage state of the host device meets the calculated required storage resource, when detecting that the current storage state of the host device does not meet the calculated required storage resource, traversing whether the same command in the command queue associated with the mapping table exists in the storage resources already cached by the host device, deleting the same command from the mapping table when traversing that the same command in the command queue associated with the mapping table exists in the storage resources already cached by the host device, and recovering the storage resources which are cached by the host device and are not associated with the deleted command.
The system for implementing command queue optimization management further comprises:
a processing module;
and the processing module is arranged in the host equipment and used for orderly processing each single command in the command queue buffer information associated with the mapping table according to the control of the controller.
According to another aspect of the present invention, there is provided an apparatus for implementing command queue optimization management, including:
at least one processor; and (c) a second step of,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any of the above described implementations of command queue optimization management.
According to still another aspect of the present invention, there is provided a computer-readable storage medium storing a computer program, which when executed by a processor implements the method for implementing command queue optimization management as described in any one of the above.
It can be seen that in the above scenario, the host device can send command queue buffer information, and the controller can receive the command queue buffer information sent by the host device, and the received command queue buffer information is mapped and converted by logical address to obtain a mapping table related to the command queue buffer information, calculating the required storage resource according to the command queue buffer information recorded by the mapping table obtained by the conversion, and detecting whether the current storage state of the host device satisfies the calculated required storage resources, when the current storage state of the host equipment is detected to meet the calculated required storage resource, the host equipment is controlled to process each single command in the command queue buffer information associated with the mapping table in order, so that the host equipment can run to an optimized state, and the commands in the command queue can be processed in time.
Furthermore, according to the above scheme, the controller may decompose the command queue buffer information according to the converted command queue buffer information recorded in the mapping table to obtain each single command, and calculate the storage resource required by each single command according to each single command obtained by the decomposition.
Further, according to the above scheme, the controller detects whether the current storage state of the host device satisfies the calculated required storage resource, and when it is detected that the current storage state of the host device does not satisfy the calculated required storage resource, the controller recovers the storage resource cached by the host device until the current storage state of the host device satisfies the calculated required storage resource.
Further, in the above solution, the controller may detect whether the current storage state of the host device satisfies the calculated required storage resource, when it is detected that the current storage state of the host device does not satisfy the calculated required storage resource, traverse the storage resource already cached by the host device whether there is the same command in the command queue associated with the mapping table, delete the same command from the mapping table when there is the same command in the command queue associated with the mapping table in the storage resource already cached by the host device, and recycle the storage resource that is cached by the host device and is not associated with the deleted command, which has the advantages of being able to ensure that the host device has enough storage resources to perform ordered optimized command queue processing, being able to ensure that the commands in the command queue are processed in time, and meanwhile, the commands in the command queue can be distinguished whether the commands are cached or not, and the processing efficiency of processing the commands in the command queue is improved.
Furthermore, according to the above scheme, the host device can process each single command in the command queue buffer information associated with the mapping table in order according to the control of the controller, so that the host device can operate to an optimized state, and the commands in the command queue can be processed in time.
Detailed Description
The invention is described in further detail below with reference to the figures and examples. It is to be noted that the following examples are only illustrative of the present invention, and do not limit the scope of the present invention. Likewise, the following examples are only some examples, not all examples, and all other examples obtained by those skilled in the art without any inventive work are within the scope of the present invention.
The invention provides a method for realizing the optimization management of a command queue, which can realize that a host device can run to an optimized state and can ensure that commands in the command queue are processed in time.
Referring to fig. 1, fig. 1 is a flowchart illustrating an embodiment of a method for implementing command queue optimization management according to the present invention. It should be noted that the method of the present invention is not limited to the flow sequence shown in fig. 1 if the results are substantially the same. As shown in fig. 1, the method comprises the steps of:
s101: the host device sends command queue buffer information.
S102: the controller receives command queue buffer information sent by the host device.
S103: the controller performs logical address mapping conversion on the received command queue buffer information to obtain a mapping table associated with the command queue buffer information.
S104: and the controller calculates the required storage resource according to the command queue buffer information recorded by the mapping table obtained by conversion.
Wherein, the controller calculates the required storage resource according to the command queue buffer information recorded by the mapping table obtained by the conversion, and may include:
the controller decomposes the command queue buffer information according to the converted command queue buffer information recorded by the mapping table to obtain each single command, and calculates the storage resource required by each single command according to each single command obtained by decomposition.
S105: the controller detects whether the current storage state of the host device meets the calculated required storage resource, and controls the host device to process each single command in the command queue buffer information associated with the mapping table in order when the current storage state of the host device is detected to meet the calculated required storage resource.
The controller may detect whether the current storage state of the host device satisfies the calculated required storage resource, and when it is detected that the current storage state of the host device satisfies the calculated required storage resource, control the host device to process each single command in the command queue buffer information associated with the mapping table in order, and may further include:
the controller detects whether the current storage state of the host equipment meets the required storage resource of the calculation, and when the current storage state of the host equipment is detected to be the required storage resource which does not meet the calculation, the cached storage resource of the host equipment is recycled until the current storage state of the host equipment can meet the required storage resource of the calculation.
The method for controlling the host device to process each single command in the command queue buffer information associated with the mapping table in order includes the steps of, when the controller detects that the current storage state of the host device satisfies the calculated required storage resource, controlling the host device to process each single command in the command queue buffer information associated with the mapping table in order, and may further include:
the controller detects whether the current storage state of the host device meets the required storage resource of the calculation, when the current storage state of the host device is detected to be the required storage resource which does not meet the calculation, the controller traverses whether the same command in the command queue associated with the mapping table exists in the storage resources already cached by the host device, deletes the same command from the mapping table when the same command in the command queue associated with the mapping table exists in the storage resources already cached by the host device, and recycles the storage resources which are cached by the host device and are not associated with the deleted command, so that the advantage of ensuring that the host device can have enough storage resources to perform ordered optimized command queue processing can be realized, the commands in the command queue can be ensured to be processed in time, and the commands in the command queue can be distinguished whether the commands are cached or not at the same time, the processing efficiency of processing the commands in the command queue is improved.
When the controller detects that the current storage state of the host device satisfies the calculated required storage resource, and when it is detected that the current storage state of the host device satisfies the calculated required storage resource, after controlling the host device to sequentially process each single command in the command queue buffer information associated with the mapping table, the method may further include:
the host equipment processes each single command in the command queue buffer information associated with the mapping table in order according to the control of the controller, can run to an optimized state, and can ensure that the commands in the command queue are processed in time.
It can be seen that in this embodiment, the host device can transmit command queue buffer information, and the controller can receive the command queue buffer information transmitted by the host device, and the received command queue buffer information is mapped and converted by logic address to obtain a mapping table related to the command queue buffer information, calculating the required storage resource according to the command queue buffer information recorded by the mapping table obtained by the conversion, and detecting whether the current storage state of the host device satisfies the calculated required storage resources, when the current storage state of the host equipment is detected to meet the calculated required storage resource, the host equipment is controlled to process each single command in the command queue buffer information associated with the mapping table in order, so that the host equipment can run to an optimized state, and the commands in the command queue can be processed in time.
Further, in this embodiment, the controller may decompose the command queue buffer information according to the command queue buffer information recorded in the mapping table obtained through the conversion to obtain each single command, and calculate the storage resource required by each single command according to each single command obtained through the decomposition.
Further, in this embodiment, the controller detects whether the current storage state of the host device satisfies the calculated required storage resource, and when it is detected that the current storage state of the host device does not satisfy the calculated required storage resource, recovers the storage resource cached by the host device until the current storage state of the host device satisfies the calculated required storage resource.
Further, in this embodiment, the controller may detect whether the current storage state of the host device satisfies the calculated required storage resource, when detecting that the current storage state of the host device does not satisfy the calculated required storage resource, traverse whether the same command in the command queue associated with the mapping table exists in the storage resources already cached by the host device, delete the same command from the mapping table when traversing that the same command in the command queue associated with the mapping table exists in the storage resources already cached by the host device, and recycle the storage resource that is cached by the host device and is not associated with the deleted command, which has the advantages of being able to ensure that the host device has enough storage resources to perform ordered optimized command queue processing, being able to ensure that the commands in the command queue are processed in time, and meanwhile, whether the commands in the command queue are cached or not can be distinguished, and the processing efficiency of processing the commands in the command queue is improved.
Referring to fig. 2, fig. 2 is a flowchart illustrating another embodiment of a method for implementing command queue optimization management according to the present invention. In this embodiment, the method includes the steps of:
s201: the host device sends command queue buffer information.
S202: the controller receives command queue buffer information sent by the host device.
S203: the controller performs logical address mapping conversion on the received command queue buffer information to obtain a mapping table associated with the command queue buffer information.
S204: and the controller calculates the required storage resource according to the command queue buffer information recorded by the mapping table obtained by conversion.
As described above in S104, and will not be described herein.
S205: the controller detects whether the current storage state of the host device meets the calculated required storage resource, and controls the host device to process each single command in the command queue buffer information associated with the mapping table in order when the current storage state of the host device is detected to meet the calculated required storage resource.
As described above in S105, further description is omitted here.
S206: and the host device processes each single command in the command queue buffer information associated with the mapping table in order according to the control of the controller.
It can be found that, in this embodiment, the host device may process each single command in the command queue buffer information associated with the mapping table in order according to the control of the controller, so that the host device can run to an optimized state, and the commands in the command queue can be guaranteed to be processed in time.
The invention also provides a system for realizing the command queue optimization management, which can realize that the host equipment can run to an optimized state and can ensure that the commands in the command queue are processed in time.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an embodiment of a system for implementing command queue optimization management according to the present invention. In this embodiment, the system 30 for implementing command queue optimization management includes a host device 31 and a controller 32.
The host device 31 is configured to transmit command queue buffer information.
The controller 32 is configured to receive command queue buffer information sent by the host device 31, perform logical address mapping conversion on the received command queue buffer information to obtain a mapping table associated with the command queue buffer information, calculate a required storage resource according to the command queue buffer information recorded in the mapping table obtained by the conversion, detect whether a current storage state of the host device 31 satisfies the calculated required storage resource, and control the host device 31 to process each single command in the command queue buffer information associated with the mapping table in order when it is detected that the current storage state of the host device 31 satisfies the calculated required storage resource.
Optionally, the controller 32 may be specifically configured to:
and decomposing the command queue buffer information according to the converted command queue buffer information recorded by the mapping table to obtain each single command, and calculating the storage resource required by each single command according to each single command obtained by decomposition.
Optionally, the controller 32 may be specifically configured to:
detecting whether the current storage state of the host device 31 satisfies the calculated required storage resource, and when detecting that the current storage state of the host device 31 does not satisfy the calculated required storage resource, recycling the storage resource cached by the host device 31 until the current storage state of the host device 31 satisfies the calculated required storage resource.
Optionally, the controller 32 may be specifically configured to:
detecting whether the current storage state of the host device 31 meets the calculated required storage resource, when detecting that the current storage state of the host device 31 does not meet the calculated required storage resource, traversing whether the same command in the command queue associated with the mapping table exists in the storage resources already cached by the host device 31, deleting the same command from the mapping table when traversing that the same command in the command queue associated with the mapping table exists in the storage resources already cached by the host device 31, and recycling the storage resources which are cached by the host device 31 and are not associated with the deleted command.
Referring to fig. 4, fig. 4 is a schematic structural diagram of another embodiment of a system for implementing command queue optimization management according to the present invention. Different from the previous embodiment, the system 40 for implementing command queue optimization management in this embodiment further includes: a processing module 41.
The processing module 41 is disposed in the host device 31 and configured to process the single commands in the command queue buffer information associated with the mapping table in order according to the control of the controller 32.
Each unit module of the command queue optimization management implementation system 30/40 can respectively execute the corresponding steps in the above method embodiments, and therefore, the description of each unit module is omitted here, and please refer to the description of the corresponding steps above in detail.
The present invention further provides a device for implementing command queue optimization management, as shown in fig. 5, including: at least one processor 51; and a memory 52 communicatively coupled to the at least one processor 51; the memory 52 stores instructions executable by the at least one processor 51, and the instructions are executed by the at least one processor 51, so that the at least one processor 51 can execute the implementation method of the above-mentioned command queue optimization management.
Wherein the memory 52 and the processor 51 are coupled in a bus, the bus may comprise any number of interconnected buses and bridges, the buses coupling together one or more of the various circuits of the processor 51 and the memory 52. The bus may also connect various other circuits such as peripherals, voltage regulators, power management circuits, etc., which are well known in the art, and therefore, will not be described any further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 51 is transmitted over a wireless medium via an antenna, which further receives the data and passes the data to the processor 51.
The processor 51 is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And the memory 52 may be used to store data used by the processor 51 in performing operations.
The present invention further provides a computer-readable storage medium storing a computer program. The computer program realizes the above-described method embodiments when executed by a processor.
It can be seen that in the above scenario, the host device may transmit command queue buffer information, and the controller may receive command queue buffer information transmitted by the host device, and the received command queue buffer information is mapped and converted by logic address to obtain a mapping table related to the command queue buffer information, calculating the required storage resource according to the command queue buffer information recorded by the mapping table obtained by the conversion, and detecting whether the current storage state of the host device satisfies the calculated required storage resources, when the current storage state of the host equipment is detected to meet the calculated required storage resource, the host equipment is controlled to process each single command in the command queue buffer information associated with the mapping table in order, so that the host equipment can run to an optimized state, and the commands in the command queue can be processed in time.
Furthermore, according to the above scheme, the controller may decompose the command queue buffer information according to the command queue buffer information recorded in the mapping table obtained through the conversion to obtain each single command, and calculate the storage resource required by each single command according to each single command obtained through the decomposition.
Further, according to the above scheme, the controller detects whether the current storage state of the host device satisfies the calculated required storage resource, and when it is detected that the current storage state of the host device does not satisfy the calculated required storage resource, the controller recovers the storage resource cached by the host device until the current storage state of the host device satisfies the calculated required storage resource.
Further, in the above solution, the controller may detect whether the current storage state of the host device satisfies the calculated required storage resource, when it is detected that the current storage state of the host device does not satisfy the calculated required storage resource, traverse the storage resource already cached by the host device whether there is the same command in the command queue associated with the mapping table, delete the same command from the mapping table when there is the same command in the command queue associated with the mapping table in the storage resource already cached by the host device, and recycle the storage resource that is cached by the host device and is not associated with the deleted command, which has the advantages of being able to ensure that the host device has enough storage resources to perform ordered optimized command queue processing, being able to ensure that the commands in the command queue are processed in time, and meanwhile, the commands in the command queue can be distinguished whether the commands are cached or not, and the processing efficiency of processing the commands in the command queue is improved.
Furthermore, according to the above scheme, the host device can process each single command in the command queue buffer information associated with the mapping table in order according to the control of the controller, so that the host device can operate to an optimized state, and the commands in the command queue can be processed in time.
In the several embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a module or a unit is only one type of logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be substantially or partially implemented in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only a part of the embodiments of the present invention, and not intended to limit the scope of the present invention, and all equivalent devices or equivalent processes performed by the contents of the present specification and the attached drawings, or directly or indirectly applied to other related technical fields, are all included in the scope of the present invention.