master - man: lvmcache better cache mode info and other command variations
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=91198ac13e61c6...
Commit: 91198ac13e61c66b65884660410311ffc8b8c24e
Parent: 17ab39f7431fdad4c8a445bd1e78a288eeb64bc1
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Aug 26 16:40:47 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Oct 2 12:01:58 2014 -0500
man: lvmcache better cache mode info and other command variations
---
man/lvmcache.7.in | 49 ++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 42 insertions(+), 7 deletions(-)
diff --git a/man/lvmcache.7.in b/man/lvmcache.7.in
index 6d7109a..6339b91 100644
--- a/man/lvmcache.7.in
+++ b/man/lvmcache.7.in
@@ -214,16 +214,27 @@ pool sub-LVs redundant.
# lvconvert \-\-type cache \-\-cachepool vg/cache1 vg/lv1
.fi
-.SS Writethough caching
+.SS Cache mode
\&
-Writethrough caching ensures that any data written will be stored both in
-the cache pool LV and on the origin LV. The loss of a device associated
-with the cache pool LV in this case would not mean the loss of any data.
-When combining the cache data LV and the cache metadata LV to form the
-cache pool LV, properties of the cache can be specified - in this case,
-\fIwritethrough\fP vs. \fIwriteback\fP.
+The default cache mode is "writethrough". Writethrough ensures that any
+data written will be stored both in the cache pool LV and on the origin
+LV. The loss of a device associated with the cache pool LV in this case
+would not mean the loss of any data.
+
+A second cache mode is "writeback". Writeback delays writing data blocks
+from the cache pool back to the origin LV. This mode will increase
+performance, but the loss of a device associated with the cache pool LV
+can result in lost data.
+
+The cache mode can be specified with the --cachemode option when a cache
+pool LV is created.
+
+.BR lvm.conf (5)
+.B cache_pool_cachemode
+.br
+defines the default cache mode.
.nf
0. Create an origin LV we wish to cache (yours may already exist)
@@ -264,6 +275,30 @@ the same VG.
.br
.B lvconvert --type cache\-pool VG/CacheDataLV
+.SS Create a new cache LV without an existing origin LV
+
+\&
+
+A cache LV can be created using an existing cache pool without an existing
+origin LV. A new origin LV is created and linked to the cache pool in a
+single step.
+
+.B lvcreate \-\-type cache \-L LargeSize \-n CacheLV
+.RS
+.B \-\-cachepool VG/CachePoolLV SlowPVs
+.RE
+
+
+.SS Single step cache pool LV creation
+
+\&
+
+A cache pool LV can be created with a single lvcreate command, rather than
+using lvconvert on existing LVs. This one command creates a cache data
+LV, a cache metadata LV, and combines the two into a cache pool LV.
+
+.B lvcreate \-\-type cache\-pool \-L CacheSize \-n CachePoolLV VG FastPVs
+
.SH SEE ALSO
.BR lvm.conf (5),
9 years, 6 months
master - cache: include cache mode in vg metadata and display
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=17ab39f7431fda...
Commit: 17ab39f7431fdad4c8a445bd1e78a288eeb64bc1
Parent: a976226e81c561d1123087d1d3dac10ce12e073f
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Oct 1 16:06:01 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Oct 2 11:17:41 2014 -0500
cache: include cache mode in vg metadata and display
The cache mode of a new cache pool is always explicitly
included in the vg metadata. If a cache mode is not
specified on the command line, the cache mode is taken
from lvm.conf allocation/cache_pool_cachemode, which
defaults to "writethrough".
The cache mode can be displayed with lvs -o+cachemode.
---
conf/example.conf.in | 9 +++++++++
lib/config/config_settings.h | 1 +
lib/config/defaults.h | 1 +
lib/metadata/cache_manip.c | 11 +++++++++++
lib/metadata/lv.c | 5 +++++
lib/metadata/lv.h | 1 +
lib/metadata/metadata-exported.h | 1 +
lib/report/columns.h | 1 +
lib/report/properties.c | 2 ++
lib/report/report.c | 18 ++++++++++++++++++
man/lvm.conf.5.in | 9 +++++++++
tools/lvconvert.c | 8 +++++---
tools/lvcreate.c | 9 ++++++---
13 files changed, 70 insertions(+), 6 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index dd1d066..d1da23f 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -335,6 +335,15 @@ allocation {
# range from 32(kiB) to 1048576 in multiples of 32.
# cache_pool_chunk_size = 64
+ # Specify the default cache mode used for new cache pools.
+ # Possible options are:
+ # "writethrough" - Data blocks are immediately written from
+ # the cache to disk.
+ # "writeback" - Data blocks are written from the cache
+ # back to disk after some delay to improve
+ # performance.
+ # cache_pool_cachemode = "writethrough"
+
# Set to 1 to guarantee that thin pool metadata will always
# be placed on different PVs from the pool data.
thin_pool_metadata_require_separate_pvs = 0
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 7724c57..a6c1d1b 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -120,6 +120,7 @@ cfg(allocation_use_blkid_wiping_CFG, "use_blkid_wiping", allocation_CFG_SECTION,
cfg(allocation_wipe_signatures_when_zeroing_new_lvs_CFG, "wipe_signatures_when_zeroing_new_lvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
cfg(allocation_mirror_logs_require_separate_pvs_CFG, "mirror_logs_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS, vsn(2, 2, 85), NULL)
cfg(allocation_cache_pool_metadata_require_separate_pvs_CFG, "cache_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 106), NULL)
+cfg(allocation_cache_pool_cachemode_CFG, "cache_pool_cachemode", allocation_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_CACHE_POOL_CACHEMODE, vsn(2, 2, 113), NULL)
cfg_runtime(allocation_cache_pool_chunk_size_CFG, "cache_pool_chunk_size", allocation_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, vsn(2, 2, 106), NULL)
cfg(allocation_thin_pool_metadata_require_separate_pvs_CFG, "thin_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 89), NULL)
cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_ZERO, vsn(2, 2, 99), NULL)
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 05187b0..2cb1e5a 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -96,6 +96,7 @@
#define DEFAULT_CACHE_POOL_CHUNK_SIZE 64 /* KB */
#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_UMASK 0077
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index 7f5ea65..a44bba8 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -22,6 +22,17 @@
#include "activate.h"
#include "defaults.h"
+const char *get_cachepool_cachemode_name(const struct lv_segment *seg)
+{
+ if (seg->feature_flags & DM_CACHE_FEATURE_WRITEBACK)
+ return "writeback";
+
+ if (seg->feature_flags & DM_CACHE_FEATURE_WRITETHROUGH)
+ return "writethrough";
+
+ return "unknown";
+}
+
int update_cache_pool_params(struct volume_group *vg, unsigned attr,
int passed_args, uint32_t data_extents,
uint64_t *pool_metadata_size,
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index d29e787..23f0991 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -128,6 +128,11 @@ char *lvseg_discards_dup(struct dm_pool *mem, const struct lv_segment *seg)
return dm_pool_strdup(mem, get_pool_discards_name(seg->discards));
}
+char *lvseg_cachemode_dup(struct dm_pool *mem, const struct lv_segment *seg)
+{
+ return dm_pool_strdup(mem, get_cachepool_cachemode_name(seg));
+}
+
#ifdef DMEVENTD
# include "libdevmapper-event.h"
#endif
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index d43bc01..bcd7028 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -82,6 +82,7 @@ uint64_t lvseg_size(const struct lv_segment *seg);
uint64_t lvseg_chunksize(const struct lv_segment *seg);
char *lvseg_segtype_dup(struct dm_pool *mem, const struct lv_segment *seg);
char *lvseg_discards_dup(struct dm_pool *mem, const struct lv_segment *seg);
+char *lvseg_cachemode_dup(struct dm_pool *mem, const struct lv_segment *seg);
char *lvseg_monitor_dup(struct dm_pool *mem, const struct lv_segment *seg);
char *lvseg_tags_dup(const struct lv_segment *seg);
char *lvseg_devices(struct dm_pool *mem, const struct lv_segment *seg);
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 5787f5a..b392bde 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1069,6 +1069,7 @@ int partial_raid_lv_supports_degraded_activation(const struct logical_volume *lv
/* -- metadata/raid_manip.c */
/* ++ metadata/cache_manip.c */
+const char *get_cachepool_cachemode_name(const struct lv_segment *seg);
int update_cache_pool_params(struct volume_group *vg, unsigned attr,
int passed_args, uint32_t data_extents,
uint64_t *pool_metadata_size,
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 796ac4e..a2f34f9 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -158,6 +158,7 @@ FIELD(SEGS, seg, SIZ, "Chunk", list, 5, chunksize, chunksize, "For snapshots, th
FIELD(SEGS, seg, SIZ, "Chunk", list, 5, chunksize, chunk_size, "For snapshots, the unit of data used when tracking changes.", 0)
FIELD(SEGS, seg, NUM, "#Thins", list, 4, thincount, thin_count, "For thin pools, the number of thin volumes in this pool.", 0)
FIELD(SEGS, seg, STR, "Discards", list, 8, discards, discards, "For thin pools, how discards are handled.", 0)
+FIELD(SEGS, seg, STR, "Cachemode", list, 9, cachemode, cachemode, "For cache pools, how writes are cached.", 0)
FIELD(SEGS, seg, BIN, "Zero", list, 4, thinzero, zero, "For thin pools, if zeroing is enabled.", 0)
FIELD(SEGS, seg, NUM, "TransId", list, 4, transactionid, transaction_id, "For thin pools, the transaction id.", 0)
FIELD(SEGS, seg, NUM, "ThId", list, 4, thinid, thin_id, "For thin volume, the thin device id.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index e0092db..8f4f472 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -380,6 +380,8 @@ GET_LVSEG_NUM_PROPERTY_FN(thin_id, lvseg->device_id)
#define _thin_id_set prop_not_implemented_set
GET_LVSEG_STR_PROPERTY_FN(discards, lvseg_discards_dup(lvseg->lv->vg->vgmem, lvseg))
#define _discards_set prop_not_implemented_set
+GET_LVSEG_STR_PROPERTY_FN(cachemode, lvseg_cachemode_dup(lvseg->lv->vg->vgmem, lvseg))
+#define _cachemode_set prop_not_implemented_set
GET_LVSEG_NUM_PROPERTY_FN(seg_start, (SECTOR_SIZE * lvseg_start(lvseg)))
#define _seg_start_set prop_not_implemented_set
GET_LVSEG_NUM_PROPERTY_FN(seg_start_pe, lvseg->le)
diff --git a/lib/report/report.c b/lib/report/report.c
index c34aa5e..69f75ed 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -773,6 +773,24 @@ static int _discards_disp(struct dm_report *rh, struct dm_pool *mem,
return _field_set_value(field, "", NULL);
}
+static int _cachemode_disp(struct dm_report *rh, struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private)
+{
+ const struct lv_segment *seg = (const struct lv_segment *) data;
+ const char *cachemode_str;
+
+ if (seg_is_cache(seg))
+ seg = first_seg(seg->pool_lv);
+
+ if (seg_is_cache_pool(seg)) {
+ cachemode_str = get_cachepool_cachemode_name(seg);
+ return dm_report_field_string(rh, field, &cachemode_str);
+ }
+
+ return _field_set_value(field, "", NULL);
+}
+
static int _originsize_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
diff --git a/man/lvm.conf.5.in b/man/lvm.conf.5.in
index c434527..5bc2081 100644
--- a/man/lvm.conf.5.in
+++ b/man/lvm.conf.5.in
@@ -299,6 +299,15 @@ they are situated and these two PV tags are selected for use with this
allocation policy:
.IP
cling_tag_list = [ "@site1", "@site2" ]
+.IP
+\fBcache_pool_cachemode\fP \(em Cache mode for new cache pools.
+.IP
+This is the default cache mode a new cache pool will be given.
+Valid cache modes are:
+\fBwritethrough\fP - Data blocks are immediately written from the
+cache to disk.
+\fBwriteback\fP - Data blocks are written from the cache
+back to disk after some delay to improve performance.
.TP
\fBlog\fP \(em Default log settings
.IP
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index c05ea1b..09257e3 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -204,7 +204,6 @@ static int _mirror_or_raid_type_requested(struct cmd_context *cmd, const char *t
static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cmd,
const char *type_str, int *pargc, char ***pargv)
{
- const char *tmp_str;
int cachepool = 0;
int thinpool = 0;
@@ -234,8 +233,11 @@ static int _read_pool_params(struct lvconvert_params *lp, struct cmd_context *cm
thinpool = 1;
if (cachepool) {
- if ((tmp_str = arg_str_value(cmd, cachemode_ARG, NULL)) &&
- !get_cache_mode(tmp_str, &lp->feature_flags))
+ const char *cachemode = arg_str_value(cmd, cachemode_ARG, NULL);
+ if (!cachemode)
+ cachemode = find_config_tree_str(cmd, allocation_cache_pool_cachemode_CFG, NULL);
+
+ if (!get_cache_mode(cachemode, &lp->feature_flags))
return_0;
} else {
if (arg_from_list_is_set(cmd, "is valid only with cache pools",
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 17fcd46..bb3892d 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -693,13 +693,16 @@ static int _read_raid_params(struct lvcreate_params *lp,
static int _read_cache_pool_params(struct lvcreate_params *lp,
struct cmd_context *cmd)
{
- const char *str_arg;
+ const char *cachemode;
if (!segtype_is_cache_pool(lp->segtype))
return 1;
- if ((str_arg = arg_str_value(cmd, cachemode_ARG, NULL)) &&
- !get_cache_mode(str_arg, &lp->feature_flags))
+ cachemode = arg_str_value(cmd, cachemode_ARG, NULL);
+ if (!cachemode)
+ cachemode = find_config_tree_str(cmd, allocation_cache_pool_cachemode_CFG, NULL);
+
+ if (!get_cache_mode(cachemode, &lp->feature_flags))
return_0;
return 1;
9 years, 6 months
master - cleanup: remove compiler warning about possible uninitialized variable use
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a976226e81c561...
Commit: a976226e81c561d1123087d1d3dac10ce12e073f
Parent: 5011cac9cfe2845c52f132feb78d72aaee60ff7b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Oct 2 13:21:24 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Oct 2 13:21:24 2014 +0200
cleanup: remove compiler warning about possible uninitialized variable use
filters/filter-usable.c:22: warning: "ucp.check_..." may be used uninitialized in this function
This can't actually be hit in real, but let's clean this up for the compiler
to be happy again.
---
lib/filters/filter-usable.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/filters/filter-usable.c b/lib/filters/filter-usable.c
index e91c3f3..2a7ef49 100644
--- a/lib/filters/filter-usable.c
+++ b/lib/filters/filter-usable.c
@@ -19,7 +19,7 @@
static int _passes_usable_filter(struct dev_filter *f, struct device *dev)
{
filter_mode_t mode = *((filter_mode_t *) f->private);
- struct dev_usable_check_params ucp;
+ struct dev_usable_check_params ucp = {0};
int r;
/* filter only device-mapper devices */
9 years, 6 months
master - filters: add cmd->full_filter - composite of cmd->filter and cmd->lvmetad_filter
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5011cac9cfe284...
Commit: 5011cac9cfe2845c52f132feb78d72aaee60ff7b
Parent: d3fb69c3f39df1a60fa05ed25a7d270af996054d
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Oct 2 12:00:57 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Oct 2 13:06:46 2014 +0200
filters: add cmd->full_filter - composite of cmd->filter and cmd->lvmetad_filter
There are actually three filter chains if lvmetad is used:
- cmd->lvmetad_filter used when when scanning devices for lvmetad
- cmd->filter used when processing lvmetad responses
- cmd->full_fiilter (which is just cmd->lvmetad_filter + cmd->filter chained together) used
for remaining situations
This patch adds the third one - "cmd->full_filter" - currently this is
used if device processing does not fall into any of the groups before,
for example, devices which does not have the PV label yet and we're just
creating a new one or we're processing the devices where the list of the
devices (PVs) is not returned by lvmetad initially.
Currently, the cmd->full_filter is used exactly in these functions:
- lvmcache_label_scan
- _pvcreate_check
- pvcreate_vol
- lvmdiskscan
- pvscan
- _process_each_label
If lvmetad is used, then simply cmd->full_filter == cmd->filter because
cmd->lvmetad_filter is NULL in this case.
---
lib/cache/lvmcache.c | 8 +++---
lib/commands/toolcontext.c | 51 ++++++++++++++++---------------------------
lib/commands/toolcontext.h | 17 +++++++++++++-
lib/metadata/metadata.c | 8 +++---
tools/lvmdiskscan.c | 4 +-
tools/pvscan.c | 4 +-
tools/toollib.c | 4 +-
7 files changed, 49 insertions(+), 47 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 41bac8b..44f586b 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -693,10 +693,10 @@ int lvmcache_label_scan(struct cmd_context *cmd, int full_scan)
goto out;
}
- if (full_scan == 2 && (cmd->filter && !cmd->filter->use_count) && !refresh_filters(cmd))
+ if (full_scan == 2 && (cmd->full_filter && !cmd->full_filter->use_count) && !refresh_filters(cmd))
goto_out;
- if (!cmd->filter || !(iter = dev_iter_create(cmd->filter, (full_scan == 2) ? 1 : 0))) {
+ if (!cmd->full_filter || !(iter = dev_iter_create(cmd->full_filter, (full_scan == 2) ? 1 : 0))) {
log_error("dev_iter creation failed");
goto out;
}
@@ -719,8 +719,8 @@ int lvmcache_label_scan(struct cmd_context *cmd, int full_scan)
* device cache for the benefit of short-lived processes.
*/
if (full_scan == 2 && cmd->is_long_lived &&
- cmd->dump_filter && cmd->filter && cmd->filter->dump &&
- !cmd->filter->dump(cmd->filter, 0))
+ cmd->dump_filter && cmd->full_filter && cmd->full_filter->dump &&
+ !cmd->full_filter->dump(cmd->full_filter, 0))
stack;
r = 1;
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index e72691d..e38aa56 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -920,22 +920,25 @@ bad:
/*
* The way the filtering is initialized depends on whether lvmetad is uesd or not.
*
- * If lvmetad is used, there are two filter chains:
+ * If lvmetad is used, there are three filter chains:
*
- * - the lvmetad filter chain used when scanning devs for lvmetad update:
+ * - cmd->lvmetad_filter - the lvmetad filter chain used when scanning devs for lvmetad update:
* sysfs filter -> global regex filter -> type filter ->
* usable device filter(FILTER_MODE_PRE_LVMETAD) ->
* mpath component filter -> partitioned filter ->
* md component filter
*
- * - the filter chain used for lvmetad responses:
+ * - cmd->filter - the filter chain used for lvmetad responses:
* persistent filter -> usable device filter(FILTER_MODE_POST_LVMETAD) ->
* regex filter
*
+ * - cmd->full_filter - the filter chain used for all the remaining situations:
+ * lvmetad_filter -> filter
*
* If lvmetad isnot used, there's just one filter chain:
*
- * - persistent filter -> regex filter -> sysfs filter ->
+ * - 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 ->
@@ -998,6 +1001,14 @@ static 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, filter_components)))
+ goto_bad;
+ } else
+ cmd->full_filter = filter;
+
/* Should we ever dump persistent filter state? */
if (find_config_tree_bool(cmd, devices_write_cache_state_CFG, NULL))
cmd->dump_filter = 1;
@@ -1653,21 +1664,9 @@ static void _destroy_dev_types(struct cmd_context *cmd)
static void _destroy_filters(struct cmd_context *cmd)
{
- /*
- * If lvmetad is used, the cmd->lvmetad_filter is
- * a separate filter chain than cmd->filter so
- * we need to destroy it separately.
- * Otherwise, if lvmetad is not used, cmd->lvmetad_filter
- * is actually a part of cmd->filter and as such, it
- * will be destroyed together with cmd->filter.
- */
- if (cmd->lvmetad_filter) {
- cmd->lvmetad_filter->destroy(cmd->lvmetad_filter);
- cmd->lvmetad_filter = NULL;
- }
- if (cmd->filter) {
- cmd->filter->destroy(cmd->filter);
- cmd->filter = NULL;
+ if (cmd->full_filter) {
+ cmd->full_filter->destroy(cmd->full_filter);
+ cmd->lvmetad_filter = cmd->filter = cmd->full_filter = NULL;
}
}
@@ -1819,19 +1818,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
label_exit();
_destroy_segtypes(&cmd->segtypes);
_destroy_formats(cmd, &cmd->formats);
-
- /*
- * If lvmetad is used, the cmd->lvmetad_filter is
- * a separate filter chain than cmd->filter so
- * we need to destroy it separately.
- * Otherwise, if lvmetad is not used, cmd->lvmetad_filter
- * is actually a part of cmd->filter and as such, it
- * will be destroyed together with cmd->filter.
- */
- if (cmd->lvmetad_filter)
- cmd->lvmetad_filter->destroy(cmd->lvmetad_filter);
- if (cmd->filter)
- cmd->filter->destroy(cmd->filter);
+ _destroy_filters(cmd);
if (cmd->mem)
dm_pool_destroy(cmd->mem);
dev_cache_exit();
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index 57c51d2..d99cc28 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -97,8 +97,23 @@ struct cmd_context {
unsigned independent_metadata_areas:1; /* Active formats have MDAs outside PVs */
struct dev_types *dev_types;
- struct dev_filter *filter;
+
+ /*
+ * Use of filters depends on whether lvmetad is used or not:
+ *
+ * - if lvmetad is used:
+ * - cmd->lvmetad_filter used when scanning devices for lvmetad
+ * - cmd->filter used when processing lvmetad responses
+ * - cmd->full_filter used for remaining situations
+ *
+ * - if lvmetad is not used:
+ * - cmd->lvmetad_filter is NULL
+ * - cmd->filter == cmd->full_filter used for all situations
+ *
+ */
struct dev_filter *lvmetad_filter;
+ struct dev_filter *filter;
+ struct dev_filter *full_filter;
int dump_filter; /* Dump filter when exiting? */
struct dm_list config_files; /* master lvm config + any existing tag configs */
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 353db25..6719fe4 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1405,7 +1405,7 @@ static int _pvcreate_check(struct cmd_context *cmd, const char *name,
if (sigint_caught())
goto_out;
- dev = dev_cache_get(name, cmd->filter);
+ dev = dev_cache_get(name, cmd->full_filter);
/* Is there an md superblock here? */
if (!dev && md_filtering()) {
@@ -1413,7 +1413,7 @@ static int _pvcreate_check(struct cmd_context *cmd, const char *name,
goto_out;
init_md_filtering(0);
- dev = dev_cache_get(name, cmd->filter);
+ dev = dev_cache_get(name, cmd->full_filter);
init_md_filtering(1);
scan_needed = 1;
@@ -1591,7 +1591,7 @@ struct physical_volume *pvcreate_vol(struct cmd_context *cmd, const char *pv_nam
if (pp->rp.idp) {
if ((dev = lvmcache_device_from_pvid(cmd, pp->rp.idp, NULL, NULL)) &&
- (dev != dev_cache_get(pv_name, cmd->filter))) {
+ (dev != dev_cache_get(pv_name, cmd->full_filter))) {
if (!id_write_format((const struct id*)&pp->rp.idp->uuid,
buffer, sizeof(buffer)))
goto_bad;
@@ -1607,7 +1607,7 @@ struct physical_volume *pvcreate_vol(struct cmd_context *cmd, const char *pv_nam
if (sigint_caught())
goto_bad;
- if (!(dev = dev_cache_get(pv_name, cmd->filter))) {
+ if (!(dev = dev_cache_get(pv_name, cmd->full_filter))) {
log_error("%s: Couldn't find device. Check your filters?",
pv_name);
goto bad;
diff --git a/tools/lvmdiskscan.c b/tools/lvmdiskscan.c
index df3f072..0320a76 100644
--- a/tools/lvmdiskscan.c
+++ b/tools/lvmdiskscan.c
@@ -111,9 +111,9 @@ int lvmdiskscan(struct cmd_context *cmd, int argc __attribute__((unused)),
if (arg_count(cmd, lvmpartition_ARG))
log_warn("WARNING: only considering LVM devices");
- max_len = _get_max_dev_name_len(cmd->filter);
+ max_len = _get_max_dev_name_len(cmd->full_filter);
- if (!(iter = dev_iter_create(cmd->filter, 0))) {
+ if (!(iter = dev_iter_create(cmd->full_filter, 0))) {
log_error("dev_iter_create failed");
return ECMD_FAILED;
}
diff --git a/tools/pvscan.c b/tools/pvscan.c
index d161ba0..10e08ba 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -360,8 +360,8 @@ int pvscan(struct cmd_context *cmd, int argc, char **argv)
return ECMD_FAILED;
}
- if (cmd->filter->wipe)
- cmd->filter->wipe(cmd->filter);
+ if (cmd->full_filter->wipe)
+ cmd->full_filter->wipe(cmd->full_filter);
lvmcache_destroy(cmd, 1, 0);
/* populate lvmcache */
diff --git a/tools/toollib.c b/tools/toollib.c
index ec9a95c..c5395ba 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1846,7 +1846,7 @@ int process_each_label(struct cmd_context *cmd, int argc, char **argv, void *han
if (argc) {
for (; opt < argc; opt++) {
- if (!(dev = dev_cache_get(argv[opt], cmd->filter))) {
+ if (!(dev = dev_cache_get(argv[opt], cmd->full_filter))) {
log_error("Failed to find device "
"\"%s\"", argv[opt]);
ret_max = ECMD_FAILED;
@@ -1872,7 +1872,7 @@ int process_each_label(struct cmd_context *cmd, int argc, char **argv, void *han
return ret_max;
}
- if (!(iter = dev_iter_create(cmd->filter, 1))) {
+ if (!(iter = dev_iter_create(cmd->full_filter, 1))) {
log_error("dev_iter creation failed");
return ECMD_FAILED;
}
9 years, 6 months
master - cleanup: remove symlink to profile in test dir for CLEAN target
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d3fb69c3f39df1...
Commit: d3fb69c3f39df1a60fa05ed25a7d270af996054d
Parent: 1cdb8766a7cf500b6657cf6f6baf2d785a3708f5
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Oct 2 09:30:38 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Oct 2 09:30:38 2014 +0200
cleanup: remove symlink to profile in test dir for CLEAN target
---
test/Makefile.in | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index 46aeaec..9774f6c 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -189,7 +189,8 @@ clean:
$(RM) -r $(LVM_TEST_RESULTS)
CLEAN_TARGETS += .lib-dir-stamp .tests-stamp $(LIB) $(addprefix lib/,$(CMDS)) \
- lib/clvmd lib/dmeventd lib/dmsetup lib/lvmetad lib/fsadm lib/vgimportclone
+ lib/clvmd lib/dmeventd lib/dmsetup lib/lvmetad lib/fsadm lib/vgimportclone \
+ lib/thin-performance.profile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
9 years, 6 months
master - tools: Add ENABLE_ALL_DEVS flag.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1cdb8766a7cf50...
Commit: 1cdb8766a7cf500b6657cf6f6baf2d785a3708f5
Parent: e6ab275aa00beb9192684f580fcbc52757f63856
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Oct 1 22:58:23 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Oct 1 22:58:23 2014 +0100
tools: Add ENABLE_ALL_DEVS flag.
The ENABLE_ALL_DEVS flag is added to the command structure
for commands that should process all devs (pvs and non-pvs)
when they call process_each_pv and the command includes the
--all arg. This will be used in a later process_each_pv patch.
---
tools/commands.h | 6 +++---
tools/tools.h | 4 +++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/commands.h b/tools/commands.h
index a3c05b8..afdf4c3 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -416,7 +416,7 @@ xx(lvmchange,
xx(lvmdiskscan,
"List devices that may be used as physical volumes",
- PERMITTED_READ_ONLY,
+ PERMITTED_READ_ONLY | ENABLE_ALL_DEVS,
"lvmdiskscan\n"
"\t[--commandprofile ProfileName]\n"
"\t[-d|--debug]\n"
@@ -700,7 +700,7 @@ xx(pvdata,
xx(pvdisplay,
"Display various attributes of physical volume(s)",
- CACHE_VGMETADATA | PERMITTED_READ_ONLY,
+ CACHE_VGMETADATA | PERMITTED_READ_ONLY | ENABLE_ALL_DEVS,
"pvdisplay\n"
"\t[-c|--colon]\n"
"\t[--commandprofile ProfileName]\n"
@@ -786,7 +786,7 @@ xx(pvremove,
xx(pvs,
"Display information about physical volumes",
- CACHE_VGMETADATA | PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT,
+ CACHE_VGMETADATA | PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | ENABLE_ALL_DEVS,
"pvs" "\n"
"\t[-a|--all]\n"
"\t[--aligned]\n"
diff --git a/tools/tools.h b/tools/tools.h
index b3dd799..134e584 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -104,7 +104,9 @@ struct arg_value_group_list {
#define PERMITTED_READ_ONLY 0x00000002
/* Process all vgs if none specified on the command line. */
#define ALL_VGS_IS_DEFAULT 0x00000004
-
+/* Process all devices with --all if none are specified on the command line. */
+#define ENABLE_ALL_DEVS 0x00000008
+
/* a register of the lvm commands */
struct command {
const char *name;
9 years, 6 months
master - tools: Add ALL_VGS_IS_DEFAULT flag.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e6ab275aa00beb...
Commit: e6ab275aa00beb9192684f580fcbc52757f63856
Parent: d66f2574529ccce5fab2c217805504f6a8fe1673
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Oct 1 22:58:00 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Oct 1 22:58:00 2014 +0100
tools: Add ALL_VGS_IS_DEFAULT flag.
The ALL_VGS_IS_DEFAULT flag is added to the command structure
for commands that should process all vgs when they call
process_each_vg or process_each_lv with no args.
This will be used in later patches to process_each functions.
---
tools/commands.h | 28 ++++++++++++++--------------
tools/tools.h | 2 ++
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/tools/commands.h b/tools/commands.h
index 6e115d9..a3c05b8 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -324,7 +324,7 @@ xx(lvcreate,
xx(lvdisplay,
"Display information about a logical volume",
- PERMITTED_READ_ONLY,
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT,
"lvdisplay\n"
"\t[-a|--all]\n"
"\t[-c|--colon]\n"
@@ -540,7 +540,7 @@ xx(lvresize,
xx(lvs,
"Display information about logical volumes",
- PERMITTED_READ_ONLY,
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT,
"lvs" "\n"
"\t[-a|--all]\n"
"\t[--aligned]\n"
@@ -577,7 +577,7 @@ xx(lvs,
xx(lvscan,
"List all logical volumes in all volume groups",
- PERMITTED_READ_ONLY,
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT,
"lvscan " "\n"
"\t[-a|--all]\n"
"\t[-b|--blockdevice] " "\n"
@@ -745,7 +745,7 @@ xx(pvdisplay,
xx(pvmove,
"Move extents from one physical volume to another",
- 0,
+ ALL_VGS_IS_DEFAULT, /* For polldaemon to find pvmoves in-progress using process_each_vg. */
"pvmove " "\n"
"\t[--abort]\n"
"\t[--alloc AllocationPolicy]\n"
@@ -786,7 +786,7 @@ xx(pvremove,
xx(pvs,
"Display information about physical volumes",
- CACHE_VGMETADATA | PERMITTED_READ_ONLY,
+ CACHE_VGMETADATA | PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT,
"pvs" "\n"
"\t[-a|--all]\n"
"\t[--aligned]\n"
@@ -855,7 +855,7 @@ xx(tags,
xx(vgcfgbackup,
"Backup volume group configuration(s)",
- PERMITTED_READ_ONLY,
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT,
"vgcfgbackup " "\n"
"\t[--commandprofile ProfileName]\n"
"\t[-d|--debug] " "\n"
@@ -890,7 +890,7 @@ xx(vgcfgrestore,
xx(vgchange,
"Change volume group attributes",
- CACHE_VGMETADATA | PERMITTED_READ_ONLY,
+ CACHE_VGMETADATA | PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT,
"vgchange" "\n"
"\t[-A|--autobackup {y|n}] " "\n"
"\t[--alloc AllocationPolicy] " "\n"
@@ -936,7 +936,7 @@ xx(vgchange,
xx(vgck,
"Check the consistency of volume group(s)",
- 0,
+ ALL_VGS_IS_DEFAULT,
"vgck "
"\t[--commandprofile ProfileName]\n"
"\t[-d|--debug]\n"
@@ -998,7 +998,7 @@ xx(vgcreate,
xx(vgdisplay,
"Display volume group information",
- PERMITTED_READ_ONLY,
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT,
"vgdisplay " "\n"
"\t[-A|--activevolumegroups]" "\n"
"\t[-c|--colon | -s|--short | -v|--verbose]" "\n"
@@ -1042,7 +1042,7 @@ xx(vgdisplay,
xx(vgexport,
"Unregister volume group(s) from the system",
- 0,
+ ALL_VGS_IS_DEFAULT,
"vgexport " "\n"
"\t[-a|--all] " "\n"
"\t[--commandprofile ProfileName]\n"
@@ -1079,7 +1079,7 @@ xx(vgextend,
xx(vgimport,
"Register exported volume group with system",
- 0,
+ ALL_VGS_IS_DEFAULT,
"vgimport " "\n"
"\t[-a|--all]\n"
"\t[--commandprofile ProfileName]\n"
@@ -1111,7 +1111,7 @@ xx(vgmerge,
xx(vgmknodes,
"Create the special files for volume group devices in /dev",
- 0,
+ ALL_VGS_IS_DEFAULT,
"vgmknodes\n"
"\t[--commandprofile ProfileName]\n"
"\t[-d|--debug]\n"
@@ -1179,7 +1179,7 @@ xx(vgrename,
xx(vgs,
"Display information about volume groups",
- PERMITTED_READ_ONLY,
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT,
"vgs" "\n"
"\t[--aligned]\n"
"\t[--binary]\n"
@@ -1215,7 +1215,7 @@ xx(vgs,
xx(vgscan,
"Search for all volume groups",
- PERMITTED_READ_ONLY,
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT,
"vgscan "
"\t[--cache]\n"
"\t[--commandprofile ProfileName]\n"
diff --git a/tools/tools.h b/tools/tools.h
index 44364d8..b3dd799 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -102,6 +102,8 @@ struct arg_value_group_list {
#define CACHE_VGMETADATA 0x00000001
#define PERMITTED_READ_ONLY 0x00000002
+/* Process all vgs if none specified on the command line. */
+#define ALL_VGS_IS_DEFAULT 0x00000004
/* a register of the lvm commands */
struct command {
9 years, 6 months
master - man: lvmthin mention alternate syntax
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d66f2574529ccc...
Commit: d66f2574529ccce5fab2c217805504f6a8fe1673
Parent: 33b96bef5bd8cfda3cf24007b84597f61a2cf0b6
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Oct 1 10:29:30 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Oct 1 10:44:18 2014 -0500
man: lvmthin mention alternate syntax
Users will probably run across the alternate syntax,
so we should explain how it relates to what is used here.
---
man/lvmthin.7.in | 78 ++++++++++++++++++++++++++++++++++-------------------
1 files changed, 50 insertions(+), 28 deletions(-)
diff --git a/man/lvmthin.7.in b/man/lvmthin.7.in
index af9669d..8009a9e 100644
--- a/man/lvmthin.7.in
+++ b/man/lvmthin.7.in
@@ -152,7 +152,8 @@ Create a new thin LV from the thin pool LV.
The thin LV is created with a virtual size.
Multiple new thin LVs may be created in the thin pool.
Thin LV names must be unique in the VG.
-The thinpool argument specifies which thin pool will
+The '--type thin' option is inferred from the virtual size option.
+The --thinpool argument specifies which thin pool will
contain the ThinLV.
.fi
@@ -225,6 +226,10 @@ or vgchange to activate thin snapshots with the "k" attribute.
.SH Thin Topics
+.B Alternate syntax for specifying type thin\-pool
+.br
+.B Automatic pool metadata LV
+.br
.B Specify devices for data and metadata LVs
.br
.B Tolerate device failures using raid
@@ -233,8 +238,6 @@ or vgchange to activate thin snapshots with the "k" attribute.
.br
.B Metadata check and repair
.br
-.B Automatic pool metadata LV
-.br
.B Activation of thin snapshots
.br
.B Removing thin pool LVs, thin LVs and snapshots
@@ -273,6 +276,50 @@ or vgchange to activate thin snapshots with the "k" attribute.
\&
+.SS Alternate syntax for specifying type thin\-pool
+
+\&
+
+The fully specified syntax for creating a thin pool LV shown above is:
+
+.B lvconvert \-\-type thin-pool \-\-poolmetadata VG/ThinMetaLV VG/ThinDataLV
+
+An existing LV is converted to a thin pool by changing its type to
+thin-pool. An alternate syntax may be used for the same operation:
+
+.B lvconvert \-\-thinpool VG/ThinDataLV \-\-poolmetadata VG/ThinMetaLV
+
+The thin-pool type is inferred by lvm; the --thinpool option is not an
+alias for --type thin-pool. The use of the --thinpool option here is
+different from the use of the --thinpool option when creating a thin LV,
+where it specifies the pool in which the thin LV is created.
+
+
+.SS Automatic pool metadata LV
+
+\&
+
+A thin data LV can be converted to a thin pool LV without specifying a
+thin pool metadata LV. LVM automatically creates a metadata LV from the
+same VG.
+
+.B lvcreate \-n ThinDataLV \-L LargeSize VG
+.br
+.B lvconvert \-\-type thin\-pool VG/ThinDataLV
+
+.I Example
+.br
+.nf
+# lvcreate \-n pool0 \-L 10G vg
+# lvconvert \-\-type thin\-pool vg/pool0
+
+# lvs \-a
+ pool0 vg twi-a-tz-- 10.00g
+ [pool0_tdata] vg Twi-ao---- 10.00g
+ [pool0_tmeta] vg ewi-ao---- 16.00m
+.fi
+
+
.SS Specify devices for data and metadata LVs
\&
@@ -420,31 +467,6 @@ containing new metadata:
.B lvconvert \-\-thinpool VG/ThinPoolLV \-\-poolmetadata VG/NewThinMetaLV
-.SS Automatic pool metadata LV
-
-\&
-
-A thin data LV can be converted to a thin pool LV without
-specifying a thin pool metadata LV. LVM will automatically
-create a metadata LV from the same VG.
-
-.B lvcreate \-n ThinDataLV \-L LargeSize VG
-.br
-.B lvconvert \-\-type thin\-pool VG/ThinDataLV
-
-.I Example
-.br
-.nf
-# lvcreate \-n pool0 \-L 10G vg
-# lvconvert \-\-type thin\-pool vg/pool0
-
-# lvs \-a
- pool0 vg twi-a-tz-- 10.00g
- [pool0_tdata] vg Twi-ao---- 10.00g
- [pool0_tmeta] vg ewi-ao---- 16.00m
-.fi
-
-
.SS Activation of thin snapshots
\&
9 years, 6 months
master - Revert "Revert "man: lvmcache should use clearer cache pool options""
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=33b96bef5bd8cf...
Commit: 33b96bef5bd8cfda3cf24007b84597f61a2cf0b6
Parent: a5f01dad224929ea39fd3a53753b8341028017b8
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Oct 1 10:43:53 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Oct 1 10:43:53 2014 -0500
Revert "Revert "man: lvmcache should use clearer cache pool options""
This reverts commit f120c954fc065d67c1aacd5cfba58843eb552b0f.
---
man/lvmcache.7.in | 32 ++++++++++++++++++--------------
1 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/man/lvmcache.7.in b/man/lvmcache.7.in
index cc92673..6d7109a 100644
--- a/man/lvmcache.7.in
+++ b/man/lvmcache.7.in
@@ -88,11 +88,15 @@ CacheDataLV is renamed CachePoolLV_cdata and becomes hidden.
.br
CacheMetaLV is renamed CachePoolLV_cmeta and becomes hidden.
-.B lvconvert \-\-cachepool VG/CacheDataLV \-\-poolmetadata VG/CacheMetaLV
+.B lvconvert \-\-type cache-pool \-\-poolmetadata VG/CacheMetaLV \\
+.br
+.RS
+.B VG/CacheDataLV
+.RE
.I Example
.br
-# lvconvert \-\-cachepool vg/cache0 \-\-poolmetadata vg/cache0meta
+# lvconvert \-\-type cache\-pool \-\-poolmetadata vg/cache0meta vg/cache0
.nf
# lvs -a vg
@@ -193,21 +197,21 @@ pool sub-LVs redundant.
.nf
0. Create an origin LV we wish to cache
-# lvcreate \-L 10G \-n lvx vg /dev/slow_devs
+# lvcreate \-L 10G \-n lv1 vg /dev/slow_devs
1. Create a 2-way RAID1 cache data LV
-# lvcreate \-\-type raid1 \-m 1 \-L 1G -n lvx_cache vg \\
+# lvcreate \-\-type raid1 \-m 1 \-L 1G -n cache1 vg \\
/dev/fast1 /dev/fast2
2. Create a 2-way RAID1 cache metadata LV
-# lvcreate \-\-type raid1 \-m 1 \-L 8M -n lvx_cache_meta vg \\
+# lvcreate \-\-type raid1 \-m 1 \-L 8M -n cache1meta vg \\
/dev/fast1 /dev/fast2
3. Create a cache pool LV combining cache data LV and cache metadata LV
-# lvconvert \-\-cachepool vg/lvx_cache \-\-poolmetadata vg/lvx_cache_meta
+# lvconvert \-\-type cache\-pool \-\-poolmetadata vg/cache1meta vg/cache1
4. Create a cached LV by combining the cache pool LV and origin LV
-# lvconvert \-\-type cache \-\-cachepool vg/lvx_cache vg/lvx
+# lvconvert \-\-type cache \-\-cachepool vg/cache1 vg/lv1
.fi
.SS Writethough caching
@@ -223,20 +227,20 @@ cache pool LV, properties of the cache can be specified - in this case,
.nf
0. Create an origin LV we wish to cache (yours may already exist)
-# lvcreate \-L 10G \-n lvx vg /dev/slow
+# lvcreate \-L 10G \-n lv1 vg /dev/slow
1. Create a cache data LV
-# lvcreate \-L 1G \-n lvx_cache vg /dev/fast
+# lvcreate \-L 1G \-n cache1 vg /dev/fast
2. Create a cache metadata LV
-# lvcreate \-L 8M \-n lvx_cache_meta vg /dev/fast
+# lvcreate \-L 8M \-n cache1meta vg /dev/fast
3. Create a cache pool LV specifying cache mode "writethrough"
-# lvconvert \-\-cachepool vg/lvx_cache \-\-poolmetadata vg/lvx_cache_meta \\
- \-\-cachemode writethrough
+# lvconvert \-\-type cache\-pool \-\-poolmetadata vg/cache1meta \\
+ \-\-cachemode writethrough vg/cache1
4. Create a cache LV by combining the cache pool LV and origin LV
-# lvconvert \-\-type cache \-\-cachepool vg/lvx_cache vg/lvx
+# lvconvert \-\-type cache \-\-cachepool vg/cache1 vg/lv1
.fi
.SS Spare metadata LV
@@ -258,7 +262,7 @@ the same VG.
.B lvcreate -n CacheDataLV -L CacheSize VG
.br
-.B lvconvert --cachepool VG/CacheDataLV
+.B lvconvert --type cache\-pool VG/CacheDataLV
.SH SEE ALSO
9 years, 6 months