master - thin: metadata size cannot be reduced
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e4b9ac46d74e27...
Commit: e4b9ac46d74e2783d4a27ceffc49d7f97fe4409f
Parent: 45f3e8bbef54b5541714010eb96da767e7856f62
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Aug 21 11:05:21 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Aug 21 15:35:45 2015 +0200
thin: metadata size cannot be reduced
Until we implement offline metadata manipulation,
the size of metadata LV cannot be reduced.
---
lib/metadata/lv_manip.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index c192d1b..5630234 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5105,6 +5105,11 @@ static int _lvresize_check_type(struct cmd_context *cmd, const struct logical_vo
}
}
+ if ((lp->resize == LV_REDUCE) && lv_is_thin_pool_metadata(lv)) {
+ log_error("Thin pool metadata volumes cannot be reduced.");
+ return 0;
+ }
+
if (lv_is_thin_volume(lv) && first_seg(lv)->external_lv &&
(lp->resize == LV_EXTEND)) {
/* Validate thin target supports bigger size of thin volume then external origin */
@@ -5296,7 +5301,7 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
*/
inactive = 1;
if (!activate_lv_excl(cmd, lock_lv)) {
- log_error("Failed to activate %s.", lock_lv->name);
+ log_error("Failed to activate %s.", display_lvname(lock_lv));
return 0;
}
}
@@ -5317,7 +5322,7 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
backup(vg);
if (inactive && !deactivate_lv(cmd, lock_lv)) {
- log_error("Problem deactivating %s.", lock_lv->name);
+ log_error("Problem deactivating %s.", display_lvname(lock_lv));
return 0;
}
}
8 years, 7 months
master - cache: enable setting cachepolicy in lvconvert
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=45f3e8bbef54b5...
Commit: 45f3e8bbef54b5541714010eb96da767e7856f62
Parent: 1fae121b222927584a7a88cd3f4f1ba2aadb4931
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Aug 21 13:00:13 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Aug 21 15:35:45 2015 +0200
cache: enable setting cachepolicy in lvconvert
---
tools/commands.h | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/tools/commands.h b/tools/commands.h
index 0ab578d..4505d18 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -275,6 +275,8 @@ xx(lvconvert,
"[--type cache[-pool]|-H|--cache]\n"
"\t[--cachepool CacheDataLogicalVolume[Path]]\n"
"\t[--cachemode CacheMode]\n"
+ "\t[--cachepolicy policy]\n"
+ "\t[--cachesettings key=value]\n"
"\t[--chunksize size]\n"
"\t[--poolmetadataspare {y|n}]]\n"
"\t[{--poolmetadata CacheMetadataLogicalVolume[Path] |\n"
@@ -282,7 +284,8 @@ xx(lvconvert,
COMMON_OPTS
"\t[Cache|CacheDataPool]LogicalVolume[Path] [PhysicalVolumePath...]\n\n",
- alloc_ARG, background_ARG, cache_ARG, cachemode_ARG, cachepool_ARG, chunksize_ARG,
+ alloc_ARG, background_ARG, cache_ARG, cachemode_ARG,
+ cachepool_ARG, cachepolicy_ARG, cachesettings_ARG, chunksize_ARG,
corelog_ARG, discards_ARG, force_ARG, interval_ARG, merge_ARG, mirrorlog_ARG,
mirrors_ARG, name_ARG, noudevsync_ARG, originname_ARG, poolmetadata_ARG,
poolmetadatasize_ARG, poolmetadataspare_ARG, readahead_ARG, regionsize_ARG,
@@ -301,6 +304,8 @@ xx(lvcreate,
"\t[--alloc AllocationPolicy]\n"
"\t[-H|--cache\n"
"\t [--cachemode {writeback|writethrough}]\n"
+ "\t [--cachepolicy policy]\n"
+ "\t [--cachesettings key=value]\n"
"\t[--cachepool CachePoolLogicalVolume{Name|Path}]\n"
"\t[-c|--chunksize ChunkSize]\n"
"\t[-C|--contiguous {y|n}]\n"
8 years, 7 months
dev-bmr-dmstats-precise - libdm: fix histogram memory allocation
by Bryn Reeves
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b7ab402cc23bfa...
Commit: b7ab402cc23bfa78d3a138e611ded77d3f67bb0c
Parent: 4cc88a734841b6a57421202b1eb5c9abcbcc5916
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Fri Aug 21 12:17:34 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Fri Aug 21 12:17:34 2015 +0100
libdm: fix histogram memory allocation
The histogram table is currently grown onto the end of an area's
counters struct. This cannot work with the current area addressing
scheme: since we are using array member access to find an area's
counters in a region's area table we cannot change the size of the
memory area used to store the counters: doing so causes histogram
data to appear in the subsequent region's counter struct.
Keeping the current memory allocation scheme would involve changing
every site that accesses an areas table to have it use the correct
multiplier when calculating an area's offset in the table. This
works since the size of the histogram table is the same for every
area within a region.
Avoid this by using a separate pool for the histogram allocations:
this allows us to grow the histogram and counter tables at the same
time without their interfering with one another.
---
libdm/libdm-stats.c | 72 +++++++++++++++++++++++++++++++-------------------
1 files changed, 45 insertions(+), 27 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index c5ed4c5..858b52d 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -50,7 +50,7 @@ struct dm_stats_counters {
uint64_t total_read_nsecs; /* Total time spent reading in milliseconds */
uint64_t total_write_nsecs; /* Total time spent writing in milliseconds */
uint64_t histogram_sum; /* Sum of histogram bin counts. */
- struct dm_stats_hist_bin histogram[0]; /* Histogram entries. */
+ struct dm_stats_hist_bin *histogram; /* Histogram entries. */
};
struct dm_stats_region {
@@ -74,6 +74,7 @@ struct dm_stats {
char *uuid; /* device-mapper UUID */
char *program_id; /* default program_id for this handle */
struct dm_pool *mem; /* memory pool for region and counter tables */
+ struct dm_pool *hist_mem; /* separate pool for histogram tables */
uint64_t nr_regions; /* total number of present regions */
uint64_t max_region; /* size of the regions table */
uint64_t interval_ns; /* sampling interval in nanoseconds */
@@ -110,13 +111,19 @@ static char *_program_id_from_proc(void)
struct dm_stats *dm_stats_create(const char *program_id)
{
+ size_t hist_hint = sizeof(struct dm_stats_hist_bin);
struct dm_stats *dms = NULL;
if (!(dms = dm_zalloc(sizeof(*dms))))
return_NULL;
+
+ /* FIXME: better hint. */
if (!(dms->mem = dm_pool_create("stats_pool", 4096)))
goto_out;
+ if (!(dms->hist_mem = dm_pool_create("histogram_pool", hist_hint)))
+ return_0;
+
if (!program_id || !strlen(program_id))
dms->program_id = _program_id_from_proc();
else
@@ -254,6 +261,7 @@ static int _stats_check_precise_timestamps(const struct dm_stats *dms)
/* Already checked? */
if (dms->precise)
return 1;
+
return dm_message_supports_precise_timestamps();
}
@@ -767,31 +775,24 @@ out:
return 0;
}
-static void _set_histogram_sums(struct dm_stats_region *region)
-{
- uint64_t i, j, sum;
-
- for (i = 0; i < _nr_areas_region(region); i++) {
- for (j = 0, sum = 0; j < region->hist_bins; j++)
- sum += region->counters[i].histogram[j].count;
- region->counters[i].histogram_sum = sum;
- }
-}
-
/*
* Parse histogram data returned from a @stats_print operation.
*/
-static int _stats_parse_histogram(struct dm_pool *mem, char *hist,
+static int _stats_parse_histogram(struct dm_pool *mem, char *hist_str,
+ struct dm_stats_hist_bin **histogram,
+ uint64_t *histogram_sum,
struct dm_stats_region *region)
{
static const char *_valid_chars = "0123456789:";
- uint64_t *bounds = region->hist_bounds;
+ uint64_t sum = 0, *bounds = region->hist_bounds;
unsigned bins = region->hist_bins;
struct dm_stats_hist_bin cur;
const char *c, *v;
int i = 0;
- c = hist;
+ c = hist_str;
+
+ dm_pool_begin_object(mem, sizeof(cur));
do {
memset(&cur, 0, sizeof(cur));
@@ -802,7 +803,7 @@ static int _stats_parse_histogram(struct dm_pool *mem, char *hist,
goto badchar;
if (*c == ',') {
- log_error("Invalid histogram: %s", hist);
+ log_error("Invalid histogram: %s", hist_str);
goto out;
} else {
const char *val_start = c;
@@ -833,6 +834,7 @@ static int _stats_parse_histogram(struct dm_pool *mem, char *hist,
UINT64_MAX : bounds[i + 1];
cur.count = this_val;
+ sum += this_val;
dm_pool_grow_object(mem, &cur, sizeof(cur));
@@ -842,6 +844,10 @@ static int _stats_parse_histogram(struct dm_pool *mem, char *hist,
log_debug("Added region histogram data with %d entries.",
region->hist_bins);
+
+ *histogram = dm_pool_end_object(mem);
+ *histogram_sum = sum;
+
return 1;
badchar:
@@ -850,11 +856,13 @@ out:
return 0;
}
-static int _stats_parse_region(struct dm_pool *mem, const char *resp,
+static int _stats_parse_region(struct dm_stats *dms, const char *resp,
struct dm_stats_region *region,
uint64_t timescale)
{
+ struct dm_stats_hist_bin *hist = NULL;
struct dm_stats_counters cur;
+ struct dm_pool *mem = dms->mem;
FILE *stats_rows = NULL;
uint64_t start, len;
char row[256];
@@ -937,22 +945,32 @@ static int _stats_parse_region(struct dm_pool *mem, const char *resp,
cur.total_write_nsecs *= timescale;
}
- if(!dm_pool_grow_object(mem, &cur, sizeof(cur)))
- goto_out;
-
if (region->hist_bins) {
/* Find first histogram separator. */
- char *hist_start = strchr(row, ':');
- if (!hist_start) {
+ char *hist_str = strchr(row, ':');
+ if (!hist_str) {
log_error("Could not parse histogram value.");
goto out;
}
/* Find space preceding histogram. */
- while (hist_start && *(hist_start - 1) != ' ')
- hist_start--;
- _stats_parse_histogram(mem, hist_start, region);
+ while (hist_str && *(hist_str - 1) != ' ')
+ hist_str--;
+
+ /* Use a separate pool for histogram objects since we
+ * are growing the area table and each area's histogram
+ * table simultaneously.
+ */
+ if (!_stats_parse_histogram(dms->hist_mem, hist_str,
+ &hist, &cur.histogram_sum,
+ region))
+ goto out;
}
+ cur.histogram = hist;
+
+ if(!dm_pool_grow_object(mem, &cur, sizeof(cur)))
+ goto_out;
+
if (region->start == UINT64_MAX) {
region->start = start;
region->step = len; /* area size is always uniform. */
@@ -962,7 +980,6 @@ static int _stats_parse_region(struct dm_pool *mem, const char *resp,
region->len = (start + len) - region->start;
region->timescale = timescale;
region->counters = dm_pool_end_object(mem);
- _set_histogram_sums(region);
if (fclose(stats_rows))
stack;
@@ -1331,7 +1348,7 @@ static int _dm_stats_populate_region(struct dm_stats *dms, uint64_t region_id,
if (!_stats_bound(dms))
return_0;
- if (!_stats_parse_region(dms->mem, resp, region, region->timescale)) {
+ if (!_stats_parse_region(dms, resp, region, region->timescale)) {
log_error("Could not parse @stats_print message response.");
return 0;
}
@@ -1399,6 +1416,7 @@ void dm_stats_destroy(struct dm_stats *dms)
_stats_regions_destroy(dms);
_stats_clear_binding(dms);
dm_pool_destroy(dms->mem);
+ dm_pool_destroy(dms->hist_mem);
if (dms->histogram)
dm_free(dms->histogram);
dm_free(dms->program_id);
8 years, 7 months
dev-prajnoha-pv-ext-flag-used - dmstats: add 'area_offset' field to stats reports
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0f3b81bb2e7de6...
Commit: 0f3b81bb2e7de61457ec0f2a72f381b9992421c6
Parent: 00ed52365916753d0bd6eb0de09c46ad782fec2e
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Fri Aug 14 21:49:40 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Fri Aug 14 22:03:37 2015 +0100
dmstats: add 'area_offset' field to stats reports
---
tools/dmsetup.c | 32 ++++++++++++++++++++++++++++++--
1 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 74e7806..f69fbe4 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -3319,6 +3319,34 @@ static int _dm_stats_area_start_disp(struct dm_report *rh,
return 1;
}
+static int _dm_stats_area_offset_disp(struct dm_report *rh,
+ struct dm_pool *mem __attribute__((unused)),
+ struct dm_report_field *field, const void *data,
+ void *private __attribute__((unused)))
+{
+ const struct dm_stats *dms = (const struct dm_stats *) data;
+ uint64_t area_offset;
+ const char *repstr;
+ double *sortval;
+ char units = _disp_units;
+ uint64_t factor = _disp_factor;
+
+ if (!dm_stats_get_current_area_offset(dms, &area_offset))
+ return_0;
+
+ if (!(repstr = dm_size_to_string(mem, area_offset, units, 1, factor,
+ _show_units(), DM_SIZE_UNIT)))
+ return_0;
+
+ if (!(sortval = dm_pool_alloc(mem, sizeof(uint64_t))))
+ return_0;
+
+ *sortval = (double) area_offset;
+
+ dm_report_field_set_value(field, repstr, sortval);
+ return 1;
+}
+
static int _dm_stats_area_len_disp(struct dm_report *rh,
struct dm_pool *mem __attribute__((unused)),
struct dm_report_field *field, const void *data,
@@ -3976,12 +4004,12 @@ FIELD_F(STATS_META, NUM, "RgID", 5, dm_stats_region_id, "region_id", "Region ID.
FIELD_F(STATS_META, SIZ, "RStart", 5, dm_stats_region_start, "region_start", "Region start.")
FIELD_F(STATS_META, SIZ, "RSize", 5, dm_stats_region_len, "region_len", "Region length.")
FIELD_F(STATS_META, NUM, "ArID", 5, dm_stats_area_id, "area_id", "Area ID.")
-FIELD_F(STATS_META, SIZ, "AStrt", 5, dm_stats_area_start, "area_start", "Area start.")
+FIELD_F(STATS_META, SIZ, "AStart", 5, dm_stats_area_start, "area_start", "Area offset from start of device.")
FIELD_F(STATS_META, SIZ, "ASize", 5, dm_stats_area_len, "area_len", "Area length.")
+FIELD_F(STATS_META, SIZ, "AOff", 5, dm_stats_area_offset, "area_offset", "Area offset from start of region.")
FIELD_F(STATS_META, NUM, "#Areas", 6, dm_stats_area_count, "area_count", "Area count.")
FIELD_F(STATS_META, STR, "ProgID", 6, dm_stats_program_id, "program_id", "Program ID.")
FIELD_F(STATS_META, STR, "AuxDat", 6, dm_stats_aux_data, "aux_data", "Auxiliary data.")
-
{0, 0, 0, 0, "", "", NULL, NULL},
/* *INDENT-ON* */
};
8 years, 7 months
dev-prajnoha-pv-ext-flag-used - cache: introduce mq and smq profiles
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=694c88e031fb44...
Commit: 694c88e031fb44f957c75bea369b898e1dedf932
Parent: 036d90bba6c1ac76195302bc5c7f2f5ce8ad89b4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 20 16:46:21 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Aug 12 14:11:16 2015 +0200
cache: introduce mq and smq profiles
Add 2 demo profiles for mq and smq policies.
Show all support profilable params.
Use with: lvcreate --policy cache-mq ....
---
WHATS_NEW | 1 +
conf/Makefile.in | 8 ++++++--
conf/cache-mq.profile | 20 ++++++++++++++++++++
conf/cache-smq.profile | 14 ++++++++++++++
4 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9c8a103..347fcd4 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.128 -
===================================
+ Add demo cache-mq and cache-smq profiles.
Add cmd profilable allocation/cache_policy,cache_settings,cache_mode.
Require cache_check 0.5.4 for use of --clear-needs-check-flag.
Fix lvmetad udev rules to not override SYSTEMD_WANTS, add the service instead.
diff --git a/conf/Makefile.in b/conf/Makefile.in
index 43d5f75..128395e 100644
--- a/conf/Makefile.in
+++ b/conf/Makefile.in
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2004-2015 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -20,7 +20,11 @@ CONFDEST=lvm.conf
CONFLOCAL=lvmlocal.conf
PROFILE_TEMPLATES=command_profile_template.profile metadata_profile_template.profile
-PROFILES=$(PROFILE_TEMPLATES) $(srcdir)/thin-generic.profile $(srcdir)/thin-performance.profile
+PROFILES=$(PROFILE_TEMPLATES) \
+ $(srcdir)/cache-mq.profile \
+ $(srcdir)/cache-smq.profile \
+ $(srcdir)/thin-generic.profile \
+ $(srcdir)/thin-performance.profile
include $(top_builddir)/make.tmpl
diff --git a/conf/cache-mq.profile b/conf/cache-mq.profile
new file mode 100644
index 0000000..3c90331
--- /dev/null
+++ b/conf/cache-mq.profile
@@ -0,0 +1,20 @@
+# Demo configuration 'mq' cache policy
+#
+# Note: This policy has been deprecated in favor of the smq policy
+# keyword "default" means, setting is left with kernel defaults.
+#
+
+allocation {
+ cache_pool_chunk_size = 64
+ cache_mode = "writethrough"
+ cache_policy = "mq"
+ cache_settings {
+ mq {
+ sequential_threshold = "default" # #nr_sequential_ios
+ random_threshold = "default" # #nr_random_ios
+ read_promote_adjustment = "default"
+ write_promote_adjustment = "default"
+ discard_promote_adjustment = "default"
+ }
+ }
+}
diff --git a/conf/cache-smq.profile b/conf/cache-smq.profile
new file mode 100644
index 0000000..c0d6266
--- /dev/null
+++ b/conf/cache-smq.profile
@@ -0,0 +1,14 @@
+# Demo configuration 'smq' cache policy
+#
+# The stochastic multi-queue (smq) policy addresses some of the problems
+# with the multiqueue (mq) policy and uses less memory.
+#
+
+allocation {
+ cache_pool_chunk_size = 64
+ cache_mode = "writethrough"
+ cache_policy = "smq"
+ cache_settings {
+ # currently no settins for "smq" policy
+ }
+}
8 years, 7 months
dev-prajnoha-pv-ext-flag-used - report: also recognize variants without underscores for <prefix>_all fields
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6ac5689ce4d4f8...
Commit: 6ac5689ce4d4f86c4b3985d73a0fdb4af04c298d
Parent: d11f8d42287025ff8584b9d6f1d5e70a0d78371b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Aug 4 09:03:31 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 4 09:03:31 2015 +0200
report: also recognize variants without underscores for <prefix>_all fields
For example: "pvs -o pv_all" and pvs -o pvall" are same.
---
libdm/libdm-report.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 5b94311..225da90 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -876,15 +876,20 @@ static void _all_match_combine(const struct dm_report_object_type *types,
const char *field, size_t flen,
uint32_t *report_types)
{
+ char field_canon[DM_REPORT_FIELD_TYPE_ID_LEN];
const struct dm_report_object_type *t;
size_t prefix_len;
+ if (!_get_canonical_field_name(field, flen, field_canon, DM_REPORT_FIELD_TYPE_ID_LEN, NULL))
+ return;
+ flen = strlen(field_canon);
+
for (t = types; t->data_fn; t++) {
- prefix_len = strlen(t->prefix);
+ prefix_len = strlen(t->prefix) - 1;
- if (!strncasecmp(t->prefix, field, prefix_len) &&
+ if (!strncasecmp(t->prefix, field_canon, prefix_len) &&
((unprefixed_all_matched && (flen == prefix_len)) ||
- (!strncasecmp(field + prefix_len, "all", 3) &&
+ (!strncasecmp(field_canon + prefix_len, "all", 3) &&
(flen == prefix_len + 3))))
*report_types |= t->id;
}
8 years, 7 months
dev-prajnoha-pv-ext-flag-used - libdm-stats: backtrace if fclose fails (Coverity)
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f072a7632655d0...
Commit: f072a7632655d0541b56858d5fbe172fa6075e68
Parent: 856f9cced83078a90ca2291eff0758d42775f195
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Mon Aug 10 19:23:41 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Mon Aug 10 20:26:07 2015 +0100
libdm-stats: backtrace if fclose fails (Coverity)
Since libdm-stats only uses fmemopen'd FILE objects the only way
that a close can fail is corruption of the memory containing the
FILE: check for this case and emit a backtrace if it occurs.
libdm/libdm-stats.c: 338 in _stats_parse_list()
libdm/libdm-stats.c: 341 in _stats_parse_list()
libdm/libdm-stats.c: 481 in _stats_parse_region()
libdm/libdm-stats.c: 487 in _stats_parse_region()
libdm/libdm-stats.c: 487 in _stats_parse_region()
- Calling "fclose" without checking return value
---
libdm/libdm-stats.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 192326e..ea4feef 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -81,11 +81,13 @@ static char *_program_id_from_proc(void)
if (!fgets(buf, sizeof(buf), comm)) {
log_error("Could not read from %s", PROC_SELF_COMM);
- fclose(comm);
+ if(fclose(comm))
+ stack;
return NULL;
}
- fclose(comm);
+ if (fclose(comm))
+ stack;
return dm_strdup(buf);
}
@@ -340,10 +342,13 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
dms->max_region = max_region - 1;
dms->regions = dm_pool_end_object(mem);
- fclose(list_rows);
+ if (fclose(list_rows))
+ stack;
+
return 1;
out:
- fclose(list_rows);
+ if(fclose(list_rows))
+ stack;
dm_pool_abandon_object(mem);
return 0;
}
@@ -483,13 +488,16 @@ static int _stats_parse_region(struct dm_pool *mem, const char *resp,
region->timescale = timescale;
region->counters = dm_pool_end_object(mem);
- fclose(stats_rows);
+ if (fclose(stats_rows))
+ stack;
+
return 1;
out:
if (stats_rows)
- fclose(stats_rows);
+ if(fclose(stats_rows))
+ stack;
dm_pool_abandon_object(mem);
return 0;
}
8 years, 7 months
dev-prajnoha-pv-ext-flag-used - dmsetup: Also install dmstats.
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=41001dbfdd5467...
Commit: 41001dbfdd54674ead6051d06a8b89701dce68c5
Parent: d62a8d2f1535468c75379b877844bdb7666c8c9e
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Aug 10 00:35:15 2015 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Aug 10 00:35:15 2015 +0100
dmsetup: Also install dmstats.
---
spec/packages.inc | 2 ++
tools/Makefile.in | 2 ++
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/spec/packages.inc b/spec/packages.inc
index 2c0caa8..d781067 100644
--- a/spec/packages.inc
+++ b/spec/packages.inc
@@ -398,7 +398,9 @@ for the kernel device-mapper.
%defattr(-,root,root,-)
%doc COPYING COPYING.LIB WHATS_NEW_DM VERSION_DM README INSTALL
%attr(755,root,root) %{_sbindir}/dmsetup
+%{_sbindir}/dmstats
%{_mandir}/man8/dmsetup.8.gz
+%{_mandir}/man8/dmstats.8.gz
%if %{enable_udev}
%doc udev/12-dm-permissions.rules
%dir %{_udevbasedir}
diff --git a/tools/Makefile.in b/tools/Makefile.in
index cec74a9..d6e54f0 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -204,9 +204,11 @@ install_tools_static: lvm.static
install_dmsetup_dynamic: dmsetup
$(INSTALL_PROGRAM) -D $< $(sbindir)/$(<F)
+ $(LN_S) -f $(<F) $(sbindir)/dmstats
install_dmsetup_static: dmsetup.static
$(INSTALL_PROGRAM) -D $< $(staticdir)/$(<F)
+ $(LN_S) -f $(<F) $(sbindir)/dmstats
install_device-mapper: $(INSTALL_DMSETUP_TARGETS)
8 years, 7 months
dev-prajnoha-pv-ext-flag-used - man lvmcache: mention LVs must be in the same VG
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1c013e7ae29a9e...
Commit: 1c013e7ae29a9e3aa20930a24f3fcf0637ef1e91
Parent: fd1782b5fc41f3b9aceba6c27ba23098b0b4b6e2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Aug 6 10:05:12 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Aug 6 10:06:21 2015 -0500
man lvmcache: mention LVs must be in the same VG
---
man/lvmcache.7.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/man/lvmcache.7.in b/man/lvmcache.7.in
index 433746b..7257386 100644
--- a/man/lvmcache.7.in
+++ b/man/lvmcache.7.in
@@ -16,7 +16,7 @@ origin LV to increase speed. The cache metadata LV holds the
accounting information that specifies where data blocks are stored (e.g.
on the origin LV or on the cache data LV). Users should be familiar with
these LVs if they wish to create the best and most robust cached
-logical volumes.
+logical volumes. All of these associated LVs must be in the same VG.
.SH Cache Terms
.nf
8 years, 7 months
dev-prajnoha-pv-ext-flag-used - libdm: check for zero in _nr_areas() (Coverity)
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=074b5de7715b76...
Commit: 074b5de7715b76ad63147f84edb5d9e1a05870e9
Parent: 69fa16048a61b6cd0b8fe9c311dd4e9eea532207
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Mon Aug 17 18:33:22 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Mon Aug 17 18:37:16 2015 +0100
libdm: check for zero in _nr_areas() (Coverity)
---
libdm/libdm-stats.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index b7000cc..ba213b7 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -504,6 +504,9 @@ out:
static uint64_t _nr_areas(uint64_t len, uint64_t step)
{
+ /* Default is one area. */
+ if (!len || !step)
+ return 1;
/*
* drivers/md/dm-stats.c::message_stats_create()
* A region may be sub-divided into areas with their own counters.
8 years, 7 months