mirror of
git://sourceware.org/git/lvm2.git
synced 2024-10-27 10:25:13 +03:00
cleanup: rename virtual_extents
Use standard 'virtual_extents' naming. Move virtual_size into 'lcp' struct out of lvcreate_params.
This commit is contained in:
parent
913f025d3e
commit
cb931eed72
@ -6745,7 +6745,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lp->voriginextents = origin_lv->le_count;
|
||||
lp->virtual_extents = origin_lv->le_count;
|
||||
|
||||
/*
|
||||
* Check if using 'external origin' or the 'normal' snapshot
|
||||
@ -6765,7 +6765,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
||||
}
|
||||
}
|
||||
} else if (lp->snapshot) {
|
||||
if (!lp->voriginsize) {
|
||||
if (!lp->virtual_extents) {
|
||||
if (!origin_lv) {
|
||||
log_error("Couldn't find origin volume '%s'.",
|
||||
lp->origin_name);
|
||||
@ -6868,7 +6868,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
||||
lp->stripes, lp->stripe_size,
|
||||
lp->mirrors,
|
||||
seg_is_pool(lp) ? lp->pool_metadata_extents : lp->region_size,
|
||||
seg_is_thin_volume(lp) ? lp->voriginextents : lp->extents,
|
||||
seg_is_thin_volume(lp) ? lp->virtual_extents : lp->extents,
|
||||
lp->pvh, lp->alloc, lp->approx_alloc))
|
||||
return_NULL;
|
||||
|
||||
@ -7080,7 +7080,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
||||
* if origin is real (not virtual) inactive device.
|
||||
*/
|
||||
if ((vg_is_clustered(vg) ||
|
||||
(!lp->voriginsize && !lv_is_active(origin_lv))) &&
|
||||
(!lp->virtual_extents && !lv_is_active(origin_lv))) &&
|
||||
!deactivate_lv(cmd, lv)) {
|
||||
log_error("Aborting. Couldn't deactivate snapshot COW area. "
|
||||
"Manual intervention required.");
|
||||
@ -7088,10 +7088,10 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
|
||||
}
|
||||
|
||||
/* A virtual origin must be activated explicitly. */
|
||||
if (lp->voriginsize) {
|
||||
if (lp->virtual_extents) {
|
||||
if (!(origin_lv = _create_virtual_origin(cmd, vg, lv->name,
|
||||
lp->permission,
|
||||
lp->voriginextents))) {
|
||||
lp->virtual_extents))) {
|
||||
stack;
|
||||
goto deactivate_and_revert_new_lv;
|
||||
}
|
||||
|
@ -857,12 +857,11 @@ struct lvcreate_params {
|
||||
|
||||
/* size */
|
||||
uint32_t extents; /* all */
|
||||
uint32_t voriginextents; /* snapshot */
|
||||
uint64_t voriginsize; /* snapshot */
|
||||
uint32_t pool_metadata_extents; /* pools */
|
||||
uint64_t pool_metadata_size; /* pools */
|
||||
uint32_t pool_data_extents; /* pools */
|
||||
uint64_t pool_data_size; /* pools */
|
||||
uint32_t virtual_extents; /* snapshots, thins */
|
||||
struct dm_list *pvh; /* all */
|
||||
|
||||
uint64_t permission; /* all */
|
||||
|
@ -498,6 +498,8 @@ static int _lv_set_pool_params(struct lvcreate_params *lp,
|
||||
vg_t vg, const char *pool_name,
|
||||
uint64_t extents, uint64_t meta_size)
|
||||
{
|
||||
uint64_t pool_metadata_size;
|
||||
|
||||
_lv_set_default_params(lp, vg, pool_name, extents);
|
||||
|
||||
lp->create_pool = 1;
|
||||
@ -505,23 +507,23 @@ static int _lv_set_pool_params(struct lvcreate_params *lp,
|
||||
lp->stripes = 1;
|
||||
|
||||
if (!meta_size) {
|
||||
lp->pool_metadata_size = extents * vg->extent_size /
|
||||
pool_metadata_size = extents * vg->extent_size /
|
||||
(lp->chunk_size * (SECTOR_SIZE / 64));
|
||||
while ((lp->pool_metadata_size >
|
||||
while ((pool_metadata_size >
|
||||
(2 * DEFAULT_THIN_POOL_OPTIMAL_SIZE / SECTOR_SIZE)) &&
|
||||
lp->chunk_size < DM_THIN_MAX_DATA_BLOCK_SIZE) {
|
||||
lp->chunk_size <<= 1;
|
||||
lp->pool_metadata_size >>= 1;
|
||||
pool_metadata_size >>= 1;
|
||||
}
|
||||
} else
|
||||
lp->pool_metadata_size = meta_size;
|
||||
pool_metadata_size = meta_size;
|
||||
|
||||
if (lp->pool_metadata_size % vg->extent_size)
|
||||
lp->pool_metadata_size +=
|
||||
vg->extent_size - lp->pool_metadata_size % vg->extent_size;
|
||||
if (pool_metadata_size % vg->extent_size)
|
||||
pool_metadata_size +=
|
||||
vg->extent_size - pool_metadata_size % vg->extent_size;
|
||||
|
||||
if (!(lp->pool_metadata_extents =
|
||||
extents_from_size(vg->cmd, lp->pool_metadata_size / SECTOR_SIZE,
|
||||
extents_from_size(vg->cmd, pool_metadata_size / SECTOR_SIZE,
|
||||
vg->extent_size)))
|
||||
return_0;
|
||||
|
||||
@ -602,20 +604,15 @@ lv_create_params_t lvm_lv_params_create_thin_pool(vg_t vg,
|
||||
|
||||
/* Set defaults for thin LV specific parameters */
|
||||
static int _lv_set_thin_params(struct lvcreate_params *lp,
|
||||
vg_t vg, const char *pool_name,
|
||||
const char *lvname,
|
||||
uint64_t extents)
|
||||
vg_t vg, const char *pool_name,
|
||||
const char *lvname,
|
||||
uint32_t extents)
|
||||
{
|
||||
_lv_set_default_params(lp, vg, lvname, extents);
|
||||
_lv_set_default_params(lp, vg, lvname, 0);
|
||||
|
||||
lp->pool_name = pool_name;
|
||||
lp->segtype = get_segtype_from_string(vg->cmd, "thin");
|
||||
|
||||
lp->voriginsize = extents * vg->extent_size;
|
||||
if (!(lp->voriginextents = extents_from_size(vg->cmd, lp->voriginsize,
|
||||
vg->extent_size)))
|
||||
return_0;
|
||||
|
||||
lp->virtual_extents = extents;
|
||||
lp->stripes = 1;
|
||||
|
||||
return 1;
|
||||
@ -698,7 +695,7 @@ static lv_create_params_t _lvm_lv_params_create_thin(const vg_t vg,
|
||||
const char *lvname, uint64_t size)
|
||||
{
|
||||
struct lvm_lv_create_params *lvcp = NULL;
|
||||
uint64_t extents = 0;
|
||||
uint32_t extents = 0;
|
||||
|
||||
/* precondition checks */
|
||||
if (vg_read_error(vg))
|
||||
|
@ -2640,8 +2640,7 @@ static int _lvconvert_thin(struct cmd_context *cmd,
|
||||
.pvh = &vg->pvs,
|
||||
.read_ahead = DM_READ_AHEAD_AUTO,
|
||||
.stripes = 1,
|
||||
.voriginextents = lv->le_count,
|
||||
.voriginsize = lv->size,
|
||||
.virtual_extents = lv->le_count,
|
||||
};
|
||||
|
||||
if (lv == pool_lv) {
|
||||
|
@ -20,6 +20,7 @@
|
||||
struct lvcreate_cmdline_params {
|
||||
percent_type_t percent;
|
||||
uint64_t size;
|
||||
uint64_t virtual_size; /* snapshot, thin */
|
||||
char **pvs;
|
||||
uint32_t pv_count;
|
||||
};
|
||||
@ -251,8 +252,8 @@ static int _update_extents_params(struct volume_group *vg,
|
||||
vg->extent_size)))
|
||||
return_0;
|
||||
|
||||
if (lp->voriginsize &&
|
||||
!(lp->voriginextents = extents_from_size(vg->cmd, lp->voriginsize,
|
||||
if (lcp->virtual_size &&
|
||||
!(lp->virtual_extents = extents_from_size(vg->cmd, lcp->virtual_size,
|
||||
vg->extent_size)))
|
||||
return_0;
|
||||
|
||||
@ -406,7 +407,7 @@ static int _read_size_params(struct cmd_context *cmd,
|
||||
-1))
|
||||
return_0;
|
||||
|
||||
lp->voriginsize = arg_uint64_value(cmd, virtualsize_ARG, UINT64_C(0));
|
||||
lcp->virtual_size = arg_uint64_value(cmd, virtualsize_ARG, UINT64_C(0));
|
||||
|
||||
if (arg_count(cmd, extents_ARG)) {
|
||||
if (arg_count(cmd, size_ARG)) {
|
||||
|
Loading…
Reference in New Issue
Block a user