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

Add vg_is_resizeable() and cleanup references.

Clean up VG_RESIZEABLE flag by creating vg_is_resizeable().
Update comment - we no longer have ALLOW_RESIZEABLE.
Also use vg_is_exported() in one place missed by earlier patch.
Should be no functional change.
This commit is contained in:
Dave Wysochanski 2009-09-15 18:35:13 +00:00
parent 2ae1562664
commit 68fac97a07
7 changed files with 13 additions and 12 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.53 - Version 2.02.53 -
===================================== =====================================
Add vg_is_resizeable() and cleanup reference to VG_RESIZEABLE.
Version 2.02.52 - 15th September 2009 Version 2.02.52 - 15th September 2009
===================================== =====================================

View File

@ -598,7 +598,7 @@ void vgdisplay_full(const struct volume_group *vg)
access_str == 0 ? "error" : ""); access_str == 0 ? "error" : "");
log_print("VG Status %s%sresizable", log_print("VG Status %s%sresizable",
vg_is_exported(vg) ? "exported/" : "", vg_is_exported(vg) ? "exported/" : "",
vg->status & RESIZEABLE_VG ? "" : "NOT "); vg_is_resizeable(vg) ? "" : "NOT ");
/* vg number not part of LVM2 design /* vg number not part of LVM2 design
log_print ("VG # %u\n", vg->vg_number); log_print ("VG # %u\n", vg->vg_number);
*/ */

View File

@ -278,7 +278,7 @@ int export_vg(struct vg_disk *vgd, struct volume_group *vg)
if (vg_is_exported(vg)) if (vg_is_exported(vg))
vgd->vg_status |= VG_EXPORTED; vgd->vg_status |= VG_EXPORTED;
if (vg->status & RESIZEABLE_VG) if (vg_is_resizeable(vg))
vgd->vg_status |= VG_EXTENDABLE; vgd->vg_status |= VG_EXTENDABLE;
vgd->lv_max = vg->max_lv; vgd->lv_max = vg->max_lv;

View File

@ -722,6 +722,7 @@ uint64_t vg_max_lv(const struct volume_group *vg);
int vg_check_write_mode(struct volume_group *vg); int vg_check_write_mode(struct volume_group *vg);
#define vg_is_clustered(vg) (vg_status((vg)) & CLUSTERED) #define vg_is_clustered(vg) (vg_status((vg)) & CLUSTERED)
#define vg_is_exported(vg) (vg_status((vg)) & EXPORTED_VG) #define vg_is_exported(vg) (vg_status((vg)) & EXPORTED_VG)
#define vg_is_resizeable(vg) (vg_status((vg)) & RESIZEABLE_VG)
struct vgcreate_params { struct vgcreate_params {
char *vg_name; char *vg_name;

View File

@ -865,7 +865,7 @@ int vg_set_extent_size(struct volume_group *vg, uint32_t new_size)
struct pv_segment *pvseg; struct pv_segment *pvseg;
uint32_t s; uint32_t s;
if (!(vg_status(vg) & RESIZEABLE_VG)) { if (!vg_is_resizeable(vg)) {
log_error("Volume group \"%s\" must be resizeable " log_error("Volume group \"%s\" must be resizeable "
"to change PE size", vg->name); "to change PE size", vg->name);
return 0; return 0;
@ -1003,7 +1003,7 @@ int vg_set_extent_size(struct volume_group *vg, uint32_t new_size)
int vg_set_max_lv(struct volume_group *vg, uint32_t max_lv) int vg_set_max_lv(struct volume_group *vg, uint32_t max_lv)
{ {
if (!(vg_status(vg) & RESIZEABLE_VG)) { if (!vg_is_resizeable(vg)) {
log_error("Volume group \"%s\" must be resizeable " log_error("Volume group \"%s\" must be resizeable "
"to change MaxLogicalVolume", vg->name); "to change MaxLogicalVolume", vg->name);
return 0; return 0;
@ -1031,7 +1031,7 @@ int vg_set_max_lv(struct volume_group *vg, uint32_t max_lv)
int vg_set_max_pv(struct volume_group *vg, uint32_t max_pv) int vg_set_max_pv(struct volume_group *vg, uint32_t max_pv)
{ {
if (!(vg_status(vg) & RESIZEABLE_VG)) { if (!vg_is_resizeable(vg)) {
log_error("Volume group \"%s\" must be resizeable " log_error("Volume group \"%s\" must be resizeable "
"to change MaxPhysicalVolumes", vg->name); "to change MaxPhysicalVolumes", vg->name);
return 0; return 0;
@ -3148,7 +3148,7 @@ static uint32_t _vg_bad_status_bits(const struct volume_group *vg,
} }
if ((status & EXPORTED_VG) && if ((status & EXPORTED_VG) &&
(vg->status & EXPORTED_VG)) { vg_is_exported(vg)) {
log_error("Volume group %s is exported", vg->name); log_error("Volume group %s is exported", vg->name);
failure |= FAILED_EXPORTED; failure |= FAILED_EXPORTED;
} }
@ -3160,7 +3160,7 @@ static uint32_t _vg_bad_status_bits(const struct volume_group *vg,
} }
if ((status & RESIZEABLE_VG) && if ((status & RESIZEABLE_VG) &&
!(vg->status & RESIZEABLE_VG)) { !vg_is_resizeable(vg)) {
log_error("Volume group %s is not resizeable.", vg->name); log_error("Volume group %s is not resizeable.", vg->name);
failure |= FAILED_RESIZEABLE; failure |= FAILED_RESIZEABLE;
} }
@ -3311,8 +3311,7 @@ bad:
* - metadata inconsistent and automatic correction failed: FAILED_INCONSISTENT * - metadata inconsistent and automatic correction failed: FAILED_INCONSISTENT
* - VG is read-only: FAILED_READ_ONLY * - VG is read-only: FAILED_READ_ONLY
* - VG is EXPORTED, unless flags has READ_ALLOW_EXPORTED: FAILED_EXPORTED * - VG is EXPORTED, unless flags has READ_ALLOW_EXPORTED: FAILED_EXPORTED
* - VG is not RESIZEABLE, unless flags has ALLOW_NONRESIZEABLE: * - VG is not RESIZEABLE: FAILED_RESIZEABLE
* FAILED_RESIZEABLE
* - locking failed: FAILED_LOCKING * - locking failed: FAILED_LOCKING
* *
* On failures, all locks are released, unless one of the following applies: * On failures, all locks are released, unless one of the following applies:

View File

@ -429,7 +429,7 @@ static int _vgstatus_disp(struct dm_report *rh __attribute((unused)), struct dm_
else else
repstr[0] = 'r'; repstr[0] = 'r';
if (vg->status & RESIZEABLE_VG) if (vg_is_resizeable(vg))
repstr[1] = 'z'; repstr[1] = 'z';
else else
repstr[1] = '-'; repstr[1] = '-';

View File

@ -212,13 +212,13 @@ static int _vgchange_resizeable(struct cmd_context *cmd,
{ {
int resizeable = !strcmp(arg_str_value(cmd, resizeable_ARG, "n"), "y"); int resizeable = !strcmp(arg_str_value(cmd, resizeable_ARG, "n"), "y");
if (resizeable && (vg_status(vg) & RESIZEABLE_VG)) { if (resizeable && vg_is_resizeable(vg)) {
log_error("Volume group \"%s\" is already resizeable", log_error("Volume group \"%s\" is already resizeable",
vg->name); vg->name);
return ECMD_FAILED; return ECMD_FAILED;
} }
if (!resizeable && !(vg_status(vg) & RESIZEABLE_VG)) { if (!resizeable && !vg_is_resizeable(vg)) {
log_error("Volume group \"%s\" is already not resizeable", log_error("Volume group \"%s\" is already not resizeable",
vg->name); vg->name);
return ECMD_FAILED; return ECMD_FAILED;