From nobody Sat May 4 03:57:58 2024 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 149451807809617.188024789432006; Thu, 11 May 2017 08:54:38 -0700 (PDT) Received: from localhost ([::1]:49037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8qQF-0008QR-6N for importer@patchew.org; Thu, 11 May 2017 11:54:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8qMU-0005rr-HW for qemu-devel@nongnu.org; Thu, 11 May 2017 11:50:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8qMR-0007B1-Uo for qemu-devel@nongnu.org; Thu, 11 May 2017 11:50:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57094) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8qMR-0007AY-L5 for qemu-devel@nongnu.org; Thu, 11 May 2017 11:50:39 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 73BF5796FE for ; Thu, 11 May 2017 15:50:38 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4517796554; Thu, 11 May 2017 15:50:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 73BF5796FE Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 73BF5796FE From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 11 May 2017 17:50:28 +0200 Message-Id: <20170511155028.6543-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 11 May 2017 15:50:38 +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] [PATCH] ram: Rename RAM_SAVE_FLAG_COMPRESS to RAM_SAVE_FLAG_ZERO 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com 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" Reflects better what it does now, and avoid confussions with RAM_SAVE_FLAG_COMPRESS_PAGE. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- Hi I always forgot the diffe9rent between COMPRESS and COMPRESS_PAGE. This patch makes it clean which is which. Please, comment. Later, Juan. --- migration/ram.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 995d1fc..76c118c 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -48,8 +48,14 @@ /***********************************************************/ /* ram save/restore */ =20 +/* RAM_SAVE_FLAG_ZERO used to be named RAM_SAVE_FLAG_COMPRESS, it + * worked for pages that where filled with the same char. We switched + * it to only search for the zero value. And to avoid confusion with + * RAM_SSAVE_FLAG_COMPRESS_PAGE just rename it. + */ + #define RAM_SAVE_FLAG_FULL 0x01 /* Obsolete, not used anymore */ -#define RAM_SAVE_FLAG_COMPRESS 0x02 +#define RAM_SAVE_FLAG_ZERO 0x02 #define RAM_SAVE_FLAG_MEM_SIZE 0x04 #define RAM_SAVE_FLAG_PAGE 0x08 #define RAM_SAVE_FLAG_EOS 0x10 @@ -746,7 +752,7 @@ static int save_zero_page(RAMState *rs, RAMBlock *block= , ram_addr_t offset, if (is_zero_range(p, TARGET_PAGE_SIZE)) { rs->zero_pages++; rs->bytes_transferred +=3D - save_page_header(rs, rs->f, block, offset | RAM_SAVE_FLAG_COMP= RESS); + save_page_header(rs, rs->f, block, offset | RAM_SAVE_FLAG_ZERO= ); qemu_put_byte(rs->f, 0); rs->bytes_transferred +=3D 1; pages =3D 1; @@ -2406,7 +2412,7 @@ static int ram_load_postcopy(QEMUFile *f) =20 trace_ram_load_postcopy_loop((uint64_t)addr, flags); place_needed =3D false; - if (flags & (RAM_SAVE_FLAG_COMPRESS | RAM_SAVE_FLAG_PAGE)) { + if (flags & (RAM_SAVE_FLAG_ZERO | RAM_SAVE_FLAG_PAGE)) { block =3D ram_block_from_stream(f, flags); =20 host =3D host_from_ram_block_offset(block, addr); @@ -2453,7 +2459,7 @@ static int ram_load_postcopy(QEMUFile *f) last_host =3D host; =20 switch (flags & ~RAM_SAVE_FLAG_CONTINUE) { - case RAM_SAVE_FLAG_COMPRESS: + case RAM_SAVE_FLAG_ZERO: ch =3D qemu_get_byte(f); memset(page_buffer, ch, TARGET_PAGE_SIZE); if (ch) { @@ -2542,7 +2548,7 @@ static int ram_load(QEMUFile *f, void *opaque, int ve= rsion_id) flags =3D addr & ~TARGET_PAGE_MASK; addr &=3D TARGET_PAGE_MASK; =20 - if (flags & (RAM_SAVE_FLAG_COMPRESS | RAM_SAVE_FLAG_PAGE | + if (flags & (RAM_SAVE_FLAG_ZERO | RAM_SAVE_FLAG_PAGE | RAM_SAVE_FLAG_COMPRESS_PAGE | RAM_SAVE_FLAG_XBZRLE)) { RAMBlock *block =3D ram_block_from_stream(f, flags); =20 @@ -2604,7 +2610,7 @@ static int ram_load(QEMUFile *f, void *opaque, int ve= rsion_id) } break; =20 - case RAM_SAVE_FLAG_COMPRESS: + case RAM_SAVE_FLAG_ZERO: ch =3D qemu_get_byte(f); ram_handle_compressed(host, ch, TARGET_PAGE_SIZE); break; --=20 2.9.3