diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2012-08-27 14:19:30 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2012-08-27 14:33:54 +0200 |
commit | 847e2856a29c41756cc5bbaf70eb87ea030826f4 (patch) | |
tree | a82ac80008113d42162368d406312040cedc10f3 /daemons | |
parent | 2a70e98b05603bf8fc59929fd2709fb5d2b859e6 (diff) | |
download | lvm2-847e2856a29c41756cc5bbaf70eb87ea030826f4.tar.gz lvm2-847e2856a29c41756cc5bbaf70eb87ea030826f4.tar.xz lvm2-847e2856a29c41756cc5bbaf70eb87ea030826f4.zip |
config: require dm_config_create_value for dm_config_node's value
If we were defining a section (which is a node without a value) and
the value was created automatically on dm_config_create_node call,
we were wasting resources as the next step after creating the config
node itself was assigning NULL for the node's value.
The dm_config_node_create + dm_config_create_value sequence should be
used instead for settings and dm_config_node_create alone for sections.
The majority of the code already used the correct sequence. Though
with dm_config_node_create fn creating the value as well, the pool
memory was being trashed this way.
This patch removes the node value initialization on dm_config_create_node
fn call and keeps it for the direct dm_config_create_value fn call.
Diffstat (limited to 'daemons')
-rw-r--r-- | daemons/lvmetad/lvmetad-core.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c index 3ca3fd52..146ee698 100644 --- a/daemons/lvmetad/lvmetad-core.c +++ b/daemons/lvmetad/lvmetad-core.c @@ -520,12 +520,19 @@ static response vg_lookup(lvmetad_state *s, request r) if (!(res.cft->root = n = dm_config_create_node(res.cft, "response"))) goto bad; + if (!(n->v = dm_config_create_value(cft))) + goto bad; + n->parent = res.cft->root; n->v->type = DM_CFG_STRING; n->v->v.str = "OK"; if (!(n = n->sib = dm_config_create_node(res.cft, "name"))) goto bad; + + if (!(n->v = dm_config_create_value(res.cft))) + goto bad; + n->parent = res.cft->root; n->v->type = DM_CFG_STRING; n->v->v.str = name; |