CN105302501A - Control method and device for disk sectors - Google Patents

Control method and device for disk sectors Download PDF

Info

Publication number
CN105302501A
CN105302501A CN201510893255.XA CN201510893255A CN105302501A CN 105302501 A CN105302501 A CN 105302501A CN 201510893255 A CN201510893255 A CN 201510893255A CN 105302501 A CN105302501 A CN 105302501A
Authority
CN
China
Prior art keywords
sector
read
chained list
write order
buffer memory
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.)
Granted
Application number
CN201510893255.XA
Other languages
Chinese (zh)
Other versions
CN105302501B (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.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview 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 Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN201510893255.XA priority Critical patent/CN105302501B/en
Publication of CN105302501A publication Critical patent/CN105302501A/en
Application granted granted Critical
Publication of CN105302501B publication Critical patent/CN105302501B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The invention provides a control method and device for disk sectors. The method comprises the steps that write commands with the size smaller than that of the sectors are received, and the sectors corresponding to the write commands and sector command structures corresponding to the sectors are determined; if a sector state is a pre-read issuing state, the write commands are added into an issuing chain table; if the sector state is a write combining issuing state, the write commands are added into a wait chain table; when a pre-read command returns, the write commands in the issuing chain table are combined in the processes of pre-reading and caching contained pre-read data, and the combined data are written into the sectors; when a write combining command returns, if write commands exist in the wait chain table, the write commands in the wait chain table are added into the issuing chain table, the write commands in the issuing chain table are combined in the processes of pre-reading and caching the contained pre-read data, and the combined data are written into the sectors. By means of the technical scheme, the sectors can support the write commands with the size smaller than that of the sectors, space of the sectors is saved, the write command processing performance is improved, and memory resources are saved.

Description

A kind of control method of disk sector and device
Technical field
The present invention relates to technical field of memory, particularly relate to a kind of control method and device of disk sector.
Background technology
At present, can disk be write data into, and read data from disk.Each magnetic track on disk is divided into several segmental arcs, and these segmental arcs are exactly the sector of disk, and the read-write of disk is all be base unit with sector, therefore, writes data into the sector of disk, and read data from the sector of disk.
When writing data into sector or read data from sector, a sector supported data amount is greater than write order or the read command of sector-size, and the write order that file system issues or read command are all the integral multiples of sector-size.Such as, sector-size can be 512K, and write order is used for the data of 1M (512K*2) or 2M to be written to sector, and read command is used for the data reading 1M or 2M from sector.
But, along with the fast development of memory technology, under application scenes, often can run into the situation that write order or read command are less than sector-size, and the write order or the read command that are less than sector-size are not supported in current sector.Such as, in the virtualized disk array management of block, each disk is divided into dummy block will up to ten thousand, in order to manage these dummy block will, need the management data of dummy block will to be written to sector, and each dummy block will takies a sector, the management data of each dummy block will may only have several byte, be far smaller than sector-size 512K, therefore the write order of the management data of dummy block will is not supported in sector.
Summary of the invention
The invention provides a kind of control method of disk sector, said method comprising the steps of:
Receive the write order being less than sector-size, determine sector command structure corresponding to the sector that described write order is corresponding and described sector, described sector command structure comprises sectors status, pre-read buffer memory, issue chained list and wait for chained list, described in pre-read the pre-reads data that buffer memory comprises in described sector the described sector-size write; If described sectors status pre-reads the state of issuing, then described write order is joined and issue chained list; If described sectors status merges to write hair-like state, then described write order is joined wait chained list;
When pre-read command returns, described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and the data after merging are written to described sector;
When merging write order and returning, if there is write order in described wait chained list, then the write order in described wait chained list is joined and issue chained list, and described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and the data after merging are written to described sector.
Manage described sector command structure by Hash table, described Hash table with LBA value corresponding to sector for key assignments; The described process determining sector command structure corresponding to the sector that described write order is corresponding and described sector, specifically comprises: the address information obtaining sector to be written from described write order, and utilizes described address information to determine the sector that described write order is corresponding; And, inquired about the key assignments of described Hash table by the LBA value of the described sector determined, obtain the sector command structure that the LBA value of described sector is corresponding;
Described method also comprises: after determining the sector that described write order is corresponding, if there is no the sector command structure that described sector is corresponding, create the sector command structure that described sector is corresponding, record the sectors status of described sector command structure for pre-reading the state of issuing, and from described sector, read the pre-reads data of the described sector-size write, store described pre-reads data pre-reading in buffer memory of described sector command structure;
When described sectors status be pre-read issue state time, described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and after the data after merging are written to described sector, by the sectors status of described sector command structure, by pre-reading, to issue status modifier be that merging writes hair-like state;
When described merging write order returns, described method comprises further: if there is not write order in described wait chained list, then after the preset lime, delete the sector command structure that described sector is corresponding.
Described described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, comprise: when described issue in chained list comprise multiple write order time, issue the time order and function order of chained list described in joining according to described multiple write order, successively described multiple write order is merged in described pre-reads data.
Described described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, comprise: according to described write order the first skew and the first size within the sector issued in chained list, use memory copying mode, from described first skew, pre-read the pre-reads data that buffer memory comprises described in being copied to by described write order, and the size of described write order in described pre-reads data is described first size.
Described method comprises further:
Receive the read command being less than sector-size, determine sector command structure corresponding to the sector that described read command is corresponding and described sector, described sector command structure comprises sectors status, pre-read buffer memory, issue chained list and wait for chained list, described in pre-read the pre-reads data that buffer memory comprises in described sector the described sector-size write; If described sectors status pre-reads the state of issuing, then described read command is joined and issue chained list; If described sectors status reads to return treatment state, then described read command is joined wait chained list; Wherein, after determining the sector that described read command is corresponding, if there is no the sector command structure that described sector is corresponding, then create the sector command structure that described sector is corresponding, record the sectors status of described sector command structure for pre-reading the state of issuing, and from described sector, read the pre-reads data of the described sector-size write, and store described pre-reads data in pre-reading in buffer memory of described sector command structure;
When pre-read command returns, sectors status is issued status modifier and returns treatment state by pre-reading for reading, read corresponding data according to the read command issued in chained list from described pre-reading the pre-reads data that buffer memory comprises, and the data of reading are returned to upper layer application; Under reading to return treatment state, if there is read command in wait chained list, then the read command in described wait chained list is joined and issue chained list, read corresponding data according to the read command issued in chained list from described pre-reading the pre-reads data that buffer memory comprises, and the data of reading are returned to upper layer application.
The invention provides a kind of control device of disk sector, described device specifically comprises:
Determination module, for receiving the write order being less than sector-size, and determine sector command structure corresponding to the sector that described write order is corresponding and described sector, wherein, described sector command structure specifically comprises sectors status, pre-read buffer memory, issue chained list and wait for chained list, and described in pre-read the pre-reads data that buffer memory comprises in described sector the described sector-size write; If described sectors status pre-reads the state of issuing, then issue chained list described in being joined by described write order; If described sectors status merges to write hair-like state, then described write order is joined described wait chained list;
Writing module, for when pre-read command returns, described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and the data after merging are written to described sector;
When merging write order and returning, if there is write order in described wait chained list, then the write order in described wait chained list is joined and issue chained list, and described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and the data after merging are written to described sector.
Manage described sector command structure by Hash table, and described Hash table with LBA value corresponding to sector for key assignments; Described determination module, specifically in the process determining sector command structure corresponding to the sector that described write order is corresponding and described sector, from write order, obtain the address information of sector to be written, and utilize described address information to determine the sector that described write order is corresponding; By the key assignments of the described Hash table of LBA value inquiry of described sector, obtain the sector command structure that the LBA value of described sector is corresponding;
Described determination module, also for after determining the sector that write order is corresponding, if there is no the sector command structure that described sector is corresponding, create the sector command structure that described sector is corresponding, record the sectors status of described sector command structure for pre-reading the state of issuing, and from described sector, read the pre-reads data of the described sector-size write, store described pre-reads data pre-reading in buffer memory of described sector command structure;
Said write module, also for when described sectors status be pre-read issue state time, described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and after the data after merging are written to described sector, then by the sectors status of described sector command structure, by pre-reading, to issue status modifier be that merging writes hair-like state; When described merging write order returns, if there is not write order in described wait chained list, then after the preset lime, delete the sector command structure that described sector is corresponding.
Said write module, specifically for described pre-read in the pre-reads data that buffer memory comprises merge described in issue in the process of the write order in chained list, when described issue in chained list comprise multiple write order time, issue the time order and function order of chained list described in joining according to described multiple write order, successively described multiple write order is merged in described pre-reads data.Said write module, specifically for described pre-read in the pre-reads data that buffer memory comprises merge described in issue in the process of the write order in chained list, according to described write order the first skew and the first size within the sector issued in chained list, use memory copying mode, from described first skew, pre-read the pre-reads data that buffer memory comprises described in being copied to by described write order, and the size of described write order in described pre-reads data is described first size.
Described determination module, also for receiving the read command being less than sector-size, determine sector command structure corresponding to the sector that described read command is corresponding and described sector, described sector command structure comprises sectors status, pre-read buffer memory, issue chained list and wait for chained list, described in pre-read the pre-reads data that buffer memory comprises in described sector the described sector-size write; If described sectors status pre-reads the state of issuing, then described read command is joined and issue chained list; If described sectors status reads to return treatment state, then described read command is joined wait chained list; After determining the sector that described read command is corresponding, if there is no the sector command structure that described sector is corresponding, then create the sector command structure that described sector is corresponding, record the sectors status of described sector command structure for pre-reading the state of issuing, from described sector, read the pre-reads data of the described sector-size write, and store described pre-reads data in pre-reading in buffer memory of described sector command structure;
Described device also comprises: read module, for when pre-read command returns, sectors status is issued status modifier and returns treatment state by pre-reading for reading, read corresponding data according to the read command issued in chained list from described pre-reading the pre-reads data that buffer memory comprises, and the data of reading are returned to upper layer application; Under reading to return treatment state, if there is read command in wait chained list, then the read command in described wait chained list is joined and issue chained list, read corresponding data according to the read command issued in chained list from described pre-reading the pre-reads data that buffer memory comprises, and the data of reading are returned to upper layer application.
Based on technique scheme, in the embodiment of the present invention, make sector can support to be less than the write order of sector-size, the multiple write orders being less than sector-size can be written to a sector, and do not need to apply for separately a sector for each write order being less than sector-size, thus can save between sector null.And, multiple write order being less than sector-size can be processed simultaneously, each write order being less than sector-size need not be processed separately, thus the handling property of write order can be improved.And, for a sector, can only safeguard that pre-reads a buffer memory for all write orders being less than sector-size, and need not safeguard that separately pre-reads a buffer memory for each write order being less than sector-size, and each buffer memory that pre-reads needs again to apply for memory source, therefore can avoid taking more memory source, thus can memory source be saved.
Accompanying drawing explanation
Fig. 1 is the process flow diagram of the control method of disk sector in one embodiment of the present invention;
Fig. 2 is the process schematic diagram of the write order in one embodiment of the present invention;
Fig. 3 A and Fig. 3 B is the schematic diagram of the test data in one embodiment of the present invention;
Fig. 4 is the process flow diagram of the writing method of disk sector in one embodiment of the present invention;
Fig. 5 is the process flow diagram of the control method of disk sector in one embodiment of the present invention;
Fig. 6 is the process schematic diagram of the read command in one embodiment of the present invention;
Fig. 7 is the process flow diagram reading control method of the disk sector in one embodiment of the present invention;
Fig. 8 is the hardware structure diagram of the memory device in one embodiment of the present invention;
Fig. 9 is the structural drawing of the control device of disk sector in one embodiment of the present invention.
Embodiment
For problems of the prior art, the embodiment of the present invention proposes a kind of control method of disk sector, can apply on a storage device, and to disk sector write process or read procedure controls.Wherein, each magnetic track on disk is divided into several segmental arcs, and these segmental arcs are exactly the sector of disk, and the read-write of disk is all be base unit with sector.When receiving the write order or read command (integral multiple as sector-size) that are more than or equal to sector-size, adopting existing mode process, in the present embodiment, this process being repeated no more.When receiving the write order or read command that are less than sector-size, as write order or the read command of the management data of dummy block will, then can adopt the technical scheme that the embodiment of the present invention proposes, follow-up write order or read command all refer to the write order or read command that are less than sector-size.Under above-mentioned application scenarios, as shown in Figure 1, the control method of this disk sector specifically can comprise the following steps:
Step 101, receive the write order being less than sector-size, determine sector command structure corresponding to the sector that this write order is corresponding and this sector, this sector command structure comprises sectors status, pre-reads buffer memory, issues chained list and wait for chained list, and this pre-reads the pre-reads data that buffer memory comprises this sector-size write in this sector.If this sectors status pre-reads the state of issuing, then this write order is joined and issue chained list; If this sectors status merges to write hair-like state, then this write order is joined wait chained list.
In the embodiment of the present invention, after determining the sector that this write order is corresponding, the sector command structure that this sector is corresponding is there is not if current, then create the sector command structure that this sector is corresponding, and the sectors status recording this sector command structure is for pre-reading the state of issuing, and from this sector, read the pre-reads data of the sector-size write, and store this pre-reads data in pre-reading in buffer memory of this sector command structure.
In the embodiment of the present invention, management sector imperative structures can be carried out by Hash table, and this Hash table is for key assignments with LBA (LogicalBlockAddress, logical block addresses) value corresponding to sector.On this basis, determine the process of sector command structure corresponding to the sector that this write order is corresponding and this sector, specifically can include but not limited to as under type: the address information obtaining sector to be written from this write order, and utilize this address information to determine the sector that this write order is corresponding; And, inquired about the key assignments of Hash table by the LBA value of the sector determined, obtain the sector command structure that the LBA value of sector is corresponding.
As shown in Figure 2, after receiving the write order being less than sector-size, write order is stored into order receiving queue, and determines the sector that each write order in order receiving queue is corresponding, the address information of the sector to be written of carrying in write order as utilized determines corresponding sector.A, B, C represent different sectors, based on the address information of the sector in write order, can determine the corresponding sector A of write order 1,2,3,5,13, the corresponding sector B of write order 4,6,7,12, the corresponding sector C of write order 8,9,10,11.
Wherein, management sector imperative structures can be carried out by Hash table, a Hash table is constructed to each disk, Hash table preserves sector command structure corresponding to each sector of disk, this sector command structure is for recording the information of all write orders corresponding to this sector, and this sector command structure can comprise this sector corresponding LBA value, sectors status, pre-reads buffer memory, issues chained list and wait for chained list, this sectors status comprises the state of issuing that pre-reads, merge and write hair-like state, and Hash table is for key assignments with LBA value corresponding to sector.
After determining the sector that write order is corresponding, directly can utilize the key assignments of the LBA value inquiry Hash table of this sector, obtain the sector command structure that the LBA value of sector is corresponding.Management sector imperative structures are carried out owing to using Hash table, and using LBA value corresponding for sector as key assignments, and Hash table is a data structure that directly can conduct interviews according to key assignments, record is visited by position key assignments being mapped to Hash table, to accelerate the speed of searching, therefore, can by Hash table fast query to sector command structure.
Wherein, after determining the sector that write order is corresponding, if there is not the sector command structure that this sector is corresponding in Hash table, in Hash table, then create the sector command structure that this sector is corresponding, and in this sector command structure, record LBA value corresponding to this sector, record the sectors status of this sector command structure for pre-reading the state of issuing, and create one pre-read buffer memory, one issue chained list and one and wait for chained list.
Wherein, if there is not sector command structure corresponding to this sector in Hash table, be not then created before representing the sector command structure that this sector is corresponding, or deleted after creation.
Wherein, when sectors status issues state for pre-reading, pre-read command will be performed, this pre-read command is for pre-reading the data of whole sector, namely from sector, read the pre-reads data equaling the sector-size of this sector write, and store this pre-reads data in pre-reading in buffer memory of sector command structure, the pre-reads data making this pre-read buffer memory to comprise this sector-size write in this sector.Such as, when the sector-size of sector A is 512K, then can store the data of 512K in the A of sector, in order to distinguish conveniently, the data of this 512K can be called pre-reads data, and pre-read command is used for the pre-reads data reading this 512K write from the A of sector, and the pre-reads data of this 512K is stored into pre-reads in buffer memory.
In embodiments of the present invention, for a sector, can only safeguard that pre-reads a buffer memory for all write orders that this sector is corresponding, and need not safeguard that separately pre-reads a buffer memory for each write order.Because each buffer memory that pre-reads needs again to apply for memory source, therefore, only safeguard that pre-reads a buffer memory by all write orders corresponding for this sector, can avoid taking more memory source, thus save memory source.
Wherein, when receiving the write order being less than sector-size, can based on the sectors status of sector command structure, determine write order to be stored into and issue chained list and still wait for chained list.If sectors status pre-reads the state of issuing, then represent the current pre-reads data pre-reading whole sector, but also do not complete the storage of pre-reads data, now write order is joined and issue chained list, wait for that pre-read command returns.And when pre-read command returns, represent and completed the storage of pre-reads data, that pre-reads data has been stored into sector command structure pre-reads in buffer memory, performs step 102.If sectors status merges to write hair-like state, then represent current data in sector after write merging, but also do not complete the ablation process of the data after merging, now write order is joined wait chained list, wait write order to be combined to return.And when merging write order and returning, represent the ablation process of the data after having completed merging, perform step 103.
Step 102, when pre-read command returns, is pre-reading the write order merging in the pre-reads data that buffer memory comprises and issue in chained list, and the data after merging is being written to sector.Wherein, issue the write order that merges in chained list and can issue all write orders in chained list or part write order for this.
Wherein, when sectors status be pre-read issue state time, then pre-reading the write order merging in the pre-reads data that buffer memory comprises and issue in chained list, and after the data after merging are written to sector, can also by pre-reading, to issue status modifier be that merging writes hair-like state by this sectors status of sector command structure.
Wherein, by configuring pre-read command, the pre-reads data of whole sector can be pre-read, and when pre-read command returns, then represent the storage having completed pre-reads data, pre-reads data being stored into pre-reading in buffer memory of sector command structure.Afterwards, merge write order by configuration, can the write order merging in the pre-reads data that buffer memory comprises and issue in chained list pre-read, and the data after merging are written to sector.
Step 103, when merging write order and returning, if wait in chained list there is write order, then the write order waited in chained list is joined and issue chained list, and pre-reading the write order merging in the pre-reads data that buffer memory comprises and issue in chained list, and the data after merging are written to sector.If there is not write order in wait chained list, then after the preset lime, sector command structure corresponding to sector is deleted.
Wherein, joining the write order issued in chained list for waiting in chained list, all write orders in chained list or part write order can be treated for these.Issue for this write order merged in chained list, all write orders in chained list or part write order can be issued for this.
Wherein, when sectors status be merge write hair-like state time, then pre-reading the write order merging in the pre-reads data that buffer memory comprises and issue in chained list, and after the data after merging are written to sector, this sectors status of sector command structure can also be kept constant, namely still for merging writes hair-like state.
Wherein, merge write order by configuration, can the write order merging in the pre-reads data that buffer memory comprises and issue in chained list pre-read, the data after merging are written to sector.When merging write order and returning, if wait in chained list there is write order, then still merge write order by configuration, merge the write order issued in chained list pre-reading in the pre-reads data that buffer memory comprises, the data after merging are written to sector.If there is not write order in wait chained list, then after the preset lime, sector command structure corresponding to sector is deleted.
Wherein, during owing to there is not write order in wait chained list, just delete sector command structure after the preset lime, instead of delete sector command structure at once, like this, if receive again write order corresponding to this sector in Preset Time, then no longer delete sector command structure, thus after avoiding sector command structure deleted, there is again write order corresponding to this sector to need process at once, thus create sector command structure corresponding to this sector again, avoid deletion repeatedly and the establishment of sector command structure, save process resource.
Wherein, when there is not write order in wait chained list, by deleting sector command structure from Hash table, thus the storage resources shared by release sector command structure, and the resource of Hash table can be saved.
Based on technique scheme, in the embodiment of the present invention, make sector can support to be less than the write order of sector-size, the multiple write orders being less than sector-size can be written to a sector, and do not need to apply for separately a sector for each write order being less than sector-size, thus can save between sector null.And, multiple write order being less than sector-size can be processed simultaneously, each write order being less than sector-size need not be processed separately, thus the handling property of write order can be improved.And, for a sector, can only safeguard that pre-reads a buffer memory for all write orders being less than sector-size, and need not safeguard that separately pre-reads a buffer memory for each write order being less than sector-size, and each buffer memory that pre-reads needs again to apply for memory source, therefore can avoid taking more memory source, thus can memory source be saved.
Such as, according to technique scheme, when realizing being less than the write of write order (as 32 bytes and 8 bytes) of sector-size, then test data can be as shown in Figure 3 A and Figure 3 B.Wherein, write 4096 sizes be the write order of 32 bytes to the same sector of disk time, then consuming time is 39 milliseconds, write 4096 sizes be the write order of 8 bytes to the same sector of disk time, then consuming time is 38ms.Obviously, technique scheme can save the processing time, and improves the handling property of write order.
In the embodiment of the present invention, for step 102 and step 103, pre-reading in the pre-reads data that buffer memory comprises the process merging the write order issued in chained list, specifically can include but not limited to as under type: according to the write order issued in chained list the first skew and the first size in a sector, use memory copying mode, from the first skew, write order is copied to the pre-reads data pre-reading buffer memory and comprise, and the size of write order in pre-reads data is the first size.Wherein, merge in the process of the write order issued in chained list pre-reading in the pre-reads data that buffer memory comprises, the write order issued in chained list can also be merged into pre-reads in buffer memory, the pre-reads data stored in buffer memory is pre-read to replace, namely according to the write order issued in chained list the first skew and the first size in a sector, memory copying mode is used, from the first skew, write order is copied to and pre-reads buffer memory, and write order is the first size pre-reading the size in buffer memory.On this basis, the data pre-read in buffer memory are exactly merge the pre-reads data after issuing in chained list write order, now, directly the data pre-read in buffer memory (data namely after merging) can be written to corresponding sector.
Such as, being stored into by the pre-reads data of the 512K in the A of sector pre-reads in buffer memory, suppose that first skew of write order 1 in the A of sector is skew 1, sized by first size 1, first skew of write order 2 in the A of sector is skew 2, sized by first size 2, first skew of write order 3 in the A of sector is skew 3, sized by first size 4, first skew of write order 5 in the A of sector is skew 4, sized by first size 4, first skew of write order 13 in the A of sector is for sized by skew 5, the first size 5.Then use memory copying mode, from skew 1, write order 1 is copied to and pre-reads buffer memory, and write order 1 is pre-reading sized by the size in buffer memory 1, replaces the pre-reads data pre-reading this position in buffer memory; Use memory copying mode, from skew 2, write order 2 is copied to and pre-reads buffer memory, and write order 2 is pre-reading sized by the size in buffer memory 2, replaces the pre-reads data pre-reading this position in buffer memory; Use memory copying mode, from skew 3, write order 3 is copied to and pre-reads buffer memory, and write order 3 is pre-reading sized by the size in buffer memory 3, replaces the pre-reads data pre-reading this position in buffer memory; Use memory copying mode, from skew 4, write order 5 is copied to and pre-reads buffer memory, and write order 5 is pre-reading sized by the size in buffer memory 4, replaces the pre-reads data pre-reading this position in buffer memory; Use memory copying mode, from skew 5, write order 13 is copied to and pre-reads buffer memory, and write order 13 is pre-reading sized by the size in buffer memory 5, replaces the pre-reads data pre-reading this position in buffer memory.Afterwards, the data (data after namely merging) of the 512K pre-read in buffer memory are written to corresponding sector A.
Based on technique scheme, pre-read in buffer memory due to the write order issued in chained list is merged into, to replace the pre-reads data pre-reading and stored in buffer memory, and the data pre-read in buffer memory (data after namely merging) are written to sector.Therefore, the data pre-read in buffer memory are identical with the data write in sector, in subsequent processes, no longer need to read pre-reads data in sector, the data pre-read in buffer memory are exactly the pre-reads data in sector, thus avoid the process repeating reading sector, save system overhead.
In the embodiment of the present invention, for step 102 and step 103, pre-reading in the pre-reads data that buffer memory comprises the process merging the write order issued in chained list, specifically can include but not limited to as under type: when issue in chained list comprise multiple write order time, then join the time order and function order issuing chained list according to multiple write order, multiple write order is merged into pre-reads in pre-reads data that buffer memory comprises successively.
Such as, when multiple write order join issue chained list time order and function order be followed successively by write order 1, write order 2, write order 3, write order 5, write order 13 time, first write order 1 is merged in pre-reads data, afterwards that write order is 2-in-1 and in pre-reads data, afterwards write order 3 is merged in pre-reads data, afterwards write order 5 is merged in pre-reads data, afterwards write order 13 is merged in pre-reads data.
Based on technique scheme, when multiple write order is the write order for the same position of sector, write order covering write order above below can be ensured, and avoid write order covering write order below above.Such as, suppose that the first skew in the A of sector of write order 1 and write order 2 is all skews 1, first size is all sizes 1, then user is after sending write order 1, need to cover write order 1 by write order 2, like this, it is write order 1, write order 2 that write order 1 and write order 2 join the time order and function order issuing chained list, therefore, aforesaid way can ensure that write order 2 covers write order 1.
Be described in detail below in conjunction with the control procedure of writing of concrete application scenarios to disk sector, as shown in Figure 4, the writing method of this disk sector specifically can include but not limited to following steps:
Step 1, reception are less than the write order of sector-size.
Step 2, write order is stored into order receiving queue.
Step 3, the address information of the sector to be written of carrying in write order is utilized to determine corresponding sector.
Step 4, judge in Hash table, whether to there is sector command structure corresponding to this sector.
If so, then perform step 5, if not, then perform step 8.
Step 5, judge that whether the sectors status of sector command structure is for pre-reading the state of issuing.If so, then perform step 6, if not (namely sectors status is that merging writes hair-like state), then perform step 7.
Step 6, write order joined issue chained list.
Step 7, write order is joined wait chained list.
Step 8, in Hash table, create sector command structure, record sectors status is for pre-reading the state of issuing.
Step 9, by pre-read command, pre-read the pre-reads data (pre-reads data of the sector-size namely write in sector) of whole sector, this pre-reads data is stored into pre-reading in buffer memory of sector command structure.
Step 10, pre-read command return.
Step 11, by sectors status, by pre-reading, to issue status modifier be that merging writes hair-like state.
Step 12, pre-reading all write orders merging in the pre-reads data that buffer memory comprises and issue in chained list.
Step 13, be written to sector by merging the data after all write orders.
Step 14, merging write order return.
Step 15, result is write in merging return to upper layer application, as write successfully or unsuccessfully etc.
Step 16, judge to wait in chained list whether there is write order.
If not, then step 17 is performed; If so, then step 18 is performed.
Step 17, from Hash table, delete sector command structure.
Step 18, all write orders waited in chained list are joined issue chained list.
Step 19, pre-reading all write orders merging in the pre-reads data that buffer memory comprises and issue in chained list.
Step 20, being written to sector by merging the data after all write orders, returning step 14.
Said process is write control procedure for disk sector, and for the control procedure of reading of disk sector, as shown in Figure 5, the control method of this disk sector specifically can comprise the following steps:
Step 501, receive the read command being less than sector-size, determine sector command structure corresponding to the sector that this read command is corresponding and this sector, this sector command structure comprises sectors status, pre-reads buffer memory, issues chained list and wait for chained list, and this pre-reads the pre-reads data that buffer memory comprises this sector-size write in this sector.If this sectors status pre-reads the state of issuing, then this read command is joined and issue chained list; If this sectors status reads to return treatment state, then this read command is joined wait chained list.
In the embodiment of the present invention, after determining the sector that this read command is corresponding, the sector command structure that this sector is corresponding is there is not if current, then create the sector command structure that this sector is corresponding, and the sectors status recording this sector command structure is for pre-reading the state of issuing, and from this sector, read the pre-reads data of the sector-size write, and store this pre-reads data in pre-reading in buffer memory of this sector command structure.
In the embodiment of the present invention, can carry out management sector imperative structures by Hash table, Hash table is for key assignments with LBA value corresponding to sector.On this basis, determine the process of sector command structure corresponding to the sector that read command is corresponding and this sector, specifically can include but not limited to as under type: the address information obtaining sector to be read from read command, and the sector utilizing this address information determination read command corresponding; By the key assignments of the LBA value inquiry Hash table of this sector, obtain the sector command structure that this LBA value is corresponding.
As shown in Figure 6, after receiving the read command being less than sector-size, read command is stored into order receiving queue, and determines the sector that each read command in order receiving queue is corresponding, the address information of the sector to be read of carrying in read command as utilized determines corresponding sector.A, B, C represent different sectors, based on the address information of the sector in read command, can determine the corresponding sector A of read command 1,2,3,5,13, the corresponding sector B of read command 4,6,7,12, the corresponding sector C of read command 8,9,10,11.
Wherein, management sector imperative structures can be carried out by Hash table, a Hash table is constructed to each disk, Hash table preserves sector command structure corresponding to each sector of disk, this sector command structure is for recording the information of all read commands corresponding to this sector, and this sector command structure can comprise this sector corresponding LBA value, sectors status, pre-reads buffer memory, issues chained list and wait for chained list, this sectors status comprises the state of issuing that pre-reads, reads to return treatment state, and Hash table is for key assignments with LBA value corresponding to sector.
After determining the sector that read command is corresponding, directly can utilize the key assignments of the LBA value inquiry Hash table of this sector, obtain the sector command structure that the LBA value of sector is corresponding.Management sector imperative structures are carried out owing to using Hash table, and using LBA value corresponding for sector as key assignments, and Hash table is a data structure that directly can conduct interviews according to key assignments, record is visited by position key assignments being mapped to Hash table, to accelerate the speed of searching, therefore, can by Hash table fast query to sector command structure.
Wherein, after determining the sector that read command is corresponding, if there is not the sector command structure that this sector is corresponding in Hash table, in Hash table, then create the sector command structure that this sector is corresponding, and in this sector command structure, record LBA value corresponding to this sector, record the sectors status of this sector command structure for pre-reading the state of issuing, and create one pre-read buffer memory, one issue chained list and one and wait for chained list.
Wherein, if there is not sector command structure corresponding to this sector in Hash table, be not then created before representing the sector command structure that this sector is corresponding, or deleted after creation.
Wherein, when sectors status issues state for pre-reading, pre-read command will be performed, this pre-read command is for pre-reading the data of whole sector, namely from sector, read the pre-reads data equaling the sector-size of this sector write, and store this pre-reads data in pre-reading in buffer memory of sector command structure, the pre-reads data making this pre-read buffer memory to comprise this sector-size write in this sector.Such as, when the sector-size of sector A is 512K, then can store the data of 512K in the A of sector, in order to distinguish conveniently, the data of this 512K can be called pre-reads data, and pre-read command is used for the pre-reads data reading this 512K write from the A of sector, and the pre-reads data of this 512K is stored into pre-reads in buffer memory.
In embodiments of the present invention, for a sector, can only safeguard that pre-reads a buffer memory for all read commands that this sector is corresponding, and need not safeguard that separately pre-reads a buffer memory for each read command.Because each buffer memory that pre-reads needs again to apply for memory source, therefore, only safeguard that pre-reads a buffer memory by all read commands corresponding for this sector, can avoid taking more memory source, thus save memory source.
Wherein, when receiving the read command being less than sector-size, can based on the sectors status of sector command structure, determine read command to be stored into and issue chained list and still wait for chained list.If sectors status pre-reads the state of issuing, then represent the current pre-reads data pre-reading whole sector, now read command is joined and issue chained list, wait for that pre-read command returns.And when pre-read command returns, represent and completed the storage of pre-reads data, that pre-reads data has been stored into sector command structure pre-reads in buffer memory, performs step 502.If sectors status reads to return treatment state, then completed the storage of pre-reads data before representing, that pre-reads data has been stored into sector command structure pre-reads in buffer memory, directly execution step 503.
Step 502, when pre-read command returns, sectors status is issued status modifier and returns treatment state by pre-reading for reading, and reads corresponding data according to the read command issued in chained list from pre-reading pre-reads data that buffer memory comprises, and the data of reading are returned to upper layer application.Wherein, issue the read command in chained list, be specifically as follows this and issue all read commands in chained list or part read command.
Wherein, by configuring pre-read command, the pre-reads data of whole sector can be pre-read, and when pre-read command returns, then represent the storage having completed pre-reads data, that pre-reads data has been stored into sector command structure pre-reads in buffer memory, and sectors status is issued status modifier and returns treatment state by pre-reading for reading.
Step 503, under reading to return treatment state, if there is read command in wait chained list, then the read command waited in chained list is joined and issue chained list, read corresponding data according to the read command issued in chained list from pre-reading pre-reads data that buffer memory comprises, and the data of reading are returned to upper layer application.If there is not read command in wait chained list, then after the preset lime, sector command structure corresponding to sector is deleted.
Wherein, joining the read command issued in chained list for waiting in chained list, all read commands in chained list or part read command can be treated for these.Issue the read command in chained list for this, all read commands in chained list or part read command can be issued for this.
Wherein, under reading to return treatment state, from the data pre-read pre-reads data that buffer memory comprises corresponding to the read command that reads and issue in chained list, and the data read can be returned to upper layer application.If there is read command in wait chained list, still returning treatment state for reading due to current, therefore, from the data pre-read pre-reads data that buffer memory comprises corresponding to the read command that reads and issue in chained list, and the data read can be returned to upper layer application.Until wait in chained list there is not read command, then after the preset lime, the sector command structure that sector is corresponding is deleted.
Wherein, during owing to there is not read command in wait chained list, just delete sector command structure after the preset lime, instead of delete sector command structure at once, like this, if receive again read command corresponding to this sector in Preset Time, then no longer delete sector command structure, thus after avoiding sector command structure deleted, there is again read command corresponding to this sector to need process at once, thus create sector command structure corresponding to this sector again, avoid deletion repeatedly and the establishment of sector command structure, save process resource.
Wherein, when there is not read command in wait chained list, by deleting sector command structure from Hash table, thus the storage resources shared by release sector command structure, and the resource of Hash table can be saved.
Based on technique scheme, in the embodiment of the present invention, make sector can support to be less than the read command of sector-size, the multiple read commands being less than sector-size can be written to a sector, and do not need to apply for separately a sector for each read command being less than sector-size, thus can save between sector null.And, multiple read command being less than sector-size can be processed simultaneously, each read command being less than sector-size need not be processed separately, thus the handling property of read command can be improved.And, for a sector, can only safeguard that pre-reads a buffer memory for all read commands being less than sector-size, and need not safeguard that separately pre-reads a buffer memory for each read command being less than sector-size, and each buffer memory that pre-reads needs again to apply for memory source, therefore can avoid taking more memory source, thus can memory source be saved.
In the embodiment of the present invention, for step 502 and step 503, according to the read command issued in chained list from pre-reading the process reading corresponding data pre-reads data that buffer memory comprises, specifically can include but not limited to as under type: according to the read command issued in chained list the second skew and the second size in a sector, from the second skew, corresponding data are read from pre-reading pre-reads data that buffer memory comprises, and the size of the data read is the second size, be the data of the corresponding size of this read command by the data returning to upper layer application.
Such as, being stored into by the pre-reads data of the 512K in the A of sector pre-reads in buffer memory, suppose that second skew of read command 1 in the A of sector is skew 1, sized by second size 1, second skew of read command 2 in the A of sector is skew 2, sized by second size 2, second skew of read command 3 in the A of sector is skew 3, sized by second size 4, second skew of read command 5 in the A of sector is skew 4, sized by second size 4, second skew of read command 13 in the A of sector is for sized by skew 5, the second size 5.Then reading out pre-reads data from pre-reading buffer memory, from skew 1, from pre-reads data, reading the data of size 1, the corresponding read command 1 of these data; Reading out pre-reads data from pre-reading buffer memory, from skew 2, from pre-reads data, reading the data of size 2, the corresponding read command 2 of these data; Reading out pre-reads data from pre-reading buffer memory, from skew 3, from pre-reads data, reading the data of size 3, the corresponding read command 3 of these data; Reading out pre-reads data from pre-reading buffer memory, from skew 4, from pre-reads data, reading the data of size 4, the corresponding read command 5 of these data; Reading out pre-reads data from pre-reading buffer memory, from skew 5, from pre-reads data, reading the data of size 5, the corresponding read command 13 of these data.Afterwards, the five numbers certificates read are returned to upper layer application.
Based on technique scheme, do not need to read pre-reads data in sector, the data pre-read in buffer memory are exactly the pre-reads data in sector, thus avoid the process repeating reading sector, save system overhead.
In the embodiment of the present invention, for step 502 and step 503, according to the read command issued in chained list from pre-reading the process reading corresponding data pre-reads data that buffer memory comprises, specifically can include but not limited to as under type: when issue in chained list comprise multiple read command time, then joining the time order and function order issuing chained list according to multiple read command, reading corresponding data from pre-reading pre-reads data that buffer memory comprises successively.
Such as, when multiple read command join issue chained list time order and function order be followed successively by read command 1, read command 2, read command 3, read command 5, read command 13 time, from pre-reads data, first read the data of read command 1 correspondence, the data of read command 2 correspondence are read afterwards from pre-reads data, the data of read command 3 correspondence are read afterwards from pre-reads data, from pre-reads data, read the data of read command 5 correspondence afterwards, from pre-reads data, read the data of read command 13 correspondence afterwards.
Be described in detail below in conjunction with the control procedure of reading of concrete application scenarios to disk sector, as shown in Figure 7, the reading control method and specifically can include but not limited to following steps of this disk sector:
Step 1, reception are less than the read command of sector-size.
Step 2, order receiving queue is stored in read command.
Step 3, the address information of the sector to be read of carrying in read command is utilized to determine corresponding sector.
Step 4, judge in Hash table, whether to there is sector command structure corresponding to this sector.
If so, then perform step 5, if not, then perform step 8.
Step 5, judge that whether the sectors status of sector command structure is for pre-reading the state of issuing.If so, then perform step 6, if not (namely sectors status is for reading to return treatment state), then perform step 7.
Step 6, read command joined issue chained list.
Step 7, read command is joined wait chained list.
Step 8, in Hash table, create sector command structure, record sectors status is for pre-reading the state of issuing.
Step 9, by pre-read command, pre-read the pre-reads data (pre-reads data of the sector-size namely write in sector) of whole sector, this pre-reads data is stored into pre-reading in buffer memory of sector command structure.
Step 10, pre-read command return.
Step 11, sectors status is issued status modifier and returns treatment state by pre-reading for reading.
Step 12, read corresponding data according to issuing read command in chained list from pre-reading pre-reads data that buffer memory comprises, and the data of reading are returned to upper layer application.
Step 13, judge to wait in chained list whether there is read command.
If not, then step 14 is performed; If so, then step 15 is performed.
Step 14, from Hash table, delete sector command structure.
Step 15, all read commands waited in chained list are joined issue chained list, return step 12.
Based on the inventive concept same with said method, a kind of control device of disk sector is additionally provided in the embodiment of the present invention, the control device of this disk sector can be applied in memory device, the control device of this disk sector can pass through software simulating, also can be realized by the mode of hardware or software and hardware combining.For software simulating, as the device on a logical meaning, be the processor of the memory device by its place, computer program instructions corresponding in nonvolatile memory read in internal memory to run and formed.Say from hardware view, as shown in Figure 8, for a kind of hardware structure diagram of the memory device at the control device place of the disk sector of the present invention's proposition, except the processor shown in Fig. 8, network interface, internal memory and nonvolatile memory, memory device can also comprise other hardware, as the forwarding chip etc. of responsible process message; From hardware configuration, this memory device may be also distributed apparatus, may comprise multiple interface card, to carry out the expansion of Message processing at hardware view.
As shown in Figure 9, be the structural drawing of the control device of the disk sector of the present invention's proposition, the control device of this disk sector can be applied in memory device, and the control device of described disk sector specifically comprises:
Determination module 11, for receiving the write order being less than sector-size, and determine sector command structure corresponding to the sector that described write order is corresponding and described sector, wherein, described sector command structure specifically comprises sectors status, pre-read buffer memory, issue chained list and wait for chained list, and described in pre-read the pre-reads data that buffer memory comprises in described sector the described sector-size write; If described sectors status pre-reads the state of issuing, then issue chained list described in being joined by described write order; If described sectors status merges to write hair-like state, then described write order is joined described wait chained list;
Writing module 12, for when pre-read command returns, described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and the data after merging are written to described sector;
When merging write order and returning, if there is write order in described wait chained list, then the write order in described wait chained list is joined and issue chained list, and described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and the data after merging are written to described sector.
Manage described sector command structure by Hash table, and described Hash table with logical block addresses LBA value corresponding to sector for key assignments;
Described determination module 11, specifically in the process determining sector command structure corresponding to the sector that described write order is corresponding and described sector, from write order, obtain the address information of sector to be written, and utilize described address information to determine the sector that described write order is corresponding; Inquired about the key assignments of described Hash table by the LBA value of the described sector determined, obtain the sector command structure that the LBA value of described sector is corresponding; Described determination module 11, also for after determining the sector that write order is corresponding, if there is no the sector command structure that described sector is corresponding, create the sector command structure that described sector is corresponding, record the sectors status of described sector command structure for pre-reading the state of issuing, and from described sector, read the pre-reads data of the described sector-size write, store described pre-reads data pre-reading in buffer memory of described sector command structure;
Said write module 12, also for when described sectors status be pre-read issue state time, described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and after the data after merging are written to described sector, then by the sectors status of described sector command structure, by pre-reading, to issue status modifier be that merging writes hair-like state; When described merging write order returns, if there is not write order in described wait chained list, then after the preset lime, delete the sector command structure that described sector is corresponding.
In the embodiment of the present invention, said write module 12, specifically for described pre-read in the pre-reads data that buffer memory comprises merge described in issue in the process of the write order in chained list, when described issue in chained list comprise multiple write order time, issue the time order and function order of chained list described in joining according to described multiple write order, successively described multiple write order is merged in described pre-reads data.Said write module 12, specifically for described pre-read in the pre-reads data that buffer memory comprises merge described in issue in the process of the write order in chained list, according to described write order the first skew and the first size within the sector issued in chained list, use memory copying mode, from described first skew, pre-read the pre-reads data that buffer memory comprises described in being copied to by described write order, and the size of described write order in described pre-reads data is described first size.
Described determination module 11, also for receiving the read command being less than sector-size, determine sector command structure corresponding to the sector that described read command is corresponding and described sector, described sector command structure comprises sectors status, pre-reads buffer memory, issues chained list and wait for chained list, pre-reads the pre-reads data that buffer memory comprises in described sector the described sector-size write; If described sectors status pre-reads the state of issuing, then described read command is joined and issue chained list; If described sectors status reads to return treatment state, then described read command is joined wait chained list; After determining the sector that described read command is corresponding, if there is no the sector command structure that described sector is corresponding, then create the sector command structure that described sector is corresponding, record the sectors status of described sector command structure for pre-reading the state of issuing, from described sector, read the pre-reads data of the described sector-size write, and store described pre-reads data in pre-reading in buffer memory of described sector command structure;
Described device also comprises: read module 13, for when pre-read command returns, sectors status is issued status modifier and returns treatment state by pre-reading for reading, read corresponding data according to the read command issued in chained list from described pre-reading the pre-reads data that buffer memory comprises, and the data of reading are returned to upper layer application; Under reading to return treatment state, if there is read command in wait chained list, then the read command in described wait chained list is joined and issue chained list, read corresponding data according to the read command issued in chained list from described pre-reading the pre-reads data that buffer memory comprises, and the data of reading are returned to upper layer application.
Wherein, the modules of apparatus of the present invention can be integrated in one, and also can be separated deployment.Above-mentioned module can merge into a module, also can split into multiple submodule further.
Through the above description of the embodiments, those skilled in the art can be well understood to the mode that the present invention can add required general hardware platform by software and realize, and can certainly pass through hardware, but in a lot of situation, the former is better embodiment.Based on such understanding, technical scheme of the present invention can embody with the form of software product the part that prior art contributes in essence in other words, this computer software product is stored in a storage medium, comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) perform method described in each embodiment of the present invention.It will be appreciated by those skilled in the art that accompanying drawing is the schematic diagram of a preferred embodiment, the module in accompanying drawing or flow process might not be that enforcement the present invention is necessary.
It will be appreciated by those skilled in the art that the module in the device in embodiment can carry out being distributed in the device of embodiment according to embodiment description, also can carry out respective change and be arranged in the one or more devices being different from the present embodiment.The module of above-described embodiment can merge into a module, also can split into multiple submodule further.The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
Be only several specific embodiment of the present invention above, but the present invention is not limited thereto, the changes that any person skilled in the art can think of all should fall into protection scope of the present invention.

Claims (10)

1. a control method for disk sector, is characterized in that, said method comprising the steps of:
Receive the write order being less than sector-size, determine sector command structure corresponding to the sector that described write order is corresponding and described sector, described sector command structure comprises sectors status, pre-read buffer memory, issue chained list and wait for chained list, described in pre-read the pre-reads data that buffer memory comprises in described sector the described sector-size write; If described sectors status pre-reads the state of issuing, then described write order is joined and issue chained list; If described sectors status merges to write hair-like state, then described write order is joined wait chained list;
When pre-read command returns, described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and the data after merging are written to described sector;
When merging write order and returning, if there is write order in described wait chained list, then the write order in described wait chained list is joined and issue chained list, and described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and the data after merging are written to described sector.
2. method according to claim 1, is characterized in that, manages described sector command structure by Hash table, and described Hash table with logical block addresses LBA value corresponding to sector for key assignments;
The described process determining sector command structure corresponding to the sector that described write order is corresponding and described sector, specifically comprises: the address information obtaining sector to be written from described write order, and utilizes described address information to determine the sector that described write order is corresponding; And, inquired about the key assignments of described Hash table by the LBA value of the described sector determined, obtain the sector command structure that the LBA value of described sector is corresponding;
Described method also comprises: after determining the sector that described write order is corresponding, if there is no the sector command structure that described sector is corresponding, create the sector command structure that described sector is corresponding, record the sectors status of described sector command structure for pre-reading the state of issuing, and from described sector, read the pre-reads data of the described sector-size write, store described pre-reads data pre-reading in buffer memory of described sector command structure;
When described sectors status be pre-read issue state time, described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and after the data after merging are written to described sector, by the sectors status of described sector command structure, by pre-reading, to issue status modifier be that merging writes hair-like state;
When described merging write order returns, described method comprises further: if there is not write order in described wait chained list, then after the preset lime, delete the sector command structure that described sector is corresponding.
3. method according to claim 1, is characterized in that, described described pre-read in the pre-reads data that buffer memory comprises merge described in issue the process of the write order in chained list, specifically comprise:
When described issue in chained list comprise multiple write order time, issue described in joining according to described multiple write order chained list time order and function order, successively described multiple write order is merged in described pre-reads data.
4. the method according to claim 1 or 3, is characterized in that, described described pre-read in the pre-reads data that buffer memory comprises merge described in issue the process of the write order in chained list, specifically comprise:
According to described write order the first skew and the first size within the sector issued in chained list, use memory copying mode, from described first skew, pre-read the pre-reads data that buffer memory comprises described in being copied to by described write order, and the size of described write order in described pre-reads data is described first size.
5. method according to claim 1, is characterized in that, described method comprises further:
Receive the read command being less than sector-size, determine sector command structure corresponding to the sector that described read command is corresponding and described sector, described sector command structure comprises sectors status, pre-read buffer memory, issue chained list and wait for chained list, described in pre-read the pre-reads data that buffer memory comprises in described sector the described sector-size write; If described sectors status pre-reads the state of issuing, then described read command is joined and issue chained list; If described sectors status reads to return treatment state, then described read command is joined wait chained list; Wherein, after determining the sector that described read command is corresponding, if there is no the sector command structure that described sector is corresponding, then create the sector command structure that described sector is corresponding, record the sectors status of described sector command structure for pre-reading the state of issuing, and from described sector, read the pre-reads data of the described sector-size write, and store described pre-reads data in pre-reading in buffer memory of described sector command structure;
When pre-read command returns, sectors status is issued status modifier and returns treatment state by pre-reading for reading, read corresponding data according to the read command issued in chained list from described pre-reading the pre-reads data that buffer memory comprises, and the data of reading are returned to upper layer application; Under reading to return treatment state, if there is read command in wait chained list, then the read command in described wait chained list is joined and issue chained list, read corresponding data according to the read command issued in chained list from described pre-reading the pre-reads data that buffer memory comprises, and the data of reading are returned to upper layer application.
6. a control device for disk sector, is characterized in that, described device specifically comprises:
Determination module, for receiving the write order being less than sector-size, and determine sector command structure corresponding to the sector that described write order is corresponding and described sector, wherein, described sector command structure specifically comprises sectors status, pre-read buffer memory, issue chained list and wait for chained list, and described in pre-read the pre-reads data that buffer memory comprises in described sector the described sector-size write; If described sectors status pre-reads the state of issuing, then issue chained list described in being joined by described write order; If described sectors status merges to write hair-like state, then described write order is joined described wait chained list;
Writing module, for when pre-read command returns, described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and the data after merging are written to described sector;
When merging write order and returning, if there is write order in described wait chained list, then the write order in described wait chained list is joined and issue chained list, and described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and the data after merging are written to described sector.
7. device according to claim 6, is characterized in that, manages described sector command structure by Hash table, and described Hash table with logical block addresses LBA value corresponding to sector for key assignments;
Described determination module, specifically in the process determining sector command structure corresponding to the sector that described write order is corresponding and described sector, from write order, obtain the address information of sector to be written, and utilize described address information to determine the sector that described write order is corresponding; Inquired about the key assignments of described Hash table by the LBA value of the described sector determined, obtain the sector command structure that the LBA value of described sector is corresponding;
Described determination module, also for after determining the sector that write order is corresponding, if there is no the sector command structure that described sector is corresponding, create the sector command structure that described sector is corresponding, record the sectors status of described sector command structure for pre-reading the state of issuing, and from described sector, read the pre-reads data of the described sector-size write, store described pre-reads data pre-reading in buffer memory of described sector command structure;
Said write module, also for when described sectors status be pre-read issue state time, described pre-read in the pre-reads data that buffer memory comprises merge described in issue write order in chained list, and after the data after merging are written to described sector, then by the sectors status of described sector command structure, by pre-reading, to issue status modifier be that merging writes hair-like state; When described merging write order returns, if there is not write order in described wait chained list, then after the preset lime, delete the sector command structure that described sector is corresponding.
8. device according to claim 6, it is characterized in that, said write module, specifically for described pre-read in the pre-reads data that buffer memory comprises merge described in issue in the process of the write order in chained list, when described issue in chained list comprise multiple write order time, issue the time order and function order of chained list described in joining according to described multiple write order, successively described multiple write order is merged in described pre-reads data.
9. the device according to claim 6 or 8, it is characterized in that, said write module, specifically for described pre-read in the pre-reads data that buffer memory comprises merge described in issue in the process of the write order in chained list, according to described write order the first skew and the first size within the sector issued in chained list, use memory copying mode, from described first skew, pre-read the pre-reads data that buffer memory comprises described in being copied to by described write order, and the size of described write order in described pre-reads data is described first size.
10. device according to claim 6, is characterized in that,
Described determination module, also for receiving the read command being less than sector-size, determine sector command structure corresponding to the sector that described read command is corresponding and described sector, described sector command structure comprises sectors status, pre-read buffer memory, issue chained list and wait for chained list, described in pre-read the pre-reads data that buffer memory comprises in described sector the described sector-size write; If described sectors status pre-reads the state of issuing, then described read command is joined and issue chained list; If described sectors status reads to return treatment state, then described read command is joined wait chained list; After determining the sector that described read command is corresponding, if there is no the sector command structure that described sector is corresponding, then create the sector command structure that described sector is corresponding, record the sectors status of described sector command structure for pre-reading the state of issuing, from described sector, read the pre-reads data of the described sector-size write, and store described pre-reads data in pre-reading in buffer memory of described sector command structure;
Described device also comprises: read module, for when pre-read command returns, sectors status is issued status modifier and returns treatment state by pre-reading for reading, read corresponding data according to the read command issued in chained list from described pre-reading the pre-reads data that buffer memory comprises, and the data of reading are returned to upper layer application; Under reading to return treatment state, if there is read command in wait chained list, then the read command in described wait chained list is joined and issue chained list, read corresponding data according to the read command issued in chained list from described pre-reading the pre-reads data that buffer memory comprises, and the data of reading are returned to upper layer application.
CN201510893255.XA 2015-11-27 2015-11-27 A kind of control method and device of disk sector Active CN105302501B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510893255.XA CN105302501B (en) 2015-11-27 2015-11-27 A kind of control method and device of disk sector

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510893255.XA CN105302501B (en) 2015-11-27 2015-11-27 A kind of control method and device of disk sector

Publications (2)

Publication Number Publication Date
CN105302501A true CN105302501A (en) 2016-02-03
CN105302501B CN105302501B (en) 2018-09-14

Family

ID=55199814

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510893255.XA Active CN105302501B (en) 2015-11-27 2015-11-27 A kind of control method and device of disk sector

Country Status (1)

Country Link
CN (1) CN105302501B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105912267A (en) * 2016-04-05 2016-08-31 深圳市四季宏胜科技有限公司 Processing method and device for file allocation tables
CN106980469A (en) * 2017-03-07 2017-07-25 记忆科技(深圳)有限公司 A kind of method for improving solid state hard disc sequential write buffer efficiency
CN107797760A (en) * 2016-09-05 2018-03-13 北京忆恒创源科技有限公司 Method, apparatus and driver based on the processing of cache optimization write order
CN114253483A (en) * 2021-12-24 2022-03-29 深圳忆联信息系统有限公司 Write cache management method and device based on command, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050141312A1 (en) * 2003-12-30 2005-06-30 Sinclair Alan W. Non-volatile memory and method with non-sequential update block management
CN102087586A (en) * 2009-12-02 2011-06-08 成都市华为赛门铁克科技有限公司 Data processing method and device
CN104503710A (en) * 2015-01-23 2015-04-08 福州瑞芯微电子有限公司 Method and device for increasing writing speed of nand flash

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050141312A1 (en) * 2003-12-30 2005-06-30 Sinclair Alan W. Non-volatile memory and method with non-sequential update block management
CN102087586A (en) * 2009-12-02 2011-06-08 成都市华为赛门铁克科技有限公司 Data processing method and device
CN104503710A (en) * 2015-01-23 2015-04-08 福州瑞芯微电子有限公司 Method and device for increasing writing speed of nand flash

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105912267A (en) * 2016-04-05 2016-08-31 深圳市四季宏胜科技有限公司 Processing method and device for file allocation tables
CN105912267B (en) * 2016-04-05 2019-01-18 深圳市四季宏胜科技有限公司 A kind of file allocation table treating method and apparatus
CN107797760A (en) * 2016-09-05 2018-03-13 北京忆恒创源科技有限公司 Method, apparatus and driver based on the processing of cache optimization write order
CN106980469A (en) * 2017-03-07 2017-07-25 记忆科技(深圳)有限公司 A kind of method for improving solid state hard disc sequential write buffer efficiency
CN114253483A (en) * 2021-12-24 2022-03-29 深圳忆联信息系统有限公司 Write cache management method and device based on command, computer equipment and storage medium
CN114253483B (en) * 2021-12-24 2023-07-04 深圳忆联信息系统有限公司 Command-based write cache management method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN105302501B (en) 2018-09-14

Similar Documents

Publication Publication Date Title
CN104636266B (en) Cover tile magnetic recording hard disk, cover tile magnetic recording hard disk write method and the device of data
CN106569738B (en) A kind of method and device for deleting cascade snapshot
US9075528B2 (en) High-efficiency virtual disk management system
CN105302501A (en) Control method and device for disk sectors
CN102611745A (en) On-line file moving method, device and system
US11099768B2 (en) Transitioning from an original device to a new device within a data storage array
US20170160940A1 (en) Data processing method and apparatus of solid state disk
CN113377579B (en) Solid state disk data recovery method and system based on mapping table
CN107329704A (en) One kind caching mirror method and controller
CN105740413A (en) File movement method by FUSE on Linux platform
US20130262799A1 (en) Control method and storage device
CN112783449A (en) Data migration method and device
CN107798063B (en) Snapshot processing method and snapshot processing device
US9733851B2 (en) Shifting a defrag operation in a mirrored system
JP4461089B2 (en) Storage control apparatus and storage control method
CN106383667A (en) Method and apparatus for LUN migration in business operation
US20130205071A1 (en) Compressed cache storage acceleration
WO2021226822A1 (en) Log write method and apparatus, electronic device, and storage medium
JP2016515258A (en) File aggregation for optimized file operation
CN111143258A (en) Method, system, device and medium for accessing FPGA (field programmable Gate array) by system based on Opencl
US9286302B2 (en) Inode reuse systems and methods
US11513951B2 (en) System and method for improving write performance for log structured storage systems
CN110286995B (en) Data reading and writing method and device
US8276041B2 (en) Data integrity validation using hierarchical volume management
CN106227473A (en) A kind of using internal memory as the implementation method of disk read-write and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant