From nobody Wed Dec 17 21:44:29 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493011082073123.73893391605202; Sun, 23 Apr 2017 22:18:02 -0700 (PDT) Received: from localhost ([::1]:42028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2WNs-0004ut-Mk for importer@patchew.org; Mon, 24 Apr 2017 01:18:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2WMD-0003qo-Hh for qemu-devel@nongnu.org; Mon, 24 Apr 2017 01:16:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2WMB-00068t-QU for qemu-devel@nongnu.org; Mon, 24 Apr 2017 01:16:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51272) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2WMB-00068e-Km for qemu-devel@nongnu.org; Mon, 24 Apr 2017 01:16:15 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A15A670721; Mon, 24 Apr 2017 05:16:14 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-8-48.pek2.redhat.com [10.72.8.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 015A178A13; Mon, 24 Apr 2017 05:16:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A15A670721 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jasowang@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A15A670721 From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Mon, 24 Apr 2017 13:15:59 +0800 Message-Id: <1493010966-22976-2-git-send-email-jasowang@redhat.com> In-Reply-To: <1493010966-22976-1-git-send-email-jasowang@redhat.com> References: <1493010966-22976-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 24 Apr 2017 05:16:14 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/8] colo-compare: Fix old packet check bug. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Zhang Chen 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 Signed-off-by: Jason Wang --- 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, int6= 4_t *check_time) } } =20 -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 =3D opaque; GList *result =3D NULL; int64_t check_time =3D REGULAR_PACKET_CHECK_MS; =20 @@ -386,7 +385,10 @@ static void colo_old_packet_check_one_conn(void *opaqu= e, if (result) { /* do checkpoint will flush old packet */ /* TODO: colo_notify_checkpoint();*/ + return 0; } + + return 1; } =20 /* @@ -398,7 +400,12 @@ static void colo_old_packet_check(void *opaque) { CompareState *s =3D opaque; =20 - 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); } =20 /* --=20 2.7.4