[lvm-devel] [PATCH 05/11] Add pv_initialise to format_handler interface.
Zdenek Kabelac
zkabelac at redhat.com
Thu Nov 25 13:28:18 UTC 2010
Dne 18.11.2010 22:32, Peter Rajnoha napsal(a):
> diff --git a/lib/format1/disk-rep.c b/lib/format1/disk-rep.c
> index bc58744..38cb34d 100644
> --- a/lib/format1/disk-rep.c
> +++ b/lib/format1/disk-rep.c
> @@ -337,6 +337,13 @@ static void __update_lvmcache(const struct format_type *fmt,
>
Interesting - we should not use '__' as prefix in our code - though not
directly related to our code.
> info->device_size = xlate32(dl->pvd.pv_size) << SECTOR_SHIFT;
> dm_list_init(&info->mdas);
> + if (info->mda_slots)
> + dm_free(info->mda_slots);
> + if (!(info->mda_slots = dm_zalloc(FMT_LVM1_MAX_MDAS_PER_PV * sizeof(struct metadata_area *)))) {
> + /* FIXME: Add revert of cache info! */
> + stack;
> + return;
This is yet another reason why we should not play with cache internally - we
may introduce internal consistency problem and may get into the moment when
our cache will represent different data than does we would read from disk.
> +
> + if (!(info->mda_slots = dm_zalloc(FMT_TEXT_MAX_MDAS_PER_PV * sizeof(struct metadata_area *)))) {
> + /* FIXME: Add revert of cache info! */
again quite important case...
> + return 0;
> + }
> +
> + return 1;
> +}
> +
> static void _text_destroy_instance(struct format_instance *fid __attribute__((unused)))
> {
> }
Zdenek
More information about the lvm-devel
mailing list