From 288adea256dba2ef2119481dc410e486ccd54f3a Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Tue, 15 Jan 2002 21:28:04 +0000 Subject: [PATCH] o missing labeller free o updated vgcfgrestore args o change _check_for_open_devices only to check devices present in the hash table instead of using dev_iter which triggers a full scan even when only displaying command line help --- lib/device/dev-cache.c | 24 ++++++++---------------- lib/format1/lvm1_label.c | 1 + tools/commands.h | 5 ++--- tools/lvm.c | 1 + 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c index 6b8ee4b34..ca1f1d56c 100644 --- a/lib/device/dev-cache.c +++ b/lib/device/dev-cache.c @@ -298,25 +298,17 @@ int dev_cache_init(void) return 0; } -static inline void _check_for_open_devices(void) +iterate_fn _check_closed(void *data) { -#ifndef NDEBUG - struct dev_iter *i = dev_iter_create(NULL); - struct device *dev; - - if (!i) { - stack; - return; - } + struct device *dev = (struct device *) data; - while ((dev = dev_iter_get(i))) { - if (dev->fd >= 0) - log_err("Device '%s' has been left open.", - dev_name(dev)); - } + if (dev->fd >= 0) + log_err("Device '%s' has been left open.", dev_name(dev)); +} - dev_iter_destroy(i); -#endif +static inline void _check_for_open_devices(void) +{ + hash_iterate(_cache.names, _check_closed); } void dev_cache_exit(void) diff --git a/lib/format1/lvm1_label.c b/lib/format1/lvm1_label.c index 60766c433..06c6d582b 100644 --- a/lib/format1/lvm1_label.c +++ b/lib/format1/lvm1_label.c @@ -99,6 +99,7 @@ static void _destroy(struct labeller *l) { struct pool *mem = (struct pool *) l->private; pool_destroy(mem); + dbg_free(l); } diff --git a/tools/commands.h b/tools/commands.h index af5250ac6..95d4710db 100644 --- a/tools/commands.h +++ b/tools/commands.h @@ -348,13 +348,12 @@ xx(vgcfgrestore, "\t[-l[l]|--list [--list]]" "\n" "\t[-n|--name VolumeGroupName] " "\n" "\t[-h|--help]" "\n" - "\t[-o|--oldpath OldPhysicalVolumePath] " "\n" "\t[-t|--test] " "\n" "\t[-v|--verbose]" "\n" "\t[--version] " "\n" - "[PhysicalVolumePath]\n", + "\tVolumeGroupName", - file_ARG, list_ARG, name_ARG, oldpath_ARG, test_ARG) + file_ARG, list_ARG, name_ARG, test_ARG) xx(vgchange, "Change volume group attributes", diff --git a/tools/lvm.c b/tools/lvm.c index 8cebf2df9..17a658c76 100644 --- a/tools/lvm.c +++ b/tools/lvm.c @@ -912,6 +912,7 @@ static void _exit_uuid_map(void) uuid_map_destroy(the_um); label_exit(); _lvm1_label->ops->destroy(_lvm1_label); + _lvm1_label = NULL; } static int _get_env_vars(void) -- 2.43.5