mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-10 05:18:36 +03:00
Thin pool resize support for data LV
Support for extension of pool data LV. TODO: figure out thin volume for suspend/resume in cluster.
This commit is contained in:
parent
22e6256d00
commit
23177b8aad
@ -2557,19 +2557,23 @@ int lv_extend(struct logical_volume *lv,
|
||||
if (segtype_is_virtual(segtype))
|
||||
return lv_add_virtual_segment(lv, 0u, extents, segtype, thin_pool_name);
|
||||
|
||||
if (segtype_is_thin_pool(segtype))
|
||||
if (!lv->le_count && segtype_is_thin_pool(segtype))
|
||||
/* Thin pool allocation treats its metadata device like a mirror log. */
|
||||
log_count = 1;
|
||||
else if (segtype_is_raid(segtype) && !lv->le_count)
|
||||
log_count = mirrors * stripes;
|
||||
|
||||
/* Thin pool allocation treats its metadata device like a mirror log. */
|
||||
if (!(ah = allocate_extents(lv->vg, lv, segtype, stripes, mirrors,
|
||||
log_count, region_size, extents,
|
||||
allocatable_pvs, alloc, NULL)))
|
||||
return_0;
|
||||
|
||||
if (segtype_is_thin_pool(segtype)) {
|
||||
if (!(r = extend_pool(lv, segtype, ah)))
|
||||
if (!lv->le_count) {
|
||||
if (!(r = extend_pool(lv, segtype, ah)))
|
||||
stack;
|
||||
} else if (!(r = _lv_extend_layered_lv(ah, lv, extents, 0,
|
||||
stripes, stripe_size)))
|
||||
stack;
|
||||
} else if (!segtype_is_mirrored(segtype) && !segtype_is_raid(segtype)) {
|
||||
if (!(r = lv_add_segment(ah, 0, ah->area_count, lv, segtype,
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
@ -669,6 +669,25 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
|
||||
}
|
||||
}
|
||||
|
||||
if (lv_is_thin_pool(lv)) {
|
||||
if (lp->resize == LV_REDUCE) {
|
||||
log_error("Thin pool volumes cannot be reduced in size yet.");
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
if (lp->resizefs) {
|
||||
log_warn("Thin pool volumes do not have filesystem.");
|
||||
lp->resizefs = 0;
|
||||
}
|
||||
|
||||
if (!lp->stripes) {
|
||||
/* Try to use the same strip settings for underlying pool data LV */
|
||||
lp->stripes = last_seg(seg_lv(first_seg(lv), 0))->area_count;
|
||||
if (!lp->stripe_size)
|
||||
lp->stripe_size = last_seg(seg_lv(first_seg(lv), 0))->stripe_size;
|
||||
}
|
||||
}
|
||||
|
||||
if ((lp->resize == LV_REDUCE) && lp->argc)
|
||||
log_warn("Ignoring PVs on command line when reducing");
|
||||
|
||||
@ -730,6 +749,10 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
|
||||
/* If snapshot, must suspend all associated devices */
|
||||
if (lv_is_cow(lv))
|
||||
lock_lv = origin_from_cow(lv);
|
||||
else if (lv_is_used_thin_pool(lv))
|
||||
// FIXME: what to pick here - maybe an active thin?
|
||||
// but it still seems to be racy in cluster
|
||||
lock_lv = lv;
|
||||
else
|
||||
lock_lv = lv;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user