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 is obtained 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 second corresponding relation before, corresponding relation between the disc unit (DU, Disk Unit) that described second corresponding relation comprises physical disk and the logical block of logic magnetic disc (LD, logic Disk).
Wherein, generally after the pairing 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 and corresponding first corresponding relation of logical block afterwards.
Step 104: judge whether the pairing physical disk of non-NULL disc unit in described second corresponding relation is same physical disk with physical disk in corresponding described first corresponding relation, if different, then execution in step 105.
Step 105: the data of disc unit are moved in the corresponding physical disk according to first corresponding relation.
Step 106: upgrade described 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 described second corresponding relation efficiently, thereby realize quick and easy dynamic capacity-expanding.And described second corresponding relation can also be used to support 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 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 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 first corresponding relation and second corresponding relation identical carries out moving of data, realized dynamic online dilatation; And carry out need not data are backed up in the data-moving, improved the efficient of disk dilatation greatly.
Below, provide a kind of specific implementation method of the embodiment of the invention shown in Figure 1, in this implementation method, write down described first corresponding relation by layout table; Write down described second corresponding relation by mapping table; As shown in Figure 2, comprise the steps:
Step 201: detect when increasing physical disk newly, keep the disk sign of original physical disk constant, and be newly-increased physical disk distribution 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 directly the slot number of disk correspondence not identified as disk, do not limit here for physical disk distributes other sign.
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 D U sign can for each disc unit, described DU sign is made up 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 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 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 promptly 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 pairing physical disk of logic magnetic disc also is an 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, and can not use 7 with described logic magnetic disc.Suppose, use P0~P5 logical block generation layout table of totally 6 physical disks and logic magnetic disc, concrete grammar can for:
According to second pre-defined rule, generate the logical block formation of each logic magnetic disc correspondence, 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 each logical block in the layout table line by line.
Described 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, thereby the logical block of each logic magnetic disc all corresponding a physical disk sign.Here, in order to make the corresponding relation between logical block and the physical disk more directly perceived, only the numerical portion that physical disk is identified is shown in the form, and 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 second pre-defined rule, generate the logical block formation of each logic magnetic disc correspondence, 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 in the layout table per two the row logical blocks 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 second corresponding relation between the disc unit of the logical block that writes down logic magnetic disc before the newly-increased physical disk and physical disk.
Wherein, described 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 logical block and physical disk more intuitively, 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, as Fig. 3 d, the 0th the pairing 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 first corresponding relation and second corresponding relation, judge successively whether the pairing physical disk of each non-NULL logical block is 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 is meant the logical block of non-NULL in second corresponding relation.When described first corresponding relation and 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 each logical block corresponding physical disk sign and compare and get final product.
Step 206: be the new disc unit that distributes a sky of this logical block on this non-NULL logical block corresponding physical disk in first corresponding relation.
Step 207: in second corresponding relation in the disc unit of this logical block correspondence data be set to the non-state of writing, and with described data-moving in newly assigned disc unit, reclaim the disc unit of this logical block correspondence in described second corresponding relation, the data in the disc unit of this logical block correspondence are set to the state of can writing.
Here, can write, can not write state for the data setting of each logical block correspondence, and when the data of logical block correspondence were moved, at first these data be set to the state of can not writing, thereby prevent the data of user's modification 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 significantly 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 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, second corresponding relation between the logical block that is logic magnetic disc behind the newly-increased physical disk that writes down in the mapping table that is obtained 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 pairing logic magnetic disc quantity of physical disk array is in case after determining, can't at will change.
Step 209: obtain in second corresponding relation and to be empty logical block, and the described logical block in corresponding 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 promptly: distribution technique when writing being adopted in the management of logical block and physical disk unit, have only and need 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 be provided with, and for example is 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 first corresponding relation between the physical disk.
Wherein, can realize the foundation of described first corresponding relation by the form that generates layout table.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 the 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,, from forward logical block, select M empty logical block to distribute to described data to be written according to putting in order of logical block sign.
Step 404:, search the pairing physical disk of each logical block in described M the empty logical block according to described first corresponding relation.
Step 405: on described corresponding physical disk, distribute disc unit, and described data to be written are write in the disc unit of described distribution for this logical block.
Wherein, after step 405, further can comprise:
Step 406: set up and preserve logical block and be 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 data storage, at this moment, also do not set up second corresponding relation between logical block and the disc unit.And after having set up described second corresponding relation, follow-uply carry out writing or during operation such as deletion, directly upgrading 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 second corresponding relation.Shown in Fig. 3 d, can use mapping table to carry out the record of first corresponding relation.Concrete mapping table generating method refer step 204 is not given unnecessary details here.
In addition, when having set up 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 second corresponding relation (as mapping table), this M empty logical block distributed to data to be written.
Step 406 is changed into: upgrade described 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, carry out the deletion of data in the disc unit or rewrite getting final product, do not give unnecessary details here according to second corresponding relation.
In the date storage method of the embodiment of the invention, logic magnetic disc and physical disk are divided logical block or disc unit respectively, and finish data processing according to first corresponding relation between logical block and the physical disk and second corresponding relation between logical block and the disc unit, thereby realized processing such as storage data.
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, first updating block 530, judging unit 540, move the unit 550 and second updating block 560; Wherein,
Acquiring unit 510 is used to detect when increasing physical disk newly, obtains newly-increased physical disk second corresponding relation before, and described 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;
First updating block 530 is used to upgrade newly-increased physical disk and corresponding first corresponding relation of logical block afterwards; Concrete,
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 and corresponding first corresponding relation of logical block afterwards;
Judging unit 540 is used for judging whether the pairing physical disk of non-NULL disc unit of described second corresponding relation and the physical disk in described first corresponding relation are same physical disk;
Move unit 550, the judged result that is used for judging unit 540 is moved the data of disc unit in the corresponding physical disk according to first corresponding relation for not simultaneously;
Second updating block 560 is used to upgrade described second corresponding relation.
By second updating block 560, upgrading, to preserve described second corresponding relation, thus can be so that the acquiring unit in the system when disk dilatation next time, get access to described 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 the state of can writing.
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 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, first corresponding relation by logical block and physical disk in first updating block, the 530 renewal logic magnetic discs, judging unit 540 Compare Logic unit the physical disk in corresponding first corresponding relation and second corresponding relation whether identical after, carry out moving of data by moving unit 550, realized dynamic online dilatation; And carry out need not data are backed up in the data-moving, improved the efficient of disk dilatation greatly.
As shown in Figure 6, described first updating block 530 can comprise:
Identification distribution subelement 5301 is used to keep the disk sign of original physical disk 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 pairing physical disk sign.
Concrete, described definite subelement 5302 can be used for: generate the logical block formation of each logic magnetic disc correspondence, 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 each logical block in the layout table line by line.
Perhaps, described definite subelement 5302 can be used for: generate the logical block formation of each logic magnetic disc correspondence, 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 in the layout table per two the row logical blocks 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:
Handle 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 to reclaim the described disc unit that shifts out data, and described newly assigned disc unit is set to the state of can writing.
In the system shown in Figure 6, provide the specific implementation of 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 each physical disk being divided into disc unit according to the capacity of 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;
First relation is set up unit 720, is used to set up the logical block of logic magnetic disc and first corresponding relation between the physical disk;
Allocation units 730 are used for writing fashionablely when carrying out data, determine the 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, search the pairing physical disk of each logical block in described M the empty logical block according to described first corresponding relation;
Storage unit 750 is distributed disc unit for this logical block, and described data to be written is write in the disc unit of described distribution on described corresponding physical disk.
Further, this system can also comprise:
Second relation is set up unit 760, is used to set up and preserve logical block and is 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 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 logical block or disc unit respectively, set up unit 720 by first relation and set up 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 first corresponding relation, and then storage unit 750 realizations are for the storage of data to be written, thereby, finished the storage of data in physical disk by management to logical block in the logic magnetic disc.
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, 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 the foregoing description can be merged into a module, also can further split into a plurality of submodules.
The invention described above embodiment sequence number is not represented 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, any those skilled in the art can think variation all should fall into protection scope of the present invention.