1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

drop mirrored_pv/mirrored_pe from alloc handle

This commit is contained in:
Alasdair Kergon 2007-11-22 14:54:35 +00:00
parent 3da4613d7b
commit 940d710ece
4 changed files with 15 additions and 43 deletions

View File

@ -48,8 +48,6 @@ struct alloc_handle *allocate_extents(struct volume_group *vg,
uint32_t stripes, uint32_t stripes,
uint32_t mirrors, uint32_t log_count, uint32_t mirrors, uint32_t log_count,
uint32_t extents, uint32_t extents,
struct physical_volume *mirrored_pv,
uint32_t mirrored_pe,
struct list *allocatable_pvs, struct list *allocatable_pvs,
alloc_policy_t alloc, alloc_policy_t alloc,
struct list *parallel_areas); struct list *parallel_areas);

View File

@ -414,8 +414,6 @@ struct alloc_handle {
uint32_t log_count; /* Number of parallel 1-extent logs */ uint32_t log_count; /* Number of parallel 1-extent logs */
uint32_t total_area_len; /* Total number of parallel extents */ uint32_t total_area_len; /* Total number of parallel extents */
struct physical_volume *mirrored_pv; /* FIXME Remove this */
uint32_t mirrored_pe; /* FIXME Remove this */
struct list *parallel_areas; /* PVs to avoid */ struct list *parallel_areas; /* PVs to avoid */
struct alloced_area log_area; /* Extent used for log */ struct alloced_area log_area; /* Extent used for log */
@ -441,8 +439,6 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
uint32_t mirrors, uint32_t mirrors,
uint32_t stripes, uint32_t stripes,
uint32_t log_count, uint32_t log_count,
struct physical_volume *mirrored_pv,
uint32_t mirrored_pe,
struct list *parallel_areas) struct list *parallel_areas)
{ {
struct alloc_handle *ah; struct alloc_handle *ah;
@ -453,15 +449,8 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
return NULL; return NULL;
} }
if ((stripes > 1 || mirrors > 1) && mirrored_pv) { if (log_count && stripes > 1) {
log_error("Can't mix striping or mirroring with " log_error("Can't mix striping with a mirror log yet.");
"creation of a mirrored PV yet");
return NULL;
}
if (log_count && (stripes > 1 || mirrored_pv)) {
log_error("Can't mix striping or pvmove with "
"a mirror log yet.");
return NULL; return NULL;
} }
@ -469,8 +458,6 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
area_count = 0; area_count = 0;
else if (mirrors > 1) else if (mirrors > 1)
area_count = mirrors; area_count = mirrors;
else if (mirrored_pv)
area_count = 1;
else else
area_count = stripes; area_count = stripes;
@ -497,8 +484,6 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
for (s = 0; s < ah->area_count; s++) for (s = 0; s < ah->area_count; s++)
list_init(&ah->alloced_areas[s]); list_init(&ah->alloced_areas[s]);
ah->mirrored_pv = mirrored_pv;
ah->mirrored_pe = mirrored_pe;
ah->parallel_areas = parallel_areas; ah->parallel_areas = parallel_areas;
return ah; return ah;
@ -1087,7 +1072,7 @@ static int _allocate(struct alloc_handle *ah,
return 1; return 1;
} }
if (ah->mirrored_pv || (ah->alloc == ALLOC_CONTIGUOUS)) if (ah->alloc == ALLOC_CONTIGUOUS)
can_split = 0; can_split = 0;
if (lv && !list_empty(&lv->segments)) if (lv && !list_empty(&lv->segments))
@ -1193,8 +1178,6 @@ struct alloc_handle *allocate_extents(struct volume_group *vg,
uint32_t stripes, uint32_t stripes,
uint32_t mirrors, uint32_t log_count, uint32_t mirrors, uint32_t log_count,
uint32_t extents, uint32_t extents,
struct physical_volume *mirrored_pv,
uint32_t mirrored_pe,
struct list *allocatable_pvs, struct list *allocatable_pvs,
alloc_policy_t alloc, alloc_policy_t alloc,
struct list *parallel_areas) struct list *parallel_areas)
@ -1220,11 +1203,8 @@ struct alloc_handle *allocate_extents(struct volume_group *vg,
alloc = vg->alloc; alloc = vg->alloc;
if (!(ah = _alloc_init(vg->cmd, vg->cmd->mem, segtype, alloc, mirrors, if (!(ah = _alloc_init(vg->cmd, vg->cmd->mem, segtype, alloc, mirrors,
stripes, log_count, mirrored_pv, stripes, log_count, parallel_areas)))
mirrored_pe, parallel_areas))) { return_NULL;
stack;
return NULL;
}
if (!segtype_is_virtual(segtype) && if (!segtype_is_virtual(segtype) &&
!_allocate(ah, vg, lv, (lv ? lv->le_count : 0) + extents, !_allocate(ah, vg, lv, (lv ? lv->le_count : 0) + extents,
@ -1427,12 +1407,13 @@ int lv_extend(struct logical_volume *lv,
if (segtype_is_virtual(segtype)) if (segtype_is_virtual(segtype))
return lv_add_virtual_segment(lv, status, extents, segtype); return lv_add_virtual_segment(lv, status, extents, segtype);
/* FIXME Temporary restriction during code reorganisation */
if (mirrored_pv)
alloc = ALLOC_CONTIGUOUS;
if (!(ah = allocate_extents(lv->vg, lv, segtype, stripes, mirrors, 0, if (!(ah = allocate_extents(lv->vg, lv, segtype, stripes, mirrors, 0,
extents, mirrored_pv, mirrored_pe, extents, allocatable_pvs, alloc, NULL)))
allocatable_pvs, alloc, NULL))) { return_0;
stack;
return 0;
}
if (mirrors < 2) { if (mirrors < 2) {
if (!lv_add_segment(ah, 0, ah->area_count, lv, segtype, stripe_size, if (!lv_add_segment(ah, 0, ah->area_count, lv, segtype, stripe_size,

View File

@ -338,9 +338,7 @@ static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * l
if (!(ah = allocate_extents(lv->vg, NULL, lp->segtype, if (!(ah = allocate_extents(lv->vg, NULL, lp->segtype,
1, lp->mirrors - 1, 1, lp->mirrors - 1,
corelog ? 0U : 1U, corelog ? 0U : 1U,
lv->le_count, lv->le_count, lp->pvh, lp->alloc,
NULL, 0, lp->pvh,
lp->alloc,
parallel_areas))) parallel_areas)))
return_0; return_0;
@ -386,9 +384,7 @@ static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * l
} }
if (!(ah = allocate_extents(lv->vg, NULL, lp->segtype, 0, if (!(ah = allocate_extents(lv->vg, NULL, lp->segtype, 0,
0, 1, 0, 0, 1, 0, lp->pvh, lp->alloc,
NULL, 0, lp->pvh,
lp->alloc,
parallel_areas))) { parallel_areas))) {
stack; stack;
return 0; return 0;

View File

@ -740,11 +740,8 @@ static int _lvcreate(struct cmd_context *cmd, struct volume_group *vg,
if (!(ah = allocate_extents(vg, NULL, lp->segtype, lp->stripes, if (!(ah = allocate_extents(vg, NULL, lp->segtype, lp->stripes,
lp->mirrors, lp->corelog ? 0U : 1U, lp->mirrors, lp->corelog ? 0U : 1U,
lp->extents, NULL, 0, lp->extents, pvh, lp->alloc, NULL)))
pvh, lp->alloc, NULL))) { return_0;
stack;
return 0;
}
lp->region_size = adjusted_mirror_region_size(vg->extent_size, lp->region_size = adjusted_mirror_region_size(vg->extent_size,
lp->extents, lp->extents,