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.
In the embodiments of the invention, a kind of method of RAID level transforming may further comprise the steps as shown in Figure 2:
Step s201, from initial LUN, judge the free space of LUN successively, when the enough current LUN of the free space of current LUN carries out level transforming, current LUN is carried out level transforming; When the enough not current LUN of the free space of current LUN carries out level transforming, execution in step 202;
RAID comprises a plurality of LUN that arrange by certain way, for example for being arranged above and below, can be understood as a formation to RAID, and LUN is exactly a sequenced element wherein, and first LUN is initial LUN.Might there be the free space that does not have memory contents around each LUN, supposes to have among the RAID n LUN, be designated as: L
1, L
2, L
3... L
n, the free space size around each LUN is Y
1, Y
2, Y
3... Y
N+1, (Y
i〉=0, i=1,2 ... n+1); For convenience of description, the free space size around the LUN is abbreviated as the free space of LUN; Level transforming in the embodiment of the invention refers to the RAID level transforming;
The free space that step s202, the current LUN of accumulation calculating play N LUN obtains the free space accumulated value, and when the enough N of a free space accumulated value LUN carried out level transforming, backward was carried out level transforming successively with this N LUN, and N is the natural number greater than 2.
Described backward is meant the direction opposite with the LUN orientation, and as the LUN that arranges up and down, backward just is meant carries out conversion from the bottom up; As about the LUN of row, backward just is meant to turn left from the right side carries out conversion;
Afterwards, can also comprise:
Whether also have the not LUN of conversion behind the LUN that step s203, judgement get access to,, otherwise carry out step s204 if then finish.
Behind step s204, the LUN that gets access to first the not LUN of conversion is set to initial LUN, returns step s201.
Embodiments of the invention provide a kind of method of RAID level transforming, by judging the free space of LUN successively, navigate to the LUN that can carry out level transforming fast and carry out level transforming, have exempted the step of defragmentation, save system resource.
Below in conjunction with a concrete application scenarios, the embodiment of a kind of RAID level transforming method in the embodiments of the invention is described.
As shown in Figure 3, suppose to have among the RAID n LUN, be designated as: L
1, L
2, L
3... L
n, the free space size of each LUN is Y
1, Y
2, Y
3... Y
N+1, (Y
i〉=0, i=1,2 ... n+1); The space that increases with respect to former LUN after each LUN conversion is X
1, X
2, X
3... X
n(X
j0, j=1,2...n).When carrying out the RAID level transforming, require current free space total amount can satisfy the requirement of RAID level transforming, promptly free space is greater than or equals demand space, otherwise can not carry out the RAID level transforming.Below equal demand space with free space situation describe, for the situation of free space greater than demand space, disposal route is identical.
Free space equals under the situation of demand space:
X
1+X
2+X
3+...+X
n=Y
1+Y
2+Y
3+......+Y
n+Y
n+1 (1)
Concrete RAID transform method is as follows:
Step s301, be example with order computation, for Y from the 1st LUN to a last LUN
1〉=X
1, i.e. first free space Y
1Can satisfy the conversion from small to large of initial LUN rank, directly to the reference position executive level conversion of initial LUN from free space.
Behind the level transforming, Y
1=0, work as Y
1Greater than X
1The time, with Y
1Greater than X
1Part merge to Y
2In, as new Y
2
Step s302, for Y
1<X
1, i.e. first free space Y
1In the time of can not satisfying from small to large the conversion of initial LUN rank, then can use formula:
X
1+...+X
m≤Y
1+...+Y
m+Y
m+1 (2)
From Y
2Beginning uses above-mentioned formula (2) to judge successively, finds first m to satisfy above-mentioned formula (2), wherein 1≤m≤n.As shown in Figure 4, according to above-mentioned formula (1), must find a m to satisfy the needs of RAID rank change to the space.
Afterwards a preceding m LUN is carried out level transforming, order change is m, m-1 ... 1; To individual each LUN in the 2nd LUN of m, carry out conversion by the LUN tail to the order of LUN head, after m LUN conversion finished, the reference position of m-1 LUN conversion was begun by the final position of m LUN conversion, the rest may be inferred, finishes until the 2nd LUN conversion; For the 1st LUN, carry out conversion by the LUN tail to LUN head earlier, the increase because the LUN after the conversion takes up room, free space Y
2Can not satisfy the needs of level transforming, this moment, new data may cover the legacy data of the conversion that also is not able to do in time, write down the position that new legacy data covers beginning this moment, then the 1st the remaining data of LUN carried out conversion from LUN head to this position, is about to data to Y
1Expansion is avoided the covering of new legacy data with this.
If all LUN level transformings of the intact back of step s303, conversion are finished, then finish, if do not finish then m+1 LUN, return step s301 then as new initial LUN.
The embodiment of the application of the invention provides the level transforming method of a kind of RAID, navigates to the LUN that need carry out level transforming simply and rapidly, and according to the conversion execution sequence that is provided with, makes LUN carry out the RAID conversion according to certain rule; Do not need earlier all LUN among the RAID to be carried out defragmentation, simplified the execution in step of level transforming.Because therefore the step of having exempted defragmentation has exempted having taken, having saved the time that defragmentation takies a large amount of system resources, has greatly improved system performance.
Embodiments of the invention also provide a kind of device of RAID level transforming, and its structure comprises as shown in Figure 5:
First converter unit 510 is used for judging the free space of LUN successively from initial LUN, when the enough current LUN of the free space of current LUN carries out level transforming, current LUN is carried out level transforming;
Second converter unit 520, be used for when the enough not current LUN of the free space of current LUN carries out level transforming, the free space that the current LUN of accumulation calculating plays N LUN obtains the free space accumulated value, when the enough N of a free space accumulated value LUN carried out level transforming, backward was carried out level transforming successively with this N LUN.
The embodiment of the invention provides a kind of device of RAID level transforming, by judging the free space of LUN successively, navigates to the LUN that can carry out level transforming fast and carries out level transforming, has exempted the step of defragmentation, saves system resource.
Embodiments of the invention also provide a kind of device of RAID level transforming, as shown in Figure 6, comprising:
First converter unit 610 is used for judging the free space of LUN successively from initial LUN, when the enough current LUN of the free space of current LUN carries out level transforming, current LUN is carried out level transforming;
Second converter unit 620, be used for when the enough not current LUN of the free space of current LUN carries out level transforming, the free space that the current LUN of accumulation calculating plays N LUN obtains the free space accumulated value, when the enough N of a free space accumulated value LUN carried out level transforming, backward was carried out level transforming successively with this N LUN;
Finish judging unit 630, be used to judge whether to exist the LUN of not conversion;
Repeat to be provided with unit 640, the judged result that is used to finish judging unit 630 is when being, the LUN after N LUN is set to initial LUN, triggers first converter unit 610 and carries out associative operations.
Wherein, first converter unit 610 comprises:
Judgment sub-unit 611, whether enough current LUN carries out level transforming to be used to judge the free space of current LUN;
Carry out subelement 612, the judged result that is used for judgment sub-unit is utilized the free space of current LUN when being, begins current LUN is carried out level transforming from the reference position of free space;
Subelement 613 is set, is used for after current LUN conversion is finished, next LUN is set, repeat the step of judgment sub-unit 611 as new initial LUN.
Second converter unit 620 comprises:
Computation subunit 621, be used for when the judged result of judgment sub-unit 611 for not the time, the free space that the current LUN of accumulation calculating plays N LUN obtains the free space accumulated value, when free space accumulated value when enough this N LUN carries out level transforming, obtains the N value;
Backward varitron unit 622, be used for the N value that obtains according to computation subunit 621 and one by one before LUN carried out level transforming from N LUN backward, until transforming to the previous LUN of initial LUN, be specially according to order and carry out level transforming from the LUN tail to LUN head;
Initial transformation subelement 623, be used for initial LUN is carried out level transforming, be specially according to order and carry out level transforming from the LUN tail to LUN head, when data after the conversion will cover original data, record covers occurrence positions, and remaining data are carried out level transforming from LUN head to covering occurrence positions.
The embodiment of the application of the invention provides the level transforming device of a kind of RAID, navigates to the LUN that can carry out level transforming simply and rapidly, and according to the conversion execution sequence that is provided with, makes LUN carry out the RAID conversion according to certain rule; Do not need earlier all LUN among the RAID to be carried out defragmentation, simplified the execution in step of level transforming.Because therefore the step of having exempted defragmentation has exempted having taken, having saved the time that defragmentation takies a large amount of system resources, has greatly improved system performance.
One of ordinary skill in the art will appreciate that all or part of flow process that realizes in the foregoing description method, be to instruct relevant hardware to finish by computer program, described program can be stored in the computer read/write memory medium, this program can comprise the flow process as the embodiment of above-mentioned each side method when carrying out.Wherein, described storage medium can be magnetic disc, CD, read-only storage memory body (Read-OnlyMemory, ROM) or at random store memory body (Random Access Memory, RAM) etc.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 conversion all should fall into protection scope of the present invention.