diff options
author | Alasdair Kergon <agk@redhat.com> | 2012-02-12 23:01:19 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2012-02-12 23:01:19 +0000 |
commit | b719e3d32322cab34ff258fd456d36eafaa6e593 (patch) | |
tree | f5eb387375cc9f6f8ff4253cb664645120116444 /lib | |
parent | ba14fff2af92264f6eeb5be855365abb1b72185e (diff) | |
download | lvm2-b719e3d32322cab34ff258fd456d36eafaa6e593.tar.gz |
FMT_INSTANCE_VG is redundant now
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cache/lvmcache.c | 2 | ||||
-rw-r--r-- | lib/format1/format1.c | 2 | ||||
-rw-r--r-- | lib/format_pool/format_pool.c | 2 | ||||
-rw-r--r-- | lib/format_text/archive.c | 2 | ||||
-rw-r--r-- | lib/format_text/archiver.c | 6 | ||||
-rw-r--r-- | lib/format_text/format-text.c | 15 | ||||
-rw-r--r-- | lib/metadata/metadata-exported.h | 13 | ||||
-rw-r--r-- | lib/metadata/metadata.c | 40 |
8 files changed, 32 insertions, 50 deletions
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index ffc617719..0de9734f9 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -707,7 +707,7 @@ struct volume_group *lvmcache_get_vg(const char *vgid, unsigned precommitted) if ((vg = vginfo->cached_vg)) goto out; - fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS; + fic.type = FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS; fic.context.vg_ref.vg_name = vginfo->vgname; fic.context.vg_ref.vg_id = vgid; if (!(fid = vginfo->fmt->ops->create_instance(vginfo->fmt, &fic))) diff --git a/lib/format1/format1.c b/lib/format1/format1.c index ee3d72515..88a961107 100644 --- a/lib/format1/format1.c +++ b/lib/format1/format1.c @@ -609,7 +609,7 @@ struct format_type *init_format(struct cmd_context *cmd) log_error("Couldn't create lvm1 orphan VG."); return NULL; } - fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_AUX_MDAS; + fic.type = FMT_INSTANCE_AUX_MDAS; fic.context.vg_ref.vg_name = fmt->orphan_vg_name; fic.context.vg_ref.vg_id = NULL; if (!(fid = _format1_create_instance(fmt, &fic))) { diff --git a/lib/format_pool/format_pool.c b/lib/format_pool/format_pool.c index ec0abd1d2..eac166017 100644 --- a/lib/format_pool/format_pool.c +++ b/lib/format_pool/format_pool.c @@ -322,7 +322,7 @@ struct format_type *init_format(struct cmd_context *cmd) log_error("Couldn't create lvm1 orphan VG."); return NULL; } - fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_AUX_MDAS; + fic.type = FMT_INSTANCE_AUX_MDAS; fic.context.vg_ref.vg_name = fmt->orphan_vg_name; fic.context.vg_ref.vg_id = NULL; if (!(fid = _pool_create_instance(fmt, &fic))) { diff --git a/lib/format_text/archive.c b/lib/format_text/archive.c index c9fd0e902..c9611501d 100644 --- a/lib/format_text/archive.c +++ b/lib/format_text/archive.c @@ -310,7 +310,7 @@ static void _display_archive(struct cmd_context *cmd, struct archive_file *af) log_print(" "); log_print("File:\t\t%s", af->path); - fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_PRIVATE_MDAS; + fic.type = FMT_INSTANCE_PRIVATE_MDAS; fic.context.private = &tc; if (!(tf = cmd->fmt_backup->ops->create_instance(cmd->fmt_backup, &fic))) { log_error("Couldn't create text instance object."); diff --git a/lib/format_text/archiver.c b/lib/format_text/archiver.c index 0efdcb840..b371dc9e6 100644 --- a/lib/format_text/archiver.c +++ b/lib/format_text/archiver.c @@ -279,7 +279,7 @@ struct volume_group *backup_read_vg(struct cmd_context *cmd, .desc = cmd->cmd_line}; struct metadata_area *mda; - fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_PRIVATE_MDAS; + fic.type = FMT_INSTANCE_PRIVATE_MDAS; fic.context.private = &tc; if (!(tf = cmd->fmt_backup->ops->create_instance(cmd->fmt_backup, &fic))) { log_error("Couldn't create text format object."); @@ -312,7 +312,7 @@ int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg) */ /* Attempt to write out using currently active format */ - fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_AUX_MDAS; + fic.type = FMT_INSTANCE_AUX_MDAS; fic.context.vg_ref.vg_name = vg->name; fic.context.vg_ref.vg_id = NULL; if (!(fid = cmd->fmt->ops->create_instance(cmd->fmt, &fic))) { @@ -409,7 +409,7 @@ int backup_to_file(const char *file, const char *desc, struct volume_group *vg) log_verbose("Creating volume group backup \"%s\" (seqno %u).", file, vg->seqno); - fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_PRIVATE_MDAS; + fic.type = FMT_INSTANCE_PRIVATE_MDAS; fic.context.private = &tc; if (!(tf = cmd->fmt_backup->ops->create_instance(cmd->fmt_backup, &fic))) { log_error("Couldn't create backup object."); diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index 94e63b3b7..7781a9362 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -1084,7 +1084,7 @@ static int _scan_file(const struct format_type *fmt, const char *vgname) /* FIXME stat file to see if it's changed */ /* FIXME: Check this fid is OK! */ - fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_PRIVATE_MDAS; + fic.type = FMT_INSTANCE_PRIVATE_MDAS; fic.context.private = NULL; fid = _text_create_text_instance(fmt, &fic); if ((vg = _vg_read_file_name(fid, scanned_vgname, @@ -1513,7 +1513,7 @@ static int _text_pv_initialise(const struct format_type *fmt, static void _text_destroy_instance(struct format_instance *fid) { if (--fid->ref_count <= 1) { - if (fid->type & FMT_INSTANCE_VG && fid->metadata_areas_index) + if (fid->metadata_areas_index) dm_hash_destroy(fid->metadata_areas_index); dm_pool_destroy(fid->mem); } @@ -1671,12 +1671,6 @@ static int _text_pv_setup(const struct format_type *fmt, return 1; } -static int _create_pv_text_instance(struct format_instance *fid, - const struct format_instance_ctx *fic) -{ - return 0; /* just fail */ -} - static void *_create_text_context(struct dm_pool *mem, struct text_context *tc) { struct text_context *new_tc; @@ -2173,8 +2167,7 @@ static struct format_instance *_text_create_text_instance(const struct format_ty if (!(fid = alloc_fid(fmt, fic))) return_NULL; - if (fid->type & FMT_INSTANCE_VG ? _create_vg_text_instance(fid, fic) : - _create_pv_text_instance(fid, fic)) + if (_create_vg_text_instance(fid, fic)) return fid; dm_pool_destroy(fid->mem); @@ -2342,7 +2335,7 @@ struct format_type *create_text_format(struct cmd_context *cmd) return NULL; } - fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_AUX_MDAS; + fic.type = FMT_INSTANCE_AUX_MDAS; fic.context.vg_ref.vg_name = fmt->orphan_vg_name; fic.context.vg_ref.vg_id = NULL; if (!(fid = _text_create_text_instance(fmt, &fic))) { diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index 73d15e279..f1d6d6989 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -199,20 +199,15 @@ struct pv_segment { #define pvseg_is_allocated(pvseg) ((pvseg)->lvseg) /* - * These flags define the type of the format instance to be created. - * There used to be a PV-based type, but all are now VG-based. - * We can further control the format_instance initialisation and functionality - * by using the other flags. Today, the primary role of the format_instance - * is to temporarily store metadata area information we are working with. More - * flags can be defined to cover even more functionality in the future... + * Properties of each format instance type. + * The primary role of the format_instance is to temporarily store metadata + * area information we are working with. */ -/* VG-based format instance */ -#define FMT_INSTANCE_VG 0x00000001U - /* Include any existing PV mdas during format_instance initialisation */ #define FMT_INSTANCE_MDAS 0x00000002U +/* FIXME Define auxiliary here! */ /* Include any auxiliary mdas during format_instance intialisation */ #define FMT_INSTANCE_AUX_MDAS 0x00000004U diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 01ce2b837..587617460 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -956,7 +956,7 @@ struct volume_group *vg_create(struct cmd_context *cmd, const char *vg_name) vg->pv_count = 0; - fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS; + fic.type = FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS; fic.context.vg_ref.vg_name = vg_name; fic.context.vg_ref.vg_id = NULL; if (!(fid = cmd->fmt->ops->create_instance(cmd->fmt, &fic))) { @@ -2940,7 +2940,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd, use_precommitted = 0; /* create format instance with appropriate metadata area */ - fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS; + fic.type = FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS; fic.context.vg_ref.vg_name = vgname; fic.context.vg_ref.vg_id = vgid; if (!(fid = fmt->ops->create_instance(fmt, &fic))) { @@ -3120,7 +3120,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd, use_precommitted = 0; /* create format instance with appropriate metadata area */ - fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS; + fic.type = FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS; fic.context.vg_ref.vg_name = vgname; fic.context.vg_ref.vg_id = vgid; if (!(fid = fmt->ops->create_instance(fmt, &fic))) { @@ -4207,14 +4207,12 @@ int fid_add_mda(struct format_instance *fid, struct metadata_area *mda, return 1; /* Add metadata area to index. */ - if (fid->type & FMT_INSTANCE_VG) { - if (!_convert_key_to_string(key, key_len, sub_key, - full_key, sizeof(full_key))) - return_0; + if (!_convert_key_to_string(key, key_len, sub_key, + full_key, sizeof(full_key))) + return_0; - dm_hash_insert(fid->metadata_areas_index, - full_key, mda); - } + dm_hash_insert(fid->metadata_areas_index, + full_key, mda); return 1; } @@ -4245,13 +4243,11 @@ struct metadata_area *fid_get_mda_indexed(struct format_instance *fid, struct metadata_area *mda = NULL; - if (fid->type & FMT_INSTANCE_VG) { - if (!_convert_key_to_string(key, key_len, sub_key, - full_key, sizeof(full_key))) - return_NULL; - mda = (struct metadata_area *) dm_hash_lookup(fid->metadata_areas_index, - full_key); - } + if (!_convert_key_to_string(key, key_len, sub_key, + full_key, sizeof(full_key))) + return_NULL; + mda = (struct metadata_area *) dm_hash_lookup(fid->metadata_areas_index, + full_key); return mda; } @@ -4278,13 +4274,11 @@ int fid_remove_mda(struct format_instance *fid, struct metadata_area *mda, mda = mda_indexed; - if (fid->type & FMT_INSTANCE_VG) { - if (!_convert_key_to_string(key, key_len, sub_key, - full_key, sizeof(full_key))) - return_0; + if (!_convert_key_to_string(key, key_len, sub_key, + full_key, sizeof(full_key))) + return_0; - dm_hash_remove(fid->metadata_areas_index, full_key); - } + dm_hash_remove(fid->metadata_areas_index, full_key); } dm_list_del(&mda->list); |