public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/lib/thin thin.c
@ 2011-10-11 8:51 zkabelac
0 siblings, 0 replies; 12+ messages in thread
From: zkabelac @ 2011-10-11 8:51 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-10-11 08:51:56
Modified files:
lib/thin : thin.c
Log message:
Reindent some thin functions
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16
--- LVM2/lib/thin/thin.c 2011/10/06 11:06:36 1.15
+++ LVM2/lib/thin/thin.c 2011/10/11 08:51:56 1.16
@@ -43,8 +43,9 @@
return seg->segtype->name;
}
-static int _thin_pool_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
- struct dm_hash_table *pv_hash __attribute__((unused)))
+static int _thin_pool_text_import(struct lv_segment *seg,
+ const struct dm_config_node *sn,
+ struct dm_hash_table *pv_hash __attribute__((unused)))
{
const char *lv_name;
struct logical_volume *pool_data_lv, *pool_metadata_lv;
@@ -113,13 +114,13 @@
#ifdef DEVMAPPER_SUPPORT
static int _thin_pool_add_target_line(struct dev_manager *dm,
- struct dm_pool *mem __attribute__((unused)),
- struct cmd_context *cmd __attribute__((unused)),
- void **target_state __attribute__((unused)),
- struct lv_segment *seg,
- const struct lv_activate_opts *laopts __attribute__((unused)),
- struct dm_tree_node *node, uint64_t len,
- uint32_t *pvmove_mirror_count __attribute__((unused)))
+ struct dm_pool *mem __attribute__((unused)),
+ struct cmd_context *cmd __attribute__((unused)),
+ void **target_state __attribute__((unused)),
+ struct lv_segment *seg,
+ const struct lv_activate_opts *laopts __attribute__((unused)),
+ struct dm_tree_node *node, uint64_t len,
+ uint32_t *pvmove_mirror_count __attribute__((unused)))
{
char *metadata_dlid, *pool_dlid;
@@ -147,8 +148,9 @@
return seg->segtype->name;
}
-static int _thin_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
- struct dm_hash_table *pv_hash __attribute__((unused)))
+static int _thin_text_import(struct lv_segment *seg,
+ const struct dm_config_node *sn,
+ struct dm_hash_table *pv_hash __attribute__((unused)))
{
const char *lv_name;
struct logical_volume *pool_lv;
^ permalink raw reply [flat|nested] 12+ messages in thread
* LVM2/lib/thin thin.c
@ 2012-01-19 15:42 zkabelac
0 siblings, 0 replies; 12+ messages in thread
From: zkabelac @ 2012-01-19 15:42 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-01-19 15:42:18
Modified files:
lib/thin : thin.c
Log message:
Thin indent update
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41
--- LVM2/lib/thin/thin.c 2012/01/19 15:27:54 1.40
+++ LVM2/lib/thin/thin.c 2012/01/19 15:42:18 1.41
@@ -313,7 +313,7 @@
if (!dm_get_status_thin_pool(mem, params, &s))
return_0;
- /* With seg report metadata percent, otherwice data percent */
+ /* With 'seg' report metadata percent, otherwice data percent */
if (seg) {
*percent = make_percent(s->used_metadata_blocks,
s->total_metadata_blocks);
^ permalink raw reply [flat|nested] 12+ messages in thread
* LVM2/lib/thin thin.c
@ 2011-12-21 12:56 zkabelac
0 siblings, 0 replies; 12+ messages in thread
From: zkabelac @ 2011-12-21 12:56 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-12-21 12:56:45
Modified files:
lib/thin : thin.c
Log message:
Thin remove unused code
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.35&r2=1.36
--- LVM2/lib/thin/thin.c 2011/12/21 12:54:19 1.35
+++ LVM2/lib/thin/thin.c 2011/12/21 12:56:45 1.36
@@ -372,19 +372,6 @@
return 0;
}
-#if 0
-{
- /* If we would need to activate 'to be deleted' thin LVs */
- struct lv_thin_message *tmsg;
- dm_list_iterate_items(tmsg, &first_seg(seg->pool_lv)->thin_messages)
- /* If this node is going to be deleted - use the error target */
- if ((tmsg->type == DM_THIN_MESSAGE_DELETE) &&
- (tmsg->u.delete_id == seg->device_id)) {
- device_id = DM_THIN_ERROR_DEVICE_ID;
- break;
- }
-}
-#endif
if (!dm_tree_node_add_thin_target(node, len, pool_dlid, device_id))
return_0;
^ permalink raw reply [flat|nested] 12+ messages in thread
* LVM2/lib/thin thin.c
@ 2011-11-03 14:37 zkabelac
0 siblings, 0 replies; 12+ messages in thread
From: zkabelac @ 2011-11-03 14:37 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-11-03 14:37:24
Modified files:
lib/thin : thin.c
Log message:
Thin clean using delete_id consitently
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28
--- LVM2/lib/thin/thin.c 2011/10/30 22:00:58 1.27
+++ LVM2/lib/thin/thin.c 2011/11/03 14:37:23 1.28
@@ -49,7 +49,7 @@
{
const char *lv_name = NULL;
struct logical_volume *lv = NULL;
- uint32_t device_id = 0;
+ uint32_t delete_id = 0;
dm_thin_message_t type;
/* Message must have only one from: create, trim, delete */
@@ -70,7 +70,7 @@
type = DM_THIN_MESSAGE_TRIM;
}
- if (!dm_config_get_uint32(sn, "delete", &device_id)) {
+ if (!dm_config_get_uint32(sn, "delete", &delete_id)) {
if (!lv)
return SEG_LOG_ERROR("Unknown message in");
} else {
@@ -79,7 +79,7 @@
type = DM_THIN_MESSAGE_DELETE;
}
- if (!attach_pool_message(seg, type, lv, device_id, 1))
+ if (!attach_pool_message(seg, type, lv, delete_id, 1))
return_0;
return 1;
^ permalink raw reply [flat|nested] 12+ messages in thread
* LVM2/lib/thin thin.c
@ 2011-10-28 20:25 zkabelac
0 siblings, 0 replies; 12+ messages in thread
From: zkabelac @ 2011-10-28 20:25 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-10-28 20:25:08
Modified files:
lib/thin : thin.c
Log message:
Thin output data_block_size via outsize
Use outsize to get nice size hint.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.25&r2=1.26
--- LVM2/lib/thin/thin.c 2011/10/22 16:45:25 1.25
+++ LVM2/lib/thin/thin.c 2011/10/28 20:25:08 1.26
@@ -155,7 +155,8 @@
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 ??)
- outf(f, "data_block_size = %u", seg->data_block_size);
+ outsize(f, (uint64_t) seg->data_block_size,
+ "data_block_size = %u", seg->data_block_size);
if (seg->low_water_mark)
outf(f, "low_water_mark = %" PRIu64, seg->low_water_mark);
^ permalink raw reply [flat|nested] 12+ messages in thread
* LVM2/lib/thin thin.c
@ 2011-10-22 16:45 zkabelac
0 siblings, 0 replies; 12+ messages in thread
From: zkabelac @ 2011-10-22 16:45 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-10-22 16:45:25
Modified files:
lib/thin : thin.c
Log message:
Consistently use metadata LV as the first in MDA
Cosmetic cleanup.
Mark LV as thin pool before calling attach_pool functions.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25
--- LVM2/lib/thin/thin.c 2011/10/21 11:38:36 1.24
+++ LVM2/lib/thin/thin.c 2011/10/22 16:45:25 1.25
@@ -92,34 +92,35 @@
const char *lv_name;
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))
return SEG_LOG_ERROR("Metadata must be a string in");
if (!(pool_metadata_lv = find_lv(seg->lv->vg, lv_name)))
return SEG_LOG_ERROR("Unknown metadata %s in", lv_name);
- if (!attach_pool_data_lv(seg, pool_data_lv))
- return_0;
+ 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;
+ if (!attach_pool_data_lv(seg, pool_data_lv))
+ return_0;
+
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_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 (!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) ||
(seg->data_block_size > DM_THIN_MAX_DATA_BLOCK_SIZE))
return SEG_LOG_ERROR("Unsupported value %u for data_block_size",
@@ -129,8 +130,6 @@
!dm_config_get_uint32(sn, "zero_new_blocks", &seg->zero_new_blocks))
return SEG_LOG_ERROR("Could not read zero_new_blocks for");
- seg->lv->status |= THIN_POOL;
-
/* Read messages */
for (; sn; sn = sn->sib)
if (!(sn->v) && !_thin_pool_add_message(seg, sn->key, sn->child))
@@ -152,9 +151,10 @@
unsigned cnt = 0;
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, "pool = \"%s\"", seg_lv(seg, 0)->name);
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);
if (seg->low_water_mark)
^ permalink raw reply [flat|nested] 12+ messages in thread
* LVM2/lib/thin thin.c
@ 2011-10-20 10:32 zkabelac
0 siblings, 0 replies; 12+ messages in thread
From: zkabelac @ 2011-10-20 10:32 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-10-20 10:32:29
Modified files:
lib/thin : thin.c
Log message:
Reindent code
Avoid 1 indent level and use check for empty list only for
add of transaction_id message.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22
--- LVM2/lib/thin/thin.c 2011/10/20 10:31:27 1.21
+++ LVM2/lib/thin/thin.c 2011/10/20 10:32:29 1.22
@@ -241,41 +241,42 @@
seg->zero_new_blocks ? 0 : 1))
return_0;
- if (!dm_list_empty(&seg->thin_messages)) {
- dm_list_iterate_items(lmsg, &seg->thin_messages) {
- dmsg.type = lmsg->type;
- switch (lmsg->type) {
- case DM_THIN_MESSAGE_CREATE_SNAP:
- /* FIXME: to be implemented */
- log_debug("Thin pool create_snap %s.", lmsg->u.lv->name);
- dmsg.u.m_create_snap.device_id = first_seg(lmsg->u.lv)->device_id;
- dmsg.u.m_create_snap.origin_id = 0;//first_seg(first_seg(lmsg->u.lv)->origin)->device_id;
- if (!dm_tree_node_add_thin_pool_message(node, &dmsg))
- return_0;
- log_error(INTERNAL_ERROR "Sorry, not implemented yet.");
- return 0;
- case DM_THIN_MESSAGE_CREATE_THIN:
- log_debug("Thin pool create_thin %s.", lmsg->u.lv->name);
- dmsg.u.m_create_thin.device_id = first_seg(lmsg->u.lv)->device_id;
- if (!dm_tree_node_add_thin_pool_message(node, &dmsg))
- return_0;
- break;
- case DM_THIN_MESSAGE_DELETE:
- log_debug("Thin pool delete %u.", lmsg->u.delete_id);
- dmsg.u.m_delete.device_id = lmsg->u.delete_id;
- if (!dm_tree_node_add_thin_pool_message(node, &dmsg))
- return_0;
- break;
- case DM_THIN_MESSAGE_TRIM:
- /* FIXME: to be implemented */
- log_error(INTERNAL_ERROR "Sorry, not implemented yet.");
- return 0;
- default:
- log_error(INTERNAL_ERROR "Unsupported message.");
- return 0;
- }
+ dm_list_iterate_items(lmsg, &seg->thin_messages) {
+ dmsg.type = lmsg->type;
+ switch (lmsg->type) {
+ case DM_THIN_MESSAGE_CREATE_SNAP:
+ /* FIXME: to be implemented */
+ log_debug("Thin pool create_snap %s.", lmsg->u.lv->name);
+ dmsg.u.m_create_snap.device_id = first_seg(lmsg->u.lv)->device_id;
+ dmsg.u.m_create_snap.origin_id = 0;//first_seg(first_seg(lmsg->u.lv)->origin)->device_id;
+ if (!dm_tree_node_add_thin_pool_message(node, &dmsg))
+ return_0;
+ log_error("Sorry SNAPSHOTS is not yet supported.");
+ return 0;
+ case DM_THIN_MESSAGE_CREATE_THIN:
+ log_debug("Thin pool create_thin %s.", lmsg->u.lv->name);
+ dmsg.u.m_create_thin.device_id = first_seg(lmsg->u.lv)->device_id;
+ if (!dm_tree_node_add_thin_pool_message(node, &dmsg))
+ return_0;
+ break;
+ case DM_THIN_MESSAGE_DELETE:
+ log_debug("Thin pool delete %u.", lmsg->u.delete_id);
+ dmsg.u.m_delete.device_id = lmsg->u.delete_id;
+ if (!dm_tree_node_add_thin_pool_message(node, &dmsg))
+ return_0;
+ break;
+ case DM_THIN_MESSAGE_TRIM:
+ /* FIXME: to be implemented */
+ log_error("Sorry TRIM is not yes supported.");
+ return 0;
+ default:
+ log_error(INTERNAL_ERROR "Unsupported message.");
+ return 0;
}
+ }
+ if (!dm_list_empty(&seg->thin_messages)) {
+ /* Messages were passed, modify transaction_id as the last one */
log_debug("Thin pool set_transaction_id %" PRIu64 ".", seg->transaction_id);
dmsg.type = DM_THIN_MESSAGE_SET_TRANSACTION_ID;
dmsg.u.m_set_transaction_id.current_id = seg->transaction_id - 1;
^ permalink raw reply [flat|nested] 12+ messages in thread
* LVM2/lib/thin thin.c
@ 2011-10-20 10:30 zkabelac
0 siblings, 0 replies; 12+ messages in thread
From: zkabelac @ 2011-10-20 10:30 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-10-20 10:30:39
Modified files:
lib/thin : thin.c
Log message:
Print low_water_mark only when it has some value
Do not expose low_water_mark in mda yet, if it has no use.
We do not allow to be set via current lvm tool code.
Usage needs to be clarified first.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.19&r2=1.20
--- LVM2/lib/thin/thin.c 2011/10/20 10:28:41 1.19
+++ LVM2/lib/thin/thin.c 2011/10/20 10:30:39 1.20
@@ -113,7 +113,8 @@
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_uint64(sn, "low_water_mark", &seg->low_water_mark))
+ 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 (!dm_config_get_uint32(sn, "data_block_size", &seg->data_block_size))
@@ -154,9 +155,11 @@
outf(f, "pool = \"%s\"", seg_lv(seg, 0)->name);
outf(f, "metadata = \"%s\"", seg->pool_metadata_lv->name);
outf(f, "transaction_id = %" PRIu64, seg->transaction_id);
- outf(f, "low_water_mark = %" PRIu64, seg->low_water_mark);
outf(f, "data_block_size = %d", seg->data_block_size);
+ if (seg->low_water_mark)
+ outf(f, "low_water_mark = %" PRIu64, seg->low_water_mark);
+
if (seg->zero_new_blocks)
outf(f, "zero_new_blocks = 1");
^ permalink raw reply [flat|nested] 12+ messages in thread
* LVM2/lib/thin thin.c
@ 2011-10-17 14:17 zkabelac
0 siblings, 0 replies; 12+ messages in thread
From: zkabelac @ 2011-10-17 14:17 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-10-17 14:17:31
Modified files:
lib/thin : thin.c
Log message:
Indent debug message
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.17&r2=1.18
--- LVM2/lib/thin/thin.c 2011/10/17 14:17:09 1.17
+++ LVM2/lib/thin/thin.c 2011/10/17 14:17:30 1.18
@@ -221,12 +221,14 @@
struct dm_thin_message dmsg;
if (!(metadata_dlid = build_dm_uuid(mem, seg->pool_metadata_lv->lvid.s, NULL))) {
- log_error("Failed to build uuid for metadata LV %s.", seg->pool_metadata_lv->name);
+ log_error("Failed to build uuid for metadata LV %s.",
+ seg->pool_metadata_lv->name);
return 0;
}
if (!(pool_dlid = build_dm_uuid(mem, seg_lv(seg, 0)->lvid.s, NULL))) {
- log_error("Failed to build uuid for pool LV %s.", seg_lv(seg, 0)->name);
+ log_error("Failed to build uuid for pool LV %s.",
+ seg_lv(seg, 0)->name);
return 0;
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* LVM2/lib/thin thin.c
@ 2011-10-06 11:06 zkabelac
0 siblings, 0 replies; 12+ messages in thread
From: zkabelac @ 2011-10-06 11:06 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-10-06 11:06:36
Modified files:
lib/thin : thin.c
Log message:
Add more validation to config parser
Do not leave it for vgvalidate().
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15
--- LVM2/lib/thin/thin.c 2011/10/03 18:26:07 1.14
+++ LVM2/lib/thin/thin.c 2011/10/06 11:06:36 1.15
@@ -76,6 +76,11 @@
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_SIZE) ||
+ (seg->data_block_size > DM_THIN_MAX_DATA_SIZE))
+ return SEG_LOG_ERROR("Unsupported value %u for data_block_size",
+ seg->device_id);
+
if (dm_config_has_node(sn, "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");
@@ -168,6 +173,10 @@
if (!dm_config_get_uint32(sn, "device_id", &seg->device_id))
return SEG_LOG_ERROR("Could not read device_id for");
+ if (seg->device_id > DM_THIN_MAX_DEVICE_ID)
+ return SEG_LOG_ERROR("Unsupported value %u for device_id",
+ seg->device_id);
+
return 1;
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* LVM2/lib/thin thin.c
@ 2011-09-06 22:35 zkabelac
0 siblings, 0 replies; 12+ messages in thread
From: zkabelac @ 2011-09-06 22:35 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-09-06 22:35:45
Modified files:
lib/thin : thin.c
Log message:
Convert data->pool
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.9&r2=1.10
--- LVM2/lib/thin/thin.c 2011/09/06 19:25:44 1.9
+++ LVM2/lib/thin/thin.c 2011/09/06 22:35:44 1.10
@@ -48,19 +48,19 @@
{
const char *lv_name;
- if (!dm_config_get_str(sn, "data", &lv_name))
- return SEG_LOG_ERROR("Thin pool data must be a string in");
+ if (!dm_config_get_str(sn, "pool", &lv_name))
+ return SEG_LOG_ERROR("Pool must be a string in");
// Use attach_pool_lv
if (!(seg->pool_lv = find_lv(seg->lv->vg, lv_name)))
- return SEG_LOG_ERROR("Unknown pool data %s in", lv_name);
+ return SEG_LOG_ERROR("Unknown pool %s in", lv_name);
if (!dm_config_get_str(sn, "metadata", &lv_name))
- return SEG_LOG_ERROR("Thin pool metadata must be a string in");
+ return SEG_LOG_ERROR("Metadata must be a string in");
// Use attach_pool_metadata()
if (!(seg->metadata_lv = find_lv(seg->lv->vg, lv_name)))
- return SEG_LOG_ERROR("Unknown pool metadata %s in", lv_name);
+ return SEG_LOG_ERROR("Unknown metadata %s in", lv_name);
if (!dm_config_get_uint64(sn, "transaction_id", &seg->transaction_id))
return SEG_LOG_ERROR("Could not read transaction_id for");
@@ -74,7 +74,7 @@
static int _thin_pool_text_export(const struct lv_segment *seg, struct formatter *f)
{
- outf(f, "data = \"%s\"", seg->pool_lv->name);
+ outf(f, "pool = \"%s\"", seg->pool_lv->name);
outf(f, "metadata = \"%s\"", seg->metadata_lv->name);
outf(f, "transaction_id = %" PRIu64, seg->transaction_id);
if (seg->zero_new_blocks)
@@ -101,7 +101,7 @@
if (dm_config_has_node(sn, "origin")) {
if (!dm_config_get_str(sn, "origin", &lv_name))
- return SEG_LOG_ERROR("Thin pool origin must be a string in");
+ return SEG_LOG_ERROR("Origin must be a string in");
if (!(seg->origin = find_lv(seg->lv->vg, lv_name)))
return SEG_LOG_ERROR("Unknown origin %s in", lv_name);
^ permalink raw reply [flat|nested] 12+ messages in thread
* LVM2/lib/thin thin.c
@ 2011-09-01 10:16 zkabelac
0 siblings, 0 replies; 12+ messages in thread
From: zkabelac @ 2011-09-01 10:16 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-09-01 10:16:33
Modified files:
lib/thin : thin.c
Log message:
Reflect dm_config API update
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7
--- LVM2/lib/thin/thin.c 2011/08/30 14:55:18 1.6
+++ LVM2/lib/thin/thin.c 2011/09/01 10:16:32 1.7
@@ -46,28 +46,24 @@
static int _thin_pool_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
struct dm_hash_table *pv_hash __attribute__((unused)))
{
- const struct dm_config_node *cn;
+ const char *lv_name;
- if (!(cn = dm_config_find_node(sn, "data")) ||
- !cn->v || cn->v->type != DM_CFG_STRING)
+ if (!dm_config_get_str(sn, "data", &lv_name))
return SEG_LOG_ERROR("Thin pool data must be a string in");
- if (!(seg->data_lv = find_lv(seg->lv->vg, cn->v->v.str)))
- return SEG_LOG_ERROR("Unknown pool data %s in",
- cn->v->v.str);
+ if (!(seg->data_lv = find_lv(seg->lv->vg, lv_name)))
+ return SEG_LOG_ERROR("Unknown pool data %s in", lv_name);
- if (!(cn = dm_config_find_node(sn, "metadata")) ||
- !cn->v || cn->v->type != DM_CFG_STRING)
+ if (!dm_config_get_str(sn, "metadata", &lv_name))
return SEG_LOG_ERROR("Thin pool metadata must be a string in");
- if (!(seg->metadata_lv = find_lv(seg->lv->vg, cn->v->v.str)))
- return SEG_LOG_ERROR("Unknown pool metadata %s in",
- cn->v->v.str);
+ if (!(seg->metadata_lv = find_lv(seg->lv->vg, lv_name)))
+ return SEG_LOG_ERROR("Unknown pool metadata %s in", lv_name);
if (!dm_config_get_uint64(sn, "transaction_id", &seg->transaction_id))
return SEG_LOG_ERROR("Could not read transaction_id for");
- if (dm_config_find_node(sn, "zero_new_blocks") &&
+ if (dm_config_has_node(sn, "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");
@@ -93,23 +89,20 @@
static int _thin_text_import(struct lv_segment *seg, const struct dm_config_node *sn,
struct dm_hash_table *pv_hash __attribute__((unused)))
{
- const struct dm_config_node *cn;
+ const char *lv_name;
- if (!(cn = dm_config_find_node(sn, "thin_pool")) ||
- !cn->v || cn->v->type != DM_CFG_STRING)
+ if (!dm_config_get_str(sn, "thin_pool", &lv_name))
return SEG_LOG_ERROR("Thin pool must be a string in");
- if (!(seg->thin_pool_lv = find_lv(seg->lv->vg, cn->v->v.str)))
- return SEG_LOG_ERROR("Unknown thin pool %s in",
- cn->v->v.str);
+ if (!(seg->thin_pool_lv = find_lv(seg->lv->vg, lv_name)))
+ return SEG_LOG_ERROR("Unknown thin pool %s in", lv_name);
- if ((cn = dm_config_find_node(sn, "origin"))) {
- if (!cn->v || cn->v->type != DM_CFG_STRING)
+ if (dm_config_has_node(sn, "origin")) {
+ if (!dm_config_get_str(sn, "origin", &lv_name))
return SEG_LOG_ERROR("Thin pool origin must be a string in");
- if (!(seg->origin = find_lv(seg->lv->vg, cn->v->v.str)))
- return SEG_LOG_ERROR("Unknown origin %s in",
- cn->v->v.str);
+ if (!(seg->origin = find_lv(seg->lv->vg, lv_name)))
+ return SEG_LOG_ERROR("Unknown origin %s in", lv_name);
}
if (!dm_config_get_uint64(sn, "device_id", &seg->device_id))
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2012-01-19 15:42 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-11 8:51 LVM2/lib/thin thin.c zkabelac
-- strict thread matches above, loose matches on Subject: below --
2012-01-19 15:42 zkabelac
2011-12-21 12:56 zkabelac
2011-11-03 14:37 zkabelac
2011-10-28 20:25 zkabelac
2011-10-22 16:45 zkabelac
2011-10-20 10:32 zkabelac
2011-10-20 10:30 zkabelac
2011-10-17 14:17 zkabelac
2011-10-06 11:06 zkabelac
2011-09-06 22:35 zkabelac
2011-09-01 10:16 zkabelac
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).