CN102929801B - A kind of method and apparatus for disk addressing - Google Patents

A kind of method and apparatus for disk addressing Download PDF

Info

Publication number
CN102929801B
CN102929801B CN201210413126.2A CN201210413126A CN102929801B CN 102929801 B CN102929801 B CN 102929801B CN 201210413126 A CN201210413126 A CN 201210413126A CN 102929801 B CN102929801 B CN 102929801B
Authority
CN
China
Prior art keywords
interface
queue
request
operation requests
requests message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201210413126.2A
Other languages
Chinese (zh)
Other versions
CN102929801A (en
Inventor
陈志新
石晶翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nantong Jinhui Computer Technology Development Co., Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201210413126.2A priority Critical patent/CN102929801B/en
Publication of CN102929801A publication Critical patent/CN102929801A/en
Application granted granted Critical
Publication of CN102929801B publication Critical patent/CN102929801B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

Embodiments provide a kind of method and apparatus for disk addressing, it is possible to solve when disk is operated, the problem that addressing time of consumption is bigger。The method includes: after described device receives the first queue of the operation requests message that described disk carries out random read-write, determine the first scope of the I/O interface position of read operation request message request, the I/O interface of write operation requests message request that then position of I/O interface belongs to described first scope carries out the first sequence with the I/O interface of all read operation request message request, it is thus achieved that the second queue of operation requests message;The write operation requests message that the position of I/O interface is not belonging to described first scope is defined as the 3rd queue, and the data of the write operation requests message request of described 3rd queue is write in buffer memory;Finally according to the operation requests message of described second queue, described disk is sequentially carried out the operation of described request。The present invention is applicable to computer realm。

Description

A kind of method and apparatus for disk addressing
Technical field
The present invention relates to field of computer technology, particularly relate to a kind of method and apparatus for disk addressing。
Background technology
When adopting mechanical hard disk media storage data, it is frequently encountered by the situation that reading and writing data position is random, thus causing that most of the time is wasted in the address procedures of magnetic disk media in read-write process。Especially in once request, the internal memory reading and writing I/O interface corresponding needing addressing is less, makes requested data be distributed in the internal memory that multiple I/O interface is corresponding, based on the randomness of read and write position, this performance loss is more serious, causes that the time waste in disk addressing is serious。
In prior art, it is proposed that the following two kinds reduces the method for disk addressing time:
1) adopt cache buffer memory Cache that the data deviateing current magnetic head bigger are carried out buffer memory。When again reading and writing data, determine whether to read-write Cache according to whether Cache stores these data, if Cache has, then need not read from disk, directly read in Cache, if Cache does not have, then read from disk。The method need not all be read and write and all pass through addressing realization in disk, saves the time of disk addressing to a certain extent。
2) Linux elevator solution is adopted。In I/O scheduling process, the method is when the message request of the read-write I/O interface processed in disk, choose the best alternatives and process after described message request ordering by merging, the message request in optimal case can by temporary suspension for some, when the request having a new I/O interface joins message request queue, first check for whether the message request of each hang-up in disk can be merged in new information request queue, if it is passable, in conjunction with the current location of magnetic head, the new message request queue after merging selects optimal ordering to be written and read the operation of I/O interface。If merging unsuccessfully, then the message request of described hang-up can be inserted into suitable position。The method can complete the message request of read-write I/O interface by certain sequence, saves the time of disk addressing to a certain extent。
But in two kinds of methods of the time waste of above-mentioned solution disk addressing, there is problems:
When adopting cache buffer memory Cache that data are carried out buffer memory, when in Cache, memory space is full, it is necessary to the data of buffer memory in Cache are written in disk。If by when in Cache, the data of buffer memory are saved in disk, owing to not accounting for the relation of the position of the I/O interface of data position in disk and current request in Cache, still random data in buffer memory are write in disk, so also being so that when disk is operated, the addressing time of consumption is bigger。
When adopting Linux elevator solution, the message request of some read-write I/O interface is due to the reason of sequence, it is possible to can be suspended and just be performed for a long time, owing to the message request holdup time of I/O interface is long, can be plugged directly into tail of the queue time processed。Now due to the addition of the request of described hang-up, still such that when disk is operated, the addressing time of consumption is bigger。
Summary of the invention
Embodiments of the invention provide a kind of method and apparatus for disk addressing, it is possible to solve when disk is operated, the problem that addressing time of consumption is bigger。
For reaching above-mentioned purpose, embodiments of the invention adopt the following technical scheme that
First aspect, it is provided that a kind of method for disk addressing, the method includes:
Receive the first queue of the operation requests message that described disk is carried out random read-write, described each operation requests message carries described disk is operated I/O interface corresponding when asking;
Determine the first scope of the I/O interface position of read operation request message request, the scope that the described first I/O interface ranging for two farthest read operation request message request of the positional distance of the I/O interface of request described in described first queue is determined;
The I/O interface of write operation requests message request that the position of I/O interface belongs to described first scope carries out the first sequence with the I/O interface of all read operation request message request, it is thus achieved that the second queue of operation requests message;
The write operation requests message that the position of I/O interface is not belonging to described first scope is defined as the 3rd queue, the data of the write operation requests message request of described 3rd queue is write in buffer memory;
Operation requests message according to described second queue, is sequentially carried out the operation of described request to described disk。
In the implementation that the first is possible, according to first aspect, after the second queue obtaining described operation requests message, the method also includes:
Determine whether the position of I/O interface corresponding to the data in buffer memory has the I/O interface belonging to described first scope;
If there being a described I/O interface, sorting according to described first, described second queue is inserted the write operation requests message that the data that a described I/O interface is corresponding carry out write operation;
Or
The I/O interface of the I/O interface Yu all read operation request message request that belong to the write operation requests message request of described first scope is carried out the first sequence, it is thus achieved that before the second queue of operation requests message, also include:
Determine whether the position of I/O interface corresponding to the data in buffer memory has the I/O interface belonging to described first scope;
If there being a described I/O interface, the write operation requests message that the data that a described I/O interface is corresponding carry out write operation is inserted in the first queue of described disk。
In the implementation that the second is possible, according to first aspect or implementation that the first is possible, the data of the write operation requests message request of described 3rd queue being write before in buffer memory, the method also includes:
Check that whether the memory space in described buffer memory is full;
If the memory space in described buffer memory is full, it is determined that the 2nd I/O interface, described 2nd I/O interface is the I/O interface closest to the second queue of the position in the I/O interface that in described 3rd queue, the I/O interface of request is corresponding with the data of described buffer memory;
If described buffer memory exists described 2nd I/O interface, sort according to described first, described second queue is inserted the write operation requests message that the data that described 2nd I/O interface is corresponding carry out write operation;
If described 3rd queue exists described 2nd I/O interface, sort according to described first, write operation requests message corresponding for the 2nd I/O interface of described 3rd queue is inserted in described second queue。
In the implementation that the third is possible, according to the implementation that first aspect or implementation that the first is possible or the second are possible, described first sequence particularly as follows:
With the position of current magnetic head place I/O interface for an I/O interface on first, the I/O interface nearest apart from the position of a upper I/O interface is defined as next I/O interface, according to the sequence obtaining described operation requests message that the sequence of I/O interface is corresponding。
In the 4th kind of possible implementation, according to the implementation that the third is possible, the data of the write operation requests message request of described 3rd queue being write before in buffer memory, the method also includes:
Whether check in described first queue entirely for write operation requests message;
If described first queue is write operation requests message entirely, then determine the 3rd I/O interface and the 4th I/O interface, described 3rd I/O interface is the I/O interface less than the first preset range of the distance with a upper I/O interface, described 4th I/O interface is the distance I/O interface more than the first preset range of the arbitrary I/O interface with described 3rd I/O interface, and the write operation requests message that described 4th I/O interface is corresponding is defined as the 3rd queue;
After the second queue obtaining operation requests message, also include:
Sort according to described first, write operation requests message corresponding for described 3rd I/O interface is inserted into described second queue。
In the 5th kind of possible implementation, according to first aspect or implementation that the first is possible to the 4th kind of possible implementation, after receiving the first queue of the operation requests message that described disk is carried out random read-write, also include:
Add up the request frequency of the I/O interface I/O interface of the disk areas of correspondence respectively of described first queue request, it is judged that whether described disk areas is remote area;
Operation requests message according to described second queue, after described disk is sequentially carried out the operation of described request, also includes:
If the I/O interface of the read operation request message request of described first queue exists the 5th I/O interface of remote area, the data that described read operation request message request the 5th I/O interface reads are written in described buffer memory。
Second aspect, it is provided that a kind of device for disk addressing, described device includes receiving unit, determining unit and processing unit;
Described reception unit, for receiving the first queue of the operation requests message that described disk carries out random read-write, carries in described each operation requests message and described disk is operated I/O interface corresponding when asking;
Described determine unit, for determining the first scope of the I/O interface position of read operation request message request, the scope that the described first I/O interface ranging for two farthest read operation request message request of the positional distance of the I/O interface of request described in described first queue is determined;
Described processing unit, the I/O interface of write operation requests message request for the position of I/O interface belongs to described first scope carries out the first sequence with the I/O interface of all read operation request message request, it is thus achieved that the second queue of operation requests message;
Described determining unit, the write operation requests message being additionally operable to be not belonging to the position of I/O interface described first scope is defined as the 3rd queue, described processing unit, is additionally operable in the data write buffer memory of the write operation requests message request by described 3rd queue;
Described processing unit, is additionally operable to the operation requests message according to described second queue, described disk is sequentially carried out the operation of described request。
In the implementation that the first is possible, in conjunction with second aspect, described determine unit, be additionally operable to after the second queue obtaining described operation requests message, it is determined that whether the position of the I/O interface that data in buffer memory are corresponding has the I/O interface belonging to described first scope;
Described processing unit, if being additionally operable to a described I/O interface, sorting according to described first, inserting the write operation requests message that the data that a described I/O interface is corresponding carry out write operation in described second queue;
Or
Described determine unit, the I/O interface of the I/O interface and all read operation request message request that are additionally operable to the write operation requests message request by belonging to described first scope carries out the first sequence, before obtaining the second queue of operation requests message, it is determined that whether the position of the I/O interface that data in buffer memory are corresponding has the I/O interface belonging to described first scope;
Described processing unit, if being additionally operable to a described I/O interface, is inserted into the write operation requests message that the data that a described I/O interface is corresponding carry out write operation in the first queue of described disk。
In the implementation that the second is possible, according to second aspect or implementation that the first is possible, described device also includes inspection unit,
Described inspection unit, for the data of the write operation requests message request of described 3rd queue being write before in buffer memory, checking that whether the memory space in described buffer memory is full;
Described determine unit, if the memory space being additionally operable in described buffer memory is full, determine that the 2nd I/O interface, described 2nd I/O interface are the I/O interface closest to the second queue of the position in the I/O interface that in described 3rd queue, the I/O interface of request is corresponding with the data of described buffer memory;
, there is described 2nd I/O interface if being additionally operable in described buffer memory in described processing unit, sorts according to described first, insert the write operation requests message that the data that described 2nd I/O interface is corresponding carry out write operation in described second queue;
Described processing unit, if being additionally operable in described 3rd queue there is described 2nd I/O interface, sorting according to described first, write operation requests message corresponding for the 2nd I/O interface of described 3rd queue being inserted in described second queue。
In the implementation that the third is possible, according to the implementation that second aspect or implementation that the first is possible or the second are possible, described first sequence particularly as follows:
With the position of current magnetic head place I/O interface for an I/O interface on first, the I/O interface nearest apart from the position of a upper I/O interface is defined as next I/O interface, according to the sequence obtaining described operation requests message that the sequence of I/O interface is corresponding。
In the 4th kind of possible implementation, according to the implementation that the third is possible,
Whether described inspection unit, for the data of the write operation requests message request of described 3rd queue being write before in buffer memory, check in described first queue entirely for write operation requests message;
Described determine unit, if it is complete in write operation requests message to be additionally operable in described first queue, then determine the 3rd I/O interface and the 4th I/O interface, described 3rd I/O interface is the I/O interface less than the first preset range of the distance with a upper I/O interface, described 4th I/O interface is the distance I/O interface more than the first preset range of the arbitrary I/O interface with described 3rd I/O interface, and the write operation requests message that described 4th I/O interface is corresponding is defined as the 3rd queue;
Described processing unit, is additionally operable to, after the second queue obtaining operation requests message, sort according to described first, write operation requests message corresponding for described 3rd I/O interface is inserted into described second queue。
In the 5th kind of possible implementation, according to second aspect or implementation that the first is possible to the 4th kind of possible implementation, described device also includes statistic unit,
Described statistic unit, for after the first queue receiving the operation requests message that described disk is carried out random read-write, add up the request frequency of the I/O interface I/O interface of the disk areas of correspondence respectively of described first queue request, it is judged that whether described disk areas is remote area;
Described processing unit, it is additionally operable in the operation requests message according to described second queue, after described disk is sequentially carried out the operation of described request, if the I/O interface of the read operation request message request of described first queue exists the 5th I/O interface of remote area, the data that described read operation request message request the 5th I/O interface reads are written in described buffer memory。
Embodiments provide a kind of method and apparatus for disk addressing, the method is after the first queue receiving the operation requests message that described disk carries out random read-write, according to the I/O interface corresponding when being operated described disk asking carried in described each operation requests message, determine the first scope of the I/O interface position of read operation request message request, the scope that the described first I/O interface ranging for two farthest read operation request message request of the positional distance of the I/O interface of request described in described first queue is determined, and then the I/O interface of write operation requests message request that the position of I/O interface belongs to described first scope carries out the first sequence with the I/O interface of all read operation request message request, obtain the second queue of operation requests message, the write operation requests message that the position of I/O interface is not belonging to described first scope is defined as the 3rd queue, the data of the write operation requests message request of described 3rd queue are write in buffer memory, operation requests message finally according to described second queue, described disk is sequentially carried out the operation of described request。
First, the position of the I/O interface of the write operation requests message request in the 3rd queue is not in the first scope, the data of the write operation requests message request in described 3rd queue are directly write in buffer memory, the time of disk addressing can be saved, it also avoid simultaneously when described operation requests message request I/O interface distance the first scope farther out time, described operation requests message is hung up for a long time in disk, when again receiving described operation requests message, it is inserted into the addressing time of the consumption that tail of the queue brings bigger problem。
It addition, when the data in said write buffer memory are asked again, it is possible to directly read in described buffer memory, it is not necessary to address in disk, also save the time of disk addressing。
Furthermore, described second queue is the queue after sequence, so according to described second queue when described disk being carried out the operation of described request, the operation of described request it is sequentially carried out according to the clooating sequence of the I/O interface of request, rather than after receiving the first queue, carry out the operation of described request at random, also save the time of disk addressing。
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, the accompanying drawing used required in embodiment or description of the prior art will be briefly described below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the premise not paying creative work, it is also possible to obtain other accompanying drawing according to these accompanying drawings。
A kind of method flow schematic diagram for disk addressing that Fig. 1 provides for the embodiment of the present invention;
The method flow schematic diagram that the another kind that Fig. 2 provides for the embodiment of the present invention addresses for disk;
The schematic diagram that the I/O interface of the method that the another kind that Fig. 3 provides for utilizing the embodiment of the present invention addresses for disk the first queue request to receiving processes;
A kind of apparatus structure schematic diagram for disk addressing that Fig. 4 provides for the embodiment of the present invention;
The apparatus structure schematic diagram that the another kind that Fig. 5 provides for the embodiment of the present invention addresses for disk;
Another apparatus structure schematic diagram addressed for disk that Fig. 6 provides for the embodiment of the present invention。
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is only a part of embodiment of the present invention, rather than whole embodiments。Based on the embodiment in the present invention, the every other embodiment that those of ordinary skill in the art obtain under not making creative work premise, broadly fall into the scope of protection of the invention。
Embodiment one,
Embodiments provide a kind of method for disk addressing, concrete as it is shown in figure 1, the method includes:
101, receive the first queue of the operation requests message that described disk is carried out random read-write, described each operation requests message carries described disk is operated I/O interface corresponding when asking。
Generally, disk is made up of many sectors, the corresponding I/O interface in one or more sectors, and when described disk carries out the operation of random read-write, essence is by described I/O interface, completes to read data or to the action of write from disk。So described disk being carried out in the operation requests message of random read-write, each operation requests message carries and described disk is operated I/O interface corresponding when asking。
102, the first scope of the I/O interface position of read operation request message request is determined, the scope that the described first I/O interface ranging for two farthest read operation request message request of the positional distance of the I/O interface of request described in described first queue is determined。
Determine the first scope of the I/O interface position of read operation request message request, when described first queue is read operation request message entirely, in described first scope, comprise the I/O interface of whole request message requests in described first queue;When described first queue is write operation requests message entirely, it is empty in described first scope;When described first queue had both comprised read operation request message, comprise again write operation requests message, be then likely to, in described first scope, the I/O interface comprising write operation requests message request。
The I/O interface of write operation requests message request that 103, the position of I/O interface belongs to described first scope carries out the first sequence with the I/O interface of all read operation request message request, it is thus achieved that the second queue of operation requests message。
In order to reduce the time of disk addressing, in determining the first queue after the first scope of I/O interface position, it is possible to the operation requests message of the first queue is easily separated。Wherein using the position of described I/O interface read-write operation request message in the first scope as a queue;Using the position of described I/O interface in the first extraneous write operation requests message as a queue。
The I/O interface of the read-write operation request message request that then position of I/O interface belongs to described first scope carries out the first sequence, wherein said first sequence can be arranged according to the position of I/O interface order from big to small, can also be arrange according to order from small to large, can also with the position of current magnetic head place I/O interface for an I/O interface on first, the I/O interface nearest apart from the position of a upper I/O interface is defined as next I/O interface, according to this I/O interface of all operations request message requests in the first scope is ranked up, then according to the sequence obtaining described operation requests message that the sequence of I/O interface is corresponding, obtain the second queue of described operation requests message。Concrete, this is not especially limited by the embodiment of the present invention。
The write operation requests message that 104, the position of I/O interface is not belonging to described first scope is defined as the 3rd queue, the data of the write operation requests message request of described 3rd queue is write in buffer memory。
Second queue includes the position of all read operation request message in the first queue and the I/O interface all write operation requests message in the first scope, then the position of I/O interface is not belonging to all write operation requests message of described first scope and is defined as described 3rd queue。
Owing to the position of I/O interface of the write operation requests message request in the 3rd queue is not in the first scope, show positional distance second queue of I/O interface of the 3rd queue request farther out, in order to save the time of disk addressing, the data of the write operation requests message request in described 3rd queue can directly write in buffer memory。
It addition, the data in said write buffer memory can be used for when the read operation request message of I/O interface corresponding to the data again occurred in described buffer memory, it is possible to directly read in described buffer memory, it is not necessary to address in disk, also save the time of disk addressing。
Needing exist for illustrating, obtaining the second queue with obtaining the 3rd queue does not have absolute sequencing in time, it is also possible to first carries out step 104, then performs step 103。This is not construed as limiting by the embodiment of the present invention。
It is further to note that described buffer memory is permanent buffer memory。
105, the operation requests message according to described second queue, is sequentially carried out the operation of described request to described disk。
Described second queue is the queue after sequence, so according to described second queue when described disk being carried out the operation of described request, the operation of described request it is sequentially carried out according to the clooating sequence of the I/O interface of request, rather than after receiving the first queue, carry out the operation of described request at random, save the time of disk addressing。
Accordingly, it is necessary to explanation, step 105 can also perform after step 103 obtains the second queue, and this is also not especially limited by the embodiment of the present invention。
Embodiments provide a kind of method for disk addressing, the method is after the first queue receiving the operation requests message that described disk carries out random read-write, according to the I/O interface corresponding when being operated described disk asking carried in described each operation requests message, determine the first scope of the I/O interface position of read operation request message request, the scope that the described first I/O interface ranging for two farthest read operation request message request of the positional distance of the I/O interface of request described in described first queue is determined, and then the I/O interface of write operation requests message request that the position of I/O interface belongs to described first scope carries out the first sequence with the I/O interface of all read operation request message request, obtain the second queue of operation requests message, the write operation requests message that the position of I/O interface is not belonging to described first scope is defined as the 3rd queue, the data of the write operation requests message request of described 3rd queue are write in buffer memory, operation requests message finally according to described second queue, described disk is sequentially carried out the operation of described request。
Based on the technical scheme that the embodiment of the present invention provides, first, the position of the I/O interface of the write operation requests message request in the 3rd queue is not in the first scope, the data of the write operation requests message request in described 3rd queue are directly write in buffer memory, the time of disk addressing can be saved, it also avoid simultaneously when described operation requests message request I/O interface distance the first scope farther out time, described operation requests message is hung up for a long time in disk, when again receiving described operation requests message, it is inserted into the addressing time of the consumption that tail of the queue brings bigger problem。
It addition, when the data in said write buffer memory are asked again, it is possible to directly read in described buffer memory, it is not necessary to address in disk, also save the time of disk addressing。
Furthermore, described second queue is the queue after sequence, so according to described second queue when described disk being carried out the operation of described request, the operation of described request it is sequentially carried out according to the clooating sequence of the I/O interface of request, rather than after receiving the first queue, carry out the operation of described request at random, also save the time of disk addressing。
Embodiment two,
Embodiments provide a kind of method for disk addressing, concrete as in figure 2 it is shown, the method includes:
201, receive the first queue of the operation requests message that described disk is carried out random read-write, described each operation requests message carries described disk is operated I/O interface corresponding when asking。
Generally, disk is made up of many sectors, the corresponding I/O interface in one or more sectors, and when described disk carries out the operation of random read-write, essence is by described I/O interface, completes to read data or to the action of write from disk。So described disk being carried out in the operation requests message of random read-write, each operation requests message carries and described disk is operated I/O interface corresponding when asking。
For example, as shown in Figure 3, it is assumed that the I/O interface of the operation requests message request of the first queue received is respectively as follows:
Read I/O interface 1, write I/O interface 15, read I/O interface 6, read I/O interface 9, write I/O interface 7, write I/O interface 12。The I/O interface for read operation request that the junior unit of each ellipse represents, the I/O interface for write operation requests that the junior unit of each rectangle represents。
202, the first scope of the I/O interface position of read operation request message request is determined, the scope that the described first I/O interface ranging for two farthest read operation request message request of the positional distance of the I/O interface of request described in described first queue is determined。
Determine the first scope of the I/O interface position of read operation request message request, when described first queue is read operation request message entirely, in described first scope, comprise the I/O interface of whole request message requests in described first queue;When described first queue is write operation requests message entirely, it is empty in described first scope;When described first queue had both comprised read operation request message, comprise again write operation requests message, be then likely to, in described first scope, the I/O interface comprising write operation requests message request。
It is concrete as it is shown on figure 3, in the first queue, the position between I/O interface 1 and I/O interface 9 is farthest, so the first scope of the first queue received should be the I/O interface between I/O interface 1 to I/O interface 9。
The I/O interface of write operation requests message request that 203, the position of I/O interface belongs to described first scope carries out the first sequence with the I/O interface of all read operation request message request, it is thus achieved that the second queue of operation requests message。
In order to reduce the time of disk addressing, in determining the first queue after the first scope of I/O interface position, it is possible to the operation requests message of the first queue is easily separated。Wherein using the position of described I/O interface read-write operation request message in the first scope as a queue;Using the position of described I/O interface in the first extraneous write operation requests message as a queue。
The I/O interface of the read-write operation request message request that then position of I/O interface belongs to described first scope carries out the first sequence, wherein said first sequence can be arranged according to the position of I/O interface order from big to small, can also be arrange according to order from small to large, can also with the position of current magnetic head place I/O interface for an I/O interface on first, the I/O interface nearest apart from the position of a upper I/O interface is defined as next I/O interface, according to this I/O interface of all operations request message requests in the first scope is ranked up, then according to the sequence obtaining described operation requests message that the sequence of I/O interface is corresponding, obtain the second queue of described operation requests message。Concrete, this is not especially limited by the embodiment of the present invention。
Specifically as shown in Figure 3, the I/O interface 7 of write operation requests message request is in the first scope, by its I/O interface I/O interface 1 with all read operation request message request, I/O interface 6, I/O interface 9 carries out the first sequence together, assume in the first scope, what I/O interface 5 from current magnetic head place was nearest is I/O interface 6, now I/O interface 6 is next I/O interface of the I/O interface 5 at current magnetic head place, then I/O interface 6 is as a upper I/O interface, what distance I/O interface 6 was nearest is I/O interface 7, in this way, next I/O interface is followed successively by I/O interface 9, I/O interface 1。Final the second queue obtained is illustrated in figure 3:
Read I/O interface 6, write I/O interface 7, read I/O interface 9, read I/O interface 1。
Certainly, described first sequence can also have other mode, it is possible to according to above-mentioned sortord, it is also possible to for arranging according to order from small to large, makes the ranking results be: I/O1, I/O6, I/O7, I/O9, it is also possible to have other mode, be not especially limited here。
204, determine whether the position of I/O interface corresponding to the data in buffer memory has the I/O interface belonging to described first scope。
Concrete in Fig. 3, it is assumed that I/O interface corresponding to data in buffer memory is I/O interface 3, I/O interface 10, I/O interface 18。
Now I/O interface 3 is in the first scope, so there being the I/O interface belonging to the first scope in buffer memory, I/O interface 3 is an I/O interface。
If there being a described I/O interface, perform step 205;If without a described I/O interface, perform step 206。
If 205 have a described I/O interface, sort according to described first, described second queue is inserted the write operation requests message that the data that a described I/O interface is corresponding carry out write operation。
If there being a described I/O interface, the write request message that data corresponding for a described I/O interface can carry out write operation is inserted in described second queue, under the premise not wasting the unnecessary addressing time, data corresponding for an I/O interface in described buffer memory can be write a described I/O interface on the one hand;On the other hand, it is possible to save space to buffer memory, for other data of buffer memory。
Concrete as it is shown on figure 3, because determining that I/O interface 3 is the I/O interface belonging to the first scope in step 204, be now inserted in the second queue by the write operation requests message of the data of I/O interface 3 correspondence, the second queue that Fig. 3 obtains is:
Read I/O interface 6, write I/O interface 7, read I/O interface 9, write I/O interface 3, read I/O interface 1。
The write operation requests message that 206, the position of I/O interface is not belonging to described first scope is defined as the 3rd queue。
Second queue includes the position of all read operation request message in the first queue and the I/O interface all write operation requests message in the first scope, then the position of I/O interface is not belonging to all write operation requests message of described first scope and is defined as described 3rd queue。
Owing to the position of I/O interface of the write operation requests message request in the 3rd queue is not in the first scope, in order to save the time of disk addressing, the data of the write operation requests message request in described 3rd queue can directly write in buffer memory。
It addition, the data in said write buffer memory can be used for when the read operation request message of I/O interface corresponding to the data again occurred in described buffer memory, it is possible to directly read in described buffer memory, it is not necessary to address in disk, also save the time of disk addressing。
Concrete as it is shown on figure 3, the position of I/O interface is not belonging to I/O interface corresponding to the write operation requests message of described first scope for writing I/O interface 15, write I/O interface 12, then the write operation requests message of I/O interface 15 and I/O interface 12 is defined as the 3rd queue。
Needing exist for illustrating, obtaining the second queue with obtaining the 3rd queue does not have absolute sequencing in time, it is also possible to first carries out step 206, then performs step 203;After can also performing step 203, then performing 206, only step 203 necessarily performs prior to step 204, and when step 206 performs early than step 204, when step 204 is judged as NO, will then perform step 207。
207, check that whether the memory space in described buffer memory is full。
Time under the premise that the memory space of described buffer memory is full, now the data of the write operation requests message request of described 3rd queue can not be write direct in buffer memory。So the data of the write operation requests message request of described 3rd queue are write before in buffer memory, it is necessary first to first check that whether the memory space in described buffer memory is full。
Specifically as shown in Figure 3, it is assumed that when buffer memory stores the data of I/O interface 3, I/O interface 10, I/O interface 18 correspondence at first, the memory space of buffer memory is just full。After the write operation requests message that the data of I/O interface 3 correspondence carry out write operation is inserted into described second queue, then show buffer memory has reserved space。And although buffer memory has had certain memory space, but the 3rd queue includes two write operation requests message, corresponding I/O interface 15 and I/O interface 12 respectively, assume that the space size shared by data of each operation requests message request is the same, now spatial cache is inadequate, if during the memory space that therefore in buffer memory, the memory space of free time is corresponding less than the data of the write operation requests message request of described 3rd queue, now thinking that spatial cache is full。
If the memory space in described buffer memory is full, then perform step 208;If the memory space in described buffer memory less than, then perform step 211。
If the memory space in 208 described buffer memorys is full, it is determined that the 2nd I/O interface, described 2nd I/O interface is the I/O interface closest to the second queue of the position in the I/O interface that in described 3rd queue, the I/O interface of request is corresponding with the data of described buffer memory。
In order to the write operation requests message processed in time in the 3rd queue, and reduce the time of disk addressing as far as possible, when spatial cache is full, it needs to be determined that closest to the I/O interface of the I/O interface of the second queue request, i.e. the 2nd I/O interface in the I/O interface that goes out in the 3rd queue request I/O interface corresponding with the data in buffer memory。Then the write operation requests message that the data that its 2nd I/O interface is corresponding carry out write operation is inserted in described second queue。
Specifically as shown in Figure 3, the I/O interface that write request message in 3rd queue is corresponding has I/O interface 12 and I/O interface 15, I/O interface corresponding to data in buffer memory also has I/O interface 10, I/O interface 18, second queue, for reading I/O interface 6, writes I/O interface 7, reads I/O interface 9, write I/O interface 3, read I/O interface 1。
Now, compare the I/O interface that the I/O interface of the 3rd queue request is corresponding with the data in buffer memory successively, find out the I/O interface that the I/O interface of distance the second queue request is nearest。Obviously, in the I/O interface that in 3rd queue, the I/O interface of request is corresponding with the data in buffer memory, the I/O interface closest to the second queue request is I/O interface 10, it is thus determined that described 2nd I/O interface can be I/O interface 10, now buffer memory there are enough memory spaces can write the data of the 3rd queue request。
Certainly, if the 3rd queue includes multiple write operation requests message, and memory space completely time, in the 3rd queue and buffer memory is determined after first the 2nd I/O interface of the second queue, the I/O interface of remaining request again can also be selected second the 2nd I/O interface with this, until buffer memory has the data of enough space write the 3rd queue requests from the 3rd queue and in buffer memory again。In this case, multiple 2nd I/O interfaces are likely concurrently present in described 3rd queue and in described buffer memory, then need to be inserted in described second queue by write operation requests message corresponding for the 2nd I/O interface of described 3rd queue respectively, the write operation requests message that the data that the 2nd I/O interface in described buffer memory is corresponding carry out write operation is inserted in described second queue, then obtains described second queue and described 3rd queue。
If 209 described buffer memorys exist described 2nd I/O interface, sort according to described first, described second queue is inserted the write operation requests message that the data that described 2nd I/O interface is corresponding carry out write operation。
If described buffer memory exists described 2nd I/O interface, the position in the I/O interface that the data of described buffer memory the are corresponding I/O interface closest to the second queue is described, now in order to save the disk addressing time, the write operation requests message that the data that described 2nd I/O interface is corresponding carry out write operation is inserted in described second queue。
Additionally, data corresponding for 2nd I/O interface described in buffer memory are carried out after the write operation requests message of write operation is inserted in described second queue, buffer memory leaves memory space, it is also possible to the data of the write operation requests message request of described 3rd queue write in buffer memory。
Concrete in Fig. 3, in 2nd I/O interface, I/O interface 10 is the I/O interface that the data in buffer memory are corresponding, therefore sorts according to described first, inserts the data in the buffer memory to described I/O interface 10 correspondence and carry out the write operation requests message of write operation in described second queue。
If 210 described 3rd queues exist described 2nd I/O interface, sort according to described first, write operation requests message corresponding for the 2nd I/O interface of described 3rd queue is inserted in described second queue。
When described 2nd I/O interface is in described 3rd queue, illustrate that described in described 3rd queue, the position of the I/O interface of write operation requests message request is nearest from described second queue, now in order to save the time of disk addressing, sort according to first, the write operation requests message of described 3rd queue is inserted in described second queue。
211, the data of the write operation requests message request of described 3rd queue are write in buffer memory。
Specifically as it is shown on figure 3, the I/O interface of the write operation requests message request of the 3rd queue is I/O interface 12 and I/O interface 15, therefore by the data write buffer memory of the write operation requests message request of I/O interface 12 and I/O interface 15 in described 3rd queue。
It should be noted that buffer memory here is permanent buffer memory。
212, the operation requests message according to described second queue, is sequentially carried out the operation of described request to described disk。
As it is shown on figure 3, through above-mentioned flow process, the second queue finally obtained is:
Read I/O6, write I/O7, read I/O9, write I/O10, write I/O3, read I/O1, according to described second queue, described disk is sequentially carried out the operation of described request。
Described second queue is the queue after sequence, so according to described second queue when described disk being carried out the operation of described request, the operation of described request it is sequentially carried out according to the clooating sequence of the I/O interface of request, rather than after receiving the first queue, carry out the operation of described request at random, save the time of disk addressing。
It should be noted that in execution of step 203 in above-described embodiment, it is thus achieved that after described second queue, just determine whether buffer memory has an I/O interface, it is determined whether need to be written in disk data in buffer memory。Optionally, before obtaining the second queue, also it is can determine in advance in buffer memory whether to have an I/O interface, it is determined whether need to be written in disk data in buffer memory。Concrete process comprises determining that whether the position of I/O interface corresponding to the data in buffer memory has the I/O interface belonging to described first scope;If there being a described I/O interface, the write operation requests message that the data that a described I/O interface is corresponding carry out write operation is inserted in the first queue of described disk。It is then passed through the first sequence, it is thus achieved that the second queue。
The second queue that two schemes finally give is the same, therefore for first sorting, rear insert the second queue and still first inserts the first queue, sorts afterwards, and this is not specifically limited by the embodiment of the present invention。
If the operation requests message comprised in the first queue is entirely for write operation requests message, now the second queue should be empty, 3rd queue is identical with the write operation requests message comprised in the first queue, in order to avoid the data that all write operation requests in the first queue are asked are written in buffer memory, optionally, the data of the write operation requests message request of described 3rd queue being write before in buffer memory, the method also includes:
Whether check in described first queue entirely for write operation requests message;
If described first queue is write operation requests message entirely, then determine the 3rd I/O interface and the 4th I/O interface, described 3rd I/O interface is the I/O interface less than the first preset range of the distance with a upper I/O interface, described 4th I/O interface is the distance I/O interface more than the first preset range of the arbitrary I/O interface with described 3rd I/O interface, and the write operation requests message that described 4th I/O interface is corresponding is defined as the 3rd queue。
Assume that the I/O interface of the operation requests message request of the first queue received is respectively as follows:
Write I/O interface 11, write I/O interface 12, write I/O interface 14, write I/O interface 1, write I/O interface 2, write I/O interface 3, write I/O interface 29。And currently head position is the position at I/O interface 10 place, the first preset range is the scope of the distance less than or equal to two I/O interfaces;With the position of the position I/O interface 10 at current magnetic head place less than or equal to the I/O interface of the distance of two I/O interfaces for being followed successively by I/O interface 11, I/O interface 12, it is I/O interface 14 with the position of I/O interface 12 less than or equal to the I/O interface of the distance of two I/O interfaces, when I/O14 is as a upper I/O interface, in remaining I/O interface, it is absent from the I/O interface less than or equal to the distance of two I/O interfaces of the distance with I/O interface 14, so determining:
3rd I/O interface is I/O interface 11, I/O interface 12, I/O interface 14。
I/O interface 1, I/O interface 2, I/O interface 3, I/O interface 29 is the distance I/O interface more than the first preset range of the arbitrary I/O interface with described 3rd I/O interface, so determining: the 4th I/O interface is I/O interface 1, I/O interface 2, I/O interface 3, I/O interface 29。
Write operation requests message corresponding for described 4th I/O interface is defined as the 3rd queue, then the 3rd queue is: write I/O interface 1, writes I/O interface 2, writes I/O interface 3, writes I/O interface 29。
Then sort according to described first, write operation requests message corresponding for described 3rd I/O interface is inserted into described second queue, further according to the operation requests message of described second queue, data corresponding for the I/O interface of described second queue request are write in disk successively。
Optionally, after receiving the first queue of the operation requests message that described disk is carried out random read-write, also include:
Add up the request frequency of the I/O interface I/O interface of the disk areas of correspondence respectively of described first queue request, it is judged that whether described disk areas is remote area;
Operation requests message according to described second queue, after described disk is sequentially carried out the operation of described request, also includes:
If the I/O interface of the read operation request message request of described first queue exists the 5th I/O interface of remote area, the data that described read operation request message request the 5th I/O interface reads are written in described buffer memory。
Due to after the first queue receiving the operation requests message that described disk is carried out random read-write, first carry out the judgement of remote area, if I/O interface corresponding to some read operation request message is in remote area, namely there is the 5th I/O interface, then the data that described read operation request message request the 5th I/O interface reads are written in described buffer memory。So, when next time the read operation request message of the 5th I/O interface occurring, it is possible to directly read from buffer memory, the time of disk addressing is saved。
Embodiments provide a kind of method for disk addressing, the method is after the first queue receiving the operation requests message that described disk carries out random read-write, according to the I/O interface corresponding when being operated described disk asking carried in described each operation requests message, determine the first scope of the I/O interface position of read operation request message request, the scope that the described first I/O interface ranging for two farthest read operation request message request of the positional distance of the I/O interface of request described in described first queue is determined, and then the I/O interface of write operation requests message request that the position of I/O interface belongs to described first scope carries out the first sequence with the I/O interface of all read operation request message request, obtain the second queue of operation requests message, the write operation requests message that the position of I/O interface is not belonging to described first scope is defined as the 3rd queue, the data of the write operation requests message request of described 3rd queue are write in buffer memory, operation requests message finally according to described second queue, described disk is sequentially carried out the operation of described request。
Based on the technical scheme that the embodiment of the present invention provides, first, the position of the I/O interface of the write operation requests message request in the 3rd queue is not in the first scope, the data of the write operation requests message request in described 3rd queue are directly write in buffer memory, the time of disk addressing can be saved, it also avoid simultaneously when described operation requests message request I/O interface distance the first scope farther out time, described operation requests message is hung up for a long time in disk, when again receiving described operation requests message, it is inserted into the addressing time of the consumption that tail of the queue brings bigger problem。
It addition, when the data in said write buffer memory are asked again, it is possible to directly read in described buffer memory, it is not necessary to address in disk, also save the time of disk addressing。
Furthermore, described second queue is the queue after sequence, so according to described second queue when described disk being carried out the operation of described request, the operation of described request it is sequentially carried out according to the clooating sequence of the I/O interface of request, rather than after receiving the first queue, carry out the operation of described request at random, also save the time of disk addressing。
Embodiment three,
Embodiments providing a kind of device 40 for disk addressing, specifically as shown in Figure 4, the described device 40 for disk addressing includes: receives unit 41, determine unit 42 and processing unit 43。
Described reception unit 41, for receiving the first queue of the operation requests message that described disk carries out random read-write, carries in described each operation requests message and described disk is operated I/O interface corresponding when asking。
Generally, disk is made up of many sectors, the corresponding I/O interface in one or more sectors, and when described disk carries out the operation of random read-write, essence is by described I/O interface, completes to read data or to the action of write from disk。So described disk being carried out in the operation requests message of random read-write, each operation requests message carries and described disk is operated I/O interface corresponding when asking。
Described determine unit 42, for determining the first scope of the I/O interface position of read operation request message request, the scope that the described first I/O interface ranging for two farthest read operation request message request of the positional distance of the I/O interface of request described in described first queue is determined。
After determining the first scope, when described first queue is read operation request message entirely, in described first scope, comprise the I/O interface of whole request message requests in described first queue;When described first queue is write operation requests message entirely, it is empty in described first scope;When described first queue had both comprised read operation request message, comprise again write operation requests message, be then likely to, in described first scope, the I/O interface comprising write operation requests message request。
Described processing unit 43, the I/O interface of write operation requests message request for the position of I/O interface belongs to described first scope carries out the first sequence with the I/O interface of all read operation request message request, it is thus achieved that the second queue of operation requests message。
In order to reduce the time of disk addressing, in determining the first queue after the first scope of I/O interface position, it is possible to the operation requests message of the first queue is easily separated。Wherein using the position of described I/O interface read-write operation request message in the first scope as a queue;Using the position of described I/O interface in the first extraneous write operation requests message as a queue。
The I/O interface of the read-write operation request message request that then position of I/O interface belongs to described first scope carries out the first sequence, wherein said first sequence can be arranged according to the position of I/O interface order from big to small, can also be arrange according to order from small to large, can also with the position of current magnetic head place I/O interface for an I/O interface on first, the I/O interface nearest apart from the position of a upper I/O interface is defined as next I/O interface, according to this I/O interface of all operations request message requests in the first scope is ranked up, then according to the sequence obtaining described operation requests message that the sequence of I/O interface is corresponding, obtain the second queue of described operation requests message。Concrete, this is not especially limited by the embodiment of the present invention。
Described determining unit 42, the write operation requests message being additionally operable to be not belonging to the position of I/O interface described first scope is defined as the 3rd queue。
Second queue includes the position of all read operation request message in the first queue and the I/O interface all write operation requests message in the first scope, then the position of I/O interface is not belonging to all write operation requests message of described first scope and is defined as described 3rd queue。
Owing to the position of I/O interface of the write operation requests message request in the 3rd queue is not in the first scope, show positional distance second queue of I/O interface of the 3rd queue request farther out, in order to save the time of disk addressing, the data of the write operation requests message request in described 3rd queue can directly write in buffer memory。
It addition, the data in said write buffer memory can be used for when the read operation request message of I/O interface corresponding to the data again occurred in described buffer memory, it is possible to directly read in described buffer memory, it is not necessary to address in disk, also save the time of disk addressing。
Described processing unit 43, is additionally operable in the data write buffer memory of the write operation requests message request by described 3rd queue。
Described processing unit 43, is additionally operable to the operation requests message according to described second queue, described disk is sequentially carried out the operation of described request。
Described second queue is the queue after sequence, so according to described second queue when described disk being carried out the operation of described request, the operation of described request it is sequentially carried out according to the clooating sequence of the I/O interface of request, rather than after receiving the first queue, carry out the operation of described request at random, save the time of disk addressing。
It should be noted that described buffer memory is permanent buffer memory。
Optionally,
Described determine unit 42, be additionally operable to after the second queue obtaining described operation requests message, it is determined that whether the position of the I/O interface that data in described buffer memory are corresponding has the I/O interface belonging to described first scope。
Described processing unit 43, if being additionally operable to a described I/O interface, sorting according to described first, inserting the write operation requests message that the data that a described I/O interface is corresponding carry out write operation in described second queue。
If there being a described I/O interface, the write request message that data corresponding for a described I/O interface can carry out write operation is inserted in described second queue, under the premise not wasting the addressing time, data corresponding for an I/O interface in described buffer memory can be write a described I/O interface on the one hand;On the other hand, it is possible to save space to buffer memory, for other data of buffer memory。
Optionally, described determine unit 42, it is additionally operable to carry out the first sequence at the I/O interface of the write operation requests message request by belonging to described first scope and the I/O interface of all read operation request message request, before obtaining the second queue of operation requests message, it is determined that whether the position of the I/O interface that data in buffer memory are corresponding has the I/O interface belonging to described first scope。
Described processing unit 43, if being additionally operable to a described I/O interface, is inserted into the write operation requests message that the data that a described I/O interface is corresponding carry out write operation in the first queue of described disk。
Optionally, as it is shown in figure 5, the described device 40 for disk addressing also includes inspection unit 44。
Described inspection unit 44, for the data of the write operation requests message request of described 3rd queue being write before in buffer memory, checking that whether the memory space in described buffer memory is full。
Time under the premise that the memory space of described buffer memory is full, now the data of the write operation requests message request of described 3rd queue can not be write direct in buffer memory。So the data of the write operation requests message request of described 3rd queue being write before in buffer memory, whether described inspection unit 44 is full firstly the need of the memory space first checked in described buffer memory。
Described determine unit 42, if the memory space being additionally operable in described buffer memory is full, determine that the 2nd I/O interface, described 2nd I/O interface are the I/O interface closest to the second queue of the position in the I/O interface that in described 3rd queue, the I/O interface of request is corresponding with the data of described buffer memory。
In order to the write operation requests message processed in time in the 3rd queue, and reduce the time of disk addressing as far as possible, when spatial cache is full, it needs to be determined that closest to the I/O interface of the I/O interface of the second queue request, i.e. the 2nd I/O interface in the I/O interface that goes out in the 3rd queue request I/O interface corresponding with the data in buffer memory。Then the write operation requests message that the data that its 2nd I/O interface is corresponding carry out write operation is inserted in described second queue。
Described processing unit 43, described 2nd I/O interface is there is if being additionally operable in described buffer memory, sort according to described first, described second queue is inserted the write operation requests message that the data that described 2nd I/O interface is corresponding carry out write operation, in the operation requests message according to described second queue, after described disk is sequentially carried out the operation of described request, in the data write buffer memory that the write request message of described 3rd queue is asked。
If described buffer memory exists described 2nd I/O interface, the position in the I/O interface that the data of described buffer memory the are corresponding I/O interface closest to the second queue is described, now in order to save the disk addressing time, the write operation requests message that the data that described 2nd I/O interface is corresponding carry out write operation is inserted in described second queue。
Additionally, data corresponding for 2nd I/O interface described in buffer memory are carried out after the write operation requests message of write operation is inserted in described second queue, buffer memory leaves memory space, it is also possible to the data of the write operation requests message request of described 3rd queue write in buffer memory。
It should be noted that described buffer memory is permanent buffer memory。
Described processing unit 43, if being additionally operable in described 3rd queue there is described 2nd I/O interface, according to the sequence of the second queue, is inserted into write operation requests message corresponding for the 2nd I/O interface of described 3rd queue in described second queue。
When described 2nd I/O interface is in described 3rd queue, illustrate that described in described 3rd queue, the position of the I/O interface of write operation requests message request is nearest from described second queue, now in order to save the time of disk addressing, described processing unit 43, sort according to first, write operation requests message corresponding for the 2nd I/O interface of described 3rd queue is inserted in described second queue。
Optionally,
Described first is ordered as:
With the position of current magnetic head place I/O interface for an I/O interface on first, the I/O interface nearest apart from the position of a upper I/O interface is defined as next I/O interface, according to the sequence obtaining described operation requests message that the sequence of I/O interface is corresponding。
Optionally,
Whether described inspection unit 44, before being additionally operable in the data write buffer memory of the write operation requests message request by described 3rd queue, check in described first queue entirely for write operation requests message。
Described determine unit 42, if it is complete in write operation requests message to be additionally operable in described first queue, then determine the 3rd I/O interface and the 4th I/O interface, described 3rd I/O interface is the I/O interface less than the first preset range of the distance with a upper I/O interface, described 4th I/O interface is the I/O interface more than the first preset range of the distance with a upper I/O interface, with the position of current magnetic head place I/O interface for an I/O interface on first, the write operation requests message that described 4th I/O interface is corresponding is defined as the 3rd queue。
Described processing unit 43, is additionally operable to, after the second queue obtaining operation requests message, sort according to described first, write operation requests message corresponding for described 3rd I/O interface is inserted into described second queue。
Optionally, as shown in Figure 6, the described device 40 for disk addressing also includes statistic unit 45。
Described statistic unit 45, for after the first queue receiving the operation requests message that described disk is carried out random read-write, add up the request frequency of the I/O interface I/O interface of the disk areas of correspondence respectively of described first queue request, it is judged that whether described disk areas is remote area。
Described processing unit 43, it is additionally operable in the operation requests message according to described second queue, after described disk is sequentially carried out the operation of described request, if the I/O interface of the read operation request message request of described first queue exists the 5th I/O interface of remote area, the data that described read operation request message request the 5th I/O interface reads are written in described buffer memory。
It should be noted that described buffer memory is permanent buffer memory。
The described detailed address procedures for the device 40 of disk addressing can referring to the description described in embodiment two, and this is repeated no more by the present embodiment。
Embodiments providing a kind of device for disk addressing, this device includes receiving unit, determining unit, processing unit。Wherein receive the first queue of the operation requests message that described disk is carried out random read-write at described reception unit after, described determine that unit is for according to corresponding I/O interface when being operated described disk asking carried in described each operation requests message, determine the first scope of the I/O interface position of read operation request message request, the scope that the described first I/O interface ranging for two farthest read operation request message request of the positional distance of the I/O interface of request described in described first queue is determined, and then the position of I/O interface is belonged to the I/O interface of write operation requests message request of described first scope and carries out the first sequence with the I/O interface of all read operation request message request by described processing unit, obtain the second queue of operation requests message, described determine that the position of I/O interface is also not belonging to the write operation requests message of described first scope and is defined as the 3rd queue by unit, the data of the write operation requests message request of described 3rd queue are write in buffer memory by described processing unit, operation requests message finally according to described second queue, described disk is sequentially carried out the operation of described request。
Based on the device for disk addressing that the embodiment of the present invention provides, first, the position of the I/O interface of the write operation requests message request in the 3rd queue is not in the first scope, the data of the write operation requests message request in described 3rd queue are directly write in buffer memory, the time of disk addressing can be saved, it also avoid simultaneously when described operation requests message request I/O interface distance the first scope farther out time, described operation requests message is hung up for a long time in disk, when again receiving described operation requests message, it is inserted into the addressing time of the consumption that tail of the queue brings bigger problem。
It addition, when the data in said write buffer memory are asked again, it is possible to directly read in described buffer memory, it is not necessary to address in disk, also save the time of disk addressing。
Furthermore, described second queue is the queue after sequence, so according to described second queue when described disk being carried out the operation of described request, the operation of described request it is sequentially carried out according to the clooating sequence of the I/O interface of request, rather than after receiving the first queue, carry out the operation of described request at random, also save the time of disk addressing。
One of ordinary skill in the art will appreciate that: all or part of step realizing said method embodiment can be completed by the hardware that programmed instruction is relevant, aforesaid program can be stored in a computer read/write memory medium, this program upon execution, performs to include the step of said method embodiment;And aforesaid storage medium includes: the various media that can store program code such as ROM, RAM, magnetic disc or CDs。
The above; being only the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, any those familiar with the art is in the technical scope that the invention discloses; change can be readily occurred in or replace, all should be encompassed within protection scope of the present invention。Therefore, protection scope of the present invention should be as the criterion with described scope of the claims。

Claims (12)

1. the method for disk addressing, it is characterised in that the method includes:
Receive the first queue of the operation requests message that described disk is carried out random read-write, each operation requests message in described operation requests message carries described disk is operated I/O interface corresponding when asking;
Determining the first scope of the I/O interface position of read operation request message request, described first ranges for the scope that all I/O interfaces between the I/O interface of two farthest read operation request message request of the positional distance of the I/O interface of described request are determined;
The I/O interface of write operation requests message request that the position of I/O interface belongs to described first scope carries out the first sequence with the I/O interface of all read operation request message request, it is thus achieved that the second queue of operation requests message;
The write operation requests message that the position of I/O interface is not belonging to described first scope is defined as the 3rd queue, the data of the write operation requests message request of described 3rd queue is write in buffer memory;
Operation requests message according to described second queue, is sequentially carried out the operation of described request to described disk。
2. method according to claim 1, it is characterised in that after the second queue obtaining described operation requests message, the method also includes:
Determine whether the position of I/O interface corresponding to the data in buffer memory has the I/O interface belonging to described first scope;
If there being a described I/O interface, sorting according to described first, described second queue is inserted the write operation requests message that the data that a described I/O interface is corresponding carry out write operation;
Maybe the I/O interface of the I/O interface Yu all read operation request message request that belong to the write operation requests message request of described first scope is carried out the first sequence, it is thus achieved that before the second queue of operation requests message, also include:
Determine whether the position of I/O interface corresponding to the data in buffer memory has the I/O interface belonging to described first scope;
If there being a described I/O interface, the write operation requests message that the data that a described I/O interface is corresponding carry out write operation is inserted in the first queue of described disk。
3. method according to claim 1 and 2, it is characterised in that the data of the write operation requests message request of described 3rd queue are write before in buffer memory, the method also includes:
Check that whether the memory space in described buffer memory is full;
If the memory space in described buffer memory is full, it is determined that the 2nd I/O interface, described 2nd I/O interface is the I/O interface closest to the second queue of the position in the I/O interface that in described 3rd queue, the I/O interface of request is corresponding with the data of described buffer memory;
If described buffer memory exists described 2nd I/O interface, sort according to described first, described second queue is inserted the write operation requests message that the data that described 2nd I/O interface is corresponding carry out write operation;
If described 3rd queue exists described 2nd I/O interface, sort according to described first, write operation requests message corresponding for the 2nd I/O interface of described 3rd queue is inserted in described second queue。
4. the method stated according to claim 1, it is characterised in that described first is ordered as:
With the position of current magnetic head place I/O interface for an I/O interface on first, the I/O interface nearest apart from the position of a upper I/O interface is defined as next I/O interface, according to the sequence obtaining described operation requests message that the sequence of I/O interface is corresponding。
5. method according to claim 4, it is characterised in that the data of the write operation requests message request of described 3rd queue being write before in buffer memory, the method also includes:
Whether check in described first queue entirely for write operation requests message;
If described first queue is write operation requests message entirely, then determine the 3rd I/O interface and the 4th I/O interface, described 3rd I/O interface is the I/O interface less than the first preset range of the distance with a upper I/O interface, described 4th I/O interface is the distance I/O interface more than the first preset range of the arbitrary I/O interface with described 3rd I/O interface, and the write operation requests message that described 4th I/O interface is corresponding is defined as the 3rd queue;
Sort according to described first, write operation requests message corresponding for described 3rd I/O interface is inserted into described second queue。
6. method according to claim 1, it is characterised in that
After receiving the first queue of the operation requests message that described disk is carried out random read-write, also include:
Add up the request frequency of the I/O interface I/O interface of the disk areas of correspondence respectively of described first queue request, it is judged that whether described disk areas is remote area;
Operation requests message according to described second queue, after described disk is sequentially carried out the operation of described request, also includes:
If the I/O interface of the read operation request message request of described first queue exists the 5th I/O interface of remote area, the data that described read operation request message request the 5th I/O interface reads are written in described buffer memory。
7. the device for disk addressing, it is characterised in that described device includes receiving unit, determining unit and processing unit;
Described reception unit, for receiving the first queue of the operation requests message that described disk carries out random read-write, carries in each operation requests message in described operation requests message and described disk is operated I/O interface corresponding when asking;
Described determine unit, for determining the first scope of the I/O interface position of read operation request message request, described first ranges for the scope that all I/O interfaces between the I/O interface of two farthest read operation request message request of the positional distance of the I/O interface of described request are determined;
Described processing unit, the I/O interface of write operation requests message request for the position of I/O interface belongs to described first scope carries out the first sequence with the I/O interface of all read operation request message request, it is thus achieved that the second queue of operation requests message;
Described determining unit, the write operation requests message being additionally operable to be not belonging to the position of I/O interface described first scope is defined as the 3rd queue, described processing unit, is additionally operable in the data write buffer memory of the write operation requests message request by described 3rd queue;
Described processing unit, is additionally operable to the operation requests message according to described second queue, described disk is sequentially carried out the operation of described request。
8. device according to claim 7, it is characterised in that
Described determine unit, be additionally operable to after the second queue obtaining described operation requests message, it is determined that whether the position of the I/O interface that data in buffer memory are corresponding has the I/O interface belonging to described first scope;
Described processing unit, if being additionally operable to a described I/O interface, sorting according to described first, inserting the write operation requests message that the data that a described I/O interface is corresponding carry out write operation in described second queue;
Or
Described determine unit, the I/O interface of the I/O interface and all read operation request message request that are additionally operable to the write operation requests message request by belonging to described first scope carries out the first sequence, before obtaining the second queue of operation requests message, it is determined that whether the position of the I/O interface that data in buffer memory are corresponding has the I/O interface belonging to described first scope;
Described processing unit, if being additionally operable to a described I/O interface, is inserted into the write operation requests message that the data that a described I/O interface is corresponding carry out write operation in the first queue of described disk。
9. the device according to claim 7 or 8, it is characterised in that described device also includes inspection unit;
Described inspection unit, for the data of the write operation requests message request of described 3rd queue being write before in buffer memory, checking that whether the memory space in described buffer memory is full;
Described determine unit, if the memory space being additionally operable in described buffer memory is full, determine that the 2nd I/O interface, described 2nd I/O interface are the I/O interface closest to the second queue of the position in the I/O interface that in described 3rd queue, the I/O interface of request is corresponding with the data of described buffer memory;
, there is described 2nd I/O interface if being additionally operable in described buffer memory in described processing unit, sorts according to described first, insert the write operation requests message that the data that described 2nd I/O interface is corresponding carry out write operation in described second queue;
Described processing unit, if being additionally operable in described 3rd queue there is described 2nd I/O interface, according to the sequence of the second queue, is inserted into write operation requests message corresponding for the 2nd I/O interface of described 3rd queue in described second queue。
10. device according to claim 7, it is characterised in that described first is ordered as:
With the position of current magnetic head place I/O interface for an I/O interface on first, the I/O interface nearest apart from the position of a upper I/O interface is defined as next I/O interface, according to the sequence obtaining described operation requests message that the sequence of I/O interface is corresponding。
11. device according to claim 10, it is characterised in that described device also includes inspection unit;
Whether described inspection unit, for the data of the write operation requests message request of described 3rd queue being write before in buffer memory, check in described first queue entirely for write operation requests message;
Described determine unit, if it is complete in write operation requests message to be additionally operable in described first queue, then determine the 3rd I/O interface and the 4th I/O interface, described 3rd I/O interface is the I/O interface less than the first preset range of the distance with a upper I/O interface, described 4th I/O interface is the distance I/O interface more than the first preset range of the arbitrary I/O interface with described 3rd I/O interface, and the write operation requests message that described 4th I/O interface is corresponding is defined as the 3rd queue;
Described processing unit, is additionally operable to, after the second queue obtaining operation requests message, sort according to described first, write operation requests message corresponding for described 3rd I/O interface is inserted into described second queue。
12. device according to claim 7, it is characterised in that described device also includes statistic unit,
Described statistic unit, for after the first queue receiving the operation requests message that described disk is carried out random read-write, add up the request frequency of the I/O interface I/O interface of the disk areas of correspondence respectively of described first queue request, it is judged that whether described disk areas is remote area;
Described processing unit, it is additionally operable in the operation requests message according to described second queue, after described disk is sequentially carried out the operation of described request, if the I/O interface of the read operation request message request of described first queue exists the 5th I/O interface of remote area, the data that described read operation request message request the 5th I/O interface reads are written in described buffer memory。
CN201210413126.2A 2012-10-25 2012-10-25 A kind of method and apparatus for disk addressing Active CN102929801B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210413126.2A CN102929801B (en) 2012-10-25 2012-10-25 A kind of method and apparatus for disk addressing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210413126.2A CN102929801B (en) 2012-10-25 2012-10-25 A kind of method and apparatus for disk addressing

Publications (2)

Publication Number Publication Date
CN102929801A CN102929801A (en) 2013-02-13
CN102929801B true CN102929801B (en) 2016-06-22

Family

ID=47644603

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210413126.2A Active CN102929801B (en) 2012-10-25 2012-10-25 A kind of method and apparatus for disk addressing

Country Status (1)

Country Link
CN (1) CN102929801B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108268381B (en) * 2017-12-15 2021-12-24 中国航空工业集团公司西安飞行自动控制研究所 Method for safely realizing fast addressing of data

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5608891A (en) * 1992-10-06 1997-03-04 Mitsubishi Denki Kabushiki Kaisha Recording system having a redundant array of storage devices and having read and write circuits with memory buffers
CN1519736A (en) * 2003-01-24 2004-08-11 华为技术有限公司 Magnetic disk storage system
CN101299181A (en) * 2008-07-08 2008-11-05 杭州华三通信技术有限公司 Method and device for performing I/O request buffer memory based on magnetic disc and SAN memory apparatus
CN101494636A (en) * 2008-01-23 2009-07-29 中兴通讯股份有限公司 Method and apparatus for ordering data based on rapid IO interconnection technology
CN102073605A (en) * 2010-12-27 2011-05-25 深圳市创新科信息技术有限公司 Method for storage interface bypassing Bio layer to access disk drive

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5608891A (en) * 1992-10-06 1997-03-04 Mitsubishi Denki Kabushiki Kaisha Recording system having a redundant array of storage devices and having read and write circuits with memory buffers
CN1519736A (en) * 2003-01-24 2004-08-11 华为技术有限公司 Magnetic disk storage system
CN101494636A (en) * 2008-01-23 2009-07-29 中兴通讯股份有限公司 Method and apparatus for ordering data based on rapid IO interconnection technology
CN101299181A (en) * 2008-07-08 2008-11-05 杭州华三通信技术有限公司 Method and device for performing I/O request buffer memory based on magnetic disc and SAN memory apparatus
CN102073605A (en) * 2010-12-27 2011-05-25 深圳市创新科信息技术有限公司 Method for storage interface bypassing Bio layer to access disk drive

Also Published As

Publication number Publication date
CN102929801A (en) 2013-02-13

Similar Documents

Publication Publication Date Title
CN102428451B (en) Command and interrupt grouping for a data storage device
US9405485B2 (en) Method and apparatus for writing data to a flash memory
CN108156823B (en) Access method of flash memory medium and controller
CN109783004A (en) The data processing method of data memory device and memory device
CN101615410B (en) Disk storage apparatus and program
US9524238B2 (en) Systems and methods for managing cache of a data storage device
US20150253992A1 (en) Memory system and control method
US20120254520A1 (en) Non-volatile memory device, a data processing device using the same, and a swapping method used by the data processing and non-volatile memory devices
JP2012108999A (en) Concurrent read and write memory operations in serial interface memory
CN101118477A (en) Process for enhancing magnetic disc data accessing efficiency
JP2011524063A5 (en)
CN103942159A (en) Data read-write method and device based on mixed storage device
CN106383742B (en) A kind of I O scheduling method based on linux
CN113625973B (en) Data writing method, device, electronic equipment and computer readable storage medium
CN104252422A (en) Memory access method and memory controller
CN106598504B (en) data storage method and device
US20090259796A1 (en) Data writing method for non-volatile memory and storage system and controller using the same
CN102096562A (en) Data writing method and device
CN105389268B (en) Data storage system and its operation method
CN104133640B (en) From the fast quick-recovery of dormancy
CN101957729A (en) Logical block transformation method and method and device compatible with reading and writing of user based on same
CN102750213B (en) Disk detects, disposal route and detection, disposal system
CN103064636A (en) Solid-state disk read-write method and solid-state disk
CN102929801B (en) A kind of method and apparatus for disk addressing
CN117873568A (en) SSD controller, solid state disk and data processing method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20191217

Address after: Room 302, No. 8319, Yanshan Road, Bengbu City, Anhui Province

Patentee after: Bengbu Lichao Information Technology Co., Ltd

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: Huawei Technologies Co., Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201020

Address after: No.24, building 1, 2 and 3, citizen square, Jinsha Town, Tongzhou District, Nantong City, Jiangsu Province 226300

Patentee after: Nantong Jinhui Computer Technology Development Co., Ltd

Address before: Room 302, No. 8319, Yanshan Road, Bengbu City, Anhui Province

Patentee before: Bengbu Lichao Information Technology Co.,Ltd.