summaryrefslogtreecommitdiff
path: root/lib/metadata
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2019-01-30 09:55:34 -0600
committerDavid Teigland <teigland@redhat.com>2019-02-27 08:52:34 -0600
commita9eaab6bebe1919b476ec3a4d094a4d6c512920e (patch)
tree87beba6e7e30e1954ce7027e35d035a3de0c131b /lib/metadata
parentc8fc18e8bfbf6e81fc26c7cde780711db748f112 (diff)
downloadlvm2-a9eaab6bebe1919b476ec3a4d094a4d6c512920e.tar.gz
Use "cachevol" to refer to cache on a single LV
and "cachepool" to refer to a cache on a cache pool object. The problem was that the --cachepool option was being used to refer to both a cache pool object, and to a standard LV used for caching. This could be somewhat confusing, and it made it less clear when each kind would be used. By separating them, it's clear when a cachepool or a cachevol should be used. Previously: - lvm would use the cache pool approach when the user passed a cache-pool LV to the --cachepool option. - lvm would use the cache vol approach when the user passed a standard LV in the --cachepool option. Now: - lvm will always use the cache pool approach when the user uses the --cachepool option. - lvm will always use the cache vol approach when the user uses the --cachevol option.
Diffstat (limited to 'lib/metadata')
-rw-r--r--lib/metadata/cache_manip.c32
-rw-r--r--lib/metadata/lv.c6
-rw-r--r--lib/metadata/lv_manip.c8
-rw-r--r--lib/metadata/merge.c6
-rw-r--r--lib/metadata/metadata-exported.h10
5 files changed, 31 insertions, 31 deletions
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index ee2a5c528..20deda3c7 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -61,7 +61,7 @@ const char *display_cache_mode(const struct lv_segment *seg)
{
const struct lv_segment *setting_seg = NULL;
- if (seg_is_cache(seg) && lv_is_cache_single(seg->pool_lv))
+ if (seg_is_cache(seg) && lv_is_cache_vol(seg->pool_lv))
setting_seg = seg;
else if (seg_is_cache_pool(seg))
@@ -131,7 +131,7 @@ int cache_set_cache_mode(struct lv_segment *seg, cache_mode_t mode)
if (seg_is_cache_pool(seg) && (mode == CACHE_MODE_UNSELECTED))
return 1;
- if (seg_is_cache(seg) && lv_is_cache_single(seg->pool_lv))
+ if (seg_is_cache(seg) && lv_is_cache_vol(seg->pool_lv))
setting_seg = seg;
else if (seg_is_cache_pool(seg))
@@ -337,7 +337,7 @@ int validate_lv_cache_create_pool(const struct logical_volume *pool_lv)
{
struct lv_segment *seg;
- if (!lv_is_cache_pool(pool_lv) && !lv_is_cache_single(pool_lv)) {
+ if (!lv_is_cache_pool(pool_lv) && !lv_is_cache_vol(pool_lv)) {
log_error("Logical volume %s is not a cache pool.",
display_lvname(pool_lv));
return 0;
@@ -559,7 +559,7 @@ int lv_cache_wait_for_clean(struct logical_volume *cache_lv, int *is_clean)
return 1;
}
-static int _lv_detach_cache_single_while_active(struct cmd_context *cmd, struct logical_volume *cache_lv)
+static int _lv_detach_cache_vol_while_active(struct cmd_context *cmd, struct logical_volume *cache_lv)
{
struct lv_segment *cache_seg = first_seg(cache_lv);
struct logical_volume *corigin_lv;
@@ -582,7 +582,7 @@ static int _lv_detach_cache_single_while_active(struct cmd_context *cmd, struct
/*
* This info is needed to remove the cmeta/cdata devs at the end.
*/
- if (!get_cache_single_meta_data(cmd, cache_lv, cache_pool_lv, &info_meta, &info_data)) {
+ if (!get_cache_vol_meta_data(cmd, cache_lv, cache_pool_lv, &info_meta, &info_data)) {
log_error("Failed to get info about cdata/cmeta for %s", display_lvname(cache_pool_lv));
return 0;
}
@@ -604,7 +604,7 @@ static int _lv_detach_cache_single_while_active(struct cmd_context *cmd, struct
return_0;
}
- cache_pool_lv->status &= ~LV_CACHE_SINGLE;
+ cache_pool_lv->status &= ~LV_CACHE_VOL;
if (!remove_layer_from_lv(cache_lv, corigin_lv)) {
log_error("Failed to remove cache layer from %s", display_lvname(cache_lv));
@@ -623,7 +623,7 @@ static int _lv_detach_cache_single_while_active(struct cmd_context *cmd, struct
*/
/* These cmeta/cdata dm devs need to be removed since they are using cache_pool_lv. */
- if (!remove_cache_single_meta_data(cmd, &info_meta, &info_data))
+ if (!remove_cache_vol_meta_data(cmd, &info_meta, &info_data))
log_error("Failed to remove cdata/cmeta devs for %s", display_lvname(cache_pool_lv));
if (!deactivate_lv(cmd, cache_pool_lv))
@@ -652,7 +652,7 @@ static int _lv_detach_cache_single_while_active(struct cmd_context *cmd, struct
return 1;
}
-static int _lv_detach_cache_single_while_inactive(struct cmd_context *cmd, struct logical_volume *cache_lv)
+static int _lv_detach_cache_vol_while_inactive(struct cmd_context *cmd, struct logical_volume *cache_lv)
{
struct lv_segment *cache_seg = first_seg(cache_lv);
struct logical_volume *corigin_lv;
@@ -707,7 +707,7 @@ static int _lv_detach_cache_single_while_inactive(struct cmd_context *cmd, struc
return_0;
}
- cache_pool_lv->status &= ~LV_CACHE_SINGLE;
+ cache_pool_lv->status &= ~LV_CACHE_VOL;
if (!remove_layer_from_lv(cache_lv, corigin_lv)) {
log_error("Failed to remove cache layer from %s", display_lvname(cache_lv));
@@ -724,7 +724,7 @@ static int _lv_detach_cache_single_while_inactive(struct cmd_context *cmd, struc
return 1;
}
-int lv_detach_cache_single(struct logical_volume *cache_lv)
+int lv_detach_cache_vol(struct logical_volume *cache_lv)
{
struct cmd_context *cmd = cache_lv->vg->cmd;
@@ -734,9 +734,9 @@ int lv_detach_cache_single(struct logical_volume *cache_lv)
}
if (lv_is_active(cache_lv))
- return _lv_detach_cache_single_while_active(cmd, cache_lv);
+ return _lv_detach_cache_vol_while_active(cmd, cache_lv);
else
- return _lv_detach_cache_single_while_inactive(cmd, cache_lv);
+ return _lv_detach_cache_vol_while_inactive(cmd, cache_lv);
}
/*
@@ -763,7 +763,7 @@ int lv_cache_remove(struct logical_volume *cache_lv)
return 0;
}
- if (lv_is_cache_single(cache_seg->pool_lv)) {
+ if (lv_is_cache_vol(cache_seg->pool_lv)) {
log_error(INTERNAL_ERROR "Incorrect remove for cache single");
return 0;
}
@@ -952,7 +952,7 @@ int cache_set_policy(struct lv_segment *lvseg, const char *name,
return 1; /* Policy and settings can be selected later when caching LV */
}
- if (seg_is_cache(lvseg) && lv_is_cache_single(lvseg->pool_lv))
+ if (seg_is_cache(lvseg) && lv_is_cache_vol(lvseg->pool_lv))
seg = lvseg;
else if (seg_is_cache_pool(lvseg))
@@ -1128,7 +1128,7 @@ int cache_set_metadata_format(struct lv_segment *seg, cache_metadata_format_t fo
#define ONE_MB_S 2048 /* 1MB in sectors */
#define ONE_GB_S 2097152 /* 1GB in sectors */
-int cache_single_set_params(struct cmd_context *cmd,
+int cache_vol_set_params(struct cmd_context *cmd,
struct logical_volume *cache_lv,
struct logical_volume *pool_lv,
uint64_t poolmetadatasize,
@@ -1428,7 +1428,7 @@ int wipe_cache_pool(struct logical_volume *cache_pool_lv)
int r;
/* Only unused cache-pool could be activated and wiped */
- if ((!lv_is_cache_pool(cache_pool_lv) && !lv_is_cache_single(cache_pool_lv)) ||
+ if ((!lv_is_cache_pool(cache_pool_lv) && !lv_is_cache_vol(cache_pool_lv)) ||
!dm_list_empty(&cache_pool_lv->segs_using_this_lv)) {
log_error(INTERNAL_ERROR "Failed to wipe cache pool for volume %s.",
display_lvname(cache_pool_lv));
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 0e543238e..e8f1fab91 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -333,7 +333,7 @@ uint64_t lvseg_chunksize(const struct lv_segment *seg)
if (lv_is_cow(seg->lv))
size = (uint64_t) find_snapshot(seg->lv)->chunk_size;
- else if (seg_is_cache(seg) && lv_is_cache_single(seg->pool_lv))
+ else if (seg_is_cache(seg) && lv_is_cache_vol(seg->pool_lv))
size = (uint64_t) seg->chunk_size;
else if (seg_is_pool(seg))
size = (uint64_t) seg->chunk_size;
@@ -941,7 +941,7 @@ uint64_t lv_metadata_size(const struct logical_volume *lv)
if (!(seg = first_seg(lv)))
return 0;
- if (seg_is_cache(seg) && lv_is_cache_single(seg->pool_lv))
+ if (seg_is_cache(seg) && lv_is_cache_vol(seg->pool_lv))
return seg->metadata_len;
if (lv_is_thin_pool(lv) || lv_is_cache_pool(lv))
@@ -1309,7 +1309,7 @@ char *lv_attr_dup_with_info_and_seg_status(struct dm_pool *mem, const struct lv_
if (lv_is_thin_pool(lv) || lv_is_thin_volume(lv))
repstr[6] = 't';
- else if (lv_is_cache_pool(lv) || lv_is_cache_single(lv) || lv_is_cache(lv) || lv_is_cache_origin(lv))
+ else if (lv_is_cache_pool(lv) || lv_is_cache_vol(lv) || lv_is_cache(lv) || lv_is_cache_origin(lv))
repstr[6] = 'C';
else if (lv_is_raid_type(lv))
repstr[6] = 'r';
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 3b08d0522..6360241a8 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -422,7 +422,7 @@ static int _lv_layout_and_role_cache(struct dm_pool *mem,
if (lv_is_cache(lv) &&
!str_list_add_no_dup_check(mem, layout, _lv_type_names[LV_TYPE_CACHE]))
goto_bad;
- else if (lv_is_cache_pool(lv) || lv_is_cache_single(lv)) {
+ else if (lv_is_cache_pool(lv) || lv_is_cache_vol(lv)) {
if (!str_list_add_no_dup_check(mem, layout, _lv_type_names[LV_TYPE_CACHE]) ||
!str_list_add_no_dup_check(mem, layout, _lv_type_names[LV_TYPE_POOL]))
goto_bad;
@@ -4453,7 +4453,7 @@ static int _rename_skip_pools_externals_cb(struct logical_volume *lv, void *data
{
if (lv_is_pool(lv) ||
lv_is_vdo_pool(lv) ||
- lv_is_cache_single(lv) ||
+ lv_is_cache_vol(lv) ||
lv_is_external_origin(lv))
return -1; /* and skip subLVs */
@@ -6225,8 +6225,8 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
if (!lockd_lv(cmd, lock_lv, "ex", LDLV_PERSISTENT))
return_0;
- if (lv_is_cache(lv) && lv_is_cache_single(first_seg(lv)->pool_lv)) {
- if (!lv_detach_cache_single(lv)) {
+ if (lv_is_cache(lv) && lv_is_cache_vol(first_seg(lv)->pool_lv)) {
+ if (!lv_detach_cache_vol(lv)) {
log_error("Failed to detach cache from %s", display_lvname(lv));
return 0;
}
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index d3d1d9565..08f8fbece 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -364,14 +364,14 @@ static void _check_lv_segment(struct logical_volume *lv, struct lv_segment *seg,
if (!seg->pool_lv) {
seg_error("is missing cache pool LV");
- } else if (!lv_is_cache_pool(seg->pool_lv) && !lv_is_cache_single(seg->pool_lv))
+ } else if (!lv_is_cache_pool(seg->pool_lv) && !lv_is_cache_vol(seg->pool_lv))
seg_error("is not referencing cache pool LV");
} else { /* !cache */
if (seg->cleaner_policy)
seg_error("sets cleaner_policy");
}
- if (lv_is_cache(lv) && seg->pool_lv && lv_is_cache_single(seg->pool_lv)) {
+ if (lv_is_cache(lv) && seg->pool_lv && lv_is_cache_vol(seg->pool_lv)) {
cache_setting_seg = seg;
no_metadata_format = 1;
}
@@ -805,7 +805,7 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
if ((seg_count != 1) &&
(lv_is_cache(lv) ||
lv_is_cache_pool(lv) ||
- lv_is_cache_single(lv) ||
+ lv_is_cache_vol(lv) ||
lv_is_raid(lv) ||
lv_is_snapshot(lv) ||
lv_is_thin_pool(lv) ||
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index c76e644be..f45114038 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -152,7 +152,7 @@
#define LV_VDO_POOL UINT64_C(0x0000000040000000) /* LV - Internal user only */
#define LV_VDO_POOL_DATA UINT64_C(0x8000000000000000) /* LV - Internal user only */
-#define LV_CACHE_SINGLE UINT64_C(0x0010000000000000) /* LV - also a PV flag */
+#define LV_CACHE_VOL UINT64_C(0x0010000000000000) /* LV - also a PV flag */
/* Format features flags */
@@ -248,11 +248,11 @@
#define lv_is_cache(lv) (((lv)->status & CACHE) ? 1 : 0)
#define lv_is_cache_pool(lv) (((lv)->status & CACHE_POOL) ? 1 : 0)
-#define lv_is_cache_single(lv) (((lv)->status & LV_CACHE_SINGLE) ? 1 : 0)
+#define lv_is_cache_vol(lv) (((lv)->status & LV_CACHE_VOL) ? 1 : 0)
#define lv_is_used_cache_pool(lv) (lv_is_cache_pool(lv) && !dm_list_empty(&(lv)->segs_using_this_lv))
#define lv_is_cache_pool_data(lv) (((lv)->status & CACHE_POOL_DATA) ? 1 : 0)
#define lv_is_cache_pool_metadata(lv) (((lv)->status & CACHE_POOL_METADATA) ? 1 : 0)
-#define lv_is_cache_type(lv) (((lv)->status & (CACHE | CACHE_POOL | LV_CACHE_SINGLE | CACHE_POOL_DATA | CACHE_POOL_METADATA)) ? 1 : 0)
+#define lv_is_cache_type(lv) (((lv)->status & (CACHE | CACHE_POOL | LV_CACHE_VOL | CACHE_POOL_DATA | CACHE_POOL_METADATA)) ? 1 : 0)
#define lv_is_pool(lv) (((lv)->status & (CACHE_POOL | THIN_POOL)) ? 1 : 0)
#define lv_is_pool_data(lv) (((lv)->status & (CACHE_POOL_DATA | THIN_POOL_DATA)) ? 1 : 0)
@@ -1254,7 +1254,7 @@ int cache_set_params(struct lv_segment *seg,
cache_mode_t mode,
const char *policy_name,
const struct dm_config_tree *policy_settings);
-int cache_single_set_params(struct cmd_context *cmd,
+int cache_vol_set_params(struct cmd_context *cmd,
struct logical_volume *cache_lv,
struct logical_volume *pool_lv,
uint64_t poolmetadatasize,
@@ -1279,7 +1279,7 @@ struct logical_volume *lv_cache_create(struct logical_volume *pool_lv,
struct logical_volume *origin_lv);
int lv_cache_wait_for_clean(struct logical_volume *cache_lv, int *is_clean);
int lv_cache_remove(struct logical_volume *cache_lv);
-int lv_detach_cache_single(struct logical_volume *cache_lv);
+int lv_detach_cache_vol(struct logical_volume *cache_lv);
int wipe_cache_pool(struct logical_volume *cache_pool_lv);
/* -- metadata/cache_manip.c */