mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Consistently use metadata LV as the first in MDA
Cosmetic cleanup. Mark LV as thin pool before calling attach_pool functions.
This commit is contained in:
parent
f4c77bd0e3
commit
5d8f78a6c0
@ -92,34 +92,35 @@ static int _thin_pool_text_import(struct lv_segment *seg,
|
|||||||
const char *lv_name;
|
const char *lv_name;
|
||||||
struct logical_volume *pool_data_lv, *pool_metadata_lv;
|
struct logical_volume *pool_data_lv, *pool_metadata_lv;
|
||||||
|
|
||||||
if (!dm_config_get_str(sn, "pool", &lv_name))
|
|
||||||
return SEG_LOG_ERROR("Pool must be a string in");
|
|
||||||
|
|
||||||
if (!(pool_data_lv = find_lv(seg->lv->vg, lv_name)))
|
|
||||||
return SEG_LOG_ERROR("Unknown pool %s in", lv_name);
|
|
||||||
|
|
||||||
if (!dm_config_get_str(sn, "metadata", &lv_name))
|
if (!dm_config_get_str(sn, "metadata", &lv_name))
|
||||||
return SEG_LOG_ERROR("Metadata must be a string in");
|
return SEG_LOG_ERROR("Metadata must be a string in");
|
||||||
|
|
||||||
if (!(pool_metadata_lv = find_lv(seg->lv->vg, lv_name)))
|
if (!(pool_metadata_lv = find_lv(seg->lv->vg, lv_name)))
|
||||||
return SEG_LOG_ERROR("Unknown metadata %s in", lv_name);
|
return SEG_LOG_ERROR("Unknown metadata %s in", lv_name);
|
||||||
|
|
||||||
if (!attach_pool_data_lv(seg, pool_data_lv))
|
if (!dm_config_get_str(sn, "pool", &lv_name))
|
||||||
|
return SEG_LOG_ERROR("Pool must be a string in");
|
||||||
|
|
||||||
|
if (!(pool_data_lv = find_lv(seg->lv->vg, lv_name)))
|
||||||
|
return SEG_LOG_ERROR("Unknown pool %s in", lv_name);
|
||||||
|
|
||||||
|
seg->lv->status |= THIN_POOL;
|
||||||
|
if (!attach_pool_metadata_lv(seg, pool_metadata_lv))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (!attach_pool_metadata_lv(seg, pool_metadata_lv))
|
if (!attach_pool_data_lv(seg, pool_data_lv))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (!dm_config_get_uint64(sn, "transaction_id", &seg->transaction_id))
|
if (!dm_config_get_uint64(sn, "transaction_id", &seg->transaction_id))
|
||||||
return SEG_LOG_ERROR("Could not read transaction_id for");
|
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_has_node(sn, "low_water_mark") &&
|
if (dm_config_has_node(sn, "low_water_mark") &&
|
||||||
!dm_config_get_uint64(sn, "low_water_mark", &seg->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");
|
return SEG_LOG_ERROR("Could not read low_water_mark");
|
||||||
|
|
||||||
if (!dm_config_get_uint32(sn, "data_block_size", &seg->data_block_size))
|
|
||||||
return SEG_LOG_ERROR("Could not read data_block_size");
|
|
||||||
|
|
||||||
if ((seg->data_block_size < DM_THIN_MIN_DATA_BLOCK_SIZE) ||
|
if ((seg->data_block_size < DM_THIN_MIN_DATA_BLOCK_SIZE) ||
|
||||||
(seg->data_block_size > DM_THIN_MAX_DATA_BLOCK_SIZE))
|
(seg->data_block_size > DM_THIN_MAX_DATA_BLOCK_SIZE))
|
||||||
return SEG_LOG_ERROR("Unsupported value %u for data_block_size",
|
return SEG_LOG_ERROR("Unsupported value %u for data_block_size",
|
||||||
@ -129,8 +130,6 @@ static int _thin_pool_text_import(struct lv_segment *seg,
|
|||||||
!dm_config_get_uint32(sn, "zero_new_blocks", &seg->zero_new_blocks))
|
!dm_config_get_uint32(sn, "zero_new_blocks", &seg->zero_new_blocks))
|
||||||
return SEG_LOG_ERROR("Could not read zero_new_blocks for");
|
return SEG_LOG_ERROR("Could not read zero_new_blocks for");
|
||||||
|
|
||||||
seg->lv->status |= THIN_POOL;
|
|
||||||
|
|
||||||
/* Read messages */
|
/* Read messages */
|
||||||
for (; sn; sn = sn->sib)
|
for (; sn; sn = sn->sib)
|
||||||
if (!(sn->v) && !_thin_pool_add_message(seg, sn->key, sn->child))
|
if (!(sn->v) && !_thin_pool_add_message(seg, sn->key, sn->child))
|
||||||
@ -152,9 +151,10 @@ static int _thin_pool_text_export(const struct lv_segment *seg, struct formatter
|
|||||||
unsigned cnt = 0;
|
unsigned cnt = 0;
|
||||||
const struct lv_thin_message *tmsg;
|
const struct lv_thin_message *tmsg;
|
||||||
|
|
||||||
outf(f, "pool = \"%s\"", seg_lv(seg, 0)->name);
|
|
||||||
outf(f, "metadata = \"%s\"", seg->pool_metadata_lv->name);
|
outf(f, "metadata = \"%s\"", seg->pool_metadata_lv->name);
|
||||||
|
outf(f, "pool = \"%s\"", seg_lv(seg, 0)->name);
|
||||||
outf(f, "transaction_id = %" PRIu64, seg->transaction_id);
|
outf(f, "transaction_id = %" PRIu64, seg->transaction_id);
|
||||||
|
// FIXME maybe switch to use chunksize (as with snapshot ??)
|
||||||
outf(f, "data_block_size = %u", seg->data_block_size);
|
outf(f, "data_block_size = %u", seg->data_block_size);
|
||||||
|
|
||||||
if (seg->low_water_mark)
|
if (seg->low_water_mark)
|
||||||
|
Loading…
Reference in New Issue
Block a user