[lvm-devel] [PATCH 2/5] Remove vg_validate call when parsing cached metadata.

Zdenek Kabelac zkabelac at redhat.com
Wed Mar 31 12:25:40 UTC 2010


On 29.3.2010 15:12, Milan Broz wrote:
> vg_validate call is an adept to optimisation, it is very
> ineeficient and slow.
> 
> Anyway, we should call it only before writing data to disk.
> 
> The call in lvmcache was just temporary validation,
> we realy do not need to revalidate cached metadata
> every time.
> (Actually, I added that there just to prove that cache works
> properly and forgot to remove it.)
> 
> Patch removes it from lvmcache completely, this can hit only
> internal bug in export function (and this bug must
> be detected in any vg_write call anyway before).
> 
> Signed-off-by: Milan Broz <mbroz at redhat.com>
> ---
>  lib/cache/lvmcache.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
> index 0ce034a..9caa216 100644
> --- a/lib/cache/lvmcache.c
> +++ b/lib/cache/lvmcache.c
> @@ -610,8 +610,7 @@ struct volume_group *lvmcache_get_vg(const char *vgid, unsigned precommitted)
>  						      vgid, NULL)))
>  		return_NULL;
>  
> -	if (!(vg = import_vg_from_buffer(vginfo->vgmetadata, fid)) ||
> -	    !vg_validate(vg)) {
> +	if (!(vg = import_vg_from_buffer(vginfo->vgmetadata, fid))) {
>  		_free_cached_vgmetadata(vginfo);
>  		vg_release(vg);
>  		return_NULL;


Ack


We control metadata before write.

Zdenek




More information about the lvm-devel mailing list