Use standard 'virtual_extents' naming.
Move virtual_size into 'lcp' struct out of lvcreate_params.
return NULL;
}
- lp->voriginextents = origin_lv->le_count;
+ lp->virtual_extents = origin_lv->le_count;
/*
* Check if using 'external origin' or the 'normal' snapshot
}
}
} 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);
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;
* 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.");
}
/* 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;
}
/* 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 */
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;
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;
/* 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;
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))
.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) {
struct lvcreate_cmdline_params {
percent_type_t percent;
uint64_t size;
+ uint64_t virtual_size; /* snapshot, thin */
char **pvs;
uint32_t pv_count;
};
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;
-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)) {