1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-10-18 03:33:15 +03:00

o Added dev_open and dev_close functions

o  Changed disk-rep to use these

o  if NDEBUG is not defined the dev_cache will check for open devices on
   teardown.

I was hoping this would speed things up.  But I'm still getting:

reti:/home/joe/sistina/LVM2/tools# time ./lvm vgchange -a n
  Volume group vg0 successfully changed

real    0m5.751s
user    0m0.060s
sys     0m0.070s

even though I have only 1 device with the vg on it passing the filters.
This commit is contained in:
Joe Thornber
2001-11-14 10:01:52 +00:00
parent b90fc3a56e
commit 3d95cfb367
6 changed files with 128 additions and 32 deletions

View File

@@ -62,6 +62,7 @@ static struct device *_create_dev(dev_t d)
list_init(&dev->aliases);
dev->dev = d;
dev->fd = -1;
return dev;
}
@@ -297,8 +298,31 @@ int dev_cache_init(void)
return 0;
}
static inline void _check_for_open_devices(void)
{
#ifndef NDEBUG
struct dev_iter *i = dev_iter_create(NULL);
struct device *dev;
if (!i) {
stack;
return;
}
while ((dev = dev_iter_get(i))) {
if (dev->fd >= 0)
log_err("Device '%s' has been left open.",
dev_name(dev));
}
dev_iter_destroy(i);
#endif
}
void dev_cache_exit(void)
{
_check_for_open_devices();
pool_destroy(_cache.mem);
if (_cache.names)
hash_destroy(_cache.names);