From: Dave Wysochanski Date: Tue, 15 Sep 2009 18:35:13 +0000 (+0000) Subject: Add vg_is_resizeable() and cleanup references. X-Git-Tag: v2_02_91~2651 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=68fac97a070b40f69444dd7b6055a3572289ee8d;p=lvm2.git 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. --- diff --git a/WHATS_NEW b/WHATS_NEW index 05ce2ef8f..f2b6234b2 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.53 - ===================================== + Add vg_is_resizeable() and cleanup reference to VG_RESIZEABLE. Version 2.02.52 - 15th September 2009 ===================================== diff --git a/lib/display/display.c b/lib/display/display.c index 058b08437..62f30f648 100644 --- a/lib/display/display.c +++ b/lib/display/display.c @@ -598,7 +598,7 @@ void vgdisplay_full(const struct volume_group *vg) access_str == 0 ? "error" : ""); log_print("VG Status %s%sresizable", vg_is_exported(vg) ? "exported/" : "", - vg->status & RESIZEABLE_VG ? "" : "NOT "); + vg_is_resizeable(vg) ? "" : "NOT "); /* vg number not part of LVM2 design log_print ("VG # %u\n", vg->vg_number); */ diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c index 070ffafa4..1160d09ba 100644 --- a/lib/format1/import-export.c +++ b/lib/format1/import-export.c @@ -278,7 +278,7 @@ int export_vg(struct vg_disk *vgd, struct volume_group *vg) if (vg_is_exported(vg)) vgd->vg_status |= VG_EXPORTED; - if (vg->status & RESIZEABLE_VG) + if (vg_is_resizeable(vg)) vgd->vg_status |= VG_EXTENDABLE; vgd->lv_max = vg->max_lv; diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index 0861f4d59..50f0b90d8 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -722,6 +722,7 @@ uint64_t vg_max_lv(const 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_exported(vg) (vg_status((vg)) & EXPORTED_VG) +#define vg_is_resizeable(vg) (vg_status((vg)) & RESIZEABLE_VG) struct vgcreate_params { char *vg_name; diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 79e0016f8..263c705fd 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -865,7 +865,7 @@ int vg_set_extent_size(struct volume_group *vg, uint32_t new_size) struct pv_segment *pvseg; uint32_t s; - if (!(vg_status(vg) & RESIZEABLE_VG)) { + if (!vg_is_resizeable(vg)) { log_error("Volume group \"%s\" must be resizeable " "to change PE size", vg->name); 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) { - if (!(vg_status(vg) & RESIZEABLE_VG)) { + if (!vg_is_resizeable(vg)) { log_error("Volume group \"%s\" must be resizeable " "to change MaxLogicalVolume", vg->name); 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) { - if (!(vg_status(vg) & RESIZEABLE_VG)) { + if (!vg_is_resizeable(vg)) { log_error("Volume group \"%s\" must be resizeable " "to change MaxPhysicalVolumes", vg->name); return 0; @@ -3148,7 +3148,7 @@ static uint32_t _vg_bad_status_bits(const struct volume_group *vg, } if ((status & EXPORTED_VG) && - (vg->status & EXPORTED_VG)) { + vg_is_exported(vg)) { log_error("Volume group %s is exported", vg->name); failure |= FAILED_EXPORTED; } @@ -3160,7 +3160,7 @@ static uint32_t _vg_bad_status_bits(const struct volume_group *vg, } if ((status & RESIZEABLE_VG) && - !(vg->status & RESIZEABLE_VG)) { + !vg_is_resizeable(vg)) { log_error("Volume group %s is not resizeable.", vg->name); failure |= FAILED_RESIZEABLE; } @@ -3311,8 +3311,7 @@ bad: * - metadata inconsistent and automatic correction failed: FAILED_INCONSISTENT * - VG is read-only: FAILED_READ_ONLY * - VG is EXPORTED, unless flags has READ_ALLOW_EXPORTED: FAILED_EXPORTED - * - VG is not RESIZEABLE, unless flags has ALLOW_NONRESIZEABLE: - * FAILED_RESIZEABLE + * - VG is not RESIZEABLE: FAILED_RESIZEABLE * - locking failed: FAILED_LOCKING * * On failures, all locks are released, unless one of the following applies: diff --git a/lib/report/report.c b/lib/report/report.c index a6569b4dd..15354e725 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -429,7 +429,7 @@ static int _vgstatus_disp(struct dm_report *rh __attribute((unused)), struct dm_ else repstr[0] = 'r'; - if (vg->status & RESIZEABLE_VG) + if (vg_is_resizeable(vg)) repstr[1] = 'z'; else repstr[1] = '-'; diff --git a/tools/vgchange.c b/tools/vgchange.c index c74116caf..95b0b48ca 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -212,13 +212,13 @@ static int _vgchange_resizeable(struct cmd_context *cmd, { 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", vg->name); 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", vg->name); return ECMD_FAILED;