diff options
author | Alasdair Kergon <agk@redhat.com> | 2010-12-10 22:39:52 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2010-12-10 22:39:52 +0000 |
commit | acb037657cf4ffb5b36e20881bdffd954e6249cf (patch) | |
tree | f7189777eb7cc0baa63f7ca30c3cce26fb888147 /lib/cache/lvmcache.c | |
parent | 706edf60d564996ea018573e495c5946872d9062 (diff) | |
download | lvm2-acb037657cf4ffb5b36e20881bdffd954e6249cf.tar.gz lvm2-acb037657cf4ffb5b36e20881bdffd954e6249cf.tar.xz lvm2-acb037657cf4ffb5b36e20881bdffd954e6249cf.zip |
Fix scanning of VGs without in-PV mdas.
Set cmd->independent_metadata_areas if metadata/dirs or disk_areas in use.
- Identify and record this state.
Don't skip full scan when independent mdas are present even if memlock is set.
- Clusters and OOM aren't supported, so no problem doing the proper scans.
Avoid revalidating the label cache immediately after scanning.
- A simple optimisation.
Support scanning for a single VG in independent mdas.
- Not used by the fix but I left it in anyway as later patches might use it.
Diffstat (limited to 'lib/cache/lvmcache.c')
-rw-r--r-- | lib/cache/lvmcache.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index ab16536c..d5455631 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -366,7 +366,7 @@ struct lvmcache_vginfo *vginfo_from_vgname(const char *vgname, const char *vgid) return vginfo; } -const struct format_type *fmt_from_vgname(const char *vgname, const char *vgid) +const struct format_type *fmt_from_vgname(const char *vgname, const char *vgid, unsigned revalidate_labels) { struct lvmcache_vginfo *vginfo; struct lvmcache_info *info; @@ -379,8 +379,16 @@ const struct format_type *fmt_from_vgname(const char *vgname, const char *vgid) if (!(vginfo = vginfo_from_vgname(vgname, vgid))) return NULL; - /* This function is normally called before reading metadata so - * we check cached labels here. Unfortunately vginfo is volatile. */ + /* + * If this function is called repeatedly, only the first one needs to revalidate. + */ + if (!revalidate_labels) + goto out; + + /* + * This function is normally called before reading metadata so + * we check cached labels here. Unfortunately vginfo is volatile. + */ dm_list_init(&devs); dm_list_iterate_items(info, &vginfo->infos) { if (!(devl = dm_malloc(sizeof(*devl)))) { @@ -405,6 +413,7 @@ const struct format_type *fmt_from_vgname(const char *vgname, const char *vgid) strncmp(vginfo->vgid, vgid_found, ID_LEN)) return NULL; +out: return vginfo->fmt; } @@ -588,10 +597,10 @@ int lvmcache_label_scan(struct cmd_context *cmd, int full_scan) _has_scanned = 1; /* Perform any format-specific scanning e.g. text files */ - dm_list_iterate_items(fmt, &cmd->formats) { - if (fmt->ops->scan && !fmt->ops->scan(fmt)) - goto out; - } + if (cmd->independent_metadata_areas) + dm_list_iterate_items(fmt, &cmd->formats) + if (fmt->ops->scan && !fmt->ops->scan(fmt, NULL)) + goto out; /* * If we are a long-lived process, write out the updated persistent |