diff options
author | David Teigland <teigland@redhat.com> | 2016-03-29 13:29:39 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2016-05-02 16:10:11 -0500 |
commit | b8e5b6d05ceb209fb744774d4c9e53c9ee6f48f5 (patch) | |
tree | 26bfcffa06d8923965e64745ef15f1f8aca33eae | |
parent | 1f22588afaea3e5787a8196b6f129b7e8c724189 (diff) | |
download | lvm2-b8e5b6d05ceb209fb744774d4c9e53c9ee6f48f5.tar.gz |
lvmcache: prefer duplicate device used by LVs
-rw-r--r-- | lib/cache/lvmcache.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index f04f7eaa8..85fbf4789 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -825,6 +825,7 @@ static void _choose_preferred_devs(struct cmd_context *cmd, int in_subsys1, in_subsys2; int is_dm1, is_dm2; int has_fs1, has_fs2; + int has_lv1, has_lv2; int change; /* @@ -880,6 +881,9 @@ next: dev2_major = MAJOR(dev2->dev); dev2_minor = MINOR(dev2->dev); + has_lv1 = (dev1->flags & DEV_USED_FOR_LV) ? 1 : 0; + has_lv2 = (dev2->flags & DEV_USED_FOR_LV) ? 1 : 0; + in_subsys1 = dev_subsystem_part_major(dt, dev1); in_subsys2 = dev_subsystem_part_major(dt, dev2); @@ -892,14 +896,19 @@ next: log_debug_cache("PV %s compare duplicates %s and %s", devl->dev->pvid, dev_name(dev1), dev_name(dev2)); - log_debug_cache("dup dev1 %s subsys %d dm %d fs %d", - dev_name(dev1), in_subsys1, is_dm1, has_fs1); - log_debug_cache("dup dev2 %s subsys %d dm %d fs %d", - dev_name(dev2), in_subsys2, is_dm2, has_fs2); + log_debug_cache("dup dev1 %s subsys %d dm %d fs %d lv %d", + dev_name(dev1), in_subsys1, is_dm1, has_fs1, has_lv1); + log_debug_cache("dup dev2 %s subsys %d dm %d fs %d lv %d", + dev_name(dev2), in_subsys2, is_dm2, has_fs2, has_lv2); change = 0; - if (has_fs1 && !has_fs2) { + if (has_lv1 && !has_lv2) { + /* keep 1 */ + } else if (has_lv2 && !has_lv1) { + /* change to 2 */ + change = 1; + } else if (has_fs1 && !has_fs2) { /* keep 1 */ } else if (has_fs2 && !has_fs1) { /* change to 2 */ @@ -925,7 +934,7 @@ next: id_write_format((const struct id *)info->dev->pvid, uuid, sizeof(uuid)); if (dev1 != info->dev) { - log_warn("PV %s is using preferred device %s, changed from %s", + log_warn("WARNING: PV %s prefers device %s instead of device %s.", uuid, dev_name(dev1), dev_name(info->dev)); /* * Move the preferred device from altdevs to add_cache_devs. @@ -940,8 +949,7 @@ next: dm_list_add(del_cache_devs, &del->list); } } else { - log_warn("PV %s is using preferred device %s", - uuid, dev_name(info->dev)); + log_warn("WARNING: PV %s prefers device %s.", uuid, dev_name(info->dev)); } /* |