master - dmstats: replace histogram command with switch
by Bryn Reeves
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cebbb0feafb975...
Commit: cebbb0feafb97516377388eb1747e3207c4f0596
Parent: 6240a7639d1473f7e22c8a8099176bc1b444d4d3
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Thu Sep 3 23:00:44 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Thu Sep 3 23:39:11 2015 +0100
dmstats: replace histogram command with switch
Replace the histogram stats subcommand with a --histogram switch
to enable histogram related fields for both list and report output.
To avoid overloading the existing --histogram rename it to --bounds:
this is also a better description of the option.
---
man/dmstats.8.in | 84 +++++++++++++++---------------------------------------
tools/dmsetup.c | 52 ++++++++++++++++++++-------------
2 files changed, 54 insertions(+), 82 deletions(-)
diff --git a/man/dmstats.8.in b/man/dmstats.8.in
index 1e19524..326ab25 100644
--- a/man/dmstats.8.in
+++ b/man/dmstats.8.in
@@ -32,8 +32,8 @@ dmstats \(em device-mapper statistics management
.IR nr_areas ]
.RB |[ \-\-areasize
.IR area_size ]]
-.RB [ \-\-histogram
-.IR boundaries ]
+.RB [ \-\-bounds
+.IR histogram_boundaries ]
.RB [ \-\-precise ]
.RB [[ \-\-start
.IR start_sector ]
@@ -58,34 +58,12 @@ dmstats \(em device-mapper statistics management
.B dmstats help
.RB [ \-c | \-C | \-\-columns ]
.br
-.B dmstats histogram
-.RI [ device_name ]
-.RB [ \-\-interval
-.IR seconds ]
-.RB [ \-\-count
-.IR count ]
-.RB [ \-\-units
-.IR units ]
-.RB [ \-\-allprograms ]
-.RB [ \-\-programid
-.IR id ]
-.RB [ \-\-relative ]
-.RB [ \-\-regionid
-.IR id ]
-.RB [ \-O | \-\-sort
-.IR sort_fields ]
-.RB [ \-S | \-\-select
-.IR Selection ]
-.RB [ \-\-units
-.IR units ]
-.RB [ \-\-nosuffix ]
-.RB [ \-\-notimesuffix ]
-.br
.B dmstats list
.RI [ device_name ]
.RB [ \-\-allprograms
.RB | \-\-programid
.IR id ]
+.RB [ \-\-histogram ]
.RB [ \-\-units
.IR units ]
.RB [ \-\-nosuffix ]
@@ -110,6 +88,7 @@ dmstats \(em device-mapper statistics management
.IR count ]
.RB [ \-\-units
.IR units ]
+.RB [ \-\-histogram ]
.RB [ \-\-allprograms ]
.RB [ \-\-programid
.IR id ]
@@ -180,13 +159,17 @@ When printing statistics counters, also atomically reset them to zero.
Specify the iteration count for repeating reports. If the count
argument is zero reports will continue to repeat until interrupted.
.TP
-.B \-\-histogram \fIboundaries
+.B \-\-bounds \fIhistogram_boundaries
Specify the boundaries of a latency histogram to be tracked for the
region as a comma separated list of latency values. Latency values are
given in nanoseconds. An optional unit suffix of ns, us, ms, or s may be
given after each value to specify units of nanoseconds, microseconds,
miliseconds or seconds respectively.
.TP
+.B \-\-histogram
+When used with the \fBreport\fP and \fBlist\fP commands select default
+fields that emphasize latency histogram data.
+.TP
.B \-\-interval \fIseconds
Specify the interval in seconds between successive iterations for
repeating reports. If \-\-interval is specified but \-\-count is not,
@@ -289,8 +272,8 @@ regions (with the exception of in-flight IO counters).
.IR nr_areas ]
.RB [ \-\-areasize
.IR area_size ]
-.RB [ \-\-histogram
-.IR boundaries ]
+.RB [ --bounds
+.IR histogram_boundaries ]
.RB [ \-\-precise ]
.RB [[ \-\-start
.IR start_sector ]
@@ -314,7 +297,7 @@ device-mapper device's table.
If the \fB\-\-precise\fP option is used the command will attempt to
create a region using nanosecond precision counters.
-If \fB\-\-histogram\fP is given a latency histogram will be tracked for
+If \fB--bounds\fP is given a latency histogram will be tracked for
the new region. The boundaries of the histogram bins are given as a
comma separated list of latency values. There is an implicit lower bound
of zero on the first bin and an implicit upper bound of infinity (or the
@@ -369,40 +352,9 @@ Outputs a summary of the commands available, optionally including
the list of report fields.
.br
.TP
-.B histogram
-.RB [ \-\-allprograms ]
-.RB [ \-\-interval
-.IR seconds ]
-.RB [ \-\-count
-.IR count ]
-.RB [ \-\-units
-.IR unit ]
-.RB [ \-\-relative ]
-.RB [ \-\-regionid
-.IR id ]
-.RB [ \-\-programid
-.IR id ]
-.RB [ \-O | \-\-sort
-.IR sort_fields ]
-.RB [ \-S | \-\-select
-.IR Selection ]
-.RB [ \-\-units
-.IR units ]
-.br
-Start a report for the specified region or for all present regions that
-emphasizes latency histograms in the default field options. If the count
-argument is specified, the report will repeat at a fixed interval set by
-the \fB\-\-interval\fP option. The default interval is one second.
-
-If the \fB\-\-allprograms\fP switch is given, all regions will be
-listed, regardless of region program ID values.
-
-If \fB\-\-relative\fP is given the default histogram field displays the
-relative histogram instead of absolute counts.
-.br
-.TP
.B list
.RI [ device_name ]
+.RB [ \-\-histogram ]
.RB [ \-\-allprograms ]
.RB [ \-\-programid
.RB [ \-v | \-\-verbose \ [ \-v | \-\-verbose ]]
@@ -414,6 +366,9 @@ regardless of region program ID values.
If \fB\-v\fP or \fB\-\-verbose\fP is given the report will include
a row of information for each area contained in each region displayed.
+
+If \fB\-\-histogram\fP is given the report will include the bin count
+and latency boundary values for any configured histograms.
.br
.TP
.B print
@@ -456,6 +411,13 @@ one second.
If the \fB\-\-allprograms\fP switch is given, all regions will be
listed, regardless of region program ID values.
+
+If \fB\-\-histogram\fP is given the report will include the histogram
+values and latency boundaries.
+
+If \fB\-\-relative\fP is used the default histogram field displays
+bin values as a percentage of the total number of I/Os.
+
.br
.SH REGIONS AND AREAS
The device-mapper statistics facility allows separate performance
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 432677b..8983e18 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -162,6 +162,7 @@ enum {
AREAS_ARG,
AREA_SIZE_ARG,
AUX_DATA_ARG,
+ BOUNDS_ARG,
CHECKS_ARG,
CLEAR_ARG,
COLS_ARG,
@@ -4234,6 +4235,8 @@ static const char *_stats_default_report_options = STATS_DEV_INFO "," STATS_AREA
static const char *_stats_raw_report_options = STATS_DEV_INFO "," STATS_AREA_INFO "," COUNTERS;
static const char *_stats_list_options = STATS_REGION_INFO ",program_id";
static const char *_stats_area_list_options = STATS_AREA_INFO_FULL ",program_id";
+static const char *_stats_hist_list_options = STATS_REGION_INFO ",hist_bins,hist_bounds";
+static const char *_stats_hist_area_list_options = STATS_AREA_INFO_FULL ",hist_bins,hist_bounds";
static const char *_stats_hist_options = STATS_HIST ",hist_count_bounds";
static const char *_stats_hist_relative_options = STATS_HIST ",hist_percent_bounds";
@@ -4257,19 +4260,24 @@ static int _report_init(const struct command *cmd, const char *subcommand)
if (cmd && !strcmp(cmd->name, "stats")) {
_report_type |= DR_STATS_META;
- if (!strcmp(subcommand, "list"))
- options = (char *) ((_switches[VERBOSE_ARG])
- ? _stats_area_list_options
- : _stats_list_options);
- else if (!strcmp(subcommand, "histogram"))
- options = (char *) ((_switches[RELATIVE_ARG])
- ? _stats_hist_relative_options
- : _stats_hist_options);
- else {
- options = (char *) ((!_switches[RAW_ARG])
- ? _stats_default_report_options
- : _stats_raw_report_options);
-
+ if (!strcmp(subcommand, "list")) {
+ if (!_switches[HISTOGRAM_ARG])
+ options = (char *) ((_switches[VERBOSE_ARG])
+ ? _stats_area_list_options
+ : _stats_list_options);
+ else
+ options = (char *) ((_switches[VERBOSE_ARG])
+ ? _stats_hist_area_list_options
+ : _stats_hist_list_options);
+ } else {
+ if (_switches[HISTOGRAM_ARG])
+ options = (char *) ((_switches[RELATIVE_ARG])
+ ? _stats_hist_relative_options
+ : _stats_hist_options);
+ else
+ options = (char *) ((!_switches[RAW_ARG])
+ ? _stats_default_report_options
+ : _stats_raw_report_options);
_report_type |= DR_STATS;
}
}
@@ -4657,7 +4665,7 @@ static int _do_stats_create_regions(struct dm_stats *dms,
const char *aux_data)
{
uint64_t this_start = 0, this_len = len, region_id = UINT64_C(0);
- const char *devname = NULL, *histogram = _string_args[HISTOGRAM_ARG];
+ const char *devname = NULL, *histogram = _string_args[BOUNDS_ARG];
int r = 0, precise = _switches[PRECISE_ARG];
struct dm_histogram *bounds = NULL; /* histogram bounds */
char *target_type, *params; /* unused */
@@ -4833,9 +4841,9 @@ static int _stats_create(CMD_ARGS)
}
}
- if (_switches[HISTOGRAM_ARG]) {
+ if (_switches[BOUNDS_ARG]) {
if (!dm_stats_driver_supports_histogram()) {
- log_error("Using --histogram requires driver version "
+ log_error("Using --bounds requires driver version "
"4.32.0 or later.");
goto out;
}
@@ -5075,7 +5083,6 @@ static struct command _stats_subcommands[] = {
{"clear", "--regionid <id> [<device>]", 0, -1, 1, 0, _stats_clear},
{"create", CREATE_OPTS "\n\t\t" ID_OPTS "[<device>]", 0, -1, 1, 0, _stats_create},
{"delete", "--regionid <id> <device>", 1, -1, 1, 0, _stats_delete},
- {"histogram", REPORT_OPTS "[<device>]", 0, -1, 1, 0, _stats_report},
{"list", "[--programid <id>] [<device>]", 0, -1, 1, 0, _stats_report},
{"print", PRINT_OPTS "[<device>]", 0, -1, 1, 0, _stats_print},
{"report", REPORT_OPTS "[<device>]", 0, -1, 1, 0, _stats_report},
@@ -5680,6 +5687,7 @@ static int _process_switches(int *argcp, char ***argvp, const char *dev_dir)
{"areas", 1, &ind, AREAS_ARG},
{"areasize", 1, &ind, AREA_SIZE_ARG},
{"auxdata", 1, &ind, AUX_DATA_ARG},
+ {"bounds", 1, &ind, BOUNDS_ARG},
{"checks", 0, &ind, CHECKS_ARG},
{"clear", 0, &ind, CLEAR_ARG},
{"columns", 0, &ind, COLS_ARG},
@@ -5690,7 +5698,7 @@ static int _process_switches(int *argcp, char ***argvp, const char *dev_dir)
{"force", 0, &ind, FORCE_ARG},
{"gid", 1, &ind, GID_ARG},
{"help", 0, &ind, HELP_ARG},
- {"histogram", 1, &ind, HISTOGRAM_ARG},
+ {"histogram", 0, &ind, HISTOGRAM_ARG},
{"inactive", 0, &ind, INACTIVE_ARG},
{"interval", 1, &ind, INTERVAL_ARG},
{"length", 1, &ind, LENGTH_ARG},
@@ -5831,9 +5839,9 @@ static int _process_switches(int *argcp, char ***argvp, const char *dev_dir)
return 0;
if (c == 'h' || ind == HELP_ARG)
_switches[HELP_ARG]++;
- if (ind == HISTOGRAM_ARG) {
- _switches[HISTOGRAM_ARG]++;
- _string_args[HISTOGRAM_ARG] = optarg;
+ if (ind == BOUNDS_ARG) {
+ _switches[BOUNDS_ARG]++;
+ _string_args[BOUNDS_ARG] = optarg;
}
if (ind == CLEAR_ARG)
_switches[CLEAR_ARG]++;
@@ -5843,6 +5851,8 @@ static int _process_switches(int *argcp, char ***argvp, const char *dev_dir)
_switches[FORCE_ARG]++;
if (c == 'r' || ind == READ_ONLY)
_switches[READ_ONLY]++;
+ if (ind == HISTOGRAM_ARG)
+ _switches[HISTOGRAM_ARG]++;
if (ind == LENGTH_ARG) {
_switches[LENGTH_ARG]++;
_string_args[LENGTH_ARG] = optarg;
8 years, 7 months
master - lvmlockd: fixes for starting dlm global lockspace
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6240a7639d1473...
Commit: 6240a7639d1473f7e22c8a8099176bc1b444d4d3
Parent: 9e8b3d4a9825ecca3dc7a71f6379b63a27d6fa8c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Sep 3 16:42:19 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Sep 3 16:47:54 2015 -0500
lvmlockd: fixes for starting dlm global lockspace
Remove the optimization/shortcut for starting the dlm global
lockspace when it was already running.
Reenable automatically starting the dlm global lockspace
when a command attempts to use it and it's not yet started.
This had become disabled at some point.
---
daemons/lvmlockd/lvmlockd-core.c | 71 +++++++++++++++++++---------------
daemons/lvmlockd/lvmlockd-internal.h | 1 -
2 files changed, 40 insertions(+), 32 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 36be584..ae6f5a1 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -2404,9 +2404,6 @@ out_act:
ls->drop_vg = drop_vg;
pthread_mutex_unlock(&lockspaces_mutex);
- if (gl_use_dlm && !strcmp(ls->name, gl_lsname_dlm))
- dlm_gl_lockspace_running = 0;
-
/* worker_thread will join this thread, and free the ls */
pthread_mutex_lock(&worker_mutex);
worker_wake = 1;
@@ -2592,22 +2589,14 @@ static int add_dlm_global_lockspace(struct action *act)
{
int rv;
- if (dlm_gl_lockspace_running)
- return -EEXIST;
- dlm_gl_lockspace_running = 1;
-
/*
- * There's a short period after which a previous gl lockspace thread
- * has set dlm_gl_lockspace_running = 0, but before its ls struct has
- * been deleted, during which this add_lockspace_thread() can fail with
- * -EAGAIN.
+ * FIXME: optimize this by setting a flag to indicate that the
+ * dlm global lockspace is running so we can quit here.
*/
rv = add_lockspace_thread(gl_lsname_dlm, NULL, NULL, LD_LM_DLM, NULL, act);
- if (rv < 0) {
+ if (rv < 0)
log_debug("add_dlm_global_lockspace add_lockspace_thread %d", rv);
- dlm_gl_lockspace_running = 0;
- }
return rv;
}
@@ -3535,15 +3524,27 @@ static int add_lock_action(struct action *act)
memset(ls_name, 0, sizeof(ls_name));
- /* Determine which lockspace this action is for, and set ls_name. */
+ /*
+ * Determine which lockspace this action is for, and set ls_name.
+ */
- if (act->rt == LD_RT_GL && gl_use_sanlock &&
- (act->op == LD_OP_ENABLE || act->op == LD_OP_DISABLE))
- vg_ls_name(act->vg_name, ls_name);
- else if (act->rt == LD_RT_GL)
- gl_ls_name(ls_name);
- else
+ if (act->rt == LD_RT_GL) {
+ /* Global lock is requested */
+ if (gl_use_sanlock && (act->op == LD_OP_ENABLE || act->op == LD_OP_DISABLE)) {
+ vg_ls_name(act->vg_name, ls_name);
+ } else {
+ if (!gl_use_dlm && !gl_use_sanlock) {
+ if (lm_is_running_dlm())
+ gl_use_dlm = 1;
+ else if (lm_is_running_sanlock())
+ gl_use_sanlock = 1;
+ }
+ gl_ls_name(ls_name);
+ }
+ } else {
+ /* VG lock is requested */
vg_ls_name(act->vg_name, ls_name);
+ }
retry:
pthread_mutex_lock(&lockspaces_mutex);
@@ -3552,35 +3553,43 @@ static int add_lock_action(struct action *act)
pthread_mutex_unlock(&lockspaces_mutex);
if (!ls) {
if (act->op == LD_OP_UPDATE && act->rt == LD_RT_VG) {
- log_debug("lockspace not found ignored for vg update");
+ log_debug("lockspace \"%s\" not found ignored for vg update", ls_name);
return -ENOLS;
} else if (act->flags & LD_AF_SEARCH_LS) {
- /* fail if we've already tried searching for the ls */
- log_debug("lockspace search repeated %s", ls_name);
+ /*
+ * Fail if we've already tried searching for the lockspace.
+ */
+ log_debug("lockspace \"%s\" not found after search", ls_name);
return -ENOLS;
} else if (act->op == LD_OP_LOCK && act->rt == LD_RT_GL && gl_use_sanlock) {
- /* gl may have been enabled in an existing vg */
- log_debug("gl lockspace not found check sanlock vgs");
+ /*
+ * The sanlock global lock may have been enabled in an existing VG,
+ * so search existing VGs for an enabled global lock.
+ */
+ log_debug("lockspace \"%s\" not found for sanlock gl, searching...", ls_name);
act->flags |= LD_AF_SEARCH_LS;
add_work_action(act);
return 0;
- } else if (act->op == LD_OP_LOCK && act->rt == LD_RT_GL && gl_use_dlm) {
- log_debug("gl lockspace not found add dlm global");
+ } else if (act->op == LD_OP_LOCK && act->rt == LD_RT_GL && act->mode != LD_LK_UN && gl_use_dlm) {
+ /*
+ * Automatically start the dlm global lockspace when
+ * a command tries to acquire the global lock.
+ */
+ log_debug("lockspace \"%s\" not found for dlm gl, adding...", ls_name);
act->flags |= LD_AF_SEARCH_LS;
act->flags |= LD_AF_WAIT_STARTING;
add_dlm_global_lockspace(NULL);
- gl_ls_name(ls_name);
goto retry;
} else if (act->op == LD_OP_LOCK && act->mode == LD_LK_UN) {
- log_debug("lockspace not found ignored for unlock");
+ log_debug("lockspace \"%s\" not found for unlock ignored", ls_name);
return -ENOLS;
} else {
- log_debug("lockspace not found %s", ls_name);
+ log_debug("lockspace \"%s\" not found", ls_name);
return -ENOLS;
}
}
diff --git a/daemons/lvmlockd/lvmlockd-internal.h b/daemons/lvmlockd/lvmlockd-internal.h
index 9d360ed..68dcd9d 100644
--- a/daemons/lvmlockd/lvmlockd-internal.h
+++ b/daemons/lvmlockd/lvmlockd-internal.h
@@ -313,7 +313,6 @@ static inline int list_empty(const struct list_head *head)
* or when disable_gl matches.
*/
-EXTERN int dlm_gl_lockspace_running;
EXTERN int gl_type_static;
EXTERN int gl_use_dlm;
EXTERN int gl_use_sanlock;
8 years, 7 months
master - lockd: check for unlock failure in all cases
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9e8b3d4a9825ec...
Commit: 9e8b3d4a9825ecca3dc7a71f6379b63a27d6fa8c
Parent: c27015368b590dc42f15ef8d55faa279e912666a
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Sep 3 13:47:54 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Sep 3 16:47:54 2015 -0500
lockd: check for unlock failure in all cases
This suppresses an unwanted error message.
---
lib/locking/lvmlockd.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 983ecc9..a726d87 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -1454,6 +1454,10 @@ int lockd_gl(struct cmd_context *cmd, const char *def_mode, uint32_t flags)
}
}
+
+ if (!strcmp(mode, "un"))
+ return 1;
+
/*
* ENOLS: no lockspace was found with a global lock.
* The VG with the global lock may not be visible or started yet,
@@ -1473,10 +1477,6 @@ int lockd_gl(struct cmd_context *cmd, const char *def_mode, uint32_t flags)
result == -ESTARTING ||
result == -EVGKILLED ||
result == -ELOCKIO) {
-
- if (!strcmp(mode, "un"))
- return 1;
-
/*
* If an ex global lock fails, then the command fails.
*/
8 years, 7 months
master - lvmlockd: improve log messages for adding dlm global lockspace
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c27015368b590d...
Commit: c27015368b590dc42f15ef8d55faa279e912666a
Parent: 5da497d0a81e100d803a1384a9394b0b513f176b
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Sep 3 13:39:56 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Sep 3 16:47:54 2015 -0500
lvmlockd: improve log messages for adding dlm global lockspace
---
daemons/lvmlockd/lvmlockd-core.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index f2a01dc..36be584 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -2545,10 +2545,13 @@ static int add_lockspace_thread(const char *ls_name,
pthread_mutex_lock(&lockspaces_mutex);
ls2 = find_lockspace_name(ls->name);
if (ls2) {
- if (ls2->thread_stop)
+ if (ls2->thread_stop) {
+ log_debug("add_lockspace_thread %s exists and stopping", ls->name);
rv = -EAGAIN;
- else
+ } else {
+ log_debug("add_lockspace_thread %s exists", ls->name);
rv = -EEXIST;
+ }
pthread_mutex_unlock(&lockspaces_mutex);
free_resource(r);
free(ls);
@@ -2567,6 +2570,7 @@ static int add_lockspace_thread(const char *ls_name,
rv = pthread_create(&ls->thread, NULL, lockspace_thread_main, ls);
if (rv < 0) {
+ log_error("add_lockspace_thread %s pthread error %d %d", ls->name, rv, errno);
pthread_mutex_lock(&lockspaces_mutex);
list_del(&ls->list);
pthread_mutex_unlock(&lockspaces_mutex);
@@ -2601,7 +2605,7 @@ static int add_dlm_global_lockspace(struct action *act)
rv = add_lockspace_thread(gl_lsname_dlm, NULL, NULL, LD_LM_DLM, NULL, act);
if (rv < 0) {
- log_error("add_dlm_global_lockspace add_lockspace_thread %d", rv);
+ log_debug("add_dlm_global_lockspace add_lockspace_thread %d", rv);
dlm_gl_lockspace_running = 0;
}
@@ -2685,20 +2689,16 @@ static int add_lockspace(struct action *act)
}
if (act->rt == LD_RT_VG) {
- if (gl_use_dlm) {
- rv = add_dlm_global_lockspace(NULL);
- if (rv < 0 && rv != -EEXIST)
- return rv;
- }
+ if (gl_use_dlm)
+ add_dlm_global_lockspace(NULL);
vg_ls_name(act->vg_name, ls_name);
rv = add_lockspace_thread(ls_name, act->vg_name, act->vg_uuid,
act->lm_type, act->vg_args,
act);
-
if (rv)
- log_error("add_lockspace %s add_lockspace_thread %d", ls_name, rv);
+ log_debug("add_lockspace %s add_lockspace_thread %d", ls_name, rv);
return rv;
}
8 years, 7 months
master - tests: update thin test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5da497d0a81e10...
Commit: 5da497d0a81e100d803a1384a9394b0b513f176b
Parent: dc261f17e96cb4012dd34329fd6ae9f766eb7c11
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 3 23:05:33 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Sep 3 23:34:37 2015 +0200
tests: update thin test
Use slightly better values
---
test/shell/lvextend-thin-metadata-dmeventd.sh | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/shell/lvextend-thin-metadata-dmeventd.sh b/test/shell/lvextend-thin-metadata-dmeventd.sh
index 4e80f75..ea081a2 100644
--- a/test/shell/lvextend-thin-metadata-dmeventd.sh
+++ b/test/shell/lvextend-thin-metadata-dmeventd.sh
@@ -40,7 +40,7 @@ fake_metadata_() {
echo '<superblock uuid="" time="1" transaction="'$2'" data_block_size="128" nr_data_blocks="3200">'
for i in $(seq 1 $1)
do
- echo ' <device dev_id="'$i'" mapped_blocks="785" transaction="0" creation_time="0" snap_time="1">'
+ echo ' <device dev_id="'$i'" mapped_blocks="37" transaction="0" creation_time="0" snap_time="1">'
echo ' <range_mapping origin_begin="0" data_begin="0" length="37" time="0"/>'
echo ' </device>'
done
@@ -68,7 +68,7 @@ lvcreate -L2M -n $lv1 $vg
lvchange -an $vg/thin $vg/thin2 $vg/pool
# Prepare some fake metadata with unmatching id
-# Transaction_id is lower by 1 and there are no message -> ERROR
+# Transaction_id is lower by 1 and there are no messages -> ERROR
fake_metadata_ 10 0 >data
"$LVM_TEST_THIN_RESTORE_CMD" -i data -o "$DM_DEV_DIR/mapper/$vg-$lv1"
lvconvert -y --thinpool $vg/pool --poolmetadata $vg/$lv1
@@ -91,7 +91,7 @@ fake_metadata_ 400 2 >data
"$LVM_TEST_THIN_RESTORE_CMD" -i data -o "$DM_DEV_DIR/mapper/$vg-$lv1"
# Swap volume with restored fake metadata
-lvconvert -y --thinpool $vg/pool --poolmetadata $vg/$lv1
+lvconvert -y --chunksize 64k --thinpool $vg/pool --poolmetadata $vg/$lv1
vgchange -ay $vg
8 years, 7 months
master - tests: use conv=fdatasync
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dc261f17e96cb4...
Commit: dc261f17e96cb4012dd34329fd6ae9f766eb7c11
Parent: ee8200f1c6d8613ae1f55b41d5eb758b547c6a4b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 3 23:04:15 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Sep 3 23:34:37 2015 +0200
tests: use conv=fdatasync
Should be slightly better to flushed before dd exits
instead of using direct IO.
---
test/shell/lvcreate-thin-external-size.sh | 8 ++++----
test/shell/snapshot-autoumount-dmeventd.sh | 2 +-
test/shell/snapshot-maxsize.sh | 2 +-
test/shell/snapshot-reactivate.sh | 10 +++++-----
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/test/shell/lvcreate-thin-external-size.sh b/test/shell/lvcreate-thin-external-size.sh
index d8e98f9..e2f49c4 100644
--- a/test/shell/lvcreate-thin-external-size.sh
+++ b/test/shell/lvcreate-thin-external-size.sh
@@ -42,7 +42,7 @@ d2="$DM_DEV_DIR/$vg/$lv2"
lvcreate -l47 -n $lv1 $vg
# Fill end with pattern
-dd if=64K of="$d1" bs=8192 seek=45 count=2
+dd if=64K of="$d1" bs=8192 seek=45 count=2 conv=fdatasync
# Switch to read-only volume
lvchange -an $vg/$lv1
@@ -58,7 +58,7 @@ cmp -n 16384 -l 64K 16K
# Now extend and rewrite
lvextend -l+2 $vg/$lv2
-dd if=64K of="$d2" bs=8192 seek=46 count=3 oflag=direct
+dd if=64K of="$d2" bs=8192 seek=46 count=3 conv=fdatasync
dd if="$d2" of=24K bs=8192 skip=46 count=3 iflag=direct
cmp -n 24576 -l 64K 24K
@@ -67,7 +67,7 @@ check lv_field $vg/$lv2 data_percent "66.67"
lvreduce -f -l-24 $vg/$lv2
-dd if=64K of="$d2" bs=8192 seek=24 count=1 oflag=direct
+dd if=64K of="$d2" bs=8192 seek=24 count=1 conv=fdatasync
dd if="$d2" of=8K bs=8192 skip=24 count=1 iflag=direct
cmp -n 8192 -l 64K 8K
@@ -80,7 +80,7 @@ lvcreate -L256M -T $vg/pool -c 64M
lvcreate -s $vg/$lv1 --name $lv2 --thinpool $vg/pool
lvextend -l+2 $vg/$lv2
-dd if=64K of="$d2" bs=8192 seek=45 count=4 oflag=direct
+dd if=64K of="$d2" bs=8192 seek=45 count=4 conv=fdatasync
dd if="$d2" of=32K bs=8192 skip=45 count=4 iflag=direct
cmp -n 32768 -l 64K 32K
diff --git a/test/shell/snapshot-autoumount-dmeventd.sh b/test/shell/snapshot-autoumount-dmeventd.sh
index d369dac..9fc1c72 100644
--- a/test/shell/snapshot-autoumount-dmeventd.sh
+++ b/test/shell/snapshot-autoumount-dmeventd.sh
@@ -34,7 +34,7 @@ mkdir "$mntdir"
mount "$DM_DEV_DIR/mapper/$vg-snap" "$mntdir"
cat /proc/mounts | grep "$mntdir"
-not dd if=/dev/zero of="$mntdir/file$1" bs=1M count=5 oflag=direct
+not dd if=/dev/zero of="$mntdir/file$1" bs=1M count=5 conv=fdatasync
# Should be nearly instant check of dmeventd for invalid snapshot.
# Wait here for umount and open_count drops to 0 as it may
diff --git a/test/shell/snapshot-maxsize.sh b/test/shell/snapshot-maxsize.sh
index e24f965..a96bd7f 100644
--- a/test/shell/snapshot-maxsize.sh
+++ b/test/shell/snapshot-maxsize.sh
@@ -24,7 +24,7 @@ lvcreate -aey -L1 -n $lv1 $vg
# Snapshot should be large enough to handle any writes
lvcreate -L2 -s $vg/$lv1 -n $lv2
-dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=1M count=1 oflag=direct
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=1M count=1 conv=fdatasync
# Snapshot must not be 'I'nvalid here
check lv_attr_bit state $vg/$lv2 "a"
diff --git a/test/shell/snapshot-reactivate.sh b/test/shell/snapshot-reactivate.sh
index 978f7c0..9e9b4b7 100644
--- a/test/shell/snapshot-reactivate.sh
+++ b/test/shell/snapshot-reactivate.sh
@@ -30,24 +30,24 @@ which md5sum || skip
aux prepare_vg
# 8M file with some random data
-dd if=/dev/urandom of=data bs=1M count=1
-dd if=data of=data bs=1M count=7 seek=1
+dd if=/dev/urandom of=data bs=1M count=1 conv=fdatasync
+dd if=data of=data bs=1M count=7 seek=1 conv=fdatasync
echo "$(md5sum data | cut -d' ' -f1) $DM_DEV_DIR/$vg/s" >md5.${vg}-s
lvcreate -aey -L 8M -n o $vg
-dd if=data of="$DM_DEV_DIR/$vg/o" bs=1M
+dd if=data of="$DM_DEV_DIR/$vg/o" bs=1M conv=fdatasync
lvcreate -L 8M -s -n s $vg/o
check_s_
-dd if=data of="$DM_DEV_DIR/$vg/o" bs=1234567 count=1 skip=1
+dd if=data of="$DM_DEV_DIR/$vg/o" bs=1234567 count=1 skip=1 conv=fdatasync
check_s_
lvchange -an $vg
lvchange -ay $vg
check_s_
-dd if=data of="$DM_DEV_DIR/$vg/o" bs=1234567 count=2 skip=1
+dd if=data of="$DM_DEV_DIR/$vg/o" bs=1234567 count=2 skip=1 conv=fdatasync
check_s_
lvchange -an $vg
8 years, 7 months
master - cleanup: use just 2 decimal digits
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ee8200f1c6d861...
Commit: ee8200f1c6d8613ae1f55b41d5eb758b547c6a4b
Parent: 0a389691dcf9a31bb0da26089febb0bdd93545d7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Sep 2 16:13:50 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Sep 3 23:34:37 2015 +0200
cleanup: use just 2 decimal digits
---
lib/activate/dev_manager.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index d4a349b..c8e9589 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1117,7 +1117,7 @@ static int _percent_run(struct dev_manager *dm, const char *name,
goto_out;
}
- log_debug_activation("LV percent: %f", dm_percent_to_float(*overall_percent));
+ log_debug_activation("LV percent: %.2f", dm_percent_to_float(*overall_percent));
r = 1;
out:
8 years, 7 months
master - cleanup: avoid printing -0.00
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0a389691dcf9a3...
Commit: 0a389691dcf9a31bb0da26089febb0bdd93545d7
Parent: 32d6ca9196591d7f4d820e373fd14fd0f2301914
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 3 22:51:15 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Sep 3 23:34:37 2015 +0200
cleanup: avoid printing -0.00
Nice trick to not print -0.00 for some percent values.
---
libdm/libdm-report.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 2ebb69e..6416f18 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -2309,7 +2309,8 @@ static const char *_get_reserved(struct dm_report *rh, unsigned type,
float dm_percent_to_float(dm_percent_t percent)
{
- return (float) percent / DM_PERCENT_1;
+ /* Add 0.f to prevent returning -0.00 */
+ return (float) percent / DM_PERCENT_1 + 0.f;
}
dm_percent_t dm_make_percent(uint64_t numerator, uint64_t denominator)
8 years, 7 months
master - cleanup: show error message
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=32d6ca9196591d...
Commit: 32d6ca9196591d7f4d820e373fd14fd0f2301914
Parent: 20e317cf92d0760c8e1052dc975a14645aecfd84
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Aug 26 14:14:44 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Sep 3 23:34:36 2015 +0200
cleanup: show error message
Add error message on error path.
---
lib/metadata/raid_manip.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 8ecdc02..118bd06 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -397,8 +397,10 @@ static struct logical_volume *_alloc_image_component(struct logical_volume *lv,
}
if (dm_snprintf(img_name, sizeof(img_name), "%s_%s_%%d",
- (alt_base_name) ? : lv->name, type_suffix) < 0)
- return_0;
+ (alt_base_name) ? : lv->name, type_suffix) < 0) {
+ log_error("Component name for raid %s is too long.", lv->name);
+ return 0;
+ }
status = LVM_READ | LVM_WRITE | LV_REBUILD | type;
if (!(tmp_lv = lv_create_empty(img_name, NULL, status, ALLOC_INHERIT, lv->vg))) {
8 years, 7 months
master - lvcreate: restore missed --monitor
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=20e317cf92d076...
Commit: 20e317cf92d0760c8e1052dc975a14645aecfd84
Parent: 2b9843c20b3ca26867228d89154b611c4464eff2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Aug 27 17:19:09 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Sep 3 23:34:36 2015 +0200
lvcreate: restore missed --monitor
Fix regression from d13239b0547e09def4b58b0f49bd0252f459d431.
This patch reorganized whole command option parsing, however
it has lost support to accept --monitor arg.
---
WHATS_NEW | 1 +
tools/lvcreate.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6336f45..887fafd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.130 -
===================================
+ Restore support for --monitor option in lvcreate (2.02.112).
Read thin-pool data and metadata percent without flush.
Detect blocked thin-pool and avoid scanning their thin volumes.
Check if dm device is usable before checking its size (2.02.116).
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 2a94f3b..364a16a 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -700,6 +700,7 @@ static int _lvcreate_params(struct cmd_context *cmd,
contiguous_ARG,\
ignoreactivationskip_ARG,\
ignoremonitoring_ARG,\
+ monitor_ARG,\
mirrors_ARG,\
name_ARG,\
noudevsync_ARG,\
8 years, 7 months