1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Thin align volume size on chunk boundary size

If the extent_size is smaller then the chunk_size we may try
to find better aligment (wasting less space).

i.e. using  4KB extent_size and  64KB chunk size will
lead to creation of 64KB aligned thin volume.
This commit is contained in:
Zdenek Kabelac 2011-11-10 12:42:15 +00:00
parent 3d9513ced4
commit 39fc633957

View File

@ -2051,6 +2051,7 @@ int lv_add_virtual_segment(struct logical_volume *lv, uint64_t status,
struct lv_segment *seg;
struct logical_volume *thin_pool_lv = NULL;
struct lv_list *lvl;
uint32_t size;
if (thin_pool_name) {
if (!(lvl = find_lv_in_vg(lv->vg, thin_pool_name))) {
@ -2059,6 +2060,17 @@ int lv_add_virtual_segment(struct logical_volume *lv, uint64_t status,
return 0;
}
thin_pool_lv = lvl->lv;
size = first_seg(thin_pool_lv)->data_block_size;
if (lv->vg->extent_size < size) {
/* Align extents on chunk boundary size */
size = ((uint64_t)lv->vg->extent_size * extents + size - 1) /
size * size / lv->vg->extent_size;
if (size != extents) {
log_print("Rounding size (%d extents) up to chunk boundary "
"size (%d extents).", extents, size);
extents = size;
}
}
}
if ((seg = last_seg(lv)) && (seg->segtype == segtype)) {