master - man lvmlockd: fix typo
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d323acdfec8aaa...
Commit: d323acdfec8aaab1161aa5f80ae67622e396a632
Parent: 81b0e9de7c28e1516263427d270907c4781964e1
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 9 15:43:28 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 9 15:43:28 2015 -0500
man lvmlockd: fix typo
---
man/lvmlockd.8.in | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/man/lvmlockd.8.in b/man/lvmlockd.8.in
index 15f9b73..8567651 100644
--- a/man/lvmlockd.8.in
+++ b/man/lvmlockd.8.in
@@ -309,8 +309,8 @@ contain the "global lock".
The first vgcreate command needs to be given the path to a device that has
not yet been initialized with pvcreate. The pvcreate initialization will
be done by vgcreate. This is because the pvcreate command requires the
-global lock, which will not available until after the first sanlock VG is
-created.
+global lock, which will not be available until after the first sanlock VG
+is created.
.IP \[bu] 2
While running vgcreate for the first sanlock VG, ensure that the device
8 years, 9 months
master - man lvmlockd: mention device used for first vgcreate
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=81b0e9de7c28e1...
Commit: 81b0e9de7c28e1516263427d270907c4781964e1
Parent: 587fd6a0e479f630ad4d574d391f269048a81186
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 9 15:21:10 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 9 15:21:10 2015 -0500
man lvmlockd: mention device used for first vgcreate
---
man/lvmlockd.8.in | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/man/lvmlockd.8.in b/man/lvmlockd.8.in
index 7df0feb..15f9b73 100644
--- a/man/lvmlockd.8.in
+++ b/man/lvmlockd.8.in
@@ -306,10 +306,17 @@ they are not available until the VG exists. The first sanlock VG will
contain the "global lock".
.IP \[bu] 2
-While running vgcreate for the first sanlock VG, ensure that the PV being
-used is not used by another LVM command. Allocation of shared PVs is
-usually protected by the global lock, but this cannot be done for the
-first sanlock VG which will hold the global lock.
+The first vgcreate command needs to be given the path to a device that has
+not yet been initialized with pvcreate. The pvcreate initialization will
+be done by vgcreate. This is because the pvcreate command requires the
+global lock, which will not available until after the first sanlock VG is
+created.
+
+.IP \[bu] 2
+While running vgcreate for the first sanlock VG, ensure that the device
+being used is not used by another LVM command. Allocation of shared
+devices is usually protected by the global lock, but this cannot be done
+for the first sanlock VG which will hold the global lock.
.IP \[bu] 2
While running vgcreate for the first sanlock VG, ensure that the VG name
@@ -321,7 +328,7 @@ Because the first sanlock VG will contain the global lock, this VG needs
to be accessible to all hosts that will use sanlock shared VGs. All hosts
will need to use the global lock from the first sanlock VG.
-See below for other special cases related to moving the global lock.
+See below for more information about managing the sanlock global lock.
.SS using lockd VGs
8 years, 9 months
master - tests: ensure dd flushed all data before exit
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=587fd6a0e479f6...
Commit: 587fd6a0e479f630ad4d574d391f269048a81186
Parent: 6cb7f21e385178a7928635fc9531e2f6d8a91aac
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 8 14:11:46 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 8 15:41:34 2015 +0200
tests: ensure dd flushed all data before exit
---
test/shell/select-report.sh | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/test/shell/select-report.sh b/test/shell/select-report.sh
index cd3f452..fde7dc0 100644
--- a/test/shell/select-report.sh
+++ b/test/shell/select-report.sh
@@ -60,7 +60,7 @@ sel() {
items_found=$(wc -l "$OUT_LOG_FILE" | cut -f 1 -d ' ')
# the number of lines on output must match
- test $items_found -eq $# || {
+ test "$items_found" -eq $# || {
echo " >>> NUMBER OF ITEMS EXPECTED: $# ($@)"
echo " >>> NUMBER OF ITEMS FOUND: $items_found ($(< $OUT_LOG_FILE))"
return 1
@@ -143,10 +143,11 @@ if aux target_at_least dm-snapshot 1 10 0; then
# Before 1.10.0, the snap percent included metadata size.
sel lv 'snap_percent=0' snap
fi
-dd if=/dev/zero of="$DM_DEV_DIR/$vg3/snap" bs=1M count=1
+dd if=/dev/zero of="$DM_DEV_DIR/$vg3/snap" bs=1M count=1 conv=fdatasync
sel lv 'snap_percent<50' snap
sel lv 'snap_percent>50'
-dd if=/dev/zero of="$DM_DEV_DIR/$vg3/snap" bs=1M count=4
+# overflow snapshot -> invalidated, but still showing 100%
+not dd if=/dev/zero of="$DM_DEV_DIR/$vg3/snap" bs=1M count=4 conv=fdatasync
sel lv 'snap_percent=100' snap
# % char is accepted as suffix for percent values
sel lv 'snap_percent=100%' snap
8 years, 9 months
master - tests: better check for compiled version
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6cb7f21e385178...
Commit: 6cb7f21e385178a7928635fc9531e2f6d8a91aac
Parent: 8ff43c3705573043e2fa8ce68c2f052273cce205
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 8 14:11:06 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 8 15:41:34 2015 +0200
tests: better check for compiled version
Use install /lib files to check for expected version.
---
test/Makefile.in | 15 ++++++++++-----
test/shell/000-basic.sh | 9 ++-------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 769f931..f258cde 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -197,15 +197,17 @@ LIB_NOT = not
LIB_LINK_NOT = invalid fail should
LIB_SHARED = check aux inittest utils get lvm-wrapper
-install: .tests-stamp lib/paths-installed
+install: .tests-stamp lib/paths-installed lib/version-expected
@echo $(srcdir)
$(INSTALL_DIR) $(DATADIR)/{shell,api,lib} $(EXECDIR)
$(INSTALL_DATA) shell/*.sh $(DATADIR)/shell
$(INSTALL_DATA) api/*.sh $(DATADIR)/api
$(INSTALL_PROGRAM) api/*.{t,py} $(DATADIR)/api
$(INSTALL_DATA) lib/paths-installed $(DATADIR)/lib/paths
- cd lib && $(INSTALL_DATA) $(LIB_FLAVOURS) $(DATADIR)/lib
- cd lib && $(INSTALL_DATA) $(LIB_LVMLOCKD_CONF) $(DATADIR)/lib
+ cd lib && $(INSTALL_DATA) \
+ $(LIB_FLAVOURS) \
+ $(LIB_LVMLOCKD_CONF) \
+ version-expected $(DATADIR)/lib
@for i in cache-mq cache-smq thin-performance ; do \
echo "$(INSTALL_DATA) $(abs_top_srcdir)/conf/$$i.profile $(DATADIR)/lib"; \
$(INSTALL_DATA) $(abs_top_srcdir)/conf/$$i.profile $(DATADIR)/lib; done
@@ -281,10 +283,13 @@ lib/paths: lib/paths-common
echo 'abs_builddir="$(abs_builddir)"' >> $@-t
mv $@-t $@
+lib/version-expected: $(top_srcdir)/VERSION .lib-dir-stamp
+ cut -f 1 -d ' ' <$< >$@
+
CMDS = lvm $(shell cat $(top_builddir)/tools/.commands 2>/dev/null)
LIB = $(addprefix lib/, $(LIB_SHARED) $(LIB_LOCAL) $(LIB_NOT) $(LIB_LINK_NOT) $(LIB_FLAVOURS))
-.tests-stamp: $(ALL) $(LIB) $(SUBDIRS)
+.tests-stamp: $(ALL) $(LIB) $(SUBDIRS) lib/version-expected
@if test "$(srcdir)" != . ; then \
echo "Linking tests to builddir."; \
$(MKDIR_P) shell; \
@@ -316,7 +321,7 @@ endif
CLEAN_TARGETS += .lib-dir-stamp .tests-stamp $(LIB) $(addprefix lib/,\
$(CMDS) clvmd dmeventd dmsetup lvmetad lvmpolld \
- harness thin-performance.profile fsadm vgimportclone \
+ harness thin-performance.profile fsadm vgimportclone version-expected \
paths-installed paths-installed-t paths-common paths-common-t)
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
diff --git a/test/shell/000-basic.sh b/test/shell/000-basic.sh
index 573bbd1..582c5ef 100644
--- a/test/shell/000-basic.sh
+++ b/test/shell/000-basic.sh
@@ -15,15 +15,10 @@ test -e LOCAL_LVMPOLLD && skip
lvm version
-test -n "$abs_top_builddir" || skip
-
-v=$abs_top_builddir/lib/misc/lvm-version.h
-sed -n "/#define LVM_VERSION ./s///p" "$v" | sed "s/ .*//" > expected
-
-lvm pvmove --version|sed -n "1s/.*: *\([0-9][^ ]*\) .*/\1/p" > actual
+lvm pvmove --version|sed -n "1s/.*: *\([0-9][^ ]*\) .*/\1/p" | tee version
# ensure they are the same
-diff -u actual expected
+diff -u version lib/version-expected
# ensure we can create devices (uses dmsetup, etc)
aux prepare_devs 5
8 years, 9 months
master - makefiles: ensure no old .h are left
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8ff43c37055730...
Commit: 8ff43c3705573043e2fa8ce68c2f052273cce205
Parent: 026db9062129d8b5f0e0a8a6539014e8c04a35e0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 8 14:33:29 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 8 15:41:33 2015 +0200
makefiles: ensure no old .h are left
Ensure make clean cleans any left-over file from their previous
location so they are not in conflict with new ones.
Also hide error message when .commands file is not present.
---
lib/Makefile.in | 2 ++
test/Makefile.in | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/lib/Makefile.in b/lib/Makefile.in
index ec80c7c..3e0e6f8 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -229,3 +229,5 @@ include $(top_builddir)/make.tmpl
CFLAGS += $(BLKID_CFLAGS) $(UDEV_CFLAGS) $(VALGRIND_CFLAGS)
$(SUBDIRS): $(LIB_STATIC)
+
+CLEAN_TARGETS += misc/configure.h misc/lvm-version.h
diff --git a/test/Makefile.in b/test/Makefile.in
index e6860e1..769f931 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -281,7 +281,7 @@ lib/paths: lib/paths-common
echo 'abs_builddir="$(abs_builddir)"' >> $@-t
mv $@-t $@
-CMDS = lvm $(shell cat $(top_builddir)/tools/.commands)
+CMDS = lvm $(shell cat $(top_builddir)/tools/.commands 2>/dev/null)
LIB = $(addprefix lib/, $(LIB_SHARED) $(LIB_LOCAL) $(LIB_NOT) $(LIB_LINK_NOT) $(LIB_FLAVOURS))
.tests-stamp: $(ALL) $(LIB) $(SUBDIRS)
8 years, 9 months
master - WHATS_NEW: commit b77497cbd86a854add3ffa4ce09a35f165c0d2ba
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=026db9062129d8...
Commit: 026db9062129d8b5f0e0a8a6539014e8c04a35e0
Parent: b77497cbd86a854add3ffa4ce09a35f165c0d2ba
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Sep 8 15:37:23 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Sep 8 15:37:23 2015 +0200
WHATS_NEW: commit b77497cbd86a854add3ffa4ce09a35f165c0d2ba
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c9dec02..43fbb56 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.131 -
=====================================
+ Fix devices/filter to be applied before disk-accessing filters. (2.02.112)
Make tags only when requested via 'make tags'.
Configure supports --disable-dependency-tracking for one-time builds.
Fix usage of configure.h when building in srcdir != builddir.
8 years, 9 months
master - filters: make sure regex filter is evaluated before any filter that needs disk access
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b77497cbd86a85...
Commit: b77497cbd86a854add3ffa4ce09a35f165c0d2ba
Parent: 596ec5c74b604de42f105032b7e13065ea67d281
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Sep 8 15:03:15 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Sep 8 15:28:10 2015 +0200
filters: make sure regex filter is evaluated before any filter that needs disk access
The regex filter (controlled by devices/filter lvm.conf setting) was
evaluated as the very last filter. However, this is not optimal when
it comes to restricting disk access - users define devices/filter
as well as devices/global_filter to avoid this.
The devices/global_filter is already positioned at the beginning of the
filter chain. We need to do the same for devices/filter.
Filter chains before this patch:
A: when lvmetad is not used:
persistent_filter -> sysfs_filter -> global_regex_filter ->
type_filter -> usable->filter -> mpath_component_filter ->
partition_filter -> md_component_filter -> fw_raid_filter ->
regex_filter
B: when lvmetad is used:
B1: to update lvmetad:
sysfs_filter -> global_regex_filter -> type_filter ->
usable_filter -> mpath_component_filter -> partition_filter ->
md_component_filter -> fw_raid_filter
B2: to retrieve info from lvmetad:
persistent_filter -> usable_filter -> regex_filter
>From the chain list above we can see that particularly in case when
lvmetad is not used, the regex filter is the very last one that is
processed. If lvmetad is used, it doesn't matter much as there's
the global_regex_filter which is used instead when updating lvmetad
and when retrieving info from lvmetad, putting regex_filter in front
of usable_filter wouldn't change much since usabled_filter is not
reading disks directly.
This patch puts the regex filter to the front even in case lvmetad
is not used, hence reinstating the state as it was before commit
a7be3b12dfe7388d1648595e6cc4c7a1379bb8a7 (which moved the regex_filter
position in the chain). Still, the arguments for the commit
a7be3b12dfe7388d1648595e6cc4c7a1379bb8a7 still apply and they're
still satisfied since component filters (MD, mpath...) are evaluated
first just before updating lvmetad.
So with this patch, we end up with:
A: when lvmetad is not used:
persistent_filter -> sysfs_filter -> global_regex_filter ->
regex_filter -> type_filter -> usable->filter ->
mpath_component_filter -> partition_filter ->
md_component_filter -> fw_raid_filter
B: when lvmetad is used:
B1: to update lvmetad:
sysfs_filter -> global_regex_filter -> type_filter ->
usable_filter -> mpath_component_filter -> partition_filter ->
md_component_filter -> fw_raid_filter
B2: to retrieve info from lvmetad:
persistent_filter -> regex_filter -> usable_filter
This way, specifying the regex_filter in non-lvmetad case causes
the devices to be filtered based on regex first before processing
any other filters which can access disks (like md_component_filter).
This patch also streamlines the code for better readability.
---
lib/commands/toolcontext.c | 64 ++++++++++++++++++++++++++------------------
1 files changed, 38 insertions(+), 26 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 11affee..c8d96ca 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -1069,7 +1069,7 @@ static struct dev_filter *_init_lvmetad_filter_chain(struct cmd_context *cmd)
nr_filt++;
}
- /* regex filter. Optional. */
+ /* global regex filter. Optional. */
if ((cn = find_config_tree_node(cmd, devices_global_filter_CFG, NULL))) {
if (!(filters[nr_filt] = regex_filter_create(cn->v))) {
log_error("Failed to create global regex device filter");
@@ -1078,6 +1078,17 @@ static struct dev_filter *_init_lvmetad_filter_chain(struct cmd_context *cmd)
nr_filt++;
}
+ /* regex filter. Optional. */
+ if (!lvmetad_used()) {
+ if ((cn = find_config_tree_node(cmd, devices_filter_CFG, NULL))) {
+ if (!(filters[nr_filt] = regex_filter_create(cn->v))) {
+ log_error("Failed to create regex device filter");
+ goto bad;
+ }
+ nr_filt++;
+ }
+ }
+
/* device type filter. Required. */
if (!(filters[nr_filt] = lvm_type_filter_create(cmd->dev_types))) {
log_error("Failed to create lvm type filter");
@@ -1145,26 +1156,24 @@ bad:
* md component filter -> fw raid filter
*
* - cmd->filter - the filter chain used for lvmetad responses:
- * persistent filter -> usable device filter(FILTER_MODE_POST_LVMETAD) ->
- * regex filter
+ * persistent filter -> regex_filter -> usable device filter(FILTER_MODE_POST_LVMETAD)
*
* - cmd->full_filter - the filter chain used for all the remaining situations:
- * lvmetad_filter -> filter
+ * cmd->lvmetad_filter -> cmd->filter
*
- * If lvmetad isnot used, there's just one filter chain:
+ * If lvmetad is not used, there's just one filter chain:
*
* - cmd->filter == cmd->full_filter:
- * persistent filter -> regex filter -> sysfs filter ->
- * global regex filter -> type filter ->
- * usable device filter(FILTER_MODE_NO_LVMETAD) ->
- * mpath component filter -> partitioned filter ->
- * md component filter -> fw raid filter
+ * persistent filter -> sysfs filter -> global regex filter ->
+ * regex_filter -> type filter -> usable device filter(FILTER_MODE_NO_LVMETAD) ->
+ * mpath component filter -> partitioned filter -> md component filter -> fw raid filter
*
*/
int init_filters(struct cmd_context *cmd, unsigned load_persistent_cache)
{
const char *dev_cache;
struct dev_filter *filter = NULL, *filter_components[2] = {0};
+ int nr_filt;
struct stat st;
const struct dm_config_node *cn;
struct timespec ts, cts;
@@ -1193,26 +1202,26 @@ int init_filters(struct cmd_context *cmd, unsigned load_persistent_cache)
*/
/* filter component 0 */
if (lvmetad_used()) {
- if (!(filter_components[0] = usable_filter_create(cmd->dev_types, FILTER_MODE_POST_LVMETAD))) {
+ nr_filt = 0;
+ if ((cn = find_config_tree_array(cmd, devices_filter_CFG, NULL))) {
+ if (!(filter_components[nr_filt] = regex_filter_create(cn->v))) {
+ log_verbose("Failed to create regex device filter.");
+ goto bad;
+ }
+ nr_filt++;
+ }
+ if (!(filter_components[nr_filt] = usable_filter_create(cmd->dev_types, FILTER_MODE_POST_LVMETAD))) {
log_verbose("Failed to create usable device filter.");
goto bad;
}
+ nr_filt++;
+ if (!(filter = composite_filter_create(nr_filt, 0, filter_components)))
+ goto_bad;
} else {
- filter_components[0] = cmd->lvmetad_filter;
+ filter = cmd->lvmetad_filter;
cmd->lvmetad_filter = NULL;
}
- /* filter component 1 */
- if ((cn = find_config_tree_array(cmd, devices_filter_CFG, NULL))) {
- if (!(filter_components[1] = regex_filter_create(cn->v)))
- goto_bad;
- /* we have two filter components - create composite filter */
- if (!(filter = composite_filter_create(2, 0, filter_components)))
- goto_bad;
- } else
- /* we have only one filter component - no need to create composite filter */
- filter = filter_components[0];
-
if (!(dev_cache = find_config_tree_str(cmd, devices_cache_CFG, NULL)))
goto_bad;
@@ -1224,9 +1233,12 @@ int init_filters(struct cmd_context *cmd, unsigned load_persistent_cache)
cmd->filter = filter;
if (lvmetad_used()) {
- filter_components[0] = cmd->lvmetad_filter;
- filter_components[1] = cmd->filter;
- if (!(cmd->full_filter = composite_filter_create(2, 0, filter_components)))
+ nr_filt = 0;
+ filter_components[nr_filt] = cmd->lvmetad_filter;
+ nr_filt++;
+ filter_components[nr_filt] = cmd->filter;
+ nr_filt++;
+ if (!(cmd->full_filter = composite_filter_create(nr_filt, 0, filter_components)))
goto_bad;
} else
cmd->full_filter = filter;
8 years, 9 months
master - tests: skip raid testing on 4.[1, 2] fc24 kernels
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=596ec5c74b604d...
Commit: 596ec5c74b604de42f105032b7e13065ea67d281
Parent: 0ec64370b24acf837c725b614db993a663cc8103
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 8 12:00:12 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 8 12:12:38 2015 +0200
tests: skip raid testing on 4.[1,2] fc24 kernels
Hopefull 4.3 will be fixed and test will be updated to let
raid test running again.
Meanwhile using md-raid may effectively kill kernel,
so leave at least other tests running.
---
test/lib/aux.sh | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index f870501..25700f6 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1108,6 +1108,14 @@ have_raid() {
return 1;
}
target_at_least dm-raid "$@"
+
+ # some kernels have broken mdraid bitmaps, don't use them!
+ # may oops kernel, we know for sure all FC24 are currently broken
+ # in general any 4.1, 4.2 is likely useless unless patched
+ # hopefully 4.3 will be patched
+ case "$(uname -r)" in
+ 4.[123].*fc24*) return 1 ;;
+ esac
}
have_cache() {
8 years, 9 months
master - specs: install lvmlockctl only when built
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0ec64370b24acf...
Commit: 0ec64370b24acf837c725b614db993a663cc8103
Parent: d7f45ebca52ecb7e15dee42f81718266b127bb5c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 7 23:27:50 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Sep 7 23:27:50 2015 +0200
specs: install lvmlockctl only when built
Move install line into proper section.
---
spec/packages.inc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/spec/packages.inc b/spec/packages.inc
index 7e59068..69643ef 100644
--- a/spec/packages.inc
+++ b/spec/packages.inc
@@ -105,7 +105,6 @@ fi
%{_mandir}/man8/lvmconf.8.gz
%{_mandir}/man8/lvmdiskscan.8.gz
%{_mandir}/man8/lvmdump.8.gz
-%{_mandir}/man8/lvmlockctl.8.gz
%{_mandir}/man8/lvmsadc.8.gz
%{_mandir}/man8/lvmsar.8.gz
%{_mandir}/man8/lvreduce.8.gz
@@ -285,6 +284,7 @@ LVM commands use lvmlockd to coordinate access to shared storage.
%{_sbindir}/lvmlockd
%{_sbindir}/lvmlockctl
%{_mandir}/man8/lvmlockd.8.gz
+%{_mandir}/man8/lvmlockctl.8.gz
%dir %{_default_locking_dir}
%{_unitdir}/lvm2-lvmlockd.service
%{_unitdir}/lvm2-lvmlocking.service
8 years, 9 months
master - libdm: clean up stats local variable use
by Bryn Reeves
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d7f45ebca52ecb...
Commit: d7f45ebca52ecb7e15dee42f81718266b127bb5c
Parent: daa94eb792ee76a507dcafe74c5ceda9707a370f
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Mon Sep 7 20:08:10 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Mon Sep 7 20:14:53 2015 +0100
libdm: clean up stats local variable use
---
libdm/libdm-stats.c | 76 ++++++++++++++++++++++++---------------------------
1 files changed, 36 insertions(+), 40 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index f239f01..ee62fe6 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -454,13 +454,13 @@ static int _stats_parse_histogram_spec(struct dm_stats *dms,
const char *histogram)
{
static const char *_valid_chars = "0123456789,";
- uint64_t scale = region->timescale;
+ uint64_t scale = region->timescale, this_val = 0;
struct dm_pool *mem = dms->hist_mem;
struct dm_histogram_bin cur;
struct dm_histogram hist;
int nr_bins = 1;
- const char *c, *v;
- char *p;
+ const char *c, *v, *val_start;
+ char *p, *endptr = NULL;
/* Advance past "histogram:". */
histogram = strchr(histogram, ':');
@@ -501,9 +501,8 @@ static int _stats_parse_histogram_spec(struct dm_stats *dms,
histogram);
goto bad;
} else {
- const char *val_start = c;
- char *endptr = NULL;
- uint64_t this_val = 0;
+ val_start = c;
+ endptr = NULL;
this_val = strtoull(val_start, &endptr, 10);
if (!endptr) {
@@ -627,11 +626,11 @@ static int _stats_parse_list_region(struct dm_stats *dms,
static int _stats_parse_list(struct dm_stats *dms, const char *resp)
{
- struct dm_pool *mem = dms->mem;
- struct dm_stats_region cur;
uint64_t max_region = 0, nr_regions = 0;
+ struct dm_stats_region cur, fill;
+ struct dm_pool *mem = dms->mem;
FILE *list_rows;
- /* FIXME: determine correct maximum line length based on kernel format */
+ /* FIXME: use correct maximum line length for kernel format */
char line[256];
if (!resp) {
@@ -666,7 +665,6 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
/* handle holes in the list of region_ids */
if (cur.region_id > max_region) {
- struct dm_stats_region fill;
memset(&fill, 0, sizeof(fill));
fill.region_id = DM_STATS_REGION_NOT_PRESENT;
do {
@@ -742,12 +740,13 @@ static int _stats_parse_histogram(struct dm_pool *mem, char *hist_str,
struct dm_histogram **histogram,
struct dm_stats_region *region)
{
+ struct dm_histogram hist, *bounds = region->bounds;
static const char *_valid_chars = "0123456789:";
int nr_bins = region->bounds->nr_bins;
- struct dm_histogram hist, *bounds = region->bounds;
+ const char *c, *v, *val_start;
struct dm_histogram_bin cur;
- uint64_t sum = 0;
- const char *c, *v;
+ uint64_t sum = 0, this_val;
+ char *endptr = NULL;
int bin = 0;
c = hist_str;
@@ -771,9 +770,8 @@ static int _stats_parse_histogram(struct dm_pool *mem, char *hist_str,
if (*c == ',')
goto badchar;
else {
- const char *val_start = c;
- char *endptr = NULL;
- uint64_t this_val = 0;
+ val_start = c;
+ endptr = NULL;
this_val = strtoull(val_start, &endptr, 10);
if (!endptr) {
@@ -821,8 +819,8 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
uint64_t timescale)
{
struct dm_histogram *hist = NULL;
- struct dm_stats_counters cur;
struct dm_pool *mem = dms->mem;
+ struct dm_stats_counters cur;
FILE *stats_rows = NULL;
uint64_t start, len;
char row[256];
@@ -1075,12 +1073,12 @@ static int _stats_create_region(struct dm_stats *dms, uint64_t *region_id,
int precise, const char *hist_arg,
const char *program_id, const char *aux_data)
{
- struct dm_task *dmt = NULL;
- char msg[1024], range[64];
const char *err_fmt = "Could not prepare @stats_create %s.";
const char *precise_str = PRECISE_ARG;
const char *resp, *opt_args = NULL;
- int r = 0, nr_opt = 0; /* number of optional args. */
+ char msg[1024], range[64], *endptr = NULL;
+ struct dm_task *dmt = NULL;
+ int r = 0, nr_opt = 0;
if (!_stats_bound(dms))
return_0;
@@ -1140,7 +1138,6 @@ static int _stats_create_region(struct dm_stats *dms, uint64_t *region_id,
}
if (region_id) {
- char *endptr = NULL;
*region_id = strtoull(resp, &endptr, 10);
if (resp == endptr)
goto_out;
@@ -1230,11 +1227,11 @@ static struct dm_task *_stats_print_region(struct dm_stats *dms,
uint64_t region_id, unsigned start_line,
unsigned num_lines, unsigned clear)
{
- struct dm_task *dmt = NULL;
/* @stats_print[_clear] <region_id> [<start_line> <num_lines>] */
const char *clear_str = "_clear", *lines_fmt = "%u %u";
const char *msg_fmt = "@stats_print%s " FMTu64 " %s";
const char *err_fmt = "Could not prepare @stats_print %s.";
+ struct dm_task *dmt = NULL;
char msg[1024], lines[64];
if (start_line || num_lines)
@@ -1327,6 +1324,8 @@ int dm_stats_populate(struct dm_stats *dms, const char *program_id,
uint64_t region_id)
{
int all_regions = (region_id == DM_STATS_REGIONS_ALL);
+ struct dm_task *dmt = NULL; /* @stats_print task */
+ const char *resp;
if (!_stats_bound(dms))
return_0;
@@ -1346,9 +1345,6 @@ int dm_stats_populate(struct dm_stats *dms, const char *program_id,
dm_stats_walk_start(dms);
do {
- struct dm_task *dmt = NULL; /* @stats_print task */
- const char *resp;
-
region_id = (all_regions)
? dm_stats_get_current_region(dms) : region_id;
@@ -2002,10 +1998,12 @@ static struct dm_histogram *_alloc_dm_histogram(int nr_bins)
struct dm_histogram *dm_histogram_bounds_from_string(const char *bounds_str)
{
static const char *_valid_chars = "0123456789,muns";
- struct dm_histogram *dmh;
+ uint64_t this_val = 0, mult = 1;
+ const char *c, *v, *val_start;
struct dm_histogram_bin *cur;
- const char *c, *v;
+ struct dm_histogram *dmh;
int nr_entries = 1;
+ char *endptr;
c = bounds_str;
@@ -2038,9 +2036,8 @@ struct dm_histogram *dm_histogram_bounds_from_string(const char *bounds_str)
bounds_str);
goto bad;
} else {
- const char *val_start = c;
- char *endptr = NULL;
- uint64_t this_val = 0, mult = 1;
+ val_start = c;
+ endptr = NULL;
this_val = strtoull(val_start, &endptr, 10);
if (!endptr) {
@@ -2093,10 +2090,10 @@ bad:
struct dm_histogram *dm_histogram_bounds_from_uint64(const uint64_t *bounds)
{
- struct dm_histogram *dmh;
+ const uint64_t *entry = bounds;
struct dm_histogram_bin *cur;
+ struct dm_histogram *dmh;
int nr_entries = 1;
- const uint64_t *entry = bounds;
if (!bounds || !bounds[0]) {
log_error("Could not parse empty histogram bounds array");
@@ -2227,12 +2224,14 @@ const char *dm_histogram_to_string(const struct dm_histogram *dmh, int bin,
int width, int flags)
{
int minwidth, bounds, values, start, last;
- uint64_t lower, upper; /* bounds of the current bin. */
+ uint64_t lower, upper, val_u64; /* bounds of the current bin. */
/* Use the histogram pool for string building. */
struct dm_pool *mem = dmh->dms->hist_mem;
char buf[64], bounds_buf[64];
const char *sep = "";
+ int bounds_width;
ssize_t len = 0;
+ float val_flt;
bounds = flags & DM_HISTOGRAM_BOUNDS_MASK;
values = flags & DM_HISTOGRAM_VALUES;
@@ -2263,8 +2262,6 @@ const char *dm_histogram_to_string(const struct dm_histogram *dmh, int bin,
for (bin = start; bin <= last; bin++) {
if (bounds) {
- int bounds_width;
-
/* Default bounds width depends on time suffixes. */
bounds_width = (!(flags & DM_HISTOGRAM_SUFFIX))
? BOUND_WIDTH_NOSUFFIX
@@ -2297,15 +2294,14 @@ const char *dm_histogram_to_string(const struct dm_histogram *dmh, int bin,
if (flags & DM_HISTOGRAM_PERCENT) {
dm_percent_t pr;
- float value;
pr = dm_histogram_get_bin_percent(dmh, bin);
- value = dm_percent_to_float(pr);
+ val_flt = dm_percent_to_float(pr);
len = dm_snprintf(buf, sizeof(buf), "%s%*.2f%%%s",
- bounds_buf, width, value, sep);
+ bounds_buf, width, val_flt, sep);
} else if (values) {
- uint64_t value = dmh->bins[bin].count;
+ val_u64 = dmh->bins[bin].count;
len = dm_snprintf(buf, sizeof(buf), "%s%*"PRIu64"%s",
- bounds_buf, width, value, sep);
+ bounds_buf, width, val_u64, sep);
} else if (bounds)
len = dm_snprintf(buf, sizeof(buf), "%s%s", bounds_buf,
sep);
8 years, 9 months