Embodiment
Below we will combine accompanying drawing, embodiment of the present invention are described in detail.
See also Fig. 1, be the process flow diagram of a kind of date storage method of providing in the embodiment of the invention, present embodiment goes for solid-state hard disk SSD, also goes for other hard disk, and present embodiment is example with SSD, and said method comprises:
Step 101: receive the request of writing;
Step 102: confirm the said stripe unit (SU, Stripe Unit) of request in virtual logical unit number (LUN, the LogicalUnit Numbe) layout that generates in advance of writing;
Step 103: write data if judge said SU, and the number of times of writing of giving sizing hard disk unit (DU, Disk Unit) that belongs to said SU surpassing the preset number of times of writing, then be said at least one new DU of SU distribution again from the DU resource pool;
Step 104: said data and the last original data of writing in the request of said SU are written among said at least one new DU for this SU distribution.
Optional, after the SU write data, said method can also comprise: this SU of mark write data, and the number of times of writing that will belong to the DU of said SU adds 1.
Also comprise:
Optional, after step 104, said method can also comprise: discharge the DU that belongs to said SU that write data originally.
Optional, said method can also comprise: if judge that said SU write data, and the number of times of writing that belongs to the DU of said SU do not surpass the preset number of times of writing, and then the said data of writing in the request is written among the DU that belongs to said SU.
Optional, said method can also comprise: if judge that said SU did not write data, be that said SU distributes at least one DU from the DU resource pool then; The said data of writing in the request are written to said among at least one DU of this SU distribution.
Optional, be that said method can also comprise: this SU of mark write data after said SU distributed at least one DU, the number of times of writing that upgrades the DU that belongs to said SU is 1.
Optional; After receiving the request of writing, said method can also comprise: judge that whether the said length of writing the reference position of request and writing request is greater than the LUN capacity, if be not more than; Then successively execution in step 102 to step 104; Certainly, can also carry out in this method except that step 102 other optional step to 104, present embodiment does not limit.
Optional, before step 101, said method can also comprise:
Generate virtual LUN layout in advance, its process that generates virtual LUN layout comprises:
A, each solid state hard disc in the storage system is carried out five equilibrium according to DU, and carry out unique number for said DU;
That is to say; Storage system is carried out five equilibrium according to DU (being generally the multiple of 4KB) with each solid state hard disc with each solid state hard disc; And carry out unique number for said DU, and carry out unique number such as being numbered each DU with the DU in the hard disk behind the solid state hard disc numbering+five equilibrium, specifically as shown in Figure 2; For in the embodiment of the invention with solid state hard disc according to the synoptic diagram of dividing for the sizing hard disk unit, the DU 2:0 in this Fig. 2 representes the 0th DU of solid state hard disc label 2; DUx:2 representes the 2nd DU of solid state hard disc label x.All DU in each solid state hard disc form " DU pond ".
B, according to the member of the required LUN capacity of user, redundancy array in disc RAID group coil quantity, RAID rank, the SU size is calculated required DU quantity, wherein, the size of SU is the integral multiple of DU;
That is to say; The user need provide required LUN capacity, redundant arrays of inexpensive disks (RAID; Redundant Arrays of Independent Disks) member of group is coiled quantity, RAID rank, (generally speaking, SU equates with DU stripe unit SU size, and is certain; SU can be the integral multiple of DU also, and present embodiment does not limit); Wherein, the type of common RAID has RAID0, RAID10, RAID5 etc., but is not limited to this; The DU quantity that storage system is required according to the required calculation of parameter of user; In this step, different RAID types, its computing formula are also different, such as,
If the type of RAID is RAID0, then DU quantity=LUN capacity/DU is big or small;
If the type of RAID is RAID10, DU quantity=(LUN capacity/DU size) * RAID10 mirror drive number then;
If the type of RAID is RAID5, then DU quantity=(LUN capacity/DU size) (RAID5 member is coiled number/(RAID5 member is coiled number-1) etc. to *, but is not limited to this.
C, choose corresponding SSD, and generate a virtual LUN layout according to said required DU quantity.
That is to say, after the DU data that calculate user's needs, choose SSD corresponding in the storage system according to the required DU quantity of user, and generate a virtual LUN layout.Can be as shown in Figure 3, the member's dish that provides for the embodiment of the invention is 4 virtual LUN layout.In Fig. 3, virtual LUN layout is that logic hard disk (LD, Logic Disk) and band (S are arranged; Stripe) X-Y scheme of forming,, LD is made up of a row SU; S is made up of the SU of delegation; DU among the same S must be distributed on the different physics solid state hard discs, after avoiding a solid state hard disc fault, causes the data on the band all to be lost.
Wherein, the size of SU is the integral multiple of DU, and generally speaking, the size of SU is big or small identical with DU's, certainly, also can be different, concrete like Fig. 4 and shown in Figure 5, Fig. 4 equals a virtual LUN layout of the size of DU for the size of SU in the embodiment of the invention; Fig. 5 in the embodiment of the invention by that analogy the P size equal SU, D representes data; P representes verification; P0-2 representes that this checking data generates with D0, D1, D2.In this Fig. 5, in D2 20-29, D2 representes the 2nd data, other by that analogy, 20-29 representes this SU corresponding address section.Shown in preceding, suppose that the size of SU equals 10, the address all is since 0 addressing, therefore, and each data SU, promptly the address realm of the D among the figure is all between X0-X9.
In embodiments of the present invention, owing to generated virtual logical unit LUN layout in advance, after request is write in reception, confirm the said SU of request in the virtual LUN layout that generates in advance that write earlier; Then, judge whether write data on the said SU, if said SU write data, and the number of times of writing of giving sizing hard disk unit DU that belongs to said SU surpasses the preset number of times of writing, and then be said at least one new DU of SU distribution again from the DU resource pool; Afterwards, be written to said data and the last original data of writing in the request of said SU said among at least one new DU of this SU distribution.That is to say; The embodiment of the invention is carried out abrasion equilibrium to the DU of all solid state hard discs in the storage system, promptly earlier judges whether the SU in the LUN layout write data, and the writing number of times and whether surpass the number of times of presetting of writing of the described DU of SU; If surpass; Then from the DU resource pool, select to write the less or new DU of number of times and redistribute to SU, with the number of times of writing of minimizing DU, thus the serviceable life of having improved solid state hard disc greatly.
Also see also Fig. 6, the particular flow sheet for a kind of date storage method of providing in the embodiment of the invention in this embodiment, is example with the solid-state hard disk SSD, but is not limited to this.Earlier generate virtual LUN layout in advance, specifically comprise: each solid-state hard disk SSD in the storage system is carried out five equilibrium according to DU, and carry out unique number for said DU; Coil quantity, RAID rank, the required DU quantity of SU size calculating according to the member of the required LUN capacity of user, redundancy array in disc RAID group, wherein, the size of SU is the integral multiple of DU; Choose SSD corresponding in the storage system according to the required DU quantity of user, and generate a virtual LUN layout.Wherein, specifically comprising of said virtual LUN layout: comprise a logic hard disk LD and a strips S at least, wherein, a LD comprises a row SU, and S comprises the SU of delegation, and the DU in the same band is distributed on the different SSD.Said method comprises:
Step 601: receive the request of writing; Such as, storage system is received the request of writing of main frame (HOST) transmission that is connected with this storage system.
Step 602: judge whether write request crosses the border, if, execution in step 603; Otherwise execution in step 604;
Wherein, judge whether cross the border, that is to say if writing request, the controller in the storage system judges that whether the said length of writing the reference position of request and writing request is greater than the LUN capacity.Wherein, this controller is appreciated that and is a kind of special computing machine, and promptly whether the reference position of judging the request of writing and the length of writing request of the CPU in the computing machine is greater than the LUN capacity.
Step 603: return and write failure response, finish;
Step 604: calculate the SU that writes in the virtual LUN layout in request place;
Because the difference of RAID type, its computing formula are also different, such as, above-mentioned shown in Figure 5, be example promptly with 4 dish RAID5, read start address equals 61 if desired, and length is 2 data, can know the D6 of position at LD2, i.e. the position of SU2.RAID type for other repeats no more at this.
Step 605: judge whether said SU write data, if, execution in step 609; Otherwise execution in step 606;
Step 606: from the DU resource pool is that said SU distributes at least one DU;
Step 607: this SU of mark write data, upgraded the number of times of writing of the DU belong to said SU;
Step 608: the said data of writing in the request are written to said among at least one DU of this SU distribution;
Step 609: judge writing number of times and whether overflowing of DU that this belongs to said SU, promptly write number of times and whether surpass the preset number of times of writing, and the number of times of writing of DU equals 5,000 to 10,000 times generally speaking, but be not limited to this; If, execution in step 611; Otherwise execution in step 610;
Step 610: the said data of writing in the request are written among the SU, finish;
Step 611: from the DU resource pool is that said SU distributes at least one new DU again;
Step 612: this SU of mark write data, and the number of times of writing that will belong to the DU of said SU adds 1;
Step 613: the data of writing on said data and the said SU that writes in the request are written to saidly distribute among at least one new DU for this SU;
Step 614: the former DU that belongs to SU is discharged back the DU resource pool.
For the ease of those skilled in the art's understanding, explain with concrete instance below.
Such as, storage system receives that a start address equals 0, length is 1 the request of writing; According to the virtual logical unit LUN layout (as shown in Figure 5) that generates in advance; Can confirm this and write the corresponding D0 in the LUN layout of request, i.e. SU0 place, will write ask to write SU0 before; Earlier judge whether SU0 write data W, and promptly whether W equals 0;
If do not write data, then from the DU pond, distribute a minimum DU of a number of times T who was once write (the T initial value equals 0) to come out, such as DU0:0, then data are write DU0:0, W=1 is set, upgrade this number of times M that was write of DU and equal 1;
If write data, judge that then whether this number of times M that was write of DU0:0 is less than set-point N (such as equaling 5000)
If, then directly data are write DU0:0, upgrade and write counting: T=T+1, M=M+1 less than set-point N;
Otherwise, from the DU pond, redistribute a minimum DU of the number of times T that was once write and come out, such as DU5:4, and then the data in will asking write into DU5:4, upgrade and write counting: T=T+1, M=1;
But, need to prove that when from the DU pond, distributing DU, require all DU on the same itemize can not belong to identical solid state hard disc, promptly to identical S, the x among the Dux:y can not be identical at every turn.
Implementation procedure based on said method; The embodiment of the invention also provides a kind of data storage device; Its structural representation sees Fig. 7 for details, and said data storage device comprises: receiving element 71, confirm unit 72, first judging unit 73, redistribute the unit 74 and first storage unit 75.Wherein, said receiving element 71 is used for receiving the request of writing; Said definite unit 72 is used for confirming the stripe unit SU of the request of writing of said receiving element 71 receptions at preset virtual logical unit layout generation unit; Said first judging unit 73 is used to judge whether the SU that said definite unit 72 is confirmed write data, and what belong to said SU gives writing number of times and whether surpassing the preset number of times of writing of sizing hard disk unit DU, and sends judged result; The said unit 74 of redistributing; Be used for sending said SU and writing data receiving first judging unit 73; And belong to said SU sizing hard disk unit DU write number of times surpass preset when writing the judged result of number of times, from the DU resource pool again for should said at least one new DU of SU distribution; Said first storage unit 75, the data of the request of writing that is used for said receiving element 71 is received are written to said allocation units 74 among at least one DU of this SU distribution.The data and the original data of said SU of the request of writing that is used for said receiving element 71 is received are written to the said unit 74 of redistributing among at least one new DU of this SU distribution.
Optional, said equipment can also comprise: first indexing unit, be used for after the SU write data, and this SU of mark write data, and the number of times of writing that will belong to the DU of said SU adds 1.
Optional, said equipment can also comprise: the resource releasing unit is used to discharge the DU that belongs to SU that write data originally.
Optional; Said equipment can also comprise: second storage unit; Be used for sending said SU and writing data receiving first judging unit; And the number of times of writing of giving sizing hard disk unit DU that belongs to said SU does not surpass presetly when writing the judged result of number of times, and the said data of writing in the request are written among the DU that belongs to said SU.
Optional; Said equipment can also comprise: allocation units 76 and the 3rd storage unit 77, wherein, allocation units 76; Being used for receiving first judging unit 73 when sending said SU and not writing the judged result of data, is that said SU distributes at least one DU from the DU resource pool then; The 3rd storage unit 77, the data of the request of writing that is used for said receiving element 71 is received are written among at least one DU that said allocation units distribute for this SU.Its corresponding structure synoptic diagram sees Fig. 8 for details.
Optional, said equipment can also comprise: second indexing unit, be used for after distributing at least one DU for said SU, and this SU of mark write data, and the number of times of writing that upgrades the DU that belongs to said SU is 1.
Optional, said equipment can also comprise: the judging unit that crosses the border, be used for after receiving element receives the request of writing, and whether judge the said length of writing the reference position of request and writing request greater than the LUN capacity, and the judged result that is not more than is sent to definite unit.
Preferably, said data storage device can further include: virtual logical unit layout generation unit, link to each other with definite unit, and be used for each SSD is carried out five equilibrium according to DU, and be said DU unique number; Coil quantity, RAID rank, the required DU quantity of SU size calculating according to the member of the required LUN capacity of user, RAID group; Choose corresponding SSD according to said required DU quantity; And generate a virtual LUN layout, wherein, the size of SU is the integral multiple of DU.
Can know by the foregoing description, in embodiments of the present invention,, after request is write in reception, confirm the said SU of request in the virtual LUN layout that generates in advance that write earlier owing to generated virtual logical unit LUN layout in advance; Then, judge whether write data on the said SU,, be that said SU distributes at least one DU then, and the said data of writing in the request are written among said at least one DU from the DU resource pool if do not have; If write, then continue to judge belong to said SU give writing number of times and whether surpassing the preset number of times of writing of sizing hard disk unit DU, if, then from the DU resource pool again for should said at least one new DU of SU distribution; And be written to said data and the original data of writing in the request of said SU said among at least one new DU of this SU distribution; If not, then the said data of writing in the request are written among the DU that belongs to said SU.The so that when DU of all hard disks in the storage system carried out abrasion equilibrium, thereby the serviceable life of having improved solid state hard disc greatly.
Through the description of above embodiment, those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential general hardware platform, can certainly pass through hardware, but the former is better embodiment under a lot of situation.Based on such understanding; The part that technical scheme of the present invention contributes to prior art in essence in other words can be come out with the embodied of software product; This computer software product can be stored in the storage medium, like ROM/RAM, magnetic disc, CD etc., comprises that some instructions are with so that a computer equipment (can be a personal computer; Server, the perhaps network equipment etc.) carry out the described method of some part of each embodiment of the present invention or embodiment.
The above only is a preferred implementation of the present invention; Should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; Can also make some improvement and retouching, these improvement and retouching also should be regarded as protection scope of the present invention.