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

Rename vg_read() to vg_read_internal(). (mornfall)

This commit is contained in:
Alasdair Kergon 2009-01-26 19:01:32 +00:00
parent 302125622a
commit 8544a8a254
12 changed files with 30 additions and 29 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.45 -
===================================
Rename vg_read() to vg_read_internal().
Version 2.02.44 - 26th January 2009
===================================

View File

@ -711,7 +711,7 @@ void lvm_do_backup(const char *vgname)
DEBUGLOG("Triggering backup of VG metadata for %s. suspended=%d\n", vgname, suspended);
vg = vg_read(cmd, vgname, NULL /*vgid*/, &consistent);
vg = vg_read_internal(cmd, vgname, NULL /*vgid*/, &consistent);
if (vg) {
if (consistent)
check_current_backup(vg);

View File

@ -76,7 +76,7 @@ struct pv_segment;
written out in metadata*/
//#define POSTORDER_FLAG 0x02000000U /* Not real flags, reserved for
//#define POSTORDER_OPEN_FLAG 0x04000000U temporary use inside vg_read. */
//#define POSTORDER_OPEN_FLAG 0x04000000U temporary use inside vg_read_internal. */
#define LVM_READ 0x00000100U /* LV VG */
#define LVM_WRITE 0x00000200U /* LV VG */
@ -328,7 +328,7 @@ struct lv_list {
int vg_write(struct volume_group *vg);
int vg_commit(struct volume_group *vg);
int vg_revert(struct volume_group *vg);
struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vg_name,
const char *vgid, int *consistent);
struct physical_volume *pv_read(struct cmd_context *cmd, const char *pv_name,
struct dm_list *mdas, uint64_t *label_sector,

View File

@ -224,8 +224,8 @@ int get_pv_from_vg_by_id(const struct format_type *fmt, const char *vg_name,
struct pv_list *pvl;
int consistent = 0;
if (!(vg = vg_read(fmt->cmd, vg_name, vgid, &consistent))) {
log_error("get_pv_from_vg_by_id: vg_read failed to read VG %s",
if (!(vg = vg_read_internal(fmt->cmd, vg_name, vgid, &consistent))) {
log_error("get_pv_from_vg_by_id: vg_read_internal failed to read VG %s",
vg_name);
return 0;
}
@ -503,7 +503,7 @@ struct volume_group *vg_create(struct cmd_context *cmd, const char *vg_name,
return_NULL;
/* is this vg name already in use ? */
if (vg_read(cmd, vg_name, NULL, &consistent)) {
if (vg_read_internal(cmd, vg_name, NULL, &consistent)) {
log_err("A volume group called '%s' already exists.", vg_name);
goto bad;
}
@ -1684,12 +1684,12 @@ int vg_missing_pv_count(const vg_t *vg)
return ret;
}
/* Caller sets consistent to 1 if it's safe for vg_read to correct
/* Caller sets consistent to 1 if it's safe for vg_read_internal to correct
* inconsistent metadata on disk (i.e. the VG write lock is held).
* This guarantees only consistent metadata is returned.
* If consistent is 0, caller must check whether consistent == 1 on return
* and take appropriate action if it isn't (e.g. abort; get write lock
* and call vg_read again).
* and call vg_read_internal again).
*
* If precommitted is set, use precommitted metadata if present.
*
@ -1716,7 +1716,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
if (is_orphan_vg(vgname)) {
if (use_precommitted) {
log_error("Internal error: vg_read requires vgname "
log_error("Internal error: vg_read_internal requires vgname "
"with pre-commit.");
return NULL;
}
@ -1974,7 +1974,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
return correct_vg;
}
struct volume_group *vg_read(struct cmd_context *cmd, const char *vgname,
struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vgname,
const char *vgid, int *consistent)
{
struct volume_group *vg;
@ -2002,7 +2002,7 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vgname,
/* This is only called by lv_from_lvid, which is only called from
* activate.c so we know the appropriate VG lock is already held and
* the vg_read is therefore safe.
* the vg_read_internal is therefore safe.
*/
static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
const char *vgid,
@ -2034,7 +2034,7 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
if (memlock())
return NULL;
/* FIXME Need a genuine read by ID here - don't vg_read by name! */
/* FIXME Need a genuine read by ID here - don't vg_read_internal by name! */
/* FIXME Disabled vgrenames while active for now because we aren't
* allowed to do a full scan here any more. */
@ -2218,7 +2218,7 @@ static int _get_pvs(struct cmd_context *cmd, struct dm_list **pvslist)
stack;
continue;
}
if (!(vg = vg_read(cmd, vgname, vgid, &consistent))) {
if (!(vg = vg_read_internal(cmd, vgname, vgid, &consistent))) {
stack;
continue;
}
@ -2446,7 +2446,7 @@ vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name,
return NULL;
}
if (!(vg = vg_read(cmd, vg_name, vgid, &consistent)) ||
if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent)) ||
((misc_flags & FAIL_INCONSISTENT) && !consistent)) {
log_error("Volume group \"%s\" not found", vg_name);
unlock_vg(cmd, vg_name);

View File

@ -79,7 +79,7 @@
// written out in metadata*/
#define POSTORDER_FLAG 0x02000000U /* Not real flags, reserved for */
#define POSTORDER_OPEN_FLAG 0x04000000U /* temporary use inside vg_read. */
#define POSTORDER_OPEN_FLAG 0x04000000U /* temporary use inside vg_read_internal. */
//#define LVM_READ 0x00000100U /* LV VG */
//#define LVM_WRITE 0x00000200U /* LV VG */

View File

@ -37,7 +37,7 @@ static int _pvdisplay_single(struct cmd_context *cmd,
/*
* Replace possibly incomplete PV structure with new one
* allocated in vg_read() path.
* allocated in vg_read_internal() path.
*/
if (!(pvl = find_pv_in_vg(vg, pv_name))) {
log_error("Unable to find \"%s\" in volume group \"%s\"",

View File

@ -62,7 +62,7 @@ static int _pv_resize_single(struct cmd_context *cmd,
return 0;
}
if (!(vg = vg_read(cmd, vg_name, NULL, &consistent))) {
if (!(vg = vg_read_internal(cmd, vg_name, NULL, &consistent))) {
unlock_vg(cmd, vg_name);
log_error("Unable to find volume group of \"%s\"",
pv_name);

View File

@ -136,7 +136,7 @@ static int _pvs_single(struct cmd_context *cmd, struct volume_group *vg,
/*
* Replace possibly incomplete PV structure with new one
* allocated in vg_read() path.
* allocated in vg_read_internal() path.
*/
if (!(pvl = find_pv_in_vg(vg, pv_dev_name(pv)))) {
log_error("Unable to find \"%s\" in volume group \"%s\"",

View File

@ -291,7 +291,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
consistent = 1;
else
consistent = 0;
if (!(vg = vg_read(cmd, vgname, NULL, &consistent)) || !consistent) {
if (!(vg = vg_read_internal(cmd, vgname, NULL, &consistent)) || !consistent) {
unlock_vg(cmd, vgname);
if (!vg)
log_error("Volume group \"%s\" "
@ -433,7 +433,7 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name,
}
log_verbose("Finding volume group \"%s\"", vg_name);
if (!(vg = vg_read(cmd, vg_name, vgid, &consistent))) {
if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent))) {
log_error("Volume group \"%s\" not found", vg_name);
unlock_vg(cmd, vg_name);
return ECMD_FAILED;
@ -720,7 +720,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
log_error("Can't lock %s: skipping", sll->str);
continue;
}
if (!(vg = vg_read(cmd, sll->str, NULL, &consistent))) {
if (!(vg = vg_read_internal(cmd, sll->str, NULL, &consistent))) {
log_error("Volume group \"%s\" not found", sll->str);
unlock_vg(cmd, sll->str);
ret_max = ECMD_FAILED;
@ -1143,7 +1143,7 @@ struct volume_group *recover_vg(struct cmd_context *cmd, const char *vgname,
return NULL;
}
return vg_read(cmd, vgname, NULL, &consistent);
return vg_read_internal(cmd, vgname, NULL, &consistent);
}
int apply_lvname_restrictions(const char *name)

View File

@ -426,7 +426,7 @@ static int _vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
vg->free_count -= pv_pe_count(pv) - pv_pe_alloc_count(pv);
vg->extent_count -= pv_pe_count(pv);
if(!(orphan_vg = vg_read(cmd, vg->fid->fmt->orphan_vg_name, NULL, &consistent)) ||
if(!(orphan_vg = vg_read_internal(cmd, vg->fid->fmt->orphan_vg_name, NULL, &consistent)) ||
!consistent) {
log_error("Unable to read existing orphan PVs");
unlock_vg(cmd, VG_ORPHANS);
@ -520,7 +520,7 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
return ECMD_FAILED;
}
if ((!(vg = vg_read(cmd, vg_name, NULL, &consistent)) || !consistent)
if ((!(vg = vg_read_internal(cmd, vg_name, NULL, &consistent)) || !consistent)
&& !repairing) {
log_error("Volume group \"%s\" doesn't exist", vg_name);
unlock_vg(cmd, vg_name);
@ -541,7 +541,7 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
}
consistent = !arg_count(cmd, force_ARG);
if (!(vg = vg_read(cmd, vg_name, NULL, &consistent))) {
if (!(vg = vg_read_internal(cmd, vg_name, NULL, &consistent))) {
log_error("Volume group \"%s\" not found", vg_name);
unlock_vg(cmd, vg_name);
return ECMD_FAILED;

View File

@ -75,7 +75,7 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path,
return 0;
}
if (!(vg = vg_read(cmd, vg_name_old, vgid, &consistent)) || !consistent) {
if (!(vg = vg_read_internal(cmd, vg_name_old, vgid, &consistent)) || !consistent) {
log_error("Volume group %s %s%s%snot found.", vg_name_old,
vgid ? "(" : "", vgid ? vgid : "", vgid ? ") " : "");
unlock_vg(cmd, vg_name_old);
@ -107,7 +107,7 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path,
}
consistent = 0;
if ((vg_new = vg_read(cmd, vg_name_new, NULL, &consistent))) {
if ((vg_new = vg_read_internal(cmd, vg_name_new, NULL, &consistent))) {
log_error("New volume group \"%s\" already exists",
vg_name_new);
goto error;

View File

@ -334,7 +334,7 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
}
consistent = 0;
if ((vg_to = vg_read(cmd, vg_name_to, NULL, &consistent))) {
if ((vg_to = vg_read_internal(cmd, vg_name_to, NULL, &consistent))) {
existing_vg = 1;
if (new_vg_option_specified(cmd)) {
log_error("Volume group \"%s\" exists, but new VG "
@ -451,7 +451,7 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
*/
consistent = 1;
if (!test_mode() &&
(!(vg_to = vg_read(cmd, vg_name_to, NULL, &consistent)) ||
(!(vg_to = vg_read_internal(cmd, vg_name_to, NULL, &consistent)) ||
!consistent)) {
log_error("Volume group \"%s\" became inconsistent: please "
"fix manually", vg_name_to);