* [Qemu-devel] [PATCH v2 0/2] block/replication fixes
@ 2016-10-11 10:46 Changlong Xie
2016-10-11 10:46 ` [Qemu-devel] [PATCH v2 1/2] block/replication: prefect the logic to acquire 'top_id' Changlong Xie
2016-10-11 10:46 ` [Qemu-devel] [PATCH v2 2/2] block/replication: Clarify 'top-id' parameter usage Changlong Xie
0 siblings, 2 replies; 7+ messages in thread
From: Changlong Xie @ 2016-10-11 10:46 UTC (permalink / raw)
To: qemu devel, qemu block, Stefan Hajnoczi, Fam Zheng, Max Reitz,
Kevin Wolf, Wen Congyang
V2:
1. fix typo
Changlong Xie (2):
block/replication: prefect the logic to acquire 'top_id'
block/replication: Clarify 'top-id' parameter usage
block/replication.c | 9 +++++++--
qapi/block-core.json | 3 ++-
2 files changed, 9 insertions(+), 3 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH v2 1/2] block/replication: prefect the logic to acquire 'top_id'
2016-10-11 10:46 [Qemu-devel] [PATCH v2 0/2] block/replication fixes Changlong Xie
@ 2016-10-11 10:46 ` Changlong Xie
2016-10-11 14:52 ` Eric Blake
2016-10-11 10:46 ` [Qemu-devel] [PATCH v2 2/2] block/replication: Clarify 'top-id' parameter usage Changlong Xie
1 sibling, 1 reply; 7+ messages in thread
From: Changlong Xie @ 2016-10-11 10:46 UTC (permalink / raw)
To: qemu devel, qemu block, Stefan Hajnoczi, Fam Zheng, Max Reitz,
Kevin Wolf, Wen Congyang
Only g_strdup(top_id) if 'top_id' is not NULL, although there
is no memory leak here
Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
---
block/replication.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/replication.c b/block/replication.c
index 3bd1cf1..5b432d9 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -104,11 +104,11 @@ static int replication_open(BlockDriverState *bs, QDict *options,
} else if (!strcmp(mode, "secondary")) {
s->mode = REPLICATION_MODE_SECONDARY;
top_id = qemu_opt_get(opts, REPLICATION_TOP_ID);
- s->top_id = g_strdup(top_id);
- if (!s->top_id) {
+ if (!top_id) {
error_setg(&local_err, "Missing the option top-id");
goto fail;
}
+ s->top_id = g_strdup(top_id);
} else {
error_setg(&local_err,
"The option mode's value should be primary or secondary");
--
1.9.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH v2 2/2] block/replication: Clarify 'top-id' parameter usage
2016-10-11 10:46 [Qemu-devel] [PATCH v2 0/2] block/replication fixes Changlong Xie
2016-10-11 10:46 ` [Qemu-devel] [PATCH v2 1/2] block/replication: prefect the logic to acquire 'top_id' Changlong Xie
@ 2016-10-11 10:46 ` Changlong Xie
2016-10-11 14:54 ` Eric Blake
1 sibling, 1 reply; 7+ messages in thread
From: Changlong Xie @ 2016-10-11 10:46 UTC (permalink / raw)
To: qemu devel, qemu block, Stefan Hajnoczi, Fam Zheng, Max Reitz,
Kevin Wolf, Wen Congyang
Replication driver only support 'top-id' parameter in secondary side,
and it must not be supplied in primary side
Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
---
block/replication.c | 5 +++++
qapi/block-core.json | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/block/replication.c b/block/replication.c
index 5b432d9..1d0f115 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -101,6 +101,11 @@ static int replication_open(BlockDriverState *bs, QDict *options,
if (!strcmp(mode, "primary")) {
s->mode = REPLICATION_MODE_PRIMARY;
+ top_id = qemu_opt_get(opts, REPLICATION_TOP_ID);
+ if (top_id) {
+ error_setg(&local_err, "The primary side does not support option top-id");
+ goto fail;
+ }
} else if (!strcmp(mode, "secondary")) {
s->mode = REPLICATION_MODE_SECONDARY;
top_id = qemu_opt_get(opts, REPLICATION_TOP_ID);
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 4badb97..ec92df4 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -2197,7 +2197,8 @@
# @mode: the replication mode
#
# @top-id: #optional In secondary mode, node name or device ID of the root
-# node who owns the replication node chain. Ignored in primary mode.
+# node who owns the replication node chain. Must not be given in
+# primary mode.
#
# Since: 2.8
##
--
1.9.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/2] block/replication: prefect the logic to acquire 'top_id'
2016-10-11 10:46 ` [Qemu-devel] [PATCH v2 1/2] block/replication: prefect the logic to acquire 'top_id' Changlong Xie
@ 2016-10-11 14:52 ` Eric Blake
2016-10-12 0:40 ` Changlong Xie
0 siblings, 1 reply; 7+ messages in thread
From: Eric Blake @ 2016-10-11 14:52 UTC (permalink / raw)
To: Changlong Xie, qemu devel, qemu block, Stefan Hajnoczi, Fam Zheng,
Max Reitz, Kevin Wolf, Wen Congyang
[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]
On 10/11/2016 05:46 AM, Changlong Xie wrote:
> Only g_strdup(top_id) if 'top_id' is not NULL, although there
> is no memory leak here
>
> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
> ---
> block/replication.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/replication.c b/block/replication.c
> index 3bd1cf1..5b432d9 100644
> --- a/block/replication.c
> +++ b/block/replication.c
> @@ -104,11 +104,11 @@ static int replication_open(BlockDriverState *bs, QDict *options,
> } else if (!strcmp(mode, "secondary")) {
> s->mode = REPLICATION_MODE_SECONDARY;
> top_id = qemu_opt_get(opts, REPLICATION_TOP_ID);
> - s->top_id = g_strdup(top_id);
g_strdup(NULL) is safe; it returns NULL in that case.
> - if (!s->top_id) {
> + if (!top_id) {
> error_setg(&local_err, "Missing the option top-id");
> goto fail;
> }
> + s->top_id = g_strdup(top_id);
I see no point to this patch, rather than churn.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/2] block/replication: Clarify 'top-id' parameter usage
2016-10-11 10:46 ` [Qemu-devel] [PATCH v2 2/2] block/replication: Clarify 'top-id' parameter usage Changlong Xie
@ 2016-10-11 14:54 ` Eric Blake
2016-10-12 0:41 ` Changlong Xie
0 siblings, 1 reply; 7+ messages in thread
From: Eric Blake @ 2016-10-11 14:54 UTC (permalink / raw)
To: Changlong Xie, qemu devel, qemu block, Stefan Hajnoczi, Fam Zheng,
Max Reitz, Kevin Wolf, Wen Congyang
[-- Attachment #1: Type: text/plain, Size: 678 bytes --]
On 10/11/2016 05:46 AM, Changlong Xie wrote:
> Replication driver only support 'top-id' parameter in secondary side,
> and it must not be supplied in primary side
Grammar suggestion:
The replication driver only supports the 'top-id' parameter for the
secondary side; it must not be supplied for the primary side.
>
> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
> ---
> block/replication.c | 5 +++++
> qapi/block-core.json | 3 ++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/2] block/replication: prefect the logic to acquire 'top_id'
2016-10-11 14:52 ` Eric Blake
@ 2016-10-12 0:40 ` Changlong Xie
0 siblings, 0 replies; 7+ messages in thread
From: Changlong Xie @ 2016-10-12 0:40 UTC (permalink / raw)
To: Eric Blake, qemu devel, qemu block, Stefan Hajnoczi, Fam Zheng,
Max Reitz, Kevin Wolf, Wen Congyang
On 10/11/2016 10:52 PM, Eric Blake wrote:
> On 10/11/2016 05:46 AM, Changlong Xie wrote:
>> Only g_strdup(top_id) if 'top_id' is not NULL, although there
>> is no memory leak here
>>
>> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
>> ---
>> block/replication.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/block/replication.c b/block/replication.c
>> index 3bd1cf1..5b432d9 100644
>> --- a/block/replication.c
>> +++ b/block/replication.c
>> @@ -104,11 +104,11 @@ static int replication_open(BlockDriverState *bs, QDict *options,
>> } else if (!strcmp(mode, "secondary")) {
>> s->mode = REPLICATION_MODE_SECONDARY;
>> top_id = qemu_opt_get(opts, REPLICATION_TOP_ID);
>> - s->top_id = g_strdup(top_id);
>
> g_strdup(NULL) is safe; it returns NULL in that case.
Yes, that's why i said 'there is no memory leak here' in the commit
message.
>
>> - if (!s->top_id) {
>> + if (!top_id) {
>> error_setg(&local_err, "Missing the option top-id");
>> goto fail;
>> }
>> + s->top_id = g_strdup(top_id);
>
> I see no point to this patch, rather than churn.
It just reduce on execution path. Maybe i'm too academic :)
Will remove it in the next series.
Thanks
-Xie
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/2] block/replication: Clarify 'top-id' parameter usage
2016-10-11 14:54 ` Eric Blake
@ 2016-10-12 0:41 ` Changlong Xie
0 siblings, 0 replies; 7+ messages in thread
From: Changlong Xie @ 2016-10-12 0:41 UTC (permalink / raw)
To: Eric Blake, qemu devel, qemu block, Stefan Hajnoczi, Fam Zheng,
Max Reitz, Kevin Wolf, Wen Congyang
On 10/11/2016 10:54 PM, Eric Blake wrote:
> The replication driver only supports the 'top-id' parameter for the
> secondary side; it must not be supplied for the primary side.
Will apply in next version.
Thanks
-Xie
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-10-12 0:33 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-11 10:46 [Qemu-devel] [PATCH v2 0/2] block/replication fixes Changlong Xie
2016-10-11 10:46 ` [Qemu-devel] [PATCH v2 1/2] block/replication: prefect the logic to acquire 'top_id' Changlong Xie
2016-10-11 14:52 ` Eric Blake
2016-10-12 0:40 ` Changlong Xie
2016-10-11 10:46 ` [Qemu-devel] [PATCH v2 2/2] block/replication: Clarify 'top-id' parameter usage Changlong Xie
2016-10-11 14:54 ` Eric Blake
2016-10-12 0:41 ` Changlong Xie
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 NNTP newsgroup(s).