if (status)
*status = -1;
- if (dm_snprintf(lv_path, PATH_MAX, "%s%s/%s", cmd->dev_dir, lp->vg_name,
- lp->lv_name) < 0) {
+ if (dm_snprintf(lv_path, sizeof(lv_path), "%s%s/%s", cmd->dev_dir,
+ vg->name, lp->lv_name) < 0) {
log_error("Couldn't create LV path for %s", lp->lv_name);
return 0;
}
argv[i++] = lv_path;
if (fcmd == FSADM_CMD_RESIZE) {
- if (dm_snprintf(size_buf, SIZE_BUF, "%" PRIu64 "K",
+ if (dm_snprintf(size_buf, sizeof(size_buf), "%" PRIu64 "K",
(uint64_t) lp->extents * (vg->extent_size / 2)) < 0) {
log_error("Couldn't generate new LV size string");
return 0;
(percent > policy_threshold)) {
if (!thin_pool_feature_supported(lv, THIN_FEATURE_METADATA_RESIZE)) {
log_error_once("Online metadata resize for %s/%s is not supported.",
- lp->vg_name, lp->lv_name);
+ lv->vg->name, lv->name);
return 0;
}
lp->poolmetadatasize = (first_seg(lv)->metadata_lv->size *
if (new_lv_name && find_lv_in_vg(vg, new_lv_name)) {
log_error("Logical volume \"%s\" already exists in "
- "volume group \"%s\"", new_lv_name, lp->vg_name);
+ "volume group \"%s\"", new_lv_name, vg->name);
return NULL;
}
};
struct lvresize_params {
- const char *vg_name;
+ const char *vg_name; /* only-used when VG is not yet opened (in /tools) */
const char *lv_name;
uint32_t stripes;
const char *origin; /* snap */
const char *pool; /* thin */
- const char *vg_name; /* all */
+ const char *vg_name; /* only-used when VG is not yet opened (in /tools) */
const char *lv_name; /* all */
/* Keep args given by the user on command line */
.read_ahead = read_ahead,
.stripe_size = stripe_size,
.stripes = stripes,
- .vg_name = pool_lv->vg->name,
.zero = 1,
};
.pvh = pvh ? : &vg->pvs,
.read_ahead = DM_READ_AHEAD_AUTO,
.stripes = 1,
- .vg_name = vg->name,
.zero = 1,
.temporary = 1,
};
lp->major = -1;
lp->minor = -1;
lp->activate = CHANGE_AY;
- lp->vg_name = vg->name;
lp->lv_name = lvname; /* FIXME: check this for safety */
lp->pvh = &vg->pvs;
int lvm_lv_resize(const lv_t lv, uint64_t new_size)
{
int rc = 0;
- struct lvresize_params lp = { 0 };
- struct saved_env e = { 0 };
-
- lp.vg_name = lv->vg->name;
- lp.lv_name = lv->name;
- lp.sign = SIGN_NONE;
- lp.percent = PERCENT_NONE;
- lp.resize = LV_ANY;
- lp.size = new_size >> SECTOR_SHIFT;
- lp.ac_force = 1; /* Assume the user has a good backup? */
- lp.sizeargs = 1;
-
- e = store_user_env(lv->vg->cmd);
+ struct lvresize_params lp = {
+ .lv_name = lv->name,
+ .sign = SIGN_NONE,
+ .percent = PERCENT_NONE,
+ .resize = LV_ANY,
+ .size = new_size >> SECTOR_SHIFT,
+ .ac_force = 1, /* Assume the user has a good backup? */
+ .sizeargs = 1,
+ };
+ struct saved_env e = store_user_env(lv->vg->cmd);
if (!lv_resize_prepare(lv->vg->cmd, lv, &lp, &lv->vg->pvs) ||
!lv_resize(lv->vg->cmd, lv, &lp, &lv->vg->pvs)) {
.pvh = &vg->pvs,
.read_ahead = DM_READ_AHEAD_AUTO,
.stripes = 1,
- .vg_name = vg->name,
.voriginextents = external_lv->le_count,
.voriginsize = external_lv->size,
};