mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
cache: use _cpool for used cache-pools
When LV gets cached and uses cache-pool - such cache-pool will now get _cpool suffix automatically. Thus 'Pool' column for cached LV will now show either _cvol or _cpool LV.
This commit is contained in:
parent
23f660cf98
commit
dd7629ea09
@ -1,5 +1,6 @@
|
|||||||
Version 2.03.06 -
|
Version 2.03.06 -
|
||||||
================================
|
================================
|
||||||
|
Add _cpool suffix to cache-pool LV name when used by caching LV.
|
||||||
No longer store extra UUID for cmeta and cdata cachevol layer.
|
No longer store extra UUID for cmeta and cdata cachevol layer.
|
||||||
Enhance activation of cache devices with cachevols.
|
Enhance activation of cache devices with cachevols.
|
||||||
Add _cvol in list of protected suffixes and start use it with DM UUID.
|
Add _cvol in list of protected suffixes and start use it with DM UUID.
|
||||||
|
@ -430,6 +430,7 @@ int validate_cache_chunk_size(struct cmd_context *cmd, uint32_t chunk_size)
|
|||||||
struct logical_volume *lv_cache_create(struct logical_volume *pool_lv,
|
struct logical_volume *lv_cache_create(struct logical_volume *pool_lv,
|
||||||
struct logical_volume *origin_lv)
|
struct logical_volume *origin_lv)
|
||||||
{
|
{
|
||||||
|
char cpool_name[NAME_LEN];
|
||||||
const struct segment_type *segtype;
|
const struct segment_type *segtype;
|
||||||
struct cmd_context *cmd = pool_lv->vg->cmd;
|
struct cmd_context *cmd = pool_lv->vg->cmd;
|
||||||
struct logical_volume *cache_lv = origin_lv;
|
struct logical_volume *cache_lv = origin_lv;
|
||||||
@ -454,6 +455,17 @@ struct logical_volume *lv_cache_create(struct logical_volume *pool_lv,
|
|||||||
if (!attach_pool_lv(seg, pool_lv, NULL, NULL, NULL))
|
if (!attach_pool_lv(seg, pool_lv, NULL, NULL, NULL))
|
||||||
return_NULL;
|
return_NULL;
|
||||||
|
|
||||||
|
if (lv_is_cache_pool(pool_lv)) {
|
||||||
|
/* Used cache-pool gets _cpool suffix (easy to recognize from _cvol usage) */
|
||||||
|
if (dm_snprintf(cpool_name, sizeof(cpool_name), "%s_cpool", pool_lv->name) < 0) {
|
||||||
|
log_error("Can't prepare new cachepool name for %s.", display_lvname(pool_lv));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lv_rename_update(cmd, pool_lv, cpool_name, 0))
|
||||||
|
return_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!seg->lv->profile) /* Inherit profile from cache-pool */
|
if (!seg->lv->profile) /* Inherit profile from cache-pool */
|
||||||
seg->lv->profile = seg->pool_lv->profile;
|
seg->lv->profile = seg->pool_lv->profile;
|
||||||
|
|
||||||
|
@ -4287,6 +4287,7 @@ static int _lvconvert_cachepool_attach_single(struct cmd_context *cmd,
|
|||||||
struct logical_volume *lv,
|
struct logical_volume *lv,
|
||||||
struct processing_handle *handle)
|
struct processing_handle *handle)
|
||||||
{
|
{
|
||||||
|
struct lv_segment *seg;
|
||||||
struct volume_group *vg = lv->vg;
|
struct volume_group *vg = lv->vg;
|
||||||
struct logical_volume *cachepool_lv;
|
struct logical_volume *cachepool_lv;
|
||||||
const char *cachepool_name;
|
const char *cachepool_name;
|
||||||
@ -4333,15 +4334,14 @@ static int _lvconvert_cachepool_attach_single(struct cmd_context *cmd,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(cachepool_lv = find_lv(vg, cachepool_name))) {
|
/* cachepool_lv is converted into cache-pool data LV */
|
||||||
log_error("LV %s cannot be found.", display_lvname(cachepool_lv));
|
if (!(seg = get_only_segment_using_this_lv(cachepool_lv))) {
|
||||||
|
log_error(INTERNAL_ERROR "LV %s is not a cache pool data volume.",
|
||||||
|
display_lvname(cachepool_lv));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lv_is_cache_pool(cachepool_lv)) {
|
cachepool_lv = seg->lv;
|
||||||
log_error("LV %s is not a cache pool.", display_lvname(cachepool_lv));
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (!dm_list_empty(&cachepool_lv->segs_using_this_lv)) {
|
if (!dm_list_empty(&cachepool_lv->segs_using_this_lv)) {
|
||||||
log_error("Cache pool %s is already in use.", cachepool_name);
|
log_error("Cache pool %s is already in use.", cachepool_name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user