mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-25 18:50:51 +03:00
Use chunk_size consistently for thin_pool within LVM.
This commit is contained in:
parent
fe5199c506
commit
0942afa35d
@ -607,7 +607,7 @@ int lvdisplay_full(struct cmd_context *cmd,
|
||||
log_print("LV Pool metadata %s", seg->metadata_lv->name);
|
||||
log_print("LV Pool data %s", seg_lv(seg, 0)->name);
|
||||
log_print("LV Pool chunk size %s",
|
||||
display_size(cmd, seg->data_block_size));
|
||||
display_size(cmd, seg->chunk_size));
|
||||
log_print("LV Zero new blocks %s",
|
||||
seg->zero_new_blocks ? "yes" : "no");
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ uint64_t lvseg_chunksize(const struct lv_segment *seg)
|
||||
if (lv_is_cow(seg->lv))
|
||||
size = (uint64_t) find_cow(seg->lv)->chunk_size;
|
||||
else if (lv_is_thin_pool(seg->lv))
|
||||
size = (uint64_t) seg->data_block_size;
|
||||
size = (uint64_t) seg->chunk_size;
|
||||
else
|
||||
size = UINT64_C(0);
|
||||
|
||||
|
@ -2060,7 +2060,7 @@ 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;
|
||||
size = first_seg(thin_pool_lv)->chunk_size;
|
||||
if (lv->vg->extent_size < size) {
|
||||
/* Align extents on chunk boundary size */
|
||||
size = ((uint64_t)lv->vg->extent_size * extents + size - 1) /
|
||||
@ -4290,7 +4290,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
|
||||
|
||||
if (seg_is_thin_pool(lp)) {
|
||||
first_seg(lv)->zero_new_blocks = lp->zero ? 1 : 0;
|
||||
first_seg(lv)->data_block_size = lp->chunk_size;
|
||||
first_seg(lv)->chunk_size = lp->chunk_size;
|
||||
/* FIXME: use lowwatermark via lvm.conf global for all thinpools ? */
|
||||
first_seg(lv)->low_water_mark = 0;
|
||||
} else if (seg_is_thin_volume(lp)) {
|
||||
|
@ -202,10 +202,10 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
|
||||
inc_error_count;
|
||||
}
|
||||
|
||||
if (seg->data_block_size < DM_THIN_MIN_DATA_BLOCK_SIZE ||
|
||||
seg->data_block_size > DM_THIN_MAX_DATA_BLOCK_SIZE) {
|
||||
log_error("LV %s: thin pool segment %u data block size %d is out of range",
|
||||
lv->name, seg_count, seg->data_block_size);
|
||||
if (seg->chunk_size < DM_THIN_MIN_DATA_BLOCK_SIZE ||
|
||||
seg->chunk_size > DM_THIN_MAX_DATA_BLOCK_SIZE) {
|
||||
log_error("LV %s: thin pool segment %u chunk size %d is out of range",
|
||||
lv->name, seg_count, seg->chunk_size);
|
||||
inc_error_count;
|
||||
}
|
||||
} else {
|
||||
|
@ -331,7 +331,8 @@ struct lv_segment {
|
||||
uint32_t stripe_size; /* For stripe and RAID - in sectors */
|
||||
uint32_t area_count;
|
||||
uint32_t area_len;
|
||||
uint32_t chunk_size; /* For snapshots - in sectors */
|
||||
uint32_t chunk_size; /* For snapshots/thin_pool. In sectors. */
|
||||
/* For thin_pool, 128..2097152. */
|
||||
struct logical_volume *origin; /* snap and thin */
|
||||
struct logical_volume *cow;
|
||||
struct dm_list origin_list;
|
||||
@ -348,7 +349,6 @@ struct lv_segment {
|
||||
struct logical_volume *metadata_lv; /* For thin_pool */
|
||||
uint64_t transaction_id; /* For thin_pool, thin */
|
||||
uint64_t low_water_mark; /* For thin_pool */
|
||||
uint32_t data_block_size; /* For thin_pool, 128..2097152 */
|
||||
unsigned zero_new_blocks; /* For thin_pool */
|
||||
struct dm_list thin_messages; /* For thin_pool */
|
||||
struct logical_volume *pool_lv; /* For thin */
|
||||
|
@ -115,16 +115,16 @@ static int _thin_pool_text_import(struct lv_segment *seg,
|
||||
if (!dm_config_get_uint64(sn, "transaction_id", &seg->transaction_id))
|
||||
return SEG_LOG_ERROR("Could not read transaction_id for");
|
||||
|
||||
if (!dm_config_get_uint32(sn, "data_block_size", &seg->data_block_size))
|
||||
return SEG_LOG_ERROR("Could not read data_block_size");
|
||||
if (!dm_config_get_uint32(sn, "chunk_size", &seg->chunk_size))
|
||||
return SEG_LOG_ERROR("Could not read chunk_size");
|
||||
|
||||
if (dm_config_has_node(sn, "low_water_mark") &&
|
||||
!dm_config_get_uint64(sn, "low_water_mark", &seg->low_water_mark))
|
||||
return SEG_LOG_ERROR("Could not read low_water_mark");
|
||||
|
||||
if ((seg->data_block_size < DM_THIN_MIN_DATA_BLOCK_SIZE) ||
|
||||
(seg->data_block_size > DM_THIN_MAX_DATA_BLOCK_SIZE))
|
||||
return SEG_LOG_ERROR("Unsupported value %u for data_block_size",
|
||||
if ((seg->chunk_size < DM_THIN_MIN_DATA_BLOCK_SIZE) ||
|
||||
(seg->chunk_size > DM_THIN_MAX_DATA_BLOCK_SIZE))
|
||||
return SEG_LOG_ERROR("Unsupported value %u for chunk_size",
|
||||
seg->device_id);
|
||||
|
||||
if (dm_config_has_node(sn, "zero_new_blocks") &&
|
||||
@ -155,9 +155,8 @@ static int _thin_pool_text_export(const struct lv_segment *seg, struct formatter
|
||||
outf(f, "metadata = \"%s\"", seg->metadata_lv->name);
|
||||
outf(f, "pool = \"%s\"", seg_lv(seg, 0)->name);
|
||||
outf(f, "transaction_id = %" PRIu64, seg->transaction_id);
|
||||
// FIXME maybe switch to use chunksize (as with snapshot ??)
|
||||
outsize(f, (uint64_t) seg->data_block_size,
|
||||
"data_block_size = %u", seg->data_block_size);
|
||||
outsize(f, (uint64_t) seg->chunk_size,
|
||||
"chunk_size = %u", seg->chunk_size);
|
||||
|
||||
if (seg->low_water_mark)
|
||||
outf(f, "low_water_mark = %" PRIu64, seg->low_water_mark);
|
||||
@ -254,7 +253,7 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
|
||||
|
||||
if (!dm_tree_node_add_thin_pool_target(node, len, seg->transaction_id,
|
||||
metadata_dlid, pool_dlid,
|
||||
seg->data_block_size, seg->low_water_mark,
|
||||
seg->chunk_size, seg->low_water_mark,
|
||||
seg->zero_new_blocks ? 0 : 1))
|
||||
return_0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user