A kind of method of disk I request queue scheduling
Technical field
The present invention relates to the computer memory technical field, relate in particular to a kind of method of disk I request queue scheduling.
Background technology
When disc driver receive operating system read the IO operational order time; Will send the instruction of a read data to disk; And the address of the data block that will read simultaneously passes to disk; Disk can be passed to disc driver with the data that read then, and returns to operating system by disc driver, accomplishes an operation of reading IO; Same; An operation of writing IO is also similar; Disc driver is received the instruction of the IO operation of writing and the data that will write, and it is passed to disk, and disk returns the operating result transmission to disc driver after data write completion; Return to operating system by disc driver again, accomplish an operation of writing IO.What single IO operation referred to is exactly to accomplish the operation writing IO or read IO.
Disc driver may once send a series of a plurality of IO instruction to disk groups, and these a plurality of IO instructions can not be carried out immediately, but get up with the form buffer memory of formation, are referred to as the IO request queue.It all is the sequencing according to IO data sector in disk that traditional disk I formation is arranged mainly, from the IO request queue, extracts the IO instruction according to vertical order and carries out successively.But in practical application, it is different that the real-time of different I instruction requires.When a large amount of disk IO read-write request; It is so high to read and write in the general file data demand write storage device real-time; But also exist sometimes some critical data (such as metadata, configuration information) is all required to write in real time as early as possible storage system, in addition professional before guaranteeing that data in real time writes disk; Business process is in waiting status always, has had a strong impact on service feature.
Summary of the invention
The invention provides a kind of method of disk I request queue scheduling, can guarantee the demanding high priority data execution of real-time.
The embodiment of the invention provides a kind of method of disk I request queue scheduling, comprises the steps:
A, file system judge whether this IO request is high real-time IO request when generating the IO request, if, execution in step B, otherwise execution in step C;
B, request distributes high priority indication, an execution in step C then to this IO;
C, this IO request is sent to disc driver;
After D, disc driver are received the IO request, judge whether the IO request contains the high priority indication, if, execution in step E, otherwise execution in step F;
E, the front position of IO request queue is sent in this IO request, and returned steps A;
F, with this IO request according to the sector position ordering, send into the IO request queue, and return steps A.
Preferably, the said judged result of steps A then further comprises: this IO request is distributed default priority indication, execution in step C then for not.
Preferably, the said disc driver of step D further comprises after receiving the IO request: disc driver distributes a timer for each IO request, if the corresponding IO request of this timer of timer expired is not also carried out, then directly carries out this IO request.
Can find out from above technical scheme, increase a priority attribute to each IO request, for indivedual crucial IO, higher priority attribute can be set, the IO request that priority is high can be handled by relative priority.The present invention program considers the IO data importance simultaneously in the IO queue scheduling, the demanding critical data of priority processing real-time.The present invention is fewer for the data of key, but these crucial real-times, the very high service application of security requirement act on comparatively obvious.
Description of drawings
The process flow diagram that Fig. 1 dispatches for a kind of disk I request queue that the embodiment of the invention provides.
Embodiment
The present invention proposes to increase a priority attribute to each IO request, for indivedual crucial IO, higher priority attribute can be set, and the IO request that priority is high can be handled by relative priority.In the time of the business datum read-write, can indicate the priority of this IO, the IO priority attribute of acquiescence is that minimum " 0 " does not perhaps indicate priority, and the IO of level that All factors being equal, preference will be give to still sorts according to sector position.For the IO that prevents some low priority can not get handling for a long time, a time threshold can be set in addition, when some IO can not get handling for a long time, can suitably handle.
Clearer for the principle, characteristics and the technique effect that make technical scheme of the present invention, below the present invention program is set forth in detail through specific embodiment.
The flow process that a kind of disk I request queue that Fig. 1 shows the embodiment of the invention to be provided is dispatched comprises the steps:
Step 101: file system judges whether this IO request is high real-time IO request when generating the IO request, if, execution in step 102, otherwise execution in step 103.
Preferably, the IO request of critical data (such as metadata, configuration information) is asked as high real-time IO.
Step 102: this IO request is distributed a high priority indication, and execution in step 104 then;
Step 103: this IO request is distributed the default priority indication, and execution in step 104 then.Perhaps, do not distribute the default priority indication, directly execution in step 104.
Step 104: this IO request is sent to disc driver.
Step 105: after disc driver was received the IO request, the priority indication of judging the IO request was high priority indication or default priority indication, if high priority indication execution in step 106, if default priority indication execution in step 107.Said judgement also can be to judge whether the IO request has the priority indication, if then execution in step 106 is arranged, otherwise execution in step 107.
Step 106: the front position of IO request queue is sent in this IO request, and returned step 101.
Step 107: this IO request according to the sector position ordering, is sent into the IO request queue, and returned step 101.
Preferably, after disc driver is received the IO request, distribute a timer also can for each IO request,, then directly carry out this IO request if the corresponding IO request of this timer of timer expired is not also carried out.
The method of the disk I request queue scheduling that the present invention proposes is considered the IO data importance, the demanding critical data of priority processing real-time simultaneously in the IO queue scheduling.The present invention is fewer for the data of key, but these crucial real-times, the very high service application of security requirement act on comparatively obvious.
The above is merely preferred embodiment of the present invention, and is in order to restriction the present invention, not all within spirit of the present invention and principle, any modification of being made, is equal to replacement, improvement etc., all should be included within the scope that the present invention protects.