* [Qemu-devel] [PATCH] colo-compare: Fix old packet check bug.
@ 2017-04-12 12:12 Zhang Chen
2017-04-13 7:29 ` Jason Wang
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Chen @ 2017-04-12 12:12 UTC (permalink / raw)
To: qemu devel, Jason Wang; +Cc: Zhang Chen, Li Zhijian
If colo-compare find one old packet,we can notify colo-frame
do checkpoint, no need continue find more old packet here.
Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
net/colo-compare.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/net/colo-compare.c b/net/colo-compare.c
index 54e6d40..9b09cfc 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -372,10 +372,9 @@ static int colo_old_packet_check_one(Packet *pkt, int64_t *check_time)
}
}
-static void colo_old_packet_check_one_conn(void *opaque,
- void *user_data)
+static int colo_old_packet_check_one_conn(Connection *conn,
+ void *user_data)
{
- Connection *conn = opaque;
GList *result = NULL;
int64_t check_time = REGULAR_PACKET_CHECK_MS;
@@ -386,7 +385,10 @@ static void colo_old_packet_check_one_conn(void *opaque,
if (result) {
/* do checkpoint will flush old packet */
/* TODO: colo_notify_checkpoint();*/
+ return 0;
}
+
+ return 1;
}
/*
@@ -398,7 +400,12 @@ static void colo_old_packet_check(void *opaque)
{
CompareState *s = opaque;
- g_queue_foreach(&s->conn_list, colo_old_packet_check_one_conn, NULL);
+ /*
+ * If we find one old packet, stop finding job and notify
+ * COLO frame do checkpoint.
+ */
+ g_queue_find_custom(&s->conn_list, NULL,
+ (GCompareFunc)colo_old_packet_check_one_conn);
}
/*
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] colo-compare: Fix old packet check bug.
2017-04-12 12:12 [Qemu-devel] [PATCH] colo-compare: Fix old packet check bug Zhang Chen
@ 2017-04-13 7:29 ` Jason Wang
0 siblings, 0 replies; 2+ messages in thread
From: Jason Wang @ 2017-04-13 7:29 UTC (permalink / raw)
To: Zhang Chen, qemu devel; +Cc: Li Zhijian
On 2017年04月12日 20:12, Zhang Chen wrote:
> If colo-compare find one old packet,we can notify colo-frame
> do checkpoint, no need continue find more old packet here.
>
> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
> ---
> net/colo-compare.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/net/colo-compare.c b/net/colo-compare.c
> index 54e6d40..9b09cfc 100644
> --- a/net/colo-compare.c
> +++ b/net/colo-compare.c
> @@ -372,10 +372,9 @@ static int colo_old_packet_check_one(Packet *pkt, int64_t *check_time)
> }
> }
>
> -static void colo_old_packet_check_one_conn(void *opaque,
> - void *user_data)
> +static int colo_old_packet_check_one_conn(Connection *conn,
> + void *user_data)
> {
> - Connection *conn = opaque;
> GList *result = NULL;
> int64_t check_time = REGULAR_PACKET_CHECK_MS;
>
> @@ -386,7 +385,10 @@ static void colo_old_packet_check_one_conn(void *opaque,
> if (result) {
> /* do checkpoint will flush old packet */
> /* TODO: colo_notify_checkpoint();*/
> + return 0;
> }
> +
> + return 1;
> }
>
> /*
> @@ -398,7 +400,12 @@ static void colo_old_packet_check(void *opaque)
> {
> CompareState *s = opaque;
>
> - g_queue_foreach(&s->conn_list, colo_old_packet_check_one_conn, NULL);
> + /*
> + * If we find one old packet, stop finding job and notify
> + * COLO frame do checkpoint.
> + */
> + g_queue_find_custom(&s->conn_list, NULL,
> + (GCompareFunc)colo_old_packet_check_one_conn);
> }
>
> /*
Queued in net-next.
Thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-13 7:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-12 12:12 [Qemu-devel] [PATCH] colo-compare: Fix old packet check bug Zhang Chen
2017-04-13 7:29 ` Jason Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.