master - Makefile: add missing deps
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ebf66ac316da27...
Commit: ebf66ac316da27399308d8cd553988c78f7ea150
Parent: 1fdead8d97376c757af01b55d7556e3411255124
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 5 11:32:42 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Sep 23 12:13:51 2013 +0200
Makefile: add missing deps
Add missing deps for device-mapper build of scripts dir.
Cleanup multiple SUBDIR lines together.
---
Makefile.in | 7 ++-----
WHATS_NEW | 1 +
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 81002ea..e1178ee 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -16,7 +16,7 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
-SUBDIRS = conf include man
+SUBDIRS = conf daemons include lib libdaemon libdm man scripts tools
ifeq ("@UDEV_RULES@", "yes")
SUBDIRS += udev
@@ -26,8 +26,6 @@ ifeq ("@INTL@", "yes")
SUBDIRS += po
endif
-SUBDIRS += lib tools daemons libdm libdaemon
-
ifeq ("@APPLIB@", "yes")
SUBDIRS += liblvm
endif
@@ -36,8 +34,6 @@ ifeq ("@PYTHON_BINDINGS@", "yes")
SUBDIRS += python
endif
-SUBDIRS += scripts
-
ifeq ($(MAKECMDGOALS),clean)
SUBDIRS += test
endif
@@ -67,6 +63,7 @@ libdm.device-mapper: include.device-mapper
liblvm.device-mapper: include.device-mapper
daemons.device-mapper: libdm.device-mapper
tools.device-mapper: libdm.device-mapper
+scripts.device-mapper: include.device-mapper
device-mapper: tools.device-mapper daemons.device-mapper man.device-mapper
ifeq ("@INTL@", "yes")
diff --git a/WHATS_NEW b/WHATS_NEW
index cca4c0e..983e582 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.102
======================================
+ Fix missing build dependency for scripts subdir in Makefile.
Extend lv_info() for more efficient lv_is_active_locally() check.
Version 2.02.101 - 20th September 2013
10 years, 7 months
master - activation: use improved lv_info
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1fdead8d97376c...
Commit: 1fdead8d97376c757af01b55d7556e3411255124
Parent: 3b604e5c8e505138fc86e009375fd33160ab84ff
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 19 22:18:16 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Sep 23 12:13:08 2013 +0200
activation: use improved lv_info
Call lv_info() with info == NULL to query for local active presence.
---
lib/activate/activate.c | 29 +++++++----------------------
1 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index e4d9b49..c9d2c1a 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -738,7 +738,7 @@ int lv_snapshot_percent(const struct logical_volume *lv, percent_t *percent)
int r;
struct dev_manager *dm;
- if (!activation())
+ if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
log_debug_activation("Checking snapshot percent for LV %s/%s", lv->vg->name, lv->name);
@@ -760,7 +760,6 @@ int lv_mirror_percent(struct cmd_context *cmd, const struct logical_volume *lv,
{
int r;
struct dev_manager *dm;
- struct lvinfo info;
/* If mirrored LV is temporarily shrinked to 1 area (= linear),
* it should be considered in-sync. */
@@ -769,16 +768,11 @@ int lv_mirror_percent(struct cmd_context *cmd, const struct logical_volume *lv,
return 1;
}
- if (!activation())
+ if (!lv_info(cmd, lv, 0, NULL, 0, 0))
return 0;
log_debug_activation("Checking mirror percent for LV %s/%s", lv->vg->name, lv->name);
- if (!lv_info(cmd, lv, 0, &info, 0, 0))
- return_0;
-
- if (!info.exists)
- return 0;
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -804,15 +798,12 @@ int lv_raid_dev_health(const struct logical_volume *lv, char **dev_health)
*dev_health = NULL;
- if (!activation())
- return_0;
+ if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
+ return 0;
log_debug_activation("Checking raid device health for LV %s/%s",
lv->vg->name, lv->name);
- if (!lv_is_active_locally(lv))
- return 0;
-
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -835,15 +826,12 @@ int lv_raid_mismatch_count(const struct logical_volume *lv, uint64_t *cnt)
*cnt = 0;
- if (!activation())
+ if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
log_debug_activation("Checking raid mismatch count for LV %s/%s",
lv->vg->name, lv->name);
- if (!lv_is_active_locally(lv))
- return_0;
-
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -866,15 +854,12 @@ int lv_raid_sync_action(const struct logical_volume *lv, char **sync_action)
*sync_action = NULL;
- if (!activation())
+ if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
log_debug_activation("Checking raid sync_action for LV %s/%s",
lv->vg->name, lv->name);
- if (!lv_is_active_locally(lv))
- return_0;
-
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@@ -906,7 +891,7 @@ int lv_raid_message(const struct logical_volume *lv, const char *msg)
return 0;
}
- if (!lv_is_active_locally(lv)) {
+ if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0)) {
log_error("Unable to send message to an inactive logical volume.");
return 0;
}
10 years, 7 months
master - lvinfo: allow to use lv_info with NULL info
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3b604e5c8e5051...
Commit: 3b604e5c8e505138fc86e009375fd33160ab84ff
Parent: b29adbbc4da6f016735929ce6a944639254a6c49
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 19 14:05:55 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Sep 23 12:13:06 2013 +0200
lvinfo: allow to use lv_info with NULL info
When NULL info struct is passed in - function is usable
as a quick query for lv_is_active_locally() - with a bonus
we may query for layered device.
So it could be seen as a more efficient lv_is_active_locally().
---
WHATS_NEW | 4 ++++
lib/activate/activate.c | 6 +++++-
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e969620..cca4c0e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,7 @@
+Version 2.02.102
+======================================
+ Extend lv_info() for more efficient lv_is_active_locally() check.
+
Version 2.02.101 - 20th September 2013
======================================
Fix 3-thread clvmd deadlock triggered by cleanup on EOF from client.
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index ecd35b2..e4d9b49 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -616,6 +616,7 @@ int target_present(struct cmd_context *cmd, const char *target_name,
/*
* Returns 1 if info structure populated, else 0 on failure.
+ * When lvinfo* is NULL, it returns 1 if the device is locally active, 0 otherwise.
*/
int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_layer,
struct lvinfo *info, int with_open_count, int with_read_ahead)
@@ -640,9 +641,12 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_la
if (!dev_manager_info(lv->vg->cmd->mem, lv,
(use_layer) ? lv_layer(lv) : NULL,
with_open_count, with_read_ahead,
- &dminfo, &info->read_ahead))
+ &dminfo, (info) ? &info->read_ahead : NULL))
return_0;
+ if (!info)
+ return dminfo.exists;
+
info->exists = dminfo.exists;
info->suspended = dminfo.suspended;
info->open_count = dminfo.open_count;
10 years, 7 months
master - raid: add lv_is_raid()
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b29adbbc4da6f0...
Commit: b29adbbc4da6f016735929ce6a944639254a6c49
Parent: a94e28ae019b94aa48dbaf1db83cc30bfdee0f4f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Sep 18 17:22:14 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Sep 23 11:35:15 2013 +0200
raid: add lv_is_raid()
More readable then status bit flag masking...
---
lib/metadata/metadata-exported.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index f20dfd0..3920385 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -158,6 +158,7 @@
#define lv_is_thin_type(lv) ((lv)->status & (THIN_POOL | THIN_VOLUME | THIN_POOL_DATA | THIN_POOL_METADATA) ? 1 : 0)
#define lv_is_mirror_type(lv) ((lv)->status & (MIRROR_LOG | MIRROR_IMAGE | MIRRORED | PVMOVE) ? 1 : 0)
+#define lv_is_raid(lv) (((lv)->status & (RAID)) ? 1 : 0)
#define lv_is_raid_type(lv) (((lv)->status & (RAID | RAID_IMAGE | RAID_META)) ? 1 : 0)
#define lv_is_virtual(lv) (((lv)->status & VIRTUAL) ? 1 : 0)
10 years, 7 months
master - dmeventd: simplify fifos init
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a94e28ae019b94...
Commit: a94e28ae019b94aa48dbaf1db83cc30bfdee0f4f
Parent: b33b618fc8e83a033d91814facd0312c84597372
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 5 13:14:19 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Sep 23 11:35:15 2013 +0200
dmeventd: simplify fifos init
Simplier code.
---
daemons/dmeventd/dmeventd.c | 22 ++++++----------------
1 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 9c7a6c6..3754714 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1247,16 +1247,6 @@ static int _get_timeout(struct message_data *message_data)
return thread ? 0 : -ENODEV;
}
-/* Initialize a fifos structure with path names. */
-static void _init_fifos(struct dm_event_fifos *fifos)
-{
- fifos->client = -1;
- fifos->server = -1;
-
- fifos->client_path = DM_EVENT_FIFO_CLIENT;
- fifos->server_path = DM_EVENT_FIFO_SERVER;
-}
-
/* Open fifos used for client communication. */
static int _open_fifos(struct dm_event_fifos *fifos)
{
@@ -1706,8 +1696,6 @@ static int _systemd_handover(struct dm_event_fifos *fifos)
unsigned long env_pid, env_listen_fds;
int r = 0;
- memset(fifos, 0, sizeof(*fifos));
-
/* SD_ACTIVATION must be set! */
if (!(e = getenv(SD_ACTIVATION_ENV_VAR_NAME)) || strcmp(e, "1"))
goto out;
@@ -1929,7 +1917,12 @@ static void usage(char *prog, FILE *file)
int main(int argc, char *argv[])
{
signed char opt;
- struct dm_event_fifos fifos;
+ struct dm_event_fifos fifos = {
+ .client = -1,
+ .server = -1,
+ .client_path = DM_EVENT_FIFO_CLIENT,
+ .server_path = DM_EVENT_FIFO_SERVER
+ };
int nothreads;
//struct sys_log logdata = {DAEMON_NAME, LOG_DAEMON};
@@ -2005,9 +1998,6 @@ int main(int argc, char *argv[])
//multilog_init_verbose(std_syslog, _LOG_DEBUG);
//multilog_async(1);
- if (!_systemd_activation)
- _init_fifos(&fifos);
-
pthread_mutex_init(&_global_mutex, NULL);
if (!_systemd_activation && !_open_fifos(&fifos))
10 years, 7 months
master - cleanup: drop unused report parameter
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b33b618fc8e83a...
Commit: b33b618fc8e83a033d91814facd0312c84597372
Parent: 9b4bfca219b47679da846a1750631fc440426143
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 23 11:01:46 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Sep 23 11:35:15 2013 +0200
cleanup: drop unused report parameter
Do not pass unused dm_report pointer.
---
lib/report/report.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/report/report.c b/lib/report/report.c
index 95525d8..540181a 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1035,8 +1035,8 @@ static int _raidmaxrecoveryrate_disp(struct dm_report *rh __attribute__((unused)
&first_seg(lv)->max_recovery_rate);
}
-static int _dtpercent_disp(int metadata, struct dm_report *rh,
- struct dm_pool *mem,
+/* Called only with lv_is_thin_pool/volume */
+static int _dtpercent_disp(int metadata, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
@@ -1091,7 +1091,7 @@ static int _datapercent_disp(struct dm_report *rh, struct dm_pool *mem,
return _snpercent_disp(rh, mem, field, data, private);
if (lv_is_thin_pool(lv) || lv_is_thin_volume(lv))
- return _dtpercent_disp(0, rh, mem, field, data, private);
+ return _dtpercent_disp(0, mem, field, data, private);
dm_report_field_set_value(field, "", NULL);
@@ -1105,7 +1105,7 @@ static int _metadatapercent_disp(struct dm_report *rh, struct dm_pool *mem,
const struct logical_volume *lv = (const struct logical_volume *) data;
if (lv_is_thin_pool(lv))
- return _dtpercent_disp(1, rh, mem, field, data, private);
+ return _dtpercent_disp(1, mem, field, data, private);
dm_report_field_set_value(field, "", NULL);
10 years, 7 months
master - cleanup: add log_error error path messages
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9b4bfca219b476...
Commit: 9b4bfca219b47679da846a1750631fc440426143
Parent: d2d61955a303d73d1a97b80f3a010711eac846d4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 23 09:59:37 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Sep 23 11:35:15 2013 +0200
cleanup: add log_error error path messages
---
lib/report/report.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/lib/report/report.c b/lib/report/report.c
index 73e72f4..95525d8 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1155,14 +1155,13 @@ static int _lvtime_disp(struct dm_report *rh, struct dm_pool *mem,
char *repstr;
uint64_t *sortval;
- if (!(sortval = dm_pool_zalloc(mem, sizeof(uint64_t)))) {
- log_error("Failed to allocate sortval.");
+ if (!(repstr = lv_time_dup(mem, lv)) ||
+ !(sortval = dm_pool_alloc(mem, sizeof(uint64_t)))) {
+ log_error("Failed to allocate buffer for time.");
return 0;
}
*sortval = lv->timestamp;
- if (!(repstr = lv_time_dup(mem, lv)))
- return_0;
dm_report_field_set_value(field, repstr, sortval);
@@ -1176,8 +1175,10 @@ static int _lvhost_disp(struct dm_report *rh, struct dm_pool *mem,
const struct logical_volume *lv = (const struct logical_volume *) data;
char *repstr;
- if (!(repstr = lv_host_dup(mem, lv)))
- return_0;
+ if (!(repstr = lv_host_dup(mem, lv))) {
+ log_error("Failed to allocate buffer for host.");
+ return 0;
+ }
dm_report_field_set_value(field, repstr, repstr);
@@ -1190,8 +1191,10 @@ static int _lvactive_disp(struct dm_report *rh, struct dm_pool *mem,
{
char *repstr;
- if (!(repstr = lv_active_dup(mem, (const struct logical_volume *) data)))
- return_0;
+ if (!(repstr = lv_active_dup(mem, (const struct logical_volume *) data))) {
+ log_error("Failed to allocate buffer for active.");
+ return 0;
+ }
dm_report_field_set_value(field, repstr, NULL);
10 years, 7 months
master - cleanup: shorter code
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d2d61955a303d7...
Commit: d2d61955a303d73d1a97b80f3a010711eac846d4
Parent: 85b9c12e92873a87b7c02bac20287beeea82ef2a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 23 09:44:53 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Sep 23 11:35:15 2013 +0200
cleanup: shorter code
Put assignment on declaration line.
---
lib/report/report.c | 109 +++++++++++++++------------------------------------
1 files changed, 32 insertions(+), 77 deletions(-)
diff --git a/lib/report/report.c b/lib/report/report.c
index 347b830..73e72f4 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -326,13 +326,10 @@ static int _poollv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__(
const void *data, void *private __attribute__((unused)))
{
const struct logical_volume *lv = (const struct logical_volume *) data;
- struct lv_segment *seg;
+ struct lv_segment *seg = lv_is_thin_volume(lv) ? first_seg(lv) : NULL;
- if (lv_is_thin_volume(lv))
- dm_list_iterate_items(seg, &lv->segments)
- if (seg_is_thin_volume(seg))
- return _lvname_disp(rh, mem, field,
- seg->pool_lv, private);
+ if (seg)
+ return _lvname_disp(rh, mem, field, seg->pool_lv, private);
dm_report_field_set_value(field, "", NULL);
return 1;
@@ -500,9 +497,9 @@ static int _lvkreadahead_disp(struct dm_report *rh, struct dm_pool *mem,
void *private)
{
const struct logical_volume *lv = (const struct logical_volume *) data;
- uint32_t read_ahead;
+ uint32_t read_ahead = lv_kernel_read_ahead(lv);
- if ((read_ahead = lv_kernel_read_ahead(lv)) == UINT32_MAX)
+ if (read_ahead == UINT32_MAX)
return dm_report_field_int32(rh, field, &_minusone32);
return _size32_disp(rh, mem, field, &read_ahead, private);
@@ -513,9 +510,7 @@ static int _vgsize_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct volume_group *vg = (const struct volume_group *) data;
- uint64_t size;
-
- size = (uint64_t) vg_size(vg);
+ uint64_t size = vg_size(vg);
return _size64_disp(rh, mem, field, &size, private);
}
@@ -539,9 +534,7 @@ static int _segstart_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct lv_segment *seg = (const struct lv_segment *) data;
- uint64_t start;
-
- start = lvseg_start(seg);
+ uint64_t start = lvseg_start(seg);
return _size64_disp(rh, mem, field, &start, private);
}
@@ -562,9 +555,7 @@ static int _segsize_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct lv_segment *seg = (const struct lv_segment *) data;
- uint64_t size;
-
- size = lvseg_size(seg);
+ uint64_t size = lvseg_size(seg);
return _size64_disp(rh, mem, field, &size, private);
}
@@ -574,9 +565,7 @@ static int _chunksize_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct lv_segment *seg = (const struct lv_segment *) data;
- uint64_t size;
-
- size = lvseg_chunksize(seg);
+ uint64_t size = lvseg_chunksize(seg);
return _size64_disp(rh, mem, field, &size, private);
}
@@ -636,14 +625,14 @@ static int _originsize_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct logical_volume *lv = (const struct logical_volume *) data;
- uint64_t size;
+ uint64_t size = lv_origin_size(lv);
- if (!(size = lv_origin_size(lv))) {
- dm_report_field_set_value(field, "", &_zero64);
- return 1;
- }
+ if (size)
+ return _size64_disp(rh, mem, field, &size, private);
- return _size64_disp(rh, mem, field, &size, private);
+ dm_report_field_set_value(field, "", &_zero64);
+
+ return 1;
}
static int _pvused_disp(struct dm_report *rh, struct dm_pool *mem,
@@ -652,9 +641,7 @@ static int _pvused_disp(struct dm_report *rh, struct dm_pool *mem,
{
const struct physical_volume *pv =
(const struct physical_volume *) data;
- uint64_t used;
-
- used = pv_used(pv);
+ uint64_t used = pv_used(pv);
return _size64_disp(rh, mem, field, &used, private);
}
@@ -665,9 +652,7 @@ static int _pvfree_disp(struct dm_report *rh, struct dm_pool *mem,
{
const struct physical_volume *pv =
(const struct physical_volume *) data;
- uint64_t freespace;
-
- freespace = pv_free(pv);
+ uint64_t freespace = pv_free(pv);
return _size64_disp(rh, mem, field, &freespace, private);
}
@@ -678,9 +663,7 @@ static int _pvsize_disp(struct dm_report *rh, struct dm_pool *mem,
{
const struct physical_volume *pv =
(const struct physical_volume *) data;
- uint64_t size;
-
- size = pv_size_field(pv);
+ uint64_t size = pv_size_field(pv);
return _size64_disp(rh, mem, field, &size, private);
}
@@ -691,9 +674,7 @@ static int _devsize_disp(struct dm_report *rh, struct dm_pool *mem,
{
const struct physical_volume *pv =
(const struct physical_volume *) data;
- uint64_t size;
-
- size = pv_dev_size(pv);
+ uint64_t size = pv_dev_size(pv);
return _size64_disp(rh, mem, field, &size, private);
}
@@ -703,9 +684,7 @@ static int _vgfree_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct volume_group *vg = (const struct volume_group *) data;
- uint64_t freespace;
-
- freespace = (uint64_t) vg_free(vg);
+ uint64_t freespace = vg_free(vg);
return _size64_disp(rh, mem, field, &freespace, private);
}
@@ -727,11 +706,9 @@ static int _pvmdas_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- uint32_t count;
const struct physical_volume *pv =
(const struct physical_volume *) data;
-
- count = pv_mda_count(pv);
+ uint32_t count = pv_mda_count(pv);
return _uint32_disp(rh, mem, field, &count, private);
}
@@ -740,11 +717,9 @@ static int _pvmdasused_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- uint32_t count;
const struct physical_volume *pv =
(const struct physical_volume *) data;
-
- count = pv_mda_used_count(pv);
+ uint32_t count = pv_mda_used_count(pv);
return _uint32_disp(rh, mem, field, &count, private);
}
@@ -754,9 +729,7 @@ static int _vgmdas_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct volume_group *vg = (const struct volume_group *) data;
- uint32_t count;
-
- count = vg_mda_count(vg);
+ uint32_t count = vg_mda_count(vg);
return _uint32_disp(rh, mem, field, &count, private);
}
@@ -766,9 +739,7 @@ static int _vgmdasused_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct volume_group *vg = (const struct volume_group *) data;
- uint32_t count;
-
- count = vg_mda_used_count(vg);
+ uint32_t count = vg_mda_used_count(vg);
return _uint32_disp(rh, mem, field, &count, private);
}
@@ -778,9 +749,7 @@ static int _vgmdacopies_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct volume_group *vg = (const struct volume_group *) data;
- uint32_t count;
-
- count = vg_mda_copies(vg);
+ uint32_t count = vg_mda_copies(vg);
if (count == VGMETADATACOPIES_UNMANAGED) {
dm_report_field_set_value(field, "unmanaged", &_minusone64);
@@ -809,9 +778,7 @@ static int _pvmdafree_disp(struct dm_report *rh, struct dm_pool *mem,
{
const struct physical_volume *pv =
(const struct physical_volume *) data;
- uint64_t freespace;
-
- freespace = pv_mda_free(pv);
+ uint64_t freespace = pv_mda_free(pv);
return _size64_disp(rh, mem, field, &freespace, private);
}
@@ -822,9 +789,7 @@ static int _pvmdasize_disp(struct dm_report *rh, struct dm_pool *mem,
{
const struct physical_volume *pv =
(const struct physical_volume *) data;
- uint64_t min_mda_size;
-
- min_mda_size = pv_mda_size(pv);
+ uint64_t min_mda_size = pv_mda_size(pv);
return _size64_disp(rh, mem, field, &min_mda_size, private);
}
@@ -834,9 +799,7 @@ static int _vgmdasize_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct volume_group *vg = (const struct volume_group *) data;
- uint64_t min_mda_size;
-
- min_mda_size = vg_mda_size(vg);
+ uint64_t min_mda_size = vg_mda_size(vg);
return _size64_disp(rh, mem, field, &min_mda_size, private);
}
@@ -846,9 +809,7 @@ static int _vgmdafree_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct volume_group *vg = (const struct volume_group *) data;
- uint64_t freespace;
-
- freespace = vg_mda_free(vg);
+ uint64_t freespace = vg_mda_free(vg);
return _size64_disp(rh, mem, field, &freespace, private);
}
@@ -858,9 +819,7 @@ static int _lvcount_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct volume_group *vg = (const struct volume_group *) data;
- uint32_t count;
-
- count = vg_visible_lvs(vg);
+ uint32_t count = vg_visible_lvs(vg);
return _uint32_disp(rh, mem, field, &count, private);
}
@@ -870,9 +829,7 @@ static int _lvsegcount_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct logical_volume *lv = (const struct logical_volume *) data;
- uint32_t count;
-
- count = dm_list_size(&lv->segments);
+ uint32_t count = dm_list_size(&lv->segments);
return _uint32_disp(rh, mem, field, &count, private);
}
@@ -882,9 +839,7 @@ static int _snapcount_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct volume_group *vg = (const struct volume_group *) data;
- uint32_t count;
-
- count = snapshot_count(vg);
+ uint32_t count = snapshot_count(vg);
return _uint32_disp(rh, mem, field, &count, private);
}
10 years, 7 months
master - cleanup: release all memory in error path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=85b9c12e92873a...
Commit: 85b9c12e92873a87b7c02bac20287beeea82ef2a
Parent: 30432bd6048ce9c52eefeba9e99d1b0805c6c59b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 19 22:23:43 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Sep 23 11:35:15 2013 +0200
cleanup: release all memory in error path
Just ensure no memory will stay in pool even in error path.
---
lib/activate/dev_manager.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 11be421..b8233bf 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -500,13 +500,15 @@ int dev_manager_info(struct dm_pool *mem, const struct logical_volume *lv,
if (!(dlid = build_dm_uuid(mem, lv->lvid.s, layer))) {
log_error("dlid build failed for %s", name);
- return 0;
+ r = 0;
+ goto out;
}
log_debug_activation("Getting device info for %s [%s]", name, dlid);
r = _info(dlid, with_open_count, with_read_ahead, info, read_ahead);
-
+out:
dm_pool_free(mem, name);
+
return r;
}
10 years, 7 months
master - cleanup: skip call of detect...
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=30432bd6048ce9...
Commit: 30432bd6048ce9c52eefeba9e99d1b0805c6c59b
Parent: 861a3b2f1940cd3667cc353c762ff3d1ef75c37b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 20 15:52:25 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Sep 23 11:35:15 2013 +0200
cleanup: skip call of detect...
SInce we know the pool was locked and we want to reloc pool again,
just use '1' directly.
---
lib/metadata/metadata.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 4ae7726..1e34f83 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -850,7 +850,7 @@ static int _vg_update_vg_ondisk(struct volume_group *vg)
dm_config_destroy(cft);
/* recompute the pool crc */
- if (pool_locked && !dm_pool_lock(vg->vgmem, detect_internal_vg_cache_corruption()))
+ if (pool_locked && !dm_pool_lock(vg->vgmem, 1))
return_0;
return vg->vg_ondisk ? 1 : 0;
10 years, 7 months