Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
Below, be described with reference to the accompanying drawings the expansion method of embodiment of the invention disk array and the realization of system.
Fig. 1 is the expansion method schematic flow sheet of embodiment of the invention disk array, as shown in Figure 1, comprising:
Step 101: when detecting newly-increased physical disk, obtain newly-increased the second corresponding relation before, corresponding relation between the disc unit (DU, Disk Unit) that described the second corresponding relation comprises physical disk and the logical block of logic magnetic disc (LD, logic Disk).
Wherein, generally after the corresponding logic magnetic disc quantity of disk array was determined, then the physical disk quantity in the disk array can change, and logic magnetic disc quantity generally cannot at will change.
Step 102: above-mentioned newly-increased physical disk is divided into disc unit.
Wherein, the execution sequence between step 101 and the step 102 does not limit.
Step 103: upgrade newly-increased physical disk first corresponding relation corresponding with logical block afterwards.
Step 104: judge whether the corresponding physical disk of non-NULL disc unit in described the second corresponding relation is the same physical disk with physical disk in corresponding described the first corresponding relation, if different, then execution in step 105.
Step 105: the data of disc unit are moved in the physical disk of correspondence according to the first corresponding relation.
Step 106: upgrade described the second corresponding relation.
By above renewal, preserve operation and can make things convenient for system when the disk dilatation of carrying out next time, get access to efficiently described the second corresponding relation, thereby realize quick and easy dynamic capacity-expanding.And described the second corresponding relation can also be used for supporting normal reading and writing data.
The embodiment of the invention shown in Figure 1 is divided into discrete disc unit with disk, and sets up logic magnetic disc, obtains the second corresponding relation between the disc unit of the logical block of logic magnetic disc and physical disk; When carrying out the dilatation of physical disk, by setting up the first corresponding relation of logical block and physical disk in the logic magnetic disc, and the Compare Logic unit whether the physical disk in corresponding the first corresponding relation and the second corresponding relation identical carries out moving of data, realized dynamically online dilatation; And carry out need not data are backed up in the data-moving, greatly improved the efficient of disk dilatation.
Below, provide a kind of concrete methods of realizing of the embodiment of the invention shown in Figure 1, in this implementation method, record described the first corresponding relation by layout table; Record described the second corresponding relation by mapping table; As shown in Figure 2, comprise the steps:
Step 201: when detecting newly-increased physical disk, keep the disk sign of original physical disk constant, and for newly-increased physical disk distributes the disk sign, and determine the corresponding relation between newly-increased physical disk and the groove position.
Wherein the disk of each physical disk sign is used for physical disk is distinguished, and therefore, the disk of each physical disk sign is unique.For example, can use integer to be followed successively by each physical disk and distribute disk sign etc.In addition, can also not identify as disk for physical disk distributes other the direct slot number that disk is corresponding of sign, do not limit here.
Here, the corresponding relation between definite newly-increased physical disk and the groove position only is used for the management to physical disk, is optional step.
Step 202: will increase physical disk newly and divide according to the capacity of disc unit respectively, and obtain disc unit.
Wherein, each physical disk is divided the disc unit that obtains and is formed a disc unit Buffer Pool.
The disk space of each newly-increased physical disk is divided into discrete disc unit, form the disc unit Buffer Pool, and, distribute corresponding DU sign can for each disc unit, described DU sign is comprised of two parts: the deviation number of this disc unit in disk sign and the disk.Shown in Fig. 3 a, suppose to exist disk 0~disk x, x is the integer more than or equal to 1, size (size) according to given disc unit is carried out five equilibrium with each disk, and be that each disc unit distribution DU identifies, described sign comprises the affiliated physical disk of DU and the side-play amount of DU on this disk, represents No. 0 DU of disk 3 such as the DU 3:0 among Fig. 3 a.In addition, the size of described DU must be the integral multiple of the maximum configurable segment depth of disk, but concrete numerical value does not limit, and generally can be the multiple of 1MB.
Step 203: determine the logical block of logic magnetic disc and the first corresponding relation between the physical disk according to logic magnetic disc quantity and current physical disk quantity, generate layout table.
Wherein, the principle that generates layout table is that the physical disk sign is evenly distributed in the described layout table, also namely the physical disk sign is assigned to uniformly the logical block of each logic magnetic disc.
Wherein, it is relevant with the rank of disk array specifically how to generate layout table.
For example, when the rank of disk array was RAID10, needing logic magnetic disc quantity was even number, and the corresponding physical disk of logic magnetic disc also is even number.Suppose that logic magnetic disc quantity is 4, sign is respectively: LD1, LD2, LD3 and LD4, physical disk quantity is 7, is respectively P0, P1...P6, when then generating layout table, can only use 6 disks in the physical disk corresponding with described logic magnetic disc, and can not use 7.Suppose, use P0~P5 logical block generation layout table of totally 6 physical disks and logic magnetic disc, concrete grammar can for:
According to the second pre-defined rule, generate logical block formation corresponding to each logic magnetic disc, with the row of each logical block formation as layout table;
Order according to the physical disk sign is identified at physical disk circularly successively and is assigned to line by line each logical block in the layout table.
Described the second pre-defined rule is the rule of the logical block ordering in the logic magnetic disc, does not limit here.
Shown in Fig. 3 b, directly physical disk is assigned to the logical block of each logic magnetic disc line by line successively by the order of P0~P5 here, thus equal corresponding the physical disk sign of the logical block of each logic magnetic disc.Here, for so that the corresponding relation between logical block and the physical disk is more directly perceived, only with the numerical portion of physical disk sign shown in the form, as can be seen from the table, being identified in the layout table of physical disk is evenly distributed.
Perhaps, when the rank of disk array was RAID0 or RAID5, the quantity of logic magnetic disc quantity and physical disk can be without limits.Suppose that logic magnetic disc quantity is 4, sign is respectively: LD1, LD2, LD3 and LD4, physical disk quantity is 7, is respectively P0, P1...P6, then generate layout table method can for:
According to the second pre-defined rule, generate logical block formation corresponding to each logic magnetic disc, with the row of each logical block formation as layout table;
The physical disk sign is distributed to logical block according to predefined procedure.
Concrete, can for: with per two row logical blocks in the layout table as one group, order according to the physical disk sign, circularly the physical disk sign is assigned to each logical block of every group line by line successively, and the appointed physical disk sign of first logical block of every group increases successively according to the order that physical disk identifies.
Shown in Fig. 3 c, physical disk is assigned to the logical block of each logic magnetic disc line by line by the order of P0~P6 here, and one group of per two behavior, every group of appointed physical disk sign of first logical block increases successively according to the order of physical disk sign.As can be seen from the table, being identified in the layout table of physical disk is evenly distributed, and physical disk sign P0~P6 all appears in the layout table.
Here, the corresponding relation determining method between logical block and the physical disk can but be not defined as the method shown in Fig. 3 b and Fig. 3 c.
Step 204: the mapping table that obtains the second corresponding relation between the disc unit of the logical block that records logic magnetic disc before the newly-increased physical disk and physical disk.
Wherein, described the second corresponding relation can use the mapping table shown in Fig. 3 d to carry out record.In Fig. 3 d for the corresponding relation between the disc unit that shows more intuitively logical block and physical disk, every row sign logic magnetic disc of described mapping table, the logical block of each form counterlogic disk in every row, in addition, only be the identification number of disc unit in the form, such as Fig. 3 d, the 0th the corresponding disc unit identification number of logical block of logic magnetic disc is " 0:0 ", be expressed as the 0th disc unit of No. 0 physical disk, oxffffffff presentation logic unit is empty.Concrete, described disc unit sign can realize in a different manner, does not limit here.
Step 205: according to described the first corresponding relation and the second corresponding relation, judge successively whether the corresponding physical disk of each non-NULL logical block is the same disk in each logic magnetic disc, if different, execution in step 206; If identical, return the logical block of next non-NULL in the decision logic disk.
In this step, the logical block of described non-NULL generally refers to the logical block of non-NULL in the second corresponding relation.When described the first corresponding relation and the second corresponding relation are realized in the mode of layout table and mapping table respectively, only need from layout table and mapping table, to extract respectively physical disk sign corresponding to each logical block and compare and get final product.
Step 206: physical disk corresponding to this non-NULL logical block is the new disc unit that distributes a sky of this logical block in the first corresponding relation.
Step 207: in the second corresponding relation in disc unit corresponding to this logical block data be set to the non-state of writing, and with described data-moving in newly assigned disc unit, reclaim disc unit corresponding to this logical block in described the second corresponding relation, the data in disc unit corresponding to this logical block are set to write state.
Here, can write, can not write state for data setting corresponding to each logical block, and when data corresponding to logical block were moved, at first these data be set to write state, thereby prevent that the user from revising the data in moving.
And, in the process of data-moving, only have the data in the disc unit to revise, and the data in other disc units all can normally be used at every turn, thereby greatly reduced in the prior art because the user that a large amount of backups of data cause waits for the access time.
Step 208: the mapping table that upgrades and preserve the second corresponding relation between the disc unit of the logical block of described record logic magnetic disc and physical disk according to described allocation result.
Upgrade described mapping table.Wherein, when each non-NULL logical block in the mapping table all carried out the judgement of step 204 and finished upgrade after, the second corresponding relation between the logical block that is logic magnetic disc behind the newly-increased physical disk that records in the mapping table that obtains and the disc unit of physical disk.With this second corresponding relation, also be that mapping table is stored, prepare against when increasing physical disk newly next time and use.
General, the corresponding logic magnetic disc quantity of physical disk array is in case after determining, can't at will change.
Step 209: obtain in the second corresponding relation and to be empty logical block, and the described logical block in corresponding the first corresponding relation is set to sky, and do not distribute the disc unit of correspondence for this logical block; Current treatment scheme finishes.
Also namely: distribution technique when writing being adopted in the management of logical block and physical disk unit, only have and need to carry out data and write fashionablely, just can be that corresponding logical block is distributed the physics disc unit.When logical block is sky, be not that this logical block is distributed disc unit.
Step 209 can be carried out any time after step 204, does not limit the execution sequence of itself and step 205~step 208 here.
Set up logic magnetic disc above for physical disk, under the thought by the data in the logical disk management physical disk, the embodiment of the invention also provides a kind of date storage method, as shown in Figure 4, comprising:
Step 401: the capacity according to disc unit is divided into disc unit (DU, Disk Unit) with each physical disk; Set up a predetermined number logic magnetic disc (LD, logic Disk), each logic magnetic disc is divided into logical block according to the capacity of disc unit; The total volume of a described predetermined number logic magnetic disc equates with the total volume of described physical disk.
Wherein, the concrete quantity of logic magnetic disc can independently arrange, and such as being 4,5,6 etc., does not limit here.
The division refer step 202 of disc unit and Fig. 3 a repeat no more here.
Step 402: set up the logical block of logic magnetic disc and the first corresponding relation between the physical disk.
Wherein, can realize by the form that generates layout table the foundation of described the first corresponding relation.Concrete generation method refer step 203 and Fig. 3 b and the 3c of layout table do not give unnecessary details here.
Step 403: writing fashionablely when carrying out data, determine logical block that data to be written are required and the quantity M of disc unit according to the capacity of disc unit, is data allocations M to be written empty logical block.
Wherein, can be the logical block of data allocations sky to be written at random, perhaps, according to putting in order of logical block sign, from forward logical block, select M empty logical block to distribute to described data to be written.
Step 404: according to described the first corresponding relation, search the corresponding physical disk of each logical block in described M the empty logical block.
Step 405: the physical disk in described correspondence distributes disc unit for this logical block, and described data to be written are write in the disc unit of described distribution.
Wherein, after step 405, further can comprise:
Step 406: set up and preserve logical block and be the second corresponding relation between the disc unit of this logical block distribution.
Figure 1 shows that the method flow synoptic diagram when initially carrying out the data storage, at this moment, also do not set up the second corresponding relation between logical block and the disc unit.And after having set up described the second corresponding relation, follow-uply carry out writing or during the operation such as deletion, directly upgrading the second corresponding relation and get final product of data.General, will arrange described corresponding relation according to the sign of each logical block in logic magnetic disc sign and each logic magnetic disc in the second corresponding relation.Shown in Fig. 3 d, can use mapping table to carry out the record of the first corresponding relation.Concrete mapping table generating method refer step 204 is not given unnecessary details here.
In addition, when having set up the second corresponding relation, can also determine empty logical block (step 403) according to this second corresponding relation.At this moment, step 403 can be changed into:
Step 403 ': search M forward empty logical block of position in described the second corresponding relation (such as mapping table), this M empty logical block distributed to data to be written.
Step 406 is changed into: upgrade described the second corresponding relation (mapping table).
In addition, when the deletion of carrying out data and rewriting etc., directly find corresponding logical block, and obtain disc unit according to the second corresponding relation, carry out the deletion of data in the disc unit or rewrite getting final product, do not give unnecessary details here.
In the date storage method of the embodiment of the invention, logic magnetic disc and physical disk are divided respectively logical block or disc unit, and finish the data processing according to the first corresponding relation between logical block and the physical disk and the second corresponding relation between logical block and the disc unit, thereby realized processing such as data storages.
Fig. 5 is the capacity-enlarging system of a kind of disk array of the embodiment of the invention, and as shown in Figure 5, this system comprises: acquiring unit 510, division unit 520, the first updating block 530, judging unit 540, move unit 550 and the second updating block 560; Wherein,
Acquiring unit 510 for detection of to newly-increased physical disk the time, obtains the second corresponding relation before the newly-increased physical disk, and described the second corresponding relation comprises the corresponding relation between disc unit and the logical block;
Division unit 520 is used for newly-increased physical disk is divided into disc unit;
The first updating block 530 is used for upgrading newly-increased physical disk first corresponding relation corresponding with logical block afterwards; Concrete,
The first updating block 530 can be used for, and the physical disk after the newly-increased physical disk is corresponding with logic magnetic disc, sets up to comprise newly-increased physical disk physical disk first corresponding relation corresponding with logical block afterwards;
Judging unit 540 is used for judging whether the corresponding physical disk of non-NULL disc unit of described the second corresponding relation and the physical disk in described the first corresponding relation are the same physical disk;
Move unit 550, be used for the judged result of judging unit 540 for not simultaneously, move the data of disc unit in the physical disk of correspondence according to the first corresponding relation;
The second updating block 560 is used for upgrading described the second corresponding relation.
By the second updating block 560, upgrading, to preserve described the second corresponding relation, thus can be so that the acquiring unit in the system when disk dilatation next time, get access to described the second corresponding relation efficiently, thus quick and easy realization dynamic capacity-expanding;
The described unit 540 of moving specifically can be used for: the judged result of judging unit 530 is not for not simultaneously, the disc unit that shifts out data is set to the non-state of writing, with described data-moving in newly assigned disc unit, reclaim the described disc unit that shifts out data, and described newly assigned disc unit is set to write state.
In the capacity-enlarging system of disk array shown in Figure 5, disk is divided into discrete disc unit, and sets up logic magnetic disc, set up the second corresponding relation between the logical block by logic magnetic disc and the disc unit of physical disk; When carrying out the dilatation of physical disk, the first corresponding relation by logical block and physical disk in the first updating block 530 renewal logic magnetic discs, judging unit 540 Compare Logic unit the physical disk in corresponding the first corresponding relation and the second corresponding relation whether identical after, carry out moving of data by moving unit 550, realized dynamically online dilatation; And carry out need not data are backed up in the data-moving, greatly improved the efficient of disk dilatation.
As shown in Figure 6, described the first updating block 530 can comprise:
Sign is distributed subelement 5301, and the disk sign that is used for maintenance original physical disk is constant, and identifies for newly-increased physical disk distributes disk;
Determine subelement 5302, be used to the logical block in the logic magnetic disc to determine corresponding physical disk sign.
Concrete, described definite subelement 5302 can be used for: generate logical block formation corresponding to each logic magnetic disc, with the row of each logical block formation as layout table; According to the order of physical disk sign, physical disk is identified at is assigned to line by line each logical block in the layout table.
Perhaps, described definite subelement 5302 can be used for: generate logical block formation corresponding to each logic magnetic disc, with the row of each logical block formation as layout table; The physical disk sign is distributed to logical block according to predefined procedure.Concrete, can for: with per two row logical blocks in the layout table as one group, order according to the physical disk sign is assigned to each logical block of every group line by line with the physical disk sign, and the appointed physical disk sign of first logical block of every group increases successively according to the order that physical disk identifies.
As shown in Figure 6, the described unit 550 of moving can comprise:
Process subelement 5501, be used for judged result when described judging unit for not simultaneously, the disc unit that shifts out data is set to the non-state of writing, with described data-moving in newly assigned disc unit;
Reclaim subelement 5502, be used for reclaiming the described disc unit that shifts out data, and described newly assigned disc unit is set to write state.
In the system shown in Figure 6, provide the specific implementation of the first updating block and definite subelement, adapting to different applied environments, as be applicable to the disk array of different stage.
Be illustrated in figure 7 as embodiment of the invention data storage system architecture synoptic diagram, as shown in Figure 7, comprise:
Divide processing unit 710, be used for according to the capacity of disc unit each physical disk being divided into disc unit; Set up a predetermined number logic magnetic disc, each logic magnetic disc is divided into logical block according to the capacity of disc unit; The total volume of a described predetermined number logic magnetic disc equates with the total volume of described physical disk;
The first relation is set up unit 720, is used for setting up the logical block of logic magnetic disc and the first corresponding relation between the physical disk;
Allocation units 730 are used for writing fashionablely when carrying out data, determine logical block that data to be written are required and the quantity M of disc unit according to the capacity of disc unit, are the logical block of data allocations M to be written sky;
Search unit 740, be used for according to described the first corresponding relation, search the corresponding physical disk of each logical block in described M the empty logical block;
Storage unit 750 is that this logical block is distributed disc unit at the physical disk of described correspondence, and described data to be written is write in the disc unit of described distribution.
Further, this system can also comprise:
The second relation is set up unit 760, is used for setting up and preserving logical block and is the second corresponding relation between the disc unit of this logical block distribution.
Preferably, described allocation units 730 specifically can be used for: write fashionable when carrying out data, determine the quantity M of the logical block that data to be written are required according to the capacity of disc unit, from described the second corresponding relation, search and obtain the forward M in position empty logical block, the logical block of described sky is distributed to described data to be written.
In the data-storage system of the embodiment of the invention shown in Figure 7, divide 710 pairs of logic magnetic discs of processing unit and physical disk and divide respectively logical block or disc unit, set up unit 720 by the first relation and set up the first corresponding relation between logical block and the physical disk, write fashionable when carrying out data, allocation units 730 can be the logical block of the sky of data allocations respective numbers to be written according to second corresponding relation between logical block and the disc unit etc., and have and search unit 740 and find empty physical disk according to the first corresponding relation, and then storage unit 750 realizes for data storage to be written, thereby by the management to logical block in the logic magnetic disc, finished the storage of data in physical disk.
Through the above description of the embodiments, those skilled in the art can be well understood to the present invention and can realize by hardware, also can realize by the mode that software adds necessary general hardware platform.Based on such understanding, technical scheme of the present invention can embody with the form of software product, it (can be CD-ROM that this software product can be stored in a non-volatile memory medium, USB flash disk, portable hard drive etc.) in, comprise some instructions with so that computer equipment (can be personal computer, server, the perhaps network equipment etc.) carry out the above-mentioned method of each embodiment of the present invention.
It will be appreciated by those skilled in the art that accompanying drawing is the synoptic diagram of a preferred embodiment, the module in the 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 among the embodiment can be distributed in the device of embodiment according to the embodiment description, also can carry out respective change and be arranged in the one or more devices that are different from present embodiment.The module of above-described embodiment can be merged into a module, also can further split into a plurality of submodules.
The invention described above embodiment sequence number does not represent the quality of embodiment just to description.
More than disclosed only be several specific embodiment of the present invention, still, 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.