CN101620515B - Method for enhancing logical volume management LVM function - Google Patents

Method for enhancing logical volume management LVM function Download PDF

Info

Publication number
CN101620515B
CN101620515B CN2009100912251A CN200910091225A CN101620515B CN 101620515 B CN101620515 B CN 101620515B CN 2009100912251 A CN2009100912251 A CN 2009100912251A CN 200910091225 A CN200910091225 A CN 200910091225A CN 101620515 B CN101620515 B CN 101620515B
Authority
CN
China
Prior art keywords
volume
physical
logical volume
physical volume
fragment
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.)
Expired - Fee Related
Application number
CN2009100912251A
Other languages
Chinese (zh)
Other versions
CN101620515A (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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN2009100912251A priority Critical patent/CN101620515B/en
Publication of CN101620515A publication Critical patent/CN101620515A/en
Application granted granted Critical
Publication of CN101620515B publication Critical patent/CN101620515B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method for enhancing logical volume management LVM functions, comprising the following steps: respectively setting a P factor of a physical volume and a P-C factor of a logical volume; obtaining the established or expanded logical volume containing the P-C factor and physical volume segments of the mapped physical volume containing the P factor; selecting one physical volume segment with a maximal P value and judging if the size of the physical volume segment is larger than and equal to that of the established or expanded logical volume when the size summation of thephysical volume segments is larger than or equal to the size of the established or expanded logical volume; if the size of the physical volume segment is larger than and equal to that of the established or expanded logical volume, mapping the established or expanded logical volume to the physical volume segments; and if the size of the physical volume segment is smaller than that of the established or expanded logical volume, sorting all the physical volume segments according to comparison values, and mapping the established or expanded logical volume to the physical volume segment with the maximal comparison value till the establishment and expansion process of the logical volume is completed. The method not only considers the continuity of physical blocks but also considers the propertyof storage equipment when the logical volume is established and expanded.

Description

A kind of method that strengthens logical volume management LVM function
Technical field
The present invention relates to the computer memory device management domain, particularly the method for a kind of enhancing Logical Disk volume management (LVM) function in the (SuSE) Linux OS.
Background technology
When (SuSE) Linux OS is installed, how a modal problem that runs into is the good memory device subregion of planning if being distributes suitable space: if too small for the space of certain memory device subregion distribution, may causing soon, the space of this memory device subregion will deplete; If the space that is this memory device subregion distribution is excessive, causes possibly again for a long time all to use and cause waste less than this memory device subregion.Therefore, for distributing suitable space, the memory device subregion of planning becomes the task of top priority that (SuSE) Linux OS is installed.
Adopted LVM to solve this problem at present, LVM is a kind of mechanism that under the Linux environment memory device subregion is managed, and it is a logical layer that is based upon on the memory device subregion, is used for improving the dirigibility of memory device partition management.
The framework that Fig. 1 manages the memory device subregion for available technology adopting LVM.As shown in Figure 1, a memory device subregion only belongs to a memory device, and this framework mainly comprises physical volume, volume group and three parts of logical volume.Wherein, physical volume forms by the memory device subregion is abstract, the corresponding different memory device subregion of each physical volume, the physical volume object that it is made up of physics reel number, physical volume size, physical volume free space, physical volume place volume group number, physical volume fragment chained list and physical volume place volume group catena etc. is described jointly; Physical blocks is the base unit of physical volume; The physical volume fragment is one section zone that physical blocks is continuous in the physical volume, it is described by the reference position in physical volume, physical volume clip size, map tag and place physical volume catena, and map tag is used for reflecting whether this physical volume fragment is mapped.The volume group is made up of a plurality of physical volumes, each physical volume can be added in the volume group, and the size of the physical blocks of each physical volume in the same volume group is identical, and the volume group objects that it is made up of volume group number, volume group size, volume group free space, physical volume chained list and logical volume chained list etc. is described.Logical volume is the memory device subregion of the logic that can see, can operate accordingly file in the good file system of logical volume deploy, the logical volume object that it is made up of logic reel number, logical volume size, logical volume place volume group number, logical volume fragment chained list and logical volume place volume group catena etc. is described, different with physical volume is that a logical volume can be striden a plurality of memory device subregions; The same with physical volume, logical blocks is the base unit of logical volume, and each logical blocks all has and its physical blocks one to one, and the size of logical blocks is the same with the size with its corresponding physical block; The logical volume fragment is one section zone that logical blocks is continuous in the logical volume, each logical volume fragment all has and its physical volume fragment one to one, and it is described by the reference position in logical volume, logical volume clip size, the physical volume fragment of being shone upon and place logical volume catena.
The specific implementation of LVM managing memory apparatus subregion is: at first, each memory device subregion is abstracted into different physical volumes; Secondly, several physical volumes are connected to a volume group, thereby form a unified storage pool; At last, on the volume group, create or extend logical volumes according to demand, and on logical volume, create correspondent file system, be used for follow-up use further.
Fig. 2 is the existing workflow diagram that utilizes LVM to create logical volume.As shown in Figure 2, this flow process mainly may further comprise the steps:
Step 201: distribute a logical volume object according to the request of creating logical volume.
When needs are created a logical volume, can send the request of creating logical volume to LVM, it is big or small and information such as set up in which volume group to have comprised logic reel number, the logical volume of logical volume of needs establishments in this request.Further, LVM can distribute a logical volume object according to the request that comprises above-mentioned information, afterwards to field assignment such as the logic reel number that wherein comprises, logical volume size and logical volume place volume group numbers, and the logical volume object that distributes is added in the logical volume chained list field in the volume group objects of place.
Step 202: obtain the physical volume fragment that logical volume can be mapped to.
This step is to scan by two-stage to obtain physical volume fragment that logical volume can shine upon, and be specially: at first, the physical volume chained list in the volume group objects of scanning logic volume place obtains physical volumes all in the respective roll group; Secondly, for each physical volume that gets access to, scanning physical volume fragment chained list wherein obtains the physical volume fragment that map tag wherein is not labeled, and also is unmapped physical volume fragment.
After getting access to unmapped physical volume fragment, also need further all these unmapped physical volume fragments to be sorted according to descending order, sort method has a variety of, what adopt here is to insert ordering: promptly insert first physical volume fragment earlier, each later physical volume fragment all is to find corresponding position to insert from sorted sequence, finish until last physical volume fragment and to insert operation, also just finished the big or small sorting operation of mapping physical roll film section not.
It should be noted that when in this step the physical volume fragment being sorted and in same physical volume, carry out.
Step 203: judge whether all the physical volume clip size summations that can shine upon are not less than the logical volume size that requires establishment, if, execution in step 205; Otherwise the constructive process of logical volume is finished in execution in step 204 backs with failure.
After getting access to all physics roll film sections that logical volume can shine upon, need also further judge whether all the physical volume clip size summations that can shine upon are not less than the logical volume size that requires establishment, if be not less than, then execution in step 205; Otherwise, after the execution in step 204, finish the constructive process of logical volume with failure.
Step 204: the logical volume object of cancelling distribution.
When all the physical volume clip size summations that can shine upon are big or small less than the logical volume that requires to create, also just can not finish the establishment of respective logic volume, therefore, need cancel the logical volume object that distributes before, and finish the constructive process of this logical volume.
Step 205: for logical volume distributes first logical volume fragment objects.
Be to be mapped on the physical volume fragment in the physical volume when setting up mapping by the logical volume fragment in the logical volume, and logical volume and physical volume can not directly be set up this mapping relations, therefore, when all the physical volume clip size summations that can shine upon are not less than the logical volume size that will create, need comprise the fields such as reference position, logical volume clip size, the physical volume fragment of being shone upon and place logical volume catena of logical volume fragment in logical volume in this logical volume fragment objects for logical volume distributes a logical volume fragment objects.
Step 206: judge whether the logical volume size that physical volume clip size maximum in the physical volume is not less than needs establishment, if, execution in step 207; Otherwise, execution in step 212.
In this step, need the physical volume fragment of the maximum that can shine upon in each physical volume of traversal, find all these maximum physical volume clip size to be not less than to need the physical volume fragment of the logical volume size of creating, if can find, execution in step 207; Otherwise, execution in step 212.
Step 207~208: from the physical volume fragment that finds, select maximum one, and judge whether this physical volume clip size need equals the logical volume size of establishment, if equal, execution in step 209; Otherwise, execution in step 210.
The physical volume fragment that is not less than the logical volume size that needs establishment that finds in the step 206 is sorted, select a wherein maximum physical volume fragment, what adopt here is the mode of quicksort.Afterwards, whether a physical volume clip size of the maximum that further judgement is selected need equals the logical volume size of establishment, if equal, and execution in step 209; If be not equal to, also be the logical volume size that the physical volume clip size is created greater than needs, then execution in step 210.
Step 209: the physical volume fragment of logical volume fragment of distributing and the maximum of selecting is set up mapping.
If the physical volume clip size of the maximum of selecting need just in time to equal the logical volume size of establishment, then directly the logical volume fragment of distribution and the physical volume fragment of described maximum are set up mapping, be specially: at first, the map tag field of physical volume fragment is set to shine upon; Secondly, the physical volume fragment field that is mapped to is set to be mapped to this physical volume fragment in the logical volume fragment objects of distributing, and this logical volume fragment is added to the logical volume fragment chained list field in the logical volume object of distribution.
After with logical volume fragment and physical volume fragment foundation mapping, can finish the constructive process of logical volume.
Step 210~211: the physical volume fragment of the maximum that will select splits, and with the logical volume fragment of distributing with split after the physical volume fragment of maximum set up the establishment that logical volume is finished in the mapping back.
If the logical volume size that the physical volume clip size of the maximum of selecting is created greater than needs, then need the physical volume fragment of maximum is split into two physical volume fragments, and the physical volume clip size of the maximum after feasible the fractionation need just in time to equal the logical volume size of establishment, concrete fractionation mode is: distribute a new physical volume fragment objects, maximum physical volume clip size is set to need just in time to equal the logical volume size of establishment, and new physical volume clip size is set to the poor of maximum physical volume clip size and logical volume size, simultaneously, the reference position of two physical volume fragments is set, and new physical volume fragment is added in the physical volume fragment chained list of corresponding physical volume object.
The physical volume clip size of finishing the maximum after the fractionation need just in time to equal the logical volume size created, mapping will be set up between them, and after this logical volume fragment being added to logical volume fragment chained list field in the logical volume object of distribution, can finish the constructive process of logical volume, concrete map operation repeats no more here with step 209.
Step 212: all the physical volume fragments that can shine upon are sorted.
If maximum physical volume clip size is not less than the logical volume size that needs establishment in the physical volume that neither one can shine upon, all the physical volume fragments that can shine upon that then need to get access in the step 202 sort.
It should be noted that in this step sorts to the physical volume fragment carries out in all physical volumes, and since before the physical volume fragment in the single physical volume is sorted, therefore, adopted the mode of merge sort here.
Step 213~214: the physical volume fragment of the maximum that selection can be shone upon, and judge whether this physical volume clip size is not less than the unmapped logical volume size of residue, if, execution in step 217, otherwise, execution in step 215.
From sorted physical volume fragment of shining upon, select a maximum physical volume fragment, and judge whether this physical volume clip size is not less than the unmapped logical volume size of residue that requires establishment, if be not less than, then execution in step 217; If less than, then execution in step 215.
Step 215~216: the logical volume fragment and the physical volume fragment of distributing are set up mapping, reallocate after the new logical volume fragment, return execution in step 213.
Concrete mapping and batch operation were introduced in front, repeated no more here.It should be noted that after executing this operation the logical volume size that also needs needs to create is set to the poor of logical volume size and this step are created before this step operation logical volume clip size, also promptly remains unmapped logical volume size.
Step 217~220: its concrete operations are with step 208~211.
So far, promptly finished the existing whole process of utilizing LVM to create logical volume.
Existing workflow and the visioning procedure basically identical that utilizes the LVM extend logical volumes, Fig. 3 are the existing workflow diagram that utilizes the LVM extend logical volumes.As shown in Figure 3, this flow process comprises:
Step 301: the request according to extend logical volumes obtains logical volume object to be expanded.
When logical volume of needs expansion, meeting has comprised the logic reel number of the logical volume of needs expansions, the information such as logical volume size of needs expansion to the request that LVM sends extend logical volumes in this request.LVM can obtain the logical volume of needs expansion according to the logic reel number, and the logical volume size field in the described logical volume object that needs to expand is revised as former logical volume size and the big or small sum of the logical volume that needs expansion.
Step 302: the physical volume fragment that the logical volume that obtaining needs expansion can be mapped to.
This step also is to scan by two-stage to obtain physical volume fragment that the logical volume that needs expansion can shine upon, after having obtained the physical volume fragment that to shine upon, also need it is sorted according to descending order in same physical volume, its concrete operations repeat no more here with step 202.
Step 303: judge the logical volume size that whether all the physical volume clip size summations that can shine upon are not less than needs expansion, if, execution in step 304; Otherwise, with the expansion process of failure end logical volume.
Step 304: the logical volume of expanding for needs distributes first logical volume fragment objects.
For the concrete operations of logical volume assignment logic roll film section object with step 205, repeat no more here.
Step 305: judge whether the size that physical volume clip size maximum in the physical volume is not less than needs expansion, if, execution in step 306; Otherwise, execution in step 311.
Step 306~307: from each physical volume that is not less than the size that needs expansion, select maximum physical volume fragment in the physical volume fragment of maximum, and judge whether this physical volume clip size need equals the size of expansion, if, execution in step 308; Otherwise, execution in step 309.
Step 308: after the physical volume fragment foundation mapping with logical volume fragment of distributing and the maximum of selecting, execution in step 320 again.
Concrete map operation is with step 209, but need to prove, after setting up mapping, also needs will shine upon further good logical volume fragment objects and is added in the logical volume chained list that needs the logical volume object that expand, and execution in step 320 again.
Step 309~310: the physical volume fragment of the maximum that will select splits, and with the logical volume fragment of distributing with split after the physical volume fragment of maximum set up mapping after, execution in step 320 again.
The same with step 308, setting up also needs will shine upon further good logical volume fragment objects after the mapping and is added in the logical volume chained list that needs the logical volume object that expand, and execution in step 320 again.
Step 311~312: its concrete operations are with step 212~213.
Step 313: whether the physical volume clip size of judging the maximum of selecting of shining upon is not less than the size that residue is not expanded, if only need step 316; Otherwise, execution in step 314.
Step 314~315: its concrete operations are with step 215~216, execute this operation after, need return execution in step 312.
Step 316~319: concrete operations are with step 307~310.
Step 320: adjacent physical volume fragment and its corresponding logical volume fragment are merged.
After mapping is finished, the adjacent situation of physical volume fragment that logical volume fragments different in the same logical volume is mapped to may appear, also promptly the end position of a physical volume fragment just in time is the reference position of another physical volume fragment, at this moment, physical volume fragment that need this is adjacent merges, correspondingly, also to merge with their corresponding respectively logical volume fragments.
So far, promptly finished the existing whole process of utilizing the LVM extend logical volumes.
By above-mentioned analysis as can be seen, the existing flow process of LVM extend logical volumes of utilizing is with the flow process basically identical of creating logical volume, and when establishment or extend logical volumes, only be in order to reduce the fragment of physical volume fragment, make in the same logical volume corresponding physical block continuous as far as possible, and do not consider the difference of the pairing memory device of each physical volume on performance.But, the performance of memory device may differ greatly in the system: in present system, other computing machine uses in regular meeting shares a part of memory device of some computing machine to consolidated network, such memory device that computing machine is managed, have and belong to that it is own direct-connected, the memory device that other computing machine of sharing by network is also arranged is because the visit latter need pass through network, so their performance is inevitable different; Even each memory device in the perhaps same computing machine, its performance also can be different.
Summary of the invention
In view of this, the invention provides a kind of method of the LVM of enhancing function, make when establishment or extend logical volumes, not only can consider the continuity of physical blocks, but also can consider the performance of each memory device.
For achieving the above object, technical scheme of the present invention specifically is achieved in that
A kind of method that strengthens the LVM function is provided with the performance parameter P factor of physical volume and the performance of logical volume-continuity P-C factor respectively, comprising:
A1. the physical volume fragment in the physical volume that comprises the P factor that the logical volume that comprises the P-C factor that obtains establishment or expand can shine upon, judge that the described physical volume clip size summation that gets access to is whether less than the logical volume size of described establishment or expansion, if then finish, otherwise, execution in step a2;
A2. obtain the physical volume fragment of the P factor maximum that can shine upon, judge whether the physical volume clip size of the described P factor maximum of obtaining of shining upon is not less than the logical volume size of described establishment or expansion, if, the logical volume of creating or expand is mapped on the physical volume fragment of the described P factor maximum of obtaining of shining upon, otherwise, after physical volume fragment in the described physical volume that comprises the P factor that shines upon that obtains sorted according to the descending order of fiducial value, execution in step a3;
Whether the physical volume clip size of a3. judging unmapped fiducial value maximum is not less than the logical volume size that residue is not shone upon or do not expand, if, execution in step a4, otherwise, the logical volume of creating or expand is mapped on the physical volume fragment of described unmapped fiducial value maximum, continues execution in step a3;
A4. the logical volume that will create or expand is mapped on the physical volume fragment of described unmapped fiducial value maximum;
Wherein, the described P factor is used to characterize the difference of the pairing memory device of each physical volume aspect readwrite performance;
The described P-C factor is used for expression when creating or during extend logical volumes, trending towards selecting storage device performance parameter height still is the continuous degree of physical blocks;
Described fiducial value, be used for determining when the logical volume fragment need be mapped to the physical volume fragment parameter that the physical volume fragment to different physical volumes compares, for two physical volume fragments in the identical physical volume of the P factor, fiducial value also just equals physical volume clip size separately; For two physical volume fragments in the different physical volume of the P factor, the fiducial value of the physical volume fragment in the bigger physical volume of the P factor is the P-C factor three's of the P factor of physical volume clip size, physical volume and logical volume a product, and the fiducial value of the physical volume fragment in the less physical volume of the P factor is the product of the P factor of physical volume clip size and physical volume.
As seen from the above technical solutions, the method of enhancing LVM function of the present invention, by in the logical volume object, adding the P-C factor and in the physical volume object, adding the P factor, thereby can be so that when establishment or extend logical volumes, pay the utmost attention to the big physical volume object of the P factor, and when the physical volume clip size of unmapped maximum in the physical volume of P factor maximum during less than the logical volume size that will create or expand, can also calculate the fiducial value of different physical volume fragments further by the P-C factor and the P factor, thereby make when establishment or extend logical volumes, the continuity of physical blocks not only can be considered, but also the performance of each memory device can be considered.
Description of drawings
The framework that Fig. 1 manages the memory device subregion for available technology adopting LVM.
Fig. 2 is the existing workflow diagram that utilizes LVM to create logical volume.
Fig. 3 is the existing workflow diagram that utilizes the LVM extend logical volumes.
Fig. 4 creates the workflow diagram of logical volume for the present invention utilizes LVM.
Fig. 5 utilizes the workflow diagram of LVM extend logical volumes for the present invention.
Embodiment
For solving problems of the prior art, the present invention proposes a kind of method of the LVM of enhancing function, be a kind of method that can improve the performance of the logical volume of creating or expanding: in the logical volume object, add the P-C factor and in the physical volume object, add the P factor, thereby can be so that when establishment or extend logical volumes, pay the utmost attention to the big physical volume object of the P factor, and when the physical volume clip size of unmapped maximum in the physical volume of P factor maximum during less than the logical volume size that will create or expand, can also calculate the fiducial value of different physical volume fragments further by the P-C factor and the P factor, this just makes when establishment or extend logical volumes, the continuity of physical blocks not only can be considered, but also the performance of each memory device can be considered.
Before introducing concrete implementation, at first introduce the notion of the P factor, the P-C factor and fiducial value.The P factor is an initiate field in the physical volume object, and it is used to characterize the difference of the pairing memory device of each physical volume at aspects such as readwrite performances, and the P factor is big more, and the readwrite performance of memory device is excellent more; When creating each physical volume, at first the attribute according to the memory device of correspondence comes the P factor of this memory device is carried out assignment, if this value is not set when creating physical volume, then system gives the value of an acquiescence can for the P factor of corresponding memory device, simultaneity factor also can provide an interface function, make and any time after creating physical volume can revise the P factor as required.The P-C factor is an initiate field in the logical volume object, it is used for expression when creating or during extend logical volumes, trending towards selecting storage device performance parameter height still is the continuous degree of physical blocks, and the value of the P-C factor is big more, and the performance height of memory device is more wished in expression; The same with the P factor, the P-C factor also can be provided with when creating logical volume, also can not be provided with when creating and is initialized as a default value, can also revise its value by the interface function that provides in any time after creating logical volume.Fiducial value is the parameter that is used for determining that when the logical volume fragment need be mapped to the physical volume fragment physical volume fragment to different physical volumes compares, the logical volume fragment should be mapped on the bigger physical volume fragment of fiducial value, for two physical volume fragments in the identical physical volume of the P factor, fiducial value also just equals physical volume clip size separately; For two physical volume fragments in the different physical volume of the P factor, the fiducial value of the physical volume fragment in the bigger physical volume of the P factor is the P-C factor three's of the P factor of physical volume clip size, physical volume and logical volume a product, and the fiducial value of the physical volume fragment in the less physical volume of the P factor is the product of the P factor of physical volume clip size and physical volume.
The specific implementation of scheme of the present invention comprises:
A1. the physical volume fragment in the physical volume that comprises the P factor that the logical volume that comprises the P-C factor that obtains establishment or expand can shine upon, judge that the described physical volume clip size summation that gets access to is whether less than the logical volume size of described establishment or expansion, if then finish, otherwise, execution in step a2;
A2. obtain the physical volume fragment of the P factor maximum that can shine upon, judge whether the physical volume clip size of the described P factor maximum of obtaining of shining upon is not less than the logical volume size of described establishment or expansion, if, the logical volume of creating or expand is mapped on the physical volume fragment of the described P factor maximum of obtaining of shining upon, otherwise, after physical volume fragment in the described physical volume that comprises the P factor that shines upon that obtains sorted according to the descending order of fiducial value, execution in step a3;
Whether the physical volume clip size of a3. judging unmapped fiducial value maximum is not less than the logical volume size that residue is not shone upon or do not expand, if, execution in step a4, otherwise, the logical volume of creating or expand is mapped on the physical volume fragment of described unmapped fiducial value maximum, continues execution in step a3;
A4. the logical volume that will create or expand is mapped on the physical volume fragment of described unmapped fiducial value maximum.
For making purpose of the present invention, technical scheme and advantage clearer, below with reference to the accompanying drawing embodiment that develops simultaneously, the present invention is described in more detail.
Fig. 4 creates the workflow diagram of logical volume for the present invention utilizes LVM.As shown in Figure 4, this flow process may further comprise the steps:
Step 401: distribute a logical volume object that comprises the P-C factor according to the request of creating logical volume.
The same with the existing LVM establishment logical volume that utilizes, when needs are created a logical volume, at first can send the request of creating logical volume to LVM, except the logic reel number, logical volume size and the logical volume that comprise the logical volume that needs create such as set up at information in which volume group, also comprised the P-C factor that logical volume will be provided with in this request.
Further, LVM can distribute a logical volume object according to the request that comprises above-mentioned information, the assignment such as the P-C factor that will be provided with the logic reel number that wherein comprises, logical volume size, logical volume place volume group number and logical volume, and the logical volume object that distributes is added to the logical volume place rolls up in the logical volume chained list field of group objects.
Need to prove, before carry out this step, the performance that the P factor of physical volume and logical volume as required at first can be set according to the performance of memory device subregion is provided with the P-C factor of logical volume, specifically is arranged on to add this field when creating physical volume object and logical volume object and get final product.
Step 402: obtain the physical volume fragment that logical volume can be mapped to.
In the present embodiment, the operation of obtaining the physical volume fragment that logical volume can be mapped to scans by two-stage equally and realizes, only be with existing different establishment parts, physical volume chained list in the volume group objects of first order scanning logic volume place, when obtaining physical volumes all in the respective roll group, these physical volumes that need to get access to sort according to P factor size.
Need to prove, in the present embodiment, physical volume is sorted and can also carry out when physical volume joins in the volume group according to P factor size, do not influence the realization of the embodiment of the invention.
Step 403: whether the physical volume clip size summation that judgement can be shone upon is not less than the logical volume size, if, execution in step 405; Otherwise the constructive process of logical volume is finished in execution in step 404 backs.
Step 404: the logical volume object that comprises the P-C factor of cancelling distribution.
Step 405: for the logical volume that comprises the P-C factor distributes first logical volume fragment objects.
Step 406: judging whether physical volume clip size maximum in the physical volume of P factor maximum is not less than needs the logical volume size created, if, execution in step 407; Otherwise, execution in step 411.
Choosing P factor maximum, also is physical volume fragment maximum in the highest physical volume of performance, if this physical volume clip size is not less than the logical volume size that needs establishment, execution in step 407; If the logical volume size that this physical volume clip size is created less than needs, then execution in step 411.
Step 407: when physical volume clip size maximum in the physical volume of P factor maximum is not less than the logical volume size, judge further whether described P physical volume clip size equals the logical volume size, if equal, execution in step 408; If be not equal to, also be the logical volume size of the physical volume clip size of P factor maximum greater than the needs establishment, then execution in step 409.
Step 408: the logical volume fragment and the described physical volume fragment of first distribution are set up the constructive process that logical volume is finished in the mapping back.
Step 409: physical volume fragment maximum in the physical volume of described P factor maximum is split.
Step 410: the logical volume fragment and the described remaining physical volume fragment in back that splits of first distribution are set up the constructive process that logical volume is finished in the mapping back.
Step 411: the physical volume fragment that all that will get access to can be shone upon sorts by fiducial value.
If the logical volume size that maximum physical volume clip size is created less than needs in the physical volume of P factor maximum, then need all the physical volume fragments that can shine upon that get access to are sorted according to the fiducial value size, in ordering the time is to carry out size relatively to physical volume fragment computations fiducial value in twos and to the described fiducial value that calculates respectively, concrete fiducial value account form was introduced in front, repeated no more here.
Step 412~413: select the physical volume fragment of remaining fiducial value maximum of shining upon, and judge whether this physical volume clip size is not less than the unmapped logical volume size of residue, if, execution in step 416; Otherwise, execution in step 414.
Choose the physical volume fragment of remaining fiducial value maximum of shining upon, if when this physical volume clip size is not less than the unmapped logical volume of residue size, execution in step 416; If this physical volume clip size is less than the unmapped logical volume size of residue, then execution in step 414.
Step 414:, the physical volume fragment of logical volume fragment and described remaining fiducial value maximum of shining upon set up shine upon when the physical volume clip size of remaining fiducial value maximum of shining upon during less than the unmapped logical volume size of residue.
Step 415: after new logical volume fragment of logical volume distribution of creating, return execution in step 412.
Step 416: when the physical volume clip size of remaining fiducial value maximum of shining upon is not less than the unmapped logical volume size of residue, further judge whether the physical volume clip size of described remaining fiducial value maximum of shining upon equals to remain unmapped logical volume size, if equal, execution in step 417; If be not equal to, also be the logical volume size of the physical volume clip size of remaining fiducial value maximum of shining upon greater than the needs establishment, then execution in step 418.
Step 417: the physical volume fragment of logical volume fragment and described remaining fiducial value maximum of shining upon is set up the constructive process that logical volume is finished in the mapping back.
Step 418: the physical volume fragment of described remaining fiducial value maximum of shining upon is split.
Step 419: the remaining physical volume fragment after logical volume fragment and the described fractionation is set up the constructive process that logical volume is finished in the mapping back.
So far, promptly having finished the present invention utilizes LVM to create the whole process of logical volume.
Need to prove that in the present embodiment, the concrete operations of step 403~405 are with step 203~205, the concrete operations of step 407~410 are with step 208~211, and the concrete operations of step 414~419 are with step 215~220, so do simple description at this.
Fig. 5 utilizes the workflow diagram of LVM extend logical volumes for the present invention.As shown in Figure 5, this method comprises:
Step 501: the logical volume object that comprises the P-C factor that obtains the needs expansion according to the request of extend logical volumes.
When logical volume of needs expansion, the request that meeting is sent extend logical volumes to LVM, the logic reel number of needs expansions, the information such as logical volume size of needs expansion have not only been comprised in this request, the logic reel number that LVM can expand as required needing to obtain the logical volume of expansion, and then obtains the P-C factor in the logical volume object.
Logical volume is the same with creating, before carry out this step, the performance that the P factor of physical volume and logical volume as required at first can be set according to the performance of memory device subregion is provided with the P-C factor of logical volume, specifically is arranged on to add this field when creating physical volume object and logical volume object and get final product.
Step 502: the physical volume fragment that the logical volume that obtaining needs expansion can be mapped to.
In the present embodiment, obtaining physical volume fragment that logical volume can be mapped to scans by two-stage equally and realizes, the two-stage scanning here is the same with the establishment process, only be with existing expansion difference, physical volume chained list in the volume group objects of first order scanning logic volume place, when obtaining physical volumes all in the respective roll group, these physical volumes that need to get access to sort according to P factor size.
Similarly, in the present embodiment, physical volume sorted according to P factor size also can when physical volume joins in the volume group, carry out, do not influence the realization of the embodiment of the invention.
Step 503: judge the logical volume size that whether all the physical volume clip size summations that can shine upon are not less than needs expansion, if, execution in step 504; Otherwise finish the expansion process of logical volume with failure.
Step 504: when all the physical volume clip size summations that can shine upon were not less than the logical volume size that needs expansion, the logical volume of expanding for needs distributed first logical volume fragment objects.
Step 505: judge the logical volume size that whether physical volume clip size maximum in the physical volume of P factor maximum is not less than needs expansion, if, execution in step 506; Otherwise, execution in step 510.
To P factor maximum, also be that physical volume clip size maximum in the highest physical volume of performance is judged, when its size is not less than the logical volume size that needs expansion, execution in step 506; When its size is big or small less than the logical volume of needs expansion, execution in step 510.
Step 506: when physical volume clip size maximum in the physical volume of P factor maximum is not less than the logical volume size that needs expansion, judge further whether it need equals the logical volume size of expansion, if equal, execution in step 507; If be not equal to, also be the logical volume size that physical volume clip size maximum in the physical volume of P factor maximum is expanded greater than needs, then execution in step 508.
Step 507: when physical volume clip size maximum in the physical volume of P factor maximum equals to need the logical volume size of expansion, maximum physical volume fragment is set up and is shone upon in the physical volume with first logical volume fragment of distributing and described P factor maximum, and after described first logical volume fragment objects being added to the logical volume fragment chained list of the logical volume object that needs expansion, execution in step 519.
Step 508: when physical volume clip size maximum in the physical volume of P factor maximum is big or small greater than the logical volume of needs expansion, described physical volume fragment is split, concrete split process was introduced in front, repeated no more here.
Step 509: first logical volume fragment that will distribute is set up mapping with splitting the remaining physical volume fragment in back, and after described first logical volume fragment objects being added to the logical volume fragment chained list of the logical volume object that needs expansion, execution in step 519 again.
Step 510: all the physical volume fragments that can shine upon that get access to are sorted by the fiducial value size.
If P factor maximum, also be physical volume clip size maximum in the highest physical volume of performance logical volume size less than the needs expansion, then need all the physical volume fragments that can shine upon that get access to are sorted according to the fiducial value size, in ordering the time is to carry out size relatively to physical volume fragment computations fiducial value in twos and to the described fiducial value that calculates respectively, concrete fiducial value account form was introduced in front, repeated no more here.
Step 511~512: select the physical volume fragment of remaining fiducial value maximum of shining upon, and judge whether this physical volume clip size is not less than the logical volume size that residue is not expanded, if, execution in step 515; Otherwise, execution in step 513.
Choose the physical volume fragment of remaining fiducial value maximum of shining upon, if when this physical volume clip size is not less than the logical volume size that residue do not expand, execution in step 515; If the logical volume size that this physical volume clip size is not expanded less than residue, then execution in step 513.
Step 513: when the physical volume clip size of remaining fiducial value maximum of shining upon less than residue not during the logical volume size of expansion, the logical volume fragment and the described physical volume fragment of distributing are set up mapping, and the logical volume fragment objects after the described mapping is added in the logical volume fragment chained list of the logical volume object that needs expansion.
Step 514: after the new logical volume fragment of logical volume distribution for the needs expansion, return execution in step 511.
Step 515: when the physical volume clip size of remaining fiducial value maximum of shining upon is not less than the logical volume size that residue do not expand, judge further whether described physical volume clip size equals to remain the not logical volume size of expansion, if equal, execution in step 516; If be not equal to, also be the logical volume size that physical volume clip size maximum in the physical volume of remaining fiducial value maximum of shining upon is expanded greater than needs, then execution in step 517.
Step 516: when the physical volume clip size of remaining fiducial value maximum of shining upon equals to remain the logical volume size of not expansion, the logical volume fragment and the described physical volume fragment of distributing are set up mapping, and after the logical volume fragment objects after the described mapping being added to the logical volume fragment chained list of the logical volume object that needs expansion, execution in step 519.
Step 517: when the physical volume clip size of remaining fiducial value maximum of shining upon, splits described physical volume fragment not during the logical volume size of expansion greater than residue, specifically how to split, repeat no more here with step 508.
Step 518: the remaining physical volume fragment of logical volume fragment and described fractionation back of distributing is set up mapping, and after the logical volume fragment objects after the described mapping being added to the logical volume fragment chained list of the logical volume object that needs expansion, execution in step 519 again.
Step 519: the physical volume fragment that each logical volume fragment is shone upon in the logical volume fragment chained list of the logical volume object after the scanning expansion, wherein adjacent physical volume fragment is merged, simultaneously, the pairing logical volume fragment of described adjacent physical volume fragment is also merged.
So far, promptly finished the whole process that the present invention utilizes the LVM extend logical volumes.
Need to prove that in the present embodiment, the concrete operations of step 503~504 are with step 303~304, the concrete operations of step 506~509 are with step 307~310, and the concrete operations of step 513~519 are with step 314~320, so do simple description at this.
In a word, the method of enhancing LVM function of the present invention, when establishment or extend logical volumes, can be by in the logical volume object, adding the P-C factor and in the physical volume object, adding the P factor, thereby make and when establishment or extend logical volumes, pay the utmost attention to the big physical volume object of the P factor, and when the physical volume clip size of unmapped maximum in the physical volume of P factor maximum during less than the logical volume size that will create or expand, can also calculate the fiducial value of different physical volume fragments further by the P-C factor and the P factor, thereby make when establishment or extend logical volumes, the continuity of physical blocks not only can be considered, but also the performance of each memory device can be considered.
In sum, more than be preferred embodiment of the present invention only, be not to be used to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (10)

1. a method that strengthens Logical Disk volume management LVM function is characterized in that, the performance parameter P factor of physical volume and the performance of logical volume-continuity P-C factor are set respectively, and this method comprises:
A1. the physical volume fragment in the physical volume that comprises the P factor that the logical volume that comprises the P-C factor that obtains establishment or expand can shine upon, judge that the described physical volume clip size summation that gets access to is whether less than the logical volume size of described establishment or expansion, if then finish, otherwise, execution in step a2;
A2. obtain the physical volume fragment of the P factor maximum that can shine upon, judge whether the physical volume clip size of the described P factor maximum of obtaining of shining upon is not less than the logical volume size of described establishment or expansion, if, the logical volume of creating or expand is mapped on the physical volume fragment of the described P factor maximum of obtaining of shining upon, otherwise, after physical volume fragment in the described physical volume that comprises the P factor that shines upon that obtains sorted according to the descending order of fiducial value, execution in step a3;
Whether the physical volume clip size of a3. judging unmapped fiducial value maximum is not less than the logical volume size that residue is not shone upon or do not expand, if, execution in step a4, otherwise, the logical volume of creating or expand is mapped on the physical volume fragment of described unmapped fiducial value maximum, continues execution in step a3;
A4. the logical volume that will create or expand is mapped on the physical volume fragment of described unmapped fiducial value maximum;
Wherein, the described P factor is used to characterize the difference of the pairing memory device of each physical volume aspect readwrite performance;
The described P-C factor is used for expression when creating or during extend logical volumes, trending towards selecting storage device performance parameter height still is the continuous degree of physical blocks;
Described fiducial value, be used for determining when the logical volume fragment need be mapped to the physical volume fragment parameter that the physical volume fragment to different physical volumes compares, for two physical volume fragments in the identical physical volume of the P factor, fiducial value also just equals physical volume clip size separately; For two physical volume fragments in the different physical volume of the P factor, the fiducial value of the physical volume fragment in the bigger physical volume of the P factor is the P-C factor three's of the P factor of physical volume clip size, physical volume and logical volume a product, and the fiducial value of the physical volume fragment in the less physical volume of the P factor is the product of the P factor of physical volume clip size and physical volume.
2. the method for claim 1 is characterized in that, the logical volume that comprises the P-C factor that this method also is included as described establishment or expansion before the a2 after the described step a1 distributes the step of a logical volume fragment objects.
3. method as claimed in claim 2, it is characterized in that it is to be mapped on the physical volume fragment of the described P factor maximum of obtaining of shining upon by the logical volume fragment with described distribution to finish that the logical volume that will create or expand described in the step a2 is mapped on the physical volume fragment of the described P factor maximum of obtaining of shining upon.
4. method as claimed in claim 3, it is characterized in that, among the described step a2, when the physical volume clip size of the described P factor maximum of obtaining of shining upon during greater than the logical volume size of described establishment or expansion, be mapped on the physical volume fragment of the described P factor maximum of obtaining of shining upon at logical volume with described establishment or expansion before this method also comprise the step that the physical volume fragment with the described P factor maximum of obtaining of shining upon splits.
5. method as claimed in claim 4, it is characterized in that described in the step a2 physical volume fragment in the described physical volume that comprises the P factor that shines upon that obtains being sorted according to the descending order of fiducial value is by respectively to physical volume fragment computations fiducial value in twos and the described fiducial value that calculates is carried out size relatively finish.
6. method as claimed in claim 5, it is characterized in that, among the described step a3, when the physical volume clip size of described unmapped fiducial value maximum is not shone upon greater than described residue or logical volume when size of expansion not, this method also comprises the step that the physical volume fragment with described unmapped fiducial value maximum splits before execution in step a4.
7. method as claimed in claim 6, it is characterized in that the logical volume that will create or expand among the described step a2 is mapped on the physical volume fragment of the described P factor maximum of obtaining of shining upon, the logical volume that to create or expand among the described step a3 is mapped on the physical volume fragment of described unmapped fiducial value maximum and the logical volume that will create or expand among the described step a4 includes after being mapped on the physical volume fragment of described unmapped fiducial value maximum the logical volume fragment after the mapping is added to step in the logical volume fragment chained list of logical volume object of described establishment or expansion.
8. method as claimed in claim 7 is characterized in that, when the logical volume that comprises the P-C factor of described establishment or expansion was the establishment logical volume, this method also was included as the step of a logical volume object of logical volume distribution of described establishment before the described step a1.
9. method as claimed in claim 8, it is characterized in that, when the logical volume that comprises the P-C factor of described establishment or expansion is the establishment logical volume, the physical volume clip size summation that gets access to described in the step a1 is during less than the logical volume of described establishment size, and this method also comprises the step that the logical volume object of described distribution is cancelled.
10. method as claimed in claim 7, it is characterized in that, when the logical volume that comprises the P-C factor of described establishment or expansion is extend logical volumes, after being added in the logical volume fragment chained list of logical volume object of described expansion, the logical volume fragment after described will the mapping also comprises the step that the logical volume fragment with adjacent physical volume fragment after the mapping and described adjacent physical volume fragment correspondence merges.
CN2009100912251A 2009-08-12 2009-08-12 Method for enhancing logical volume management LVM function Expired - Fee Related CN101620515B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2009100912251A CN101620515B (en) 2009-08-12 2009-08-12 Method for enhancing logical volume management LVM function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2009100912251A CN101620515B (en) 2009-08-12 2009-08-12 Method for enhancing logical volume management LVM function

Publications (2)

Publication Number Publication Date
CN101620515A CN101620515A (en) 2010-01-06
CN101620515B true CN101620515B (en) 2010-12-01

Family

ID=41513769

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2009100912251A Expired - Fee Related CN101620515B (en) 2009-08-12 2009-08-12 Method for enhancing logical volume management LVM function

Country Status (1)

Country Link
CN (1) CN101620515B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8533420B2 (en) * 2010-11-24 2013-09-10 Microsoft Corporation Thin provisioned space allocation
CN102541470B (en) * 2011-12-21 2014-10-08 华为数字技术(成都)有限公司 Data object processing method and device
CN102609220A (en) * 2012-01-19 2012-07-25 北京天地云箱科技有限公司 Method and device for creating logical volumes
CN105630702A (en) * 2015-12-18 2016-06-01 浪潮(北京)电子信息产业有限公司 Logical volume creation method and system
EP3286648B1 (en) 2016-02-12 2020-08-26 Hewlett-Packard Enterprise Development LP Assembling operating system volumes
CN106775451A (en) * 2016-11-16 2017-05-31 天脉聚源(北京)传媒科技有限公司 A kind of method and device for processing logical volume
CN109032521B (en) * 2018-07-25 2019-09-10 星环信息科技(上海)有限公司 Storage volume creation method, device, server and storage medium
CN109558754B (en) * 2018-11-30 2022-04-01 安徽继远软件有限公司 Backup data anti-theft method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1327330C (en) * 2004-07-08 2007-07-18 东芝解决方案株式会社 Logical disk management method and apparatus
CN101408835A (en) * 2007-10-10 2009-04-15 英业达股份有限公司 Data management method of logical volume manager
CN101425000A (en) * 2007-10-31 2009-05-06 株式会社日立制作所 A management method of performance history and a management system of performance history
CN100487639C (en) * 2006-04-04 2009-05-13 株式会社东芝 Storage system for processing access request from host and method for doing the same

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1327330C (en) * 2004-07-08 2007-07-18 东芝解决方案株式会社 Logical disk management method and apparatus
CN100487639C (en) * 2006-04-04 2009-05-13 株式会社东芝 Storage system for processing access request from host and method for doing the same
CN101408835A (en) * 2007-10-10 2009-04-15 英业达股份有限公司 Data management method of logical volume manager
CN101425000A (en) * 2007-10-31 2009-05-06 株式会社日立制作所 A management method of performance history and a management system of performance history

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JP特開2006-338201A 2006.12.14

Also Published As

Publication number Publication date
CN101620515A (en) 2010-01-06

Similar Documents

Publication Publication Date Title
CN101620515B (en) Method for enhancing logical volume management LVM function
JP4614956B2 (en) Dynamic reassignment of data ownership
CN104348881B (en) User resources division methods and device in cloud management platform
CN107102824B (en) A kind of Hadoop isomery method and system based on storage and acceleration optimization
CN102057353B (en) For the configurable division of parallel data
CN105824686B (en) A kind of selection method of virtual machine host machine and selection system
CN104834557B (en) A kind of data analysing method based on Hadoop
CN102932415A (en) Method and device for storing mirror image document
CN105009110A (en) Method for automated scaling of massive parallel processing (mpp) database
CN103383653A (en) Method and system for managing and dispatching cloud resource
CN111309440B (en) Method and equipment for managing and scheduling multiple types of GPUs
CN101741907A (en) Method and system for balancing server load and main server
CN104639594A (en) System and method for allocating physical resources and virtual resources
CN102946413B (en) Method and system for resource preprocessing in dispatching and deployment performing process of virtual machine
CN101625628B (en) Method for realizing customization of mapping of logical volume manager (LVM)
CN109558084A (en) A kind of data processing method and relevant device
US10761869B2 (en) Cloud platform construction method and cloud platform storing image files in storage backend cluster according to image file type
CN104871153A (en) System and method for flexible distributed massively parallel processing (mpp) database
CN101360123A (en) Network system and management method thereof
CN106354548A (en) Virtual cluster creating and management method and device in distributed database system
CN110941602A (en) Database configuration method and device, electronic equipment and storage medium
CN103559319A (en) Cache synchronization method and equipment for distributed cluster file system
CN103793332B (en) Date storage method based on internal memory, device, processor and electronic equipment
CN103365784A (en) Method and device for memory recycle and allocation
CN106325999A (en) Method and device for distributing resources of host machine

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20101201

Termination date: 20130812