master - refactor: rename struct lv_with_info used in reporting code to lv_with_info_and_seg_status
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d7e5f038887be8...
Commit: d7e5f038887be820874522674a51071705439c8e
Parent: 20b22cd023bdfd30301305ba5b78655619d965f1
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Oct 20 13:46:50 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Nov 11 08:53:28 2014 +0100
refactor: rename struct lv_with_info used in reporting code to lv_with_info_and_seg_status
The former struct lv_with_info is renamed to lv_with_info_and_seg_status as it can
hold more than just "info", there's lv's segment status now in addition:
struct lv_with_info_and_seg_status {
struct logical_volume *lv;
struct lvinfo *info;
struct lv_seg_status *seg_status;
}
Where struct lv_seg_status is:
struct lv_seg_status {
struct dm_pool *mem;
struct lv_segment lv_seg;
lv_seg_status_type_t type;
void *status; /* struct dm_status_* */
}
Where lv_seg points to lv's segment that is being reported or
processed in general.
New struct lv_seg_status keeps the information about segment status -
the status retrieved via DM_DEVICE_STATUS ioctl. This information will
be used for reporting dm device target status for the LV segment
specified.
So this patch introduces third level of LV information that is
kept for reuse while reporting fields within one reporting line,
causing only one DM_DEVICE_STATUS ioctl call per LV segment line
reported (otherwise we'd need to call the DM_DEVICE_STATUS for each
segment status field in one LV segment/reporting line which is not
efficient).
This is following exactly the same principle as already introduced
by commit ecb2be5d1642aa0142d216f9e52f64fd3e8c3fc8.
So currently we have three levels of information that can be used
to report an LV/LV segment:
- LV metadata itself (struct logical_volume *lv)
- LV's DM_DEVICE_INFO ioctl result (struct lvinfo *info)
- LV's segment DM_DEVICE_STATUS ioctl result (this status must be
bound to a segment, not the whole LV as the whole LV may be
composed of several segments of course)
(this is the new struct lv_seg_status *seg_status)
---
lib/activate/activate.h | 23 ++++++++++++++
lib/report/report.c | 76 ++++++++++++++++++++++------------------------
lib/report/report.h | 3 +-
tools/reporter.c | 23 ++++++++------
4 files changed, 74 insertions(+), 51 deletions(-)
diff --git a/lib/activate/activate.h b/lib/activate/activate.h
index 9dfbcfa..ab5e69d 100644
--- a/lib/activate/activate.h
+++ b/lib/activate/activate.h
@@ -30,6 +30,29 @@ struct lvinfo {
uint32_t read_ahead;
};
+typedef enum {
+ SEG_STATUS_NONE,
+ SEG_STATUS_CACHE,
+ SEG_STATUS_RAID,
+ SEG_STATUS_SNAPSHOT,
+ SEG_STATUS_THIN,
+ SEG_STATUS_THIN_POOL
+} lv_seg_status_type_t;
+
+struct lv_seg_status {
+ struct dm_pool *mem; /* input */
+ struct lv_segment *seg; /* input */
+ lv_seg_status_type_t type; /* output */
+ void *status; /* struct dm_status_* */ /* output */
+};
+
+struct lv_with_info_and_seg_status {
+ struct logical_volume *lv; /* input */
+ struct lvinfo *info; /* output */
+ int seg_part_of_lv; /* output */
+ struct lv_seg_status *seg_status; /* input/output, see lv_seg_status */
+};
+
struct lv_activate_opts {
int exclusive;
int origin_only;
diff --git a/lib/report/report.c b/lib/report/report.c
index e6df787..511d6cb 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -27,14 +27,9 @@
#include <stddef.h> /* offsetof() */
-struct lv_with_info {
- struct logical_volume *lv;
- struct lvinfo *info;
-};
-
struct lvm_report_object {
struct volume_group *vg;
- struct lv_with_info *lvi;
+ struct lv_with_info_and_seg_status *lvdm;
struct physical_volume *pv;
struct lv_segment *seg;
struct pv_segment *pvseg;
@@ -297,10 +292,10 @@ static int _lvkmaj_disp(struct dm_report *rh, struct dm_pool *mem __attribute__(
struct dm_report_field *field,
const void *data, void *private __attribute__((unused)))
{
- const struct lv_with_info *lvi = (const struct lv_with_info *) data;
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
- if (lvi->info && lvi->info->exists && lvi->info->major >= 0)
- return dm_report_field_int(rh, field, &lvi->info->major);
+ if (lvdm->info && lvdm->info->exists && lvdm->info->major >= 0)
+ return dm_report_field_int(rh, field, &lvdm->info->major);
return dm_report_field_int32(rh, field, &RESERVED(number_undef_32));
}
@@ -309,10 +304,10 @@ static int _lvkmin_disp(struct dm_report *rh, struct dm_pool *mem __attribute__(
struct dm_report_field *field,
const void *data, void *private __attribute__((unused)))
{
- const struct lv_with_info *lvi = (const struct lv_with_info *) data;
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
- if (lvi->info && lvi->info->exists && lvi->info->minor >= 0)
- return dm_report_field_int(rh, field, &lvi->info->minor);
+ if (lvdm->info && lvdm->info->exists && lvdm->info->minor >= 0)
+ return dm_report_field_int(rh, field, &lvdm->info->minor);
return dm_report_field_int32(rh, field, &RESERVED(number_undef_32));
}
@@ -649,12 +644,12 @@ static int _lvkreadahead_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data,
void *private)
{
- const struct lv_with_info *lvi = (const struct lv_with_info *) data;
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
- if (!lvi->info || !lvi->info->exists)
+ if (!lvdm->info || !lvdm->info->exists)
return dm_report_field_int32(rh, field, &RESERVED(number_undef_32));
- return _size32_disp(rh, mem, field, &lvi->info->read_ahead, private);
+ return _size32_disp(rh, mem, field, &lvdm->info->read_ahead, private);
}
static int _vgsize_disp(struct dm_report *rh, struct dm_pool *mem,
@@ -1430,18 +1425,18 @@ static int _lvpermissions_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- const struct lv_with_info *lvi = (const struct lv_with_info *) data;
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
const char *perms = "";
- if (!lv_is_pvmove(lvi->lv)) {
- if (lvi->lv->status & LVM_WRITE) {
- if (!lvi->info->exists)
+ if (!lv_is_pvmove(lvdm->lv)) {
+ if (lvdm->lv->status & LVM_WRITE) {
+ if (!lvdm->info->exists)
perms = _str_unknown;
- else if (lvi->info->read_only)
+ else if (lvdm->info->read_only)
perms = FIRST_NAME(lv_permissions_r_override);
else
perms = FIRST_NAME(lv_permissions_rw);
- } else if (lvi->lv->status & LVM_READ)
+ } else if (lvdm->lv->status & LVM_READ)
perms = FIRST_NAME(lv_permissions_r);
else
perms = _str_unknown;
@@ -1602,10 +1597,10 @@ static int _lvsuspended_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- const struct lv_with_info *lvi = (const struct lv_with_info *) data;
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
- if (lvi->info->exists)
- return _binary_disp(rh, mem, field, lvi->info->suspended, FIRST_NAME(lv_suspended_y), private);
+ if (lvdm->info->exists)
+ return _binary_disp(rh, mem, field, lvdm->info->suspended, FIRST_NAME(lv_suspended_y), private);
return _binary_undef_disp(rh, mem, field, private);
}
@@ -1614,10 +1609,10 @@ static int _lvlivetable_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- const struct lv_with_info *lvi = (const struct lv_with_info *) data;
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
- if (lvi->info->exists)
- return _binary_disp(rh, mem, field, lvi->info->live_table, FIRST_NAME(lv_live_table_y), private);
+ if (lvdm->info->exists)
+ return _binary_disp(rh, mem, field, lvdm->info->live_table, FIRST_NAME(lv_live_table_y), private);
return _binary_undef_disp(rh, mem, field, private);
}
@@ -1626,10 +1621,10 @@ static int _lvinactivetable_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- const struct lv_with_info *lvi = (const struct lv_with_info *) data;
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
- if (lvi->info->exists)
- return _binary_disp(rh, mem, field, lvi->info->inactive_table, FIRST_NAME(lv_inactive_table_y), private);
+ if (lvdm->info->exists)
+ return _binary_disp(rh, mem, field, lvdm->info->inactive_table, FIRST_NAME(lv_inactive_table_y), private);
return _binary_undef_disp(rh, mem, field, private);
}
@@ -1638,10 +1633,10 @@ static int _lvdeviceopen_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- const struct lv_with_info *lvi = (const struct lv_with_info *) data;
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
- if (lvi->info->exists)
- return _binary_disp(rh, mem, field, lvi->info->open_count, FIRST_NAME(lv_device_open_y), private);
+ if (lvdm->info->exists)
+ return _binary_disp(rh, mem, field, lvdm->info->open_count, FIRST_NAME(lv_device_open_y), private);
return _binary_undef_disp(rh, mem, field, private);
}
@@ -1717,12 +1712,12 @@ static void *_obj_get_vg(void *obj)
static void *_obj_get_lv(void *obj)
{
- return ((struct lvm_report_object *)obj)->lvi->lv;
+ return ((struct lvm_report_object *)obj)->lvdm->lv;
}
-static void *_obj_get_lv_with_info(void *obj)
+static void *_obj_get_lv_with_info_and_seg_status(void *obj)
{
- return ((struct lvm_report_object *)obj)->lvi;
+ return ((struct lvm_report_object *)obj)->lvdm;
}
static void *_obj_get_pv(void *obj)
@@ -1753,7 +1748,7 @@ static void *_obj_get_devtypes(void *obj)
static const struct dm_report_object_type _report_types[] = {
{ VGS, "Volume Group", "vg_", _obj_get_vg },
{ LVS, "Logical Volume", "lv_", _obj_get_lv },
- { LVSINFO, "Logical Volume Device", "lv_", _obj_get_lv_with_info },
+ { LVSINFO, "Logical Volume Device Info", "lv_", _obj_get_lv_with_info_and_seg_status },
{ PVS, "Physical Volume", "pv_", _obj_get_pv },
{ LABEL, "Physical Volume Label", "pv_", _obj_get_label },
{ SEGS, "Logical Volume Segment", "seg_", _obj_get_seg },
@@ -1851,14 +1846,15 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
int report_object(void *handle, struct volume_group *vg,
struct logical_volume *lv, struct physical_volume *pv,
struct lv_segment *seg, struct pv_segment *pvseg,
- struct lvinfo *lvinfo, struct label *label)
+ struct lvinfo *lvinfo, struct lv_seg_status *lv_seg_status,
+ struct label *label)
{
struct device dummy_device = { .dev = 0 };
struct label dummy_label = { .dev = &dummy_device };
- struct lv_with_info lvi = { .lv = lv, .info = lvinfo };
+ struct lv_with_info_and_seg_status lvdm = { .lv = lv, .info = lvinfo, .seg_status = lv_seg_status};
struct lvm_report_object obj = {
.vg = vg,
- .lvi = &lvi,
+ .lvdm = &lvdm,
.pv = pv,
.seg = seg,
.pvseg = pvseg,
diff --git a/lib/report/report.h b/lib/report/report.h
index 089fc15..e4b302e 100644
--- a/lib/report/report.h
+++ b/lib/report/report.h
@@ -45,7 +45,8 @@ void report_free(void *handle);
int report_object(void *handle, struct volume_group *vg,
struct logical_volume *lv, struct physical_volume *pv,
struct lv_segment *seg, struct pv_segment *pvseg,
- struct lvinfo *lvinfo, struct label *label);
+ struct lvinfo *lvinfo, struct lv_seg_status *lv_seg_status,
+ struct label *label);
int report_devtypes(void *handle);
int report_output(void *handle);
diff --git a/tools/reporter.c b/tools/reporter.c
index b49f37d..959e884 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -31,7 +31,7 @@ static int _vgs_single(struct cmd_context *cmd __attribute__((unused)),
const char *vg_name, struct volume_group *vg,
void *handle)
{
- if (!report_object(handle, vg, NULL, NULL, NULL, NULL, NULL, NULL))
+ if (!report_object(handle, vg, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
return_ECMD_FAILED;
check_current_backup(vg);
@@ -42,7 +42,7 @@ static int _vgs_single(struct cmd_context *cmd __attribute__((unused)),
static int _lvs_single(struct cmd_context *cmd, struct logical_volume *lv,
void *handle)
{
- if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL, NULL, NULL))
+ if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL, NULL, NULL, NULL))
return_ECMD_FAILED;
return ECMD_PROCESSED;
@@ -62,7 +62,7 @@ static int _lvs_with_info_single(struct cmd_context *cmd, struct logical_volume
struct lvinfo lvinfo;
_get_lv_info_for_report(cmd, lv, &lvinfo);
- if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL, &lvinfo, NULL))
+ if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL, &lvinfo, NULL, NULL))
return_ECMD_FAILED;
return ECMD_PROCESSED;
@@ -71,7 +71,7 @@ static int _lvs_with_info_single(struct cmd_context *cmd, struct logical_volume
static int _segs_single(struct cmd_context *cmd __attribute__((unused)),
struct lv_segment *seg, void *handle)
{
- if (!report_object(handle, seg->lv->vg, seg->lv, NULL, seg, NULL, NULL, NULL))
+ if (!report_object(handle, seg->lv->vg, seg->lv, NULL, seg, NULL, NULL, NULL, NULL))
return_ECMD_FAILED;
return ECMD_PROCESSED;
@@ -83,7 +83,7 @@ static int _segs_with_lv_info_single(struct cmd_context *cmd __attribute__((unus
struct lvinfo lvinfo;
_get_lv_info_for_report(cmd, seg->lv, &lvinfo);
- if (!report_object(handle, seg->lv->vg, seg->lv, NULL, seg, NULL, &lvinfo, NULL))
+ if (!report_object(handle, seg->lv->vg, seg->lv, NULL, seg, NULL, &lvinfo, NULL, NULL))
return_ECMD_FAILED;
return ECMD_PROCESSED;
@@ -93,11 +93,13 @@ static int _do_pvsegs_sub_single(struct cmd_context *cmd,
struct volume_group *vg,
struct pv_segment *pvseg,
int lv_info_needed,
+ int lv_seg_status_needed,
void *handle)
{
int ret = ECMD_PROCESSED;
struct lv_segment *seg = pvseg->lvseg;
struct lvinfo lvinfo = { .exists = 0 };
+ struct lv_seg_status lv_seg_status;
struct segment_type _freeseg_type = {
.name = "free",
@@ -136,7 +138,8 @@ static int _do_pvsegs_sub_single(struct cmd_context *cmd,
_get_lv_info_for_report(cmd, seg->lv, &lvinfo);
if (!report_object(handle, vg, seg ? seg->lv : &_free_logical_volume, pvseg->pv,
- seg ? : &_free_lv_segment, pvseg, &lvinfo, pv_label(pvseg->pv))) {
+ seg ? : &_free_lv_segment, pvseg, &lvinfo, &lv_seg_status,
+ pv_label(pvseg->pv))) {
ret = ECMD_FAILED;
goto_out;
}
@@ -149,7 +152,7 @@ static int _pvsegs_sub_single(struct cmd_context *cmd,
struct volume_group *vg,
struct pv_segment *pvseg, void *handle)
{
- return _do_pvsegs_sub_single(cmd, vg, pvseg, 0, handle);
+ return _do_pvsegs_sub_single(cmd, vg, pvseg, 0, 0, handle);
}
static int _pvsegs_with_lv_info_sub_single(struct cmd_context *cmd,
@@ -157,7 +160,7 @@ static int _pvsegs_with_lv_info_sub_single(struct cmd_context *cmd,
struct pv_segment *pvseg,
void *handle)
{
- return _do_pvsegs_sub_single(cmd, vg, pvseg, 1, handle);
+ return _do_pvsegs_sub_single(cmd, vg, pvseg, 1, 0, handle);
}
static int _lvsegs_single(struct cmd_context *cmd, struct logical_volume *lv,
@@ -198,7 +201,7 @@ static int _pvsegs_with_lv_info_single(struct cmd_context *cmd,
static int _pvs_single(struct cmd_context *cmd, struct volume_group *vg,
struct physical_volume *pv, void *handle)
{
- if (!report_object(handle, vg, NULL, pv, NULL, NULL, NULL, NULL))
+ if (!report_object(handle, vg, NULL, pv, NULL, NULL, NULL, NULL, NULL))
return_ECMD_FAILED;
return ECMD_PROCESSED;
@@ -207,7 +210,7 @@ static int _pvs_single(struct cmd_context *cmd, struct volume_group *vg,
static int _label_single(struct cmd_context *cmd, struct label *label,
void *handle)
{
- if (!report_object(handle, NULL, NULL, NULL, NULL, NULL, NULL, label))
+ if (!report_object(handle, NULL, NULL, NULL, NULL, NULL, NULL, NULL, label))
return_ECMD_FAILED;
return ECMD_PROCESSED;
9 years, 6 months
master - libdm: still better API
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=20b22cd023bdfd...
Commit: 20b22cd023bdfd30301305ba5b78655619d965f1
Parent: ca509c97467f5f077463c54fee185442cb98f817
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 10 23:41:03 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Nov 11 00:54:03 2014 +0100
libdm: still better API
Do not use 'any' policy name as a value in config tree - so we stick
with 'policy_settings' and extra 'policy_name' for libdm params.
Update lvm2 API as well.
Example of supported metadata:
policy = "mq"
policy_settings {
migration_threshold = 2048
sequential_threshold = 512
random_threshold = 4
read_promote_adjustment = 10
}
---
lib/cache_segtype/cache.c | 43 +++++++++++++++++++++++++------------
lib/config/defaults.h | 1 +
lib/metadata/metadata-exported.h | 3 +-
libdm/libdevmapper.h | 14 ++++++------
libdm/libdm-deptree.c | 16 +++++++-------
5 files changed, 47 insertions(+), 30 deletions(-)
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index ab9d4a0..b42a529 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -71,9 +71,18 @@ static int _cache_pool_text_import(struct lv_segment *seg,
return SEG_LOG_ERROR("Unknown cache_mode in");
}
+ if (dm_config_has_node(sn, "policy")) {
+ if (!(str = dm_config_find_str(sn, "policy", NULL)))
+ return SEG_LOG_ERROR("policy must be a string in");
+ if (!(seg->policy_name = dm_pool_strdup(mem, str)))
+ return SEG_LOG_ERROR("Failed to duplicate policy in");
+ } else
+ /* Cannot use 'just' default, so pick one */
+ seg->policy_name = DEFAULT_CACHE_POOL_POLICY; /* TODO: configurable default */
+
/*
* Read in policy args:
- * mq {
+ * policy_settings {
* migration_threshold=2048
* sequention_threashold=100
* random_threashold=200
@@ -88,14 +97,13 @@ static int _cache_pool_text_import(struct lv_segment *seg,
*
* If the policy is not present, default policy is used.
*/
- for (; sn; sn = sn->sib)
- if (!sn->v) {
- if (seg->policy_args)
- return SEG_LOG_ERROR("only a singly policy is supported for");
+ if ((sn = dm_config_find_node(sn, "policy_settings"))) {
+ if (sn->v)
+ return SEG_LOG_ERROR("policy_settings must be a section in");
- if (!(seg->policy_args = dm_config_clone_node_with_mem(mem, sn, 0)))
- return_0;
- }
+ if (!(seg->policy_settings = dm_config_clone_node_with_mem(mem, sn, 0)))
+ return_0;
+ }
if (!attach_pool_data_lv(seg, data_lv))
return_0;
@@ -126,8 +134,17 @@ static int _cache_pool_text_export(const struct lv_segment *seg,
outf(f, "chunk_size = %" PRIu32, seg->chunk_size);
outf(f, "cache_mode = \"%s\"", cache_mode);
- if (seg->policy_args)
- out_config_node(f, seg->policy_args);
+ if (seg->policy_name)
+ outf(f, "policy = \"%s\"", seg->policy_name);
+
+ if (seg->policy_settings) {
+ if (strcmp(seg->policy_settings->key, "policy_settings")) {
+ log_error(INTERNAL_ERROR "Incorrect policy_settings tree, %s.",
+ seg->policy_settings->key);
+ return 0;
+ }
+ out_config_node(f, seg->policy_settings);
+ }
return 1;
}
@@ -266,8 +283,6 @@ static int _cache_add_target_line(struct dev_manager *dm,
{
struct lv_segment *cache_pool_seg = first_seg(seg->pool_lv);
char *metadata_uuid, *data_uuid, *origin_uuid;
- const char *policy_name = seg->cleaner_policy ? "cleaner" :
- cache_pool_seg->policy_args ? cache_pool_seg->policy_args->key : NULL;
if (!(metadata_uuid = build_dm_uuid(mem, cache_pool_seg->metadata_lv, NULL)))
return_0;
@@ -283,8 +298,8 @@ static int _cache_add_target_line(struct dev_manager *dm,
metadata_uuid,
data_uuid,
origin_uuid,
- seg->cleaner_policy ? NULL : cache_pool_seg->policy_args,
- policy_name,
+ seg->cleaner_policy ? "cleaner" : cache_pool_seg->policy_name,
+ seg->cleaner_policy ? NULL : cache_pool_seg->policy_settings,
cache_pool_seg->chunk_size))
return_0;
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index acf768b..cbc95fb 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -96,6 +96,7 @@
#define DEFAULT_CACHE_POOL_MIN_METADATA_SIZE 2048 /* KB */
#define DEFAULT_CACHE_POOL_MAX_METADATA_SIZE (16 * 1024 * 1024) /* KB */
#define DEFAULT_CACHE_POOL_CACHEMODE "writethrough"
+#define DEFAULT_CACHE_POOL_POLICY "mq"
#define DEFAULT_UMASK 0077
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 0ba1ed5..375f7be 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -432,7 +432,8 @@ struct lv_segment {
uint32_t device_id; /* For thin, 24bit */
uint64_t feature_flags; /* For cache_pool */
- struct dm_config_node *policy_args; /* For cache_pool (-> policy_name) */
+ const char *policy_name; /* For cache_pool */
+ struct dm_config_node *policy_settings; /* For cache_pool */
unsigned cleaner_policy; /* For cache */
struct logical_volume *replicator;/* For replicator-devs - link to replicator LV */
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 62a5941..9ea7dbe 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -780,13 +780,13 @@ struct dm_config_node;
/*
* Use for passing cache policy and all its args e.g.:
*
- * mq {
- * migration_threshold=2048
- * sequention_threashold=100
- * ...
- * }
+ * policy_settings {
+ * migration_threshold=2048
+ * sequention_threashold=100
+ * ...
+ * }
*
- * For policy without any parameters simply specify policy_name.
+ * For policy without any parameters use NULL.
*/
int dm_tree_node_add_cache_target(struct dm_tree_node *node,
uint64_t size,
@@ -794,8 +794,8 @@ int dm_tree_node_add_cache_target(struct dm_tree_node *node,
const char *metadata_uuid,
const char *data_uuid,
const char *origin_uuid,
- const struct dm_config_node *policy,
const char *policy_name,
+ const struct dm_config_node *policy_settings,
uint32_t chunk_size);
/*
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 70373a2..c3a5df6 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -173,7 +173,7 @@ struct load_segment {
const char *policy_name; /* Cache */
unsigned policy_argc; /* Cache */
- struct dm_config_node *policy; /* Cache */
+ struct dm_config_node *policy_settings; /* Cache */
const char *cipher; /* Crypt */
const char *chainmode; /* Crypt */
@@ -2399,13 +2399,13 @@ static int _cache_emit_segment_line(struct dm_task *dmt,
EMIT_PARAMS(pos, " 1 writeback");
/* Cache Policy */
- name = seg->policy_name ? : seg->policy ? seg->policy->key : "default";
+ name = seg->policy_name ? : "default";
EMIT_PARAMS(pos, " %s", name);
EMIT_PARAMS(pos, " %u", seg->policy_argc * 2);
- if (seg->policy)
- for (cn = seg->policy->child; cn; cn = cn->sib)
+ if (seg->policy_settings)
+ for (cn = seg->policy_settings->child; cn; cn = cn->sib)
EMIT_PARAMS(pos, " %s %" PRIu64, cn->key, cn->v->v.i);
return 1;
@@ -3303,8 +3303,8 @@ int dm_tree_node_add_cache_target(struct dm_tree_node *node,
const char *metadata_uuid,
const char *data_uuid,
const char *origin_uuid,
- const struct dm_config_node *policy,
const char *policy_name,
+ const struct dm_config_node *policy_settings,
uint32_t chunk_size)
{
struct dm_config_node *cn;
@@ -3346,11 +3346,11 @@ int dm_tree_node_add_cache_target(struct dm_tree_node *node,
seg->policy_name = policy_name;
/* FIXME: better validation missing */
- if (policy) {
- if (!(seg->policy = dm_config_clone_node_with_mem(node->dtree->mem, policy, 0)))
+ if (policy_settings) {
+ if (!(seg->policy_settings = dm_config_clone_node_with_mem(node->dtree->mem, policy_settings, 0)))
return_0;
- for (cn = seg->policy->child; cn; cn = cn->sib) {
+ for (cn = seg->policy_settings->child; cn; cn = cn->sib) {
if (!cn->v || (cn->v->type != DM_CFG_INT)) {
/* For now only <key> = <int> pairs are supported */
log_error("Cache policy parameter %s is without integer value.", cn->key);
9 years, 6 months
master - dev_manager: workaround to allow top-level _tmeta, _tdata
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ca509c97467f5f...
Commit: ca509c97467f5f077463c54fee185442cb98f817
Parent: a7fc1082987c3d5842664fd7817ec01e1ddec9cc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Nov 11 00:50:13 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Nov 11 00:53:37 2014 +0100
dev_manager: workaround to allow top-level _tmeta, _tdata
---
lib/activate/dev_manager.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 1666d41..2651ec8 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -2889,6 +2889,10 @@ static int _clean_tree(struct dev_manager *dm, struct dm_tree_node *root, char *
if (!*layer && (!(layer = strchr(uuid + 4, '-')) || strstr(layer, "-pool") || strstr(layer, "-tpool")))
continue;
+ /* FIXME: we still occasionally need to activate these at top-level */
+ if (strstr(lvname, "_tmeta") || strstr(lvname, "_tdata"))
+ continue;
+
/* If operation was performed on a partial tree, don't remove it */
if (non_toplevel_tree_dlid && !strcmp(non_toplevel_tree_dlid, uuid))
continue;
9 years, 6 months
master - mirror: layer remove doesn't work properly with mirrors
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a7fc1082987c3d...
Commit: a7fc1082987c3d5842664fd7817ec01e1ddec9cc
Parent: 094596cfd2001a8714923dd87abb2feacd116a13
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 10 22:32:43 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 10 22:32:43 2014 +0100
mirror: layer remove doesn't work properly with mirrors
---
lib/metadata/lv_manip.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 220f894..20bf76f 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6007,14 +6007,15 @@ int remove_layer_from_lv(struct logical_volume *lv,
* currently supported only for thin data layer
* FIXME: without strcmp it breaks mirrors....
*/
- for (r = 0; r < DM_ARRAY_SIZE(_suffixes); ++r)
- if (strstr(layer_lv->name, _suffixes[r]) == 0) {
- lv_names.old = layer_lv->name;
- lv_names.new = parent_lv->name;
- if (!for_each_sub_lv(parent_lv, _rename_cb, (void *) &lv_names))
- return_0;
- break;
- }
+ if (!strstr(layer_lv->name, "_mimage"))
+ for (r = 0; r < DM_ARRAY_SIZE(_suffixes); ++r)
+ if (strstr(layer_lv->name, _suffixes[r]) == 0) {
+ lv_names.old = layer_lv->name;
+ lv_names.new = parent_lv->name;
+ if (!for_each_sub_lv(parent_lv, _rename_cb, (void *) &lv_names))
+ return_0;
+ break;
+ }
return 1;
}
9 years, 6 months
master - tests: reach cache params
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=094596cfd2001a...
Commit: 094596cfd2001a8714923dd87abb2feacd116a13
Parent: 10ebabdd2a8c686d814205fd923229572eebdd3a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 10 21:29:20 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 10 22:05:49 2014 +0100
tests: reach cache params
---
test/shell/lvcreate-cache.sh | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/test/shell/lvcreate-cache.sh b/test/shell/lvcreate-cache.sh
index b37f321..eeba827 100644
--- a/test/shell/lvcreate-cache.sh
+++ b/test/shell/lvcreate-cache.sh
@@ -206,14 +206,17 @@ lvremove -f $vg
# Validate args are properly preserved #
########################################
lvcreate --type cache-pool -L10 --chunksize 256 --cachemode writeback $vg/cpool1
-lvcreate -H -L10 $vg/cpool1
check lv_field $vg/cpool1 chunksize "256.00k"
check lv_field $vg/cpool1 cachemode "writeback"
+lvcreate -H -L10 -n $lv1 $vg/cpool1
+lvs -a -o+cachemode,chunksize $vg
+check lv_field $vg/$lv1 chunksize "256.00k"
+check lv_field $vg/$lv1 cachemode "writeback"
lvcreate --type cache-pool -L10 --chunksize 256 --cachemode writethrough $vg/cpool2
-lvcreate -H -L10 --chunksize 512 --cachemode writeback $vg/cpool2
-check lv_field $vg/cpool2 chunksize "512.00k"
-check lv_field $vg/cpool2 cachemode "writeback"
+lvcreate -H -L10 --chunksize 512 --cachemode writeback -n $lv2 $vg/cpool2
+check lv_field $vg/$lv2 chunksize "512.00k"
+check lv_field $vg/$lv2 cachemode "writeback"
# Chunk bigger then pool size
fail lvcreate --type cache-pool -l1 --chunksize 1G $vg/cpool3
9 years, 6 months
master - tests: cache snapshot
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=10ebabdd2a8c68...
Commit: 10ebabdd2a8c686d814205fd923229572eebdd3a
Parent: 02f49caa3599d74ff9ef850d76fec69569ef9621
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Nov 4 23:24:56 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 10 22:05:49 2014 +0100
tests: cache snapshot
---
test/shell/lvconvert-cache.sh | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvconvert-cache.sh b/test/shell/lvconvert-cache.sh
index 4f266ba..ed414ed 100644
--- a/test/shell/lvconvert-cache.sh
+++ b/test/shell/lvconvert-cache.sh
@@ -17,6 +17,14 @@ aux have_cache 1 3 0 || skip
aux prepare_vg 5 80
+lvcreate --type cache-pool -an -v -L 2 -n cpool $vg
+lvcreate -H -L 4 -n corigin --cachepool $vg/cpool
+
+fail lvcreate -s -L2 $vg/corigin
+fail lvcreate -s -L2 $vg/cpool
+fail lvcreate -s -L2 $vg/cpool_cdata
+fail lvcreate -s -L2 $vg/cpool_cmeta
+
###########################
# Check regular converion #
###########################
9 years, 6 months
master - debug: log tree type is created
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=02f49caa3599d7...
Commit: 02f49caa3599d74ff9ef850d76fec69569ef9621
Parent: f12e3da6393376ed13370a45995bf1950081a954
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Nov 8 23:41:22 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 10 22:05:49 2014 +0100
debug: log tree type is created
Print tree type and use internal_error for unknown type.
---
lib/activate/dev_manager.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index ffd7ff3..1666d41 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -2903,12 +2903,18 @@ static int _clean_tree(struct dev_manager *dm, struct dm_tree_node *root, char *
static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv,
struct lv_activate_opts *laopts, action_t action)
{
+ static const char const _action_names[][24] = {
+ "PRELOAD", "ACTIVATE", "DEACTIVATE", "SUSPEND", "SUSPEND_WITH_LOCKFS", "CLEAN"
+ };
const size_t DLID_SIZE = ID_LEN + sizeof(UUID_PREFIX) - 1;
struct dm_tree *dtree;
struct dm_tree_node *root;
char *dlid;
int r = 0;
+ if (action < DM_ARRAY_SIZE(_action_names))
+ log_debug_activation("Creating %s tree for %s.", _action_names[action], lv->name);
+
/* Some LV can be used for top level tree */
/* TODO: add more.... */
if (lv_is_cache_pool(lv) && !dm_list_empty(&lv->segs_using_this_lv)) {
@@ -2980,7 +2986,7 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv,
break;
default:
- log_error("_tree_action: Action %u not supported.", action);
+ log_error(INTERNAL_ERROR "_tree_action: Action %u not supported.", action);
goto out;
}
9 years, 6 months
master - cleanup: gcc warnings
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f12e3da6393376...
Commit: f12e3da6393376ed13370a45995bf1950081a954
Parent: e5d3f812854b23ef5e7e51f96a3f89fa02c093fa
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Nov 8 15:33:17 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 10 22:05:49 2014 +0100
cleanup: gcc warnings
---
daemons/lvmetad/lvmetad-core.c | 2 +-
libdm/libdm-deptree.c | 2 +-
python/liblvm.c | 3 ++-
tools/lvmcmdline.c | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 5b23a56..693eb86 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -1035,7 +1035,7 @@ static void _dump_pairs(struct buffer *buf, struct dm_hash_table *ht, const char
*val = dm_hash_get_data(ht, n);
buffer_append(buf, " ");
if (int_key)
- (void) dm_asprintf(&append, "%d = \"%s\"", *(int*)key, val);
+ (void) dm_asprintf(&append, "%d = \"%s\"", *(const int*)key, val);
else
(void) dm_asprintf(&append, "%s = \"%s\"", key, val);
if (append)
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 6521360..70373a2 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -3176,7 +3176,7 @@ int dm_tree_node_add_raid_target_with_params(struct dm_tree_node *node,
uint64_t size,
struct dm_tree_node_raid_params *p)
{
- int i;
+ unsigned i;
struct load_segment *seg = NULL;
for (i = 0; i < DM_ARRAY_SIZE(_dm_segtypes) && !seg; ++i)
diff --git a/python/liblvm.c b/python/liblvm.c
index 9983135..1b0942d 100644
--- a/python/liblvm.c
+++ b/python/liblvm.c
@@ -1986,6 +1986,7 @@ static void _liblvm_cleanup(void)
}
}
+PyMODINIT_FUNC initlvm(void);
PyMODINIT_FUNC initlvm(void)
{
PyObject *m;
@@ -2020,7 +2021,7 @@ PyMODINIT_FUNC initlvm(void)
LVM_THIN_DISCARDS_PASSDOWN) < 0)
return;
- if ((_LibLVMError = PyErr_NewException("lvm.LibLVMError", NULL, NULL))) {
+ if ((_LibLVMError = PyErr_NewException((char*)"lvm.LibLVMError", NULL, NULL))) {
/* Each call to PyModule_AddObject decrefs it; compensate: */
Py_INCREF(_LibLVMError);
Py_INCREF(_LibLVMError);
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index ce45eb4..6149dbc 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1500,8 +1500,8 @@ int lvm_return_code(int ret)
int lvm_split(char *str, int *argc, char **argv, int max)
{
char *b = str, *e;
- *argc = 0;
char quote = 0;
+ *argc = 0;
while (*b) {
while (*b && isspace(*b))
9 years, 6 months
master - cleanup: indents comments backtraces
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e5d3f812854b23...
Commit: e5d3f812854b23ef5e7e51f96a3f89fa02c093fa
Parent: 1e97d2dd286a184fc1d26a9abb60fea9e2b7d44d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 6 20:36:53 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 10 22:05:49 2014 +0100
cleanup: indents comments backtraces
---
lib/activate/activate.c | 3 ++-
lib/activate/dev_manager.c | 2 +-
lib/cache_segtype/cache.c | 11 +++++------
lib/metadata/cache_manip.c | 3 ++-
lib/metadata/lv_manip.c | 1 +
libdm/mm/pool-debug.c | 2 +-
libdm/mm/pool-fast.c | 2 +-
7 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 7adb90f..93f9b9c 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1687,7 +1687,8 @@ static int _preload_detached_lv(struct logical_volume *lv, void *data)
struct lv_list *lvl_pre;
if ((lvl_pre = find_lv_in_vg(detached->lv_pre->vg, lv->name))) {
- if (lv_is_visible(lvl_pre->lv) && lv_is_active(lv) && (!lv_is_cow(lv) || !lv_is_cow(lvl_pre->lv)) &&
+ if (lv_is_visible(lvl_pre->lv) && lv_is_active(lv) &&
+ (!lv_is_cow(lv) || !lv_is_cow(lvl_pre->lv)) &&
!_lv_preload(lvl_pre->lv, detached->laopts, detached->flush_required))
return_0;
}
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 2c6ed50..ffd7ff3 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1207,7 +1207,7 @@ int dev_manager_cache_status(struct dev_manager *dm,
goto_out;
c = (*status)->cache;
- (*status)->mem = dm->mem; /* User can destroy this mem pool later */
+ (*status)->mem = dm->mem; /* User has to destroy this mem pool later */
(*status)->data_usage = dm_make_percent(c->used_blocks,
c->total_blocks);
(*status)->metadata_usage = dm_make_percent(c->metadata_used_blocks,
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index 11c5b10..ab9d4a0 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -45,7 +45,7 @@ static int _cache_pool_text_import(struct lv_segment *seg,
return SEG_LOG_ERROR("Cache data must be a string in");
if (!(data_lv = find_lv(seg->lv->vg, str)))
return SEG_LOG_ERROR("Unknown logical volume %s specified for "
- "cache data in", str);
+ "cache data in", str);
if (!dm_config_has_node(sn, "metadata"))
return SEG_LOG_ERROR("Cache metadata not specified in");
@@ -53,7 +53,7 @@ static int _cache_pool_text_import(struct lv_segment *seg,
return SEG_LOG_ERROR("Cache metadata must be a string in");
if (!(meta_lv = find_lv(seg->lv->vg, str)))
return SEG_LOG_ERROR("Unknown logical volume %s specified for "
- "cache metadata in", str);
+ "cache metadata in", str);
if (!dm_config_get_uint32(sn, "chunk_size", &seg->chunk_size))
return SEG_LOG_ERROR("Couldn't read cache chunk_size in");
@@ -199,7 +199,7 @@ static int _cache_text_import(struct lv_segment *seg,
struct dm_hash_table *pv_hash __attribute__((unused)))
{
struct logical_volume *pool_lv, *origin_lv;
- const char *name = NULL;
+ const char *name;
if (!dm_config_has_node(sn, "cache_pool"))
return SEG_LOG_ERROR("cache_pool not specified in");
@@ -207,7 +207,7 @@ static int _cache_text_import(struct lv_segment *seg,
return SEG_LOG_ERROR("cache_pool must be a string in");
if (!(pool_lv = find_lv(seg->lv->vg, name)))
return SEG_LOG_ERROR("Unknown logical volume %s specified for "
- "cache_pool in", name);
+ "cache_pool in", name);
if (!dm_config_has_node(sn, "origin"))
return SEG_LOG_ERROR("Cache origin not specified in");
@@ -215,8 +215,7 @@ static int _cache_text_import(struct lv_segment *seg,
return SEG_LOG_ERROR("Cache origin must be a string in");
if (!(origin_lv = find_lv(seg->lv->vg, name)))
return SEG_LOG_ERROR("Unknown logical volume %s specified for "
- "cache origin in", name);
-
+ "cache origin in", name);
if (!set_lv_segment_area_lv(seg, 0, origin_lv, 0, 0))
return_0;
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index e50b796..6c74e57 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -342,8 +342,9 @@ int lv_cache_remove(struct logical_volume *cache_lv)
*/
corigin_lv = seg_lv(cache_seg, 0);
lv_set_visible(corigin_lv);
+
if (!remove_layer_from_lv(cache_lv, corigin_lv))
- return_0;
+ return_0;
/* Replace 'error' with 'cache' segtype */
cache_seg = first_seg(corigin_lv);
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 30944c1..220f894 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7018,6 +7018,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
if (seg_is_cache(lp)) {
/* TODO: support remote exclusive activation? */
+ /* Not yet 'cache' LV, it is stripe volume for wiping */
if (is_change_activating(lp->activate) &&
!activate_lv_excl_local(cmd, lv)) {
log_error("Aborting. Failed to activate LV %s locally exclusively.",
diff --git a/libdm/mm/pool-debug.c b/libdm/mm/pool-debug.c
index afaa39e..a2767cd 100644
--- a/libdm/mm/pool-debug.c
+++ b/libdm/mm/pool-debug.c
@@ -170,7 +170,7 @@ void *dm_pool_alloc_aligned(struct dm_pool *p, size_t s, unsigned alignment)
struct block *b = _new_block(s, alignment);
if (!b)
- return NULL;
+ return_NULL;
_append_block(p, b);
diff --git a/libdm/mm/pool-fast.c b/libdm/mm/pool-fast.c
index edb31a0..803842c 100644
--- a/libdm/mm/pool-fast.c
+++ b/libdm/mm/pool-fast.c
@@ -107,7 +107,7 @@ void *dm_pool_alloc_aligned(struct dm_pool *p, size_t s, unsigned alignment)
needed : p->chunk_size);
if (!c)
- return NULL;
+ return_NULL;
_align_chunk(c, alignment);
}
9 years, 6 months
master - cleanup: use chunk_size directly
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1e97d2dd286a18...
Commit: 1e97d2dd286a184fc1d26a9abb60fea9e2b7d44d
Parent: f5e265a07fb3e083416d9f5cf17bd601a1e3f782
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Nov 9 18:55:42 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 10 22:05:49 2014 +0100
cleanup: use chunk_size directly
---
lib/cache_segtype/cache.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index c53eb23..11c5b10 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -35,7 +35,6 @@ static int _cache_pool_text_import(struct lv_segment *seg,
const struct dm_config_node *sn,
struct dm_hash_table *pv_hash __attribute__((unused)))
{
- uint32_t chunk_size;
struct logical_volume *data_lv, *meta_lv;
const char *str = NULL;
struct dm_pool *mem = seg->lv->vg->vgmem;
@@ -56,7 +55,7 @@ static int _cache_pool_text_import(struct lv_segment *seg,
return SEG_LOG_ERROR("Unknown logical volume %s specified for "
"cache metadata in", str);
- if (!dm_config_get_uint32(sn, "chunk_size", &chunk_size))
+ if (!dm_config_get_uint32(sn, "chunk_size", &seg->chunk_size))
return SEG_LOG_ERROR("Couldn't read cache chunk_size in");
/*
@@ -102,7 +101,6 @@ static int _cache_pool_text_import(struct lv_segment *seg,
return_0;
if (!attach_pool_metadata_lv(seg, meta_lv))
return_0;
- seg->chunk_size = chunk_size;
return 1;
}
9 years, 6 months