Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=833b02106d448dcec7a3e…
Commit: 833b02106d448dcec7a3e9ff23a8ec2cdc5bb3ab
Parent: 722542fabb30915653a222a6dca8f34338db4e80
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Wed Mar 29 20:42:36 2017 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Thu Mar 30 10:02:39 2017 +0100
libdm: make _stats_resize_group() num_regions argument uint64_t
---
libdm/libdm-stats.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 5a454fd..2e6022d 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4181,21 +4181,23 @@ int dm_stats_get_group_descriptor(const struct dm_stats *dms,
* Resize the group bitmap corresponding to group_id so that it can
* contain at least num_regions members.
*/
-static int _stats_resize_group(struct dm_stats_group *group, int num_regions)
+static int _stats_resize_group(struct dm_stats_group *group,
+ uint64_t num_regions)
{
- int last_bit = dm_bit_get_last(group->regions);
+ uint64_t last_bit = dm_bit_get_last(group->regions);
dm_bitset_t new, old;
if (last_bit >= num_regions) {
- log_error("Cannot resize group bitmap to %d with bit %d set.",
- num_regions, last_bit);
+ log_error("Cannot resize group bitmap to " FMTu64
+ " with bit " FMTu64 " set.", num_regions, last_bit);
return 0;
}
- log_very_verbose("Resizing group bitmap from %d to %d (last_bit: %d).",
+ log_very_verbose("Resizing group bitmap from " FMTu64
+ " to " FMTu64 " (last_bit: " FMTu64 ").",
group->regions[0], num_regions, last_bit);
- new = dm_bitset_create(NULL, num_regions);
+ new = dm_bitset_create(NULL, (unsigned) num_regions);
if (!new) {
log_error("Could not allocate memory for new group bitmap.");
return 0;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=834574cc27851266bd288…
Commit: 834574cc27851266bd288163cddcab36b4db22cb
Parent: bfc880994c80a798f28d51558ee120f70d65dd0f
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Wed Mar 29 20:29:20 2017 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Thu Mar 30 10:01:57 2017 +0100
dmfilemapd: use log_sys_error in _filemap_monitor_set_notify
Since _filemap_monitor_set_notify() is only called after daemon
start up it should not use the _early_log() macros. Instead, use
log_sys_error to log errors from the two syscalls in the function.
---
daemons/dmfilemapd/dmfilemapd.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c
index 3e691e8..7939c48 100644
--- a/daemons/dmfilemapd/dmfilemapd.c
+++ b/daemons/dmfilemapd/dmfilemapd.c
@@ -409,13 +409,13 @@ static int _filemap_monitor_set_notify(struct filemap_monitor *fm)
* and does not fork or exec.
*/
if ((inotify_fd = inotify_init1(IN_NONBLOCK)) < 0) {
- _early_log("Failed to initialise inotify.");
+ log_sys_error("inotify_init1", "IN_NONBLOCK");
return 0;
}
if ((watch_fd = inotify_add_watch(inotify_fd, fm->path,
IN_MODIFY | IN_DELETE_SELF)) < 0) {
- _early_log("Failed to add inotify watch.");
+ log_sys_error("inotify_add_watch", fm->path);
return 0;
}
fm->inotify_fd = inotify_fd;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fe0922b8a6632456d9f20…
Commit: fe0922b8a6632456d9f20085f1c67d2ddb5b2d88
Parent: 803b1775ba06218ad193402a13e6da4b3406511a
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Wed Mar 29 18:30:16 2017 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Thu Mar 30 09:57:58 2017 +0100
dmsetup: simplify branching in _stats_update_file()
The fallback branch in _stats_update_file() is redundant (since the
branch taken when the daemon starts successfully must jump to the
'out' label anyway): remove it and re-order the conditions to
improve readability.
---
tools/dmsetup.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 5f07ab6..d25b3bd 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -5716,17 +5716,18 @@ static int _stats_update_file(CMD_ARGS)
* If starting the daemon fails, fall back to a direct update.
*/
if (!_switches[NOMONITOR_ARG]) {
- if (!dm_stats_start_filemapd(fd, group_id, abspath, mode,
- foreground, verbose)) {
- log_warn("Failed to start filemap monitoring daemon.");
- goto fallback;
- }
- goto out;
+ if (dm_stats_start_filemapd(fd, group_id, abspath, mode,
+ foreground, verbose))
+ goto out;
+
+ log_warn("Failed to start filemap monitoring daemon.");
+
+ /* fall back to one-shot update */
}
-fallback:
/*
- * --nomonitor case - perform a one-shot update directly from dmstats.
+ * --nomonitor and fall back case - perform a one-shot update directly
+ * from dmsetup.
*/
regions = dm_stats_update_regions_from_fd(dms, fd, group_id);