1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

activation: do not check for devs without LVM-

Devices without "LVM-" uuid prefix have been generated by very old
version of lvm2 2.00 and 2.01.
Since version 2.02 all lvm2 devices are using prefix "LVM-".

However checking for present of ancient non prefixed devices does
take extra IOCTL per every call and for majority of todays user
it will not find anything new.

So use the assumption that users with kernel 3.X and newer are not
really using such old versions of lvm2 (year <2005) and with their
new kernel they are also using new version of lvm2 and skip
checking for them.

This change also makes trace logs more readable.
This commit is contained in:
Zdenek Kabelac 2016-04-07 21:37:26 +02:00
parent 097a724bda
commit 8b2108e6b1
2 changed files with 24 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.150 -
=================================
Check for devices without LVM- uuid prefix only with kernels < 3.X.
Reuse %FREE size aproximation with lvcreate -l%PVS thin-pool.
Allow the lvmdump directory to exist already provided it is empty.
Show lvconverted percentage with 2 decimal digits.

View File

@ -29,6 +29,7 @@
#include <limits.h>
#include <dirent.h>
#include <sys/utsname.h>
#define MAX_TARGET_PARAMSIZE 50000
#define LVM_UDEV_NOSCAN_FLAG DM_SUBSYSTEM_UDEV_FLAG0
@ -674,6 +675,24 @@ int device_is_usable(struct device *dev, struct dev_usable_check_params check)
return r;
}
/* Returns 1 for kernels >= 3.X, otherwise 0 */
static int _check_new_kernel(void)
{
static int major = 0;
struct utsname _uts;
if (!major) {
if (uname(&_uts) ||
(sscanf(_uts.release, "%d", &major) != 1))
major = 1;
else if (major >= 3)
log_debug("Not checking for devices without prefix "
UUID_PREFIX " with newer kernel.");
}
return (major >= 3);
}
static int _info(const char *dlid, int with_open_count, int with_read_ahead,
struct dm_info *dminfo, uint32_t *read_ahead,
struct lv_seg_status *seg_status)
@ -703,6 +722,10 @@ static int _info(const char *dlid, int with_open_count, int with_read_ahead,
}
}
/* With kernels > 3.X skip checking for devices without UUID_PREFIX */
if (_check_new_kernel())
return r;
/* Check for dlid before UUID_PREFIX was added */
if ((r = _info_run(seg_status ? STATUS : INFO, NULL, dlid + sizeof(UUID_PREFIX) - 1,
dminfo, read_ahead, seg_status, with_open_count,