master - pvscan: ignore online for unused PV
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a0c848d4e4a9b53fa1f...
Commit: a0c848d4e4a9b53fa1f9cc7a8330fea6b23c07a8
Parent: 07483cc165e210a23627b4b6d5c89f9008c9e950
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Mar 4 14:25:53 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Mar 4 14:25:53 2019 -0600
pvscan: ignore online for unused PV
If an unused PV comes online, ignore it from
pvscan --cache.
---
tools/pvscan.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 389aafa..c484531 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -644,6 +644,8 @@ static int _online_pvscan_one(struct cmd_context *cmd, struct device *dev,
const struct format_type *fmt;
/* Create a dummy instance. */
struct format_instance_ctx fic = { .type = 0 };
+ uint32_t ext_version;
+ uint32_t ext_flags;
int ret = 0;
log_debug("pvscan metadata from dev %s", dev_name(dev));
@@ -667,6 +669,14 @@ static int _online_pvscan_one(struct cmd_context *cmd, struct device *dev,
return 1;
}
+ ext_version = lvmcache_ext_version(info);
+ ext_flags = lvmcache_ext_flags(info);
+
+ if ((ext_version >= 2) && !(ext_flags & PV_EXT_USED)) {
+ log_print("pvscan[%d] PV %s not used.", getpid(), dev_name(dev));
+ return 1;
+ }
+
fmt = lvmcache_fmt(info);
baton.cmd = cmd;
5 years, 1 month
stable-2.02 - dmsetup: Fix multi-line concise table parsing
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=519f4453a51508e43d3...
Commit: 519f4453a51508e43d36607cc7d1693c79275151
Parent: bc6ae7030ad3c620fadce2654c106f78a5bc2350
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Feb 25 13:41:51 2019 +0000
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 13:01:40 2019 +0100
dmsetup: Fix multi-line concise table parsing
Use the correct loop variable within the loop, instead of reusing the
initial value. Table lines after the first don't get terminated in
the right place.
Signed-off-by: Kurt Garloff <kurt(a)garloff.de>
(cherry picked from commit ccfbd505fea2f259f7c89dc23b020b838363a611)
---
tools/dmsetup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index a6610a9..bd080b8 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -367,7 +367,7 @@ static int _parse_table_lines(struct dm_task *dmt)
do {
/* Identify and terminate each line */
- if ((next_pos = strchr(_table, '\n')))
+ if ((next_pos = strchr(pos, '\n')))
*next_pos++ = '\0';
if (!_parse_line(dmt, pos, "", ++line))
return_0;
5 years, 1 month
stable-2.02 - dm: migration_threshold for old linked tools
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bc6ae7030ad3c620fad...
Commit: bc6ae7030ad3c620fadce2654c106f78a5bc2350
Parent: 167aa349268008b47e333ce9e5423e06bb29d95f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Jan 20 11:45:27 2019 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 13:01:19 2019 +0100
dm: migration_threshold for old linked tools
Just like with precending lvm2 device_mapper patch, ensure
that old users of libdm will also get fixed migration threshold
for caches.
(cherry picked from commit 74ae1c5bc1150005ae6e82c90415c433f4a24cbd)
Conflicts:
WHATS_NEW_DM
---
WHATS_NEW_DM | 1 +
libdm/libdm-deptree.c | 20 +++++++++++++++++---
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index f92e4d8..5d3c9db 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.156 -
=====================================
+ Ensure migration_threshold for cache is at least 8 chunks.
Enhance ioctl flattening and add parameters only when needed.
Add DM_DEVICE_ARM_POLL for API completness matching kernel.
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index a9d71a2..f41a338 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -192,6 +192,7 @@ struct load_segment {
uint64_t transaction_id; /* Thin_pool */
uint64_t low_water_mark; /* Thin_pool */
uint32_t data_block_size; /* Thin_pool + cache */
+ uint32_t migration_threshold; /* Cache */
unsigned skip_block_zeroing; /* Thin_pool */
unsigned ignore_discard; /* Thin_pool target vsn 1.1 */
unsigned no_discard_passdown; /* Thin_pool target vsn 1.1 */
@@ -2462,10 +2463,14 @@ static int _cache_emit_segment_line(struct dm_task *dmt,
EMIT_PARAMS(pos, " %s", name);
- EMIT_PARAMS(pos, " %u", seg->policy_argc * 2);
+ /* Do not pass migration_threshold 2048 which is default */
+ EMIT_PARAMS(pos, " %u", (seg->policy_argc + (seg->migration_threshold != 2048) ? 1 : 0) * 2);
+ if (seg->migration_threshold != 2048)
+ EMIT_PARAMS(pos, " migration_threshold %u", seg->migration_threshold);
if (seg->policy_settings)
for (cn = seg->policy_settings->child; cn; cn = cn->sib)
- EMIT_PARAMS(pos, " %s %" PRIu64, cn->key, cn->v->v.i);
+ if (cn->v) /* Skip deleted entry */
+ EMIT_PARAMS(pos, " %s %" PRIu64, cn->key, cn->v->v.i);
return 1;
}
@@ -3373,6 +3378,7 @@ int dm_tree_node_add_cache_target(struct dm_tree_node *node,
seg->data_block_size = data_block_size;
seg->flags = feature_flags;
seg->policy_name = policy_name;
+ seg->migration_threshold = 2048; /* Default migration threshold 1MiB */
/* FIXME: better validation missing */
if (policy_settings) {
@@ -3385,10 +3391,18 @@ int dm_tree_node_add_cache_target(struct dm_tree_node *node,
log_error("Cache policy parameter %s is without integer value.", cn->key);
return 0;
}
- seg->policy_argc++;
+ if (strcmp(cn->key, "migration_threshold") == 0) {
+ seg->migration_threshold = cn->v->v.i;
+ cn->v = NULL; /* skip this entry */
+ } else
+ seg->policy_argc++;
}
}
+ /* Always some throughput available for cache to proceed */
+ if (seg->migration_threshold < data_block_size * 8)
+ seg->migration_threshold = data_block_size * 8;
+
return 1;
}
5 years, 1 month
stable-2.02 - stats: initilize regions to NULL
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=167aa349268008b47e3...
Commit: 167aa349268008b47e333ce9e5423e06bb29d95f
Parent: 8fc64c5ee67c90ac33df657ec514216ce2a804b9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 22:42:36 2018 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:57:50 2019 +0100
stats: initilize regions to NULL
Commit 3750b0cff5ab1c41076afdf8275e3fa20aa756d0 used bad: error
path in more occasions thus it now needs regions defined as NULL.
(cherry picked from commit 83c6f7e7e6e76199d836bf694266c78e3cbc12f1)
---
libdm/libdm-stats.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index deb20c9..df4322a 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4809,7 +4809,7 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
{
struct dm_histogram *bounds = NULL;
int nr_bins, precise, regroup;
- uint64_t *regions, count = 0;
+ uint64_t *regions = NULL, count = 0;
const char *alias = NULL;
if (!dms->regions || !dm_stats_group_present(dms, group_id)) {
5 years, 1 month
stable-2.02 - stats: fix error path when region is NULL
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8fc64c5ee67c90ac33d...
Commit: 8fc64c5ee67c90ac33df657ec514216ce2a804b9
Parent: 8d44cd3e47a05db4983bcb8e8e1c08cfe80708ab
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 20:12:40 2018 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:57:40 2019 +0100
stats: fix error path when region is NULL
We should not call _stats_cleanup_region_ids() when regions
are NULL.
Also add backtracing for goto.
(cherry picked from commit 3750b0cff5ab1c41076afdf8275e3fa20aa756d0)
---
libdm/libdm-stats.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 3078596..deb20c9 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4869,24 +4869,24 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
group_id, &count, ®roup);
if (!regions)
- goto bad;
+ goto_out;
if (!dm_stats_list(dms, NULL))
- goto bad;
+ goto_bad;
/* regroup if there are regions to group */
if (regroup && (*regions != DM_STATS_REGION_NOT_PRESENT))
if (!_stats_group_file_regions(dms, regions, count, alias))
- goto bad;
+ goto_bad;
dm_free(bounds);
dm_free((char *) alias);
return regions;
bad:
_stats_cleanup_region_ids(dms, regions, count);
- dm_free(bounds);
- dm_free(regions);
out:
+ dm_free(regions);
+ dm_free(bounds);
dm_free((char *) alias);
return NULL;
}
5 years, 1 month
stable-2.02 - libdm: add memory barrier
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8d44cd3e47a05db4983...
Commit: 8d44cd3e47a05db4983bcb8e8e1c08cfe80708ab
Parent: 40f57155a308bcefedb1ec6dc482b8c719b56750
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 16 16:01:03 2018 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:48:15 2019 +0100
libdm: add memory barrier
Just for case ensure compiler is not able to optimize
memset() away for resources that are released.
This idea of using memory barrier is taken from openssl.
Other options would be to check for 'explicit_bzero' function.
(cherry picked from commit 55a8d6c86b4c6c6c707cfcc3dd887bca0632114f)
Conflicts:
device_mapper/ioctl/libdm-iface.c
---
libdm/ioctl/libdm-iface.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index 3a48c9b..79ea51d 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -469,6 +469,7 @@ static void _dm_zfree_string(char *string)
{
if (string) {
memset(string, 0, strlen(string));
+ asm volatile ("" ::: "memory"); /* Compiler barrier. */
dm_free(string);
}
}
@@ -477,6 +478,7 @@ static void _dm_zfree_dmi(struct dm_ioctl *dmi)
{
if (dmi) {
memset(dmi, 0, dmi->data_size);
+ asm volatile ("" ::: "memory"); /* Compiler barrier. */
dm_free(dmi);
}
}
5 years, 1 month
stable-2.02 - libdm: print params only for ioctls using them
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=40f57155a308bcefedb...
Commit: 40f57155a308bcefedb1ec6dc482b8c719b56750
Parent: 1bef4dfab39c9cef28df979a2b092a0dff79b2cc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 16 15:57:15 2018 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:47:50 2019 +0100
libdm: print params only for ioctls using them
When preparing ioctl buffer and flatting all parameters,
add table parameters only to ioctl that do process them.
Note: list of ioctl should be kept in sync with kernel code.
(cherry picked from commit 43f8da76997a22be123e97b6d0f357d6ec2d0c7c)
Conflicts:
WHATS_NEW_DM
device_mapper/ioctl/libdm-iface.c
---
WHATS_NEW_DM | 1 +
libdm/ioctl/libdm-iface.c | 37 +++++++++++++++++++++++++++++--------
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index ff92031..f92e4d8 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.156 -
=====================================
+ Enhance ioctl flattening and add parameters only when needed.
Add DM_DEVICE_ARM_POLL for API completness matching kernel.
Version 1.02.154 - 07th December 2018
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index 863e812..3a48c9b 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -1097,6 +1097,22 @@ static int _lookup_dev_name(uint64_t dev, char *buf, size_t len)
return r;
}
+static int _add_params(int type)
+{
+ switch (type) {
+ case DM_DEVICE_REMOVE_ALL:
+ case DM_DEVICE_CREATE:
+ case DM_DEVICE_REMOVE:
+ case DM_DEVICE_SUSPEND:
+ case DM_DEVICE_STATUS:
+ case DM_DEVICE_CLEAR:
+ case DM_DEVICE_ARM_POLL:
+ return 0; /* IOCTL_FLAGS_NO_PARAMS in drivers/md/dm-ioctl.c */
+ default:
+ return 1;
+ }
+}
+
static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
{
const size_t min_size = 16 * 1024;
@@ -1109,11 +1125,15 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
char *b, *e;
int count = 0;
- for (t = dmt->head; t; t = t->next) {
- len += sizeof(struct dm_target_spec);
- len += strlen(t->params) + 1 + ALIGNMENT;
- count++;
- }
+ if (_add_params(dmt->type))
+ for (t = dmt->head; t; t = t->next) {
+ len += sizeof(struct dm_target_spec);
+ len += strlen(t->params) + 1 + ALIGNMENT;
+ count++;
+ }
+ else if (dmt->head)
+ log_debug_activation(INTERNAL_ERROR "dm '%s' ioctl should not define parameters.",
+ _cmd_data_v4[dmt->type].name);
if (count && (dmt->sector || dmt->message)) {
log_error("targets and message are incompatible");
@@ -1263,9 +1283,10 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
b = (char *) (dmi + 1);
e = (char *) dmi + len;
- for (t = dmt->head; t; t = t->next)
- if (!(b = _add_target(t, b, e)))
- goto_bad;
+ if (_add_params(dmt->type))
+ for (t = dmt->head; t; t = t->next)
+ if (!(b = _add_target(t, b, e)))
+ goto_bad;
if (dmt->newname)
strcpy(b, dmt->newname);
5 years, 1 month
stable-2.02 - libdm: add DM_DEVICE_ARM_POLL
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1bef4dfab39c9cef28d...
Commit: 1bef4dfab39c9cef28df979a2b092a0dff79b2cc
Parent: e974f6866af02f0d0727a434c3150ca408da2658
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 16 15:58:16 2018 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:46:21 2019 +0100
libdm: add DM_DEVICE_ARM_POLL
Expose DM_DEVICE_ARM_POLL via standard API enum.
(cherry picked from commit 1ae5bf2b833a5d55cf97de1619cc820d4e8c394f)
Conflicts:
WHATS_NEW_DM
device_mapper/all.h
device_mapper/ioctl/libdm-iface.c
---
WHATS_NEW_DM | 1 +
libdm/ioctl/libdm-iface.c | 3 +++
libdm/libdevmapper.h | 4 +++-
3 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 80b45be..ff92031 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.156 -
=====================================
+ Add DM_DEVICE_ARM_POLL for API completness matching kernel.
Version 1.02.154 - 07th December 2018
=====================================
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index cf7a279..863e812 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -115,6 +115,9 @@ static struct cmd_data _cmd_data_v4[] = {
#ifdef DM_DEV_SET_GEOMETRY
{"setgeometry", DM_DEV_SET_GEOMETRY, {4, 6, 0}},
#endif
+#ifdef DM_DEV_ARM_POLL
+ {"armpoll", DM_DEV_ARM_POLL, {4, 36, 0}},
+#endif
};
/* *INDENT-ON* */
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 2438f74..19032d7 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -119,7 +119,9 @@ enum {
DM_DEVICE_TARGET_MSG,
- DM_DEVICE_SET_GEOMETRY
+ DM_DEVICE_SET_GEOMETRY,
+
+ DM_DEVICE_ARM_POLL
};
/*
5 years, 1 month
stable-2.02 - cleanup: move cast to det_t into MKDEV macro
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e974f6866af02f0d072...
Commit: e974f6866af02f0d0727a434c3150ca408da2658
Parent: a93699ece9dfebe5dfa8a7c8008b12bdecf037c9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Nov 3 17:13:10 2018 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:39:17 2019 +0100
cleanup: move cast to det_t into MKDEV macro
(cherry picked from commit aa8b2d6a0feb91bb5ea4364cdc53a00dfa233dca)
Conflicts:
daemons/clvmd/clvmd-common.h
device_mapper/ioctl/libdm-iface.c
device_mapper/libdm-common.c
device_mapper/libdm-deptree.c
---
daemons/dmfilemapd/dmfilemapd.c | 2 +-
lib/activate/dev_manager.c | 2 +-
lib/device/dev-cache.c | 4 ++--
lib/device/dev-type.c | 4 ++--
lib/device/dev-type.h | 2 +-
libdm/ioctl/libdm-iface.c | 8 ++++----
libdm/libdm-common.c | 2 +-
libdm/libdm-deptree.c | 4 ++--
libdm/misc/kdev_t.h | 2 +-
tools/pvscan.c | 4 ++--
10 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c
index 79ddf18..a6e8c67 100644
--- a/daemons/dmfilemapd/dmfilemapd.c
+++ b/daemons/dmfilemapd/dmfilemapd.c
@@ -33,7 +33,7 @@
#else
# define MAJOR(x) major((x))
# define MINOR(x) minor((x))
-# define MKDEV(x,y) makedev((x),(y))
+# define MKDEV(x,y) makedev((dev_t)(x),(dev_t)(y))
#endif
/* limit to two updates/sec */
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 1f4ec65..b6a188a 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -366,7 +366,7 @@ static int _ignore_blocked_mirror_devices(struct device *dev,
if (!(tmp_dev = dev_create_file(buf, NULL, NULL, 0)))
goto_out;
- tmp_dev->dev = MKDEV((dev_t)sm->logs[0].major, (dev_t)sm->logs[0].minor);
+ tmp_dev->dev = MKDEV(sm->logs[0].major, sm->logs[0].minor);
if (device_is_usable(tmp_dev, (struct dev_usable_check_params)
{ .check_empty = 1,
.check_blocked = 1,
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 997d75f..04ee41e 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -480,7 +480,7 @@ static struct device *_get_device_for_sysfs_dev_name_using_devno(const char *dev
return NULL;
}
- devno = MKDEV((dev_t)major, (dev_t)minor);
+ devno = MKDEV(major, minor);
if (!(dev = (struct device *) btree_lookup(_cache.devices, (uint32_t) devno))) {
/*
* If we get here, it means the device is referenced in sysfs, but it's not yet in /dev.
@@ -984,7 +984,7 @@ static int _dev_cache_iterate_sysfs_for_index(const char *path)
continue;
}
- devno = MKDEV((dev_t)major, (dev_t)minor);
+ devno = MKDEV(major, minor);
if (!(dev = (struct device *) btree_lookup(_cache.devices, (uint32_t) devno)) &&
!(dev = (struct device *) btree_lookup(_cache.sysfs_only_devices, (uint32_t) devno))) {
if (!dm_device_get_name(major, minor, 1, devname, sizeof(devname)) ||
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index e909c0f..ce4a05b 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -505,7 +505,7 @@ int dev_get_primary_dev(struct dev_types *dt, struct device *dev, dev_t *result)
*/
if ((parts = dt->dev_type_array[major].max_partitions) > 1) {
if ((residue = minor % parts)) {
- *result = MKDEV((dev_t)major, (dev_t)(minor - residue));
+ *result = MKDEV(major, (minor - residue));
ret = 2;
} else {
*result = dev->dev;
@@ -575,7 +575,7 @@ int dev_get_primary_dev(struct dev_types *dt, struct device *dev, dev_t *result)
path, buffer);
goto out;
}
- *result = MKDEV((dev_t)major, (dev_t)minor);
+ *result = MKDEV(major, minor);
ret = 2;
out:
if (fp && fclose(fp))
diff --git a/lib/device/dev-type.h b/lib/device/dev-type.h
index 2644383..bd989f8 100644
--- a/lib/device/dev-type.h
+++ b/lib/device/dev-type.h
@@ -26,7 +26,7 @@
#else
# define MAJOR(x) major((x))
# define MINOR(x) minor((x))
-# define MKDEV(x,y) makedev((x),(y))
+# define MKDEV(x,y) makedev((dev_t)(x),(dev_t)(y))
#endif
#define PARTITION_SCSI_DEVICE (1 << 0)
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index 5068d4c..cf7a279 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -30,7 +30,7 @@
#else
# define MAJOR(x) major((x))
# define MINOR(x) minor((x))
-# define MKDEV(x,y) makedev((x),(y))
+# define MKDEV(x,y) makedev(((dev_t)x),((dev_t)y))
#endif
#include "dm-ioctl.h"
@@ -259,7 +259,7 @@ static int _control_exists(const char *control, uint32_t major, uint32_t minor)
return -1;
}
- if (major && buf.st_rdev != MKDEV((dev_t)major, (dev_t)minor)) {
+ if (major && buf.st_rdev != MKDEV(major, minor)) {
log_verbose("%s: Wrong device number: (%u, %u) instead of "
"(%u, %u)", control,
MAJOR(buf.st_mode), MINOR(buf.st_mode),
@@ -302,7 +302,7 @@ static int _create_control(const char *control, uint32_t major, uint32_t minor)
(void) dm_prepare_selinux_context(control, S_IFCHR);
old_umask = umask(DM_CONTROL_NODE_UMASK);
if (mknod(control, S_IFCHR | S_IRUSR | S_IWUSR,
- MKDEV((dev_t)major, (dev_t)minor)) < 0) {
+ MKDEV(major, minor)) < 0) {
log_sys_error("mknod", control);
ret = 0;
}
@@ -1194,7 +1194,7 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
}
dmi->flags |= DM_PERSISTENT_DEV_FLAG;
- dmi->dev = MKDEV((dev_t)dmt->major, (dev_t)dmt->minor);
+ dmi->dev = MKDEV(dmt->major, dmt->minor);
}
/* Does driver support device number referencing? */
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index 40b366b..e7934d1 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -1040,7 +1040,7 @@ static int _add_dev_node(const char *dev_name, uint32_t major, uint32_t minor,
{
char path[PATH_MAX];
struct stat info;
- dev_t dev = MKDEV((dev_t)major, (dev_t)minor);
+ dev_t dev = MKDEV(major, minor);
mode_t old_mask;
if (!_build_dev_path(path, sizeof(path), dev_name))
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index ab05456..a9d71a2 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -523,7 +523,7 @@ static struct dm_tree_node *_create_dm_tree_node(struct dm_tree *dtree,
dm_list_init(&node->activated);
dm_list_init(&node->props.segs);
- dev = MKDEV((dev_t)info->major, (dev_t)info->minor);
+ dev = MKDEV(info->major, info->minor);
if (!dm_hash_insert_binary(dtree->devs, (const char *) &dev,
sizeof(dev), node)) {
@@ -546,7 +546,7 @@ static struct dm_tree_node *_create_dm_tree_node(struct dm_tree *dtree,
static struct dm_tree_node *_find_dm_tree_node(struct dm_tree *dtree,
uint32_t major, uint32_t minor)
{
- dev_t dev = MKDEV((dev_t)major, (dev_t)minor);
+ dev_t dev = MKDEV(major, minor);
return dm_hash_lookup_binary(dtree->devs, (const char *) &dev,
sizeof(dev));
diff --git a/libdm/misc/kdev_t.h b/libdm/misc/kdev_t.h
index f88bb0a..12780d2 100644
--- a/libdm/misc/kdev_t.h
+++ b/libdm/misc/kdev_t.h
@@ -17,6 +17,6 @@
#define MAJOR(dev) ((dev & 0xfff00) >> 8)
#define MINOR(dev) ((dev & 0xff) | ((dev >> 12) & 0xfff00))
-#define MKDEV(ma,mi) ((mi & 0xff) | (ma << 8) | ((mi & ~0xff) << 12))
+#define MKDEV(ma,mi) (((dev_t)mi & 0xff) | ((dev_t)ma << 8) | (((dev_t)mi & ~0xff) << 12))
#endif
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 877b6b2..5587928 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -496,7 +496,7 @@ static int _pvscan_cache(struct cmd_context *cmd, int argc, char **argv)
log_warn("WARNING: Failed to parse major:minor from %s, skipping.", pv_name);
continue;
}
- devno = MKDEV((dev_t)major, (dev_t)minor);
+ devno = MKDEV(major, minor);
if (!(dev = dev_cache_get_by_devt(devno, cmd->lvmetad_filter))) {
/* Remove major:minor from lvmetad. */
@@ -559,7 +559,7 @@ static int _pvscan_cache(struct cmd_context *cmd, int argc, char **argv)
if (major < 0 || minor < 0)
continue;
- devno = MKDEV((dev_t)major, (dev_t)minor);
+ devno = MKDEV(major, minor);
if (!(dev = dev_cache_get_by_devt(devno, cmd->lvmetad_filter))) {
/* Remove major:minor from lvmetad. */
5 years, 1 month
stable-2.02 - cov: remove unused assigns
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a93699ece9dfebe5dfa...
Commit: a93699ece9dfebe5dfa8a7c8008b12bdecf037c9
Parent: e4bb94a93e9cda695717093024800f637aead51c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Nov 3 16:48:20 2018 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Mar 5 12:28:31 2019 +0100
cov: remove unused assigns
(cherry picked from commit 70e3d0a613fb53e52f7a7cb31d65bcc2fa7ab738)
Conflicts:
tools/pvscan.c
tools/vgchange.c
---
daemons/dmfilemapd/dmfilemapd.c | 4 ++--
lib/device/dev-cache.c | 3 +--
lib/metadata/metadata.c | 6 ++----
3 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c
index 7519799..79ddf18 100644
--- a/daemons/dmfilemapd/dmfilemapd.c
+++ b/daemons/dmfilemapd/dmfilemapd.c
@@ -629,10 +629,10 @@ check_unlinked:
static int _daemonise(struct filemap_monitor *fm)
{
- pid_t pid = 0, sid;
+ pid_t pid = 0;
int fd;
- if (!(sid = setsid())) {
+ if (!setsid()) {
_early_log("setsid failed.");
return 0;
}
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index c866ff9..997d75f 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -667,10 +667,9 @@ struct dm_list *dev_cache_get_dev_list_for_lvid(const char *lvid)
void dev_cache_failed_path(struct device *dev, const char *path)
{
- struct device *dev_by_path;
struct dm_str_list *strl;
- if ((dev_by_path = (struct device *) dm_hash_lookup(_cache.names, path)))
+ if (dm_hash_lookup(_cache.names, path))
dm_hash_remove(_cache.names, path);
dm_list_iterate_items(strl, &dev->aliases) {
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 2292568..cb38f66 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1720,15 +1720,13 @@ struct generic_logical_volume *find_historical_glv(const struct volume_group *vg
int lv_name_is_used_in_vg(const struct volume_group *vg, const char *name, int *historical)
{
- struct generic_logical_volume *historical_lv;
- struct logical_volume *lv;
int found = 0;
- if ((lv = find_lv(vg, name))) {
+ if (find_lv(vg, name)) {
found = 1;
if (historical)
*historical = 0;
- } else if ((historical_lv = find_historical_glv(vg, name, 0, NULL))) {
+ } else if (find_historical_glv(vg, name, 0, NULL)) {
found = 1;
if (historical)
*historical = 1;
5 years, 1 month