From nobody Thu Nov 13 17:44:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158202380622039.66696160766378; Tue, 18 Feb 2020 03:03:26 -0800 (PST) Received: from localhost ([::1]:32768 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j40ez-0001cj-95 for importer@patchew.org; Tue, 18 Feb 2020 06:03:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56061) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j40dx-0000eW-7F for qemu-devel@nongnu.org; Tue, 18 Feb 2020 06:02:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j40dv-00052m-Sb for qemu-devel@nongnu.org; Tue, 18 Feb 2020 06:02:21 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:30155 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j40dv-00052K-Ov for qemu-devel@nongnu.org; Tue, 18 Feb 2020 06:02:19 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-35-AiH2HNpFMqejptT1JBDqOA-1; Tue, 18 Feb 2020 06:02:15 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 613BF1857347; Tue, 18 Feb 2020 11:02:14 +0000 (UTC) Received: from localhost (unknown [10.36.118.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 311511001920; Tue, 18 Feb 2020 11:02:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582023739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zA0NDRhS4e8KqLesRq/ColgO7+xQb84DJ7fwZBMQCZM=; b=QtIXzzJ6y0O2/4J4z/9bavy3iAfljA++NTCK8p4XaoRph6gp2pW40ZvZPXzmejTHLU8G3R 1Rnvs7bh0o0Gf2XjkTRkGJsG9UXSpzCgpUhD5O0/t/Acyp9BdC8YEpjP8Xxkk/gc9BO18j kdTaM9s2CFOBHokcQl2x3mG/1x4AD1k= From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH] migration/block: rename BLOCK_SIZE macro Date: Tue, 18 Feb 2020 11:02:09 +0000 Message-Id: <20200218110209.800294-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: AiH2HNpFMqejptT1JBDqOA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , qemu-block@nongnu.org, "Dr. David Alan Gilbert" , Stefan Hajnoczi , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Both and define BLOCK_SIZE macros. Avoiding using that name in block/migration.c. I noticed this when including (Linux io_uring) from "block/aio.h" and compilation failed. Although patches adding that include haven't been sent yet, it makes sense to rename the macro now in case someone else stumbles on it in the meantime. Signed-off-by: Stefan Hajnoczi Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- migration/block.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/migration/block.c b/migration/block.c index c90288ed29..737b6499f9 100644 --- a/migration/block.c +++ b/migration/block.c @@ -27,8 +27,8 @@ #include "migration/vmstate.h" #include "sysemu/block-backend.h" =20 -#define BLOCK_SIZE (1 << 20) -#define BDRV_SECTORS_PER_DIRTY_CHUNK (BLOCK_SIZE >> BDRV_SECTOR_BITS) +#define BLK_MIG_BLOCK_SIZE (1 << 20) +#define BDRV_SECTORS_PER_DIRTY_CHUNK (BLK_MIG_BLOCK_SIZE >> BDRV_SECTOR_BI= TS) =20 #define BLK_MIG_FLAG_DEVICE_BLOCK 0x01 #define BLK_MIG_FLAG_EOS 0x02 @@ -133,7 +133,7 @@ static void blk_send(QEMUFile *f, BlkMigBlock * blk) uint64_t flags =3D BLK_MIG_FLAG_DEVICE_BLOCK; =20 if (block_mig_state.zero_blocks && - buffer_is_zero(blk->buf, BLOCK_SIZE)) { + buffer_is_zero(blk->buf, BLK_MIG_BLOCK_SIZE)) { flags |=3D BLK_MIG_FLAG_ZERO_BLOCK; } =20 @@ -154,7 +154,7 @@ static void blk_send(QEMUFile *f, BlkMigBlock * blk) return; } =20 - qemu_put_buffer(f, blk->buf, BLOCK_SIZE); + qemu_put_buffer(f, blk->buf, BLK_MIG_BLOCK_SIZE); } =20 int blk_mig_active(void) @@ -309,7 +309,7 @@ static int mig_save_device_bulk(QEMUFile *f, BlkMigDevS= tate *bmds) } =20 blk =3D g_new(BlkMigBlock, 1); - blk->buf =3D g_malloc(BLOCK_SIZE); + blk->buf =3D g_malloc(BLK_MIG_BLOCK_SIZE); blk->bmds =3D bmds; blk->sector =3D cur_sector; blk->nr_sectors =3D nr_sectors; @@ -350,7 +350,8 @@ static int set_dirty_tracking(void) =20 QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { bmds->dirty_bitmap =3D bdrv_create_dirty_bitmap(blk_bs(bmds->blk), - BLOCK_SIZE, NULL, NU= LL); + BLK_MIG_BLOCK_SIZE, + NULL, NULL); if (!bmds->dirty_bitmap) { ret =3D -errno; goto fail; @@ -548,7 +549,7 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDev= State *bmds, bdrv_dirty_bitmap_unlock(bmds->dirty_bitmap); =20 blk =3D g_new(BlkMigBlock, 1); - blk->buf =3D g_malloc(BLOCK_SIZE); + blk->buf =3D g_malloc(BLK_MIG_BLOCK_SIZE); blk->bmds =3D bmds; blk->sector =3D sector; blk->nr_sectors =3D nr_sectors; @@ -770,7 +771,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque) =20 /* control the rate of transfer */ blk_mig_lock(); - while (block_mig_state.read_done * BLOCK_SIZE < + while (block_mig_state.read_done * BLK_MIG_BLOCK_SIZE < qemu_file_get_rate_limit(f) && block_mig_state.submitted < MAX_PARALLEL_IO && (block_mig_state.submitted + block_mig_state.read_done) < @@ -874,13 +875,13 @@ static void block_save_pending(QEMUFile *f, void *opa= que, uint64_t max_size, qemu_mutex_unlock_iothread(); =20 blk_mig_lock(); - pending +=3D block_mig_state.submitted * BLOCK_SIZE + - block_mig_state.read_done * BLOCK_SIZE; + pending +=3D block_mig_state.submitted * BLK_MIG_BLOCK_SIZE + + block_mig_state.read_done * BLK_MIG_BLOCK_SIZE; blk_mig_unlock(); =20 /* Report at least one block pending during bulk phase */ if (pending <=3D max_size && !block_mig_state.bulk_completed) { - pending =3D max_size + BLOCK_SIZE; + pending =3D max_size + BLK_MIG_BLOCK_SIZE; } =20 DPRINTF("Enter save live pending %" PRIu64 "\n", pending); @@ -901,7 +902,7 @@ static int block_load(QEMUFile *f, void *opaque, int ve= rsion_id) int nr_sectors; int ret; BlockDriverInfo bdi; - int cluster_size =3D BLOCK_SIZE; + int cluster_size =3D BLK_MIG_BLOCK_SIZE; =20 do { addr =3D qemu_get_be64(f); @@ -939,11 +940,11 @@ static int block_load(QEMUFile *f, void *opaque, int = version_id) =20 ret =3D bdrv_get_info(blk_bs(blk), &bdi); if (ret =3D=3D 0 && bdi.cluster_size > 0 && - bdi.cluster_size <=3D BLOCK_SIZE && - BLOCK_SIZE % bdi.cluster_size =3D=3D 0) { + bdi.cluster_size <=3D BLK_MIG_BLOCK_SIZE && + BLK_MIG_BLOCK_SIZE % bdi.cluster_size =3D=3D 0) { cluster_size =3D bdi.cluster_size; } else { - cluster_size =3D BLOCK_SIZE; + cluster_size =3D BLK_MIG_BLOCK_SIZE; } } =20 @@ -962,14 +963,14 @@ static int block_load(QEMUFile *f, void *opaque, int = version_id) int64_t cur_addr; uint8_t *cur_buf; =20 - buf =3D g_malloc(BLOCK_SIZE); - qemu_get_buffer(f, buf, BLOCK_SIZE); - for (i =3D 0; i < BLOCK_SIZE / cluster_size; i++) { + buf =3D g_malloc(BLK_MIG_BLOCK_SIZE); + qemu_get_buffer(f, buf, BLK_MIG_BLOCK_SIZE); + for (i =3D 0; i < BLK_MIG_BLOCK_SIZE / cluster_size; i++) { cur_addr =3D addr * BDRV_SECTOR_SIZE + i * cluster_siz= e; cur_buf =3D buf + i * cluster_size; =20 if ((!block_mig_state.zero_blocks || - cluster_size < BLOCK_SIZE) && + cluster_size < BLK_MIG_BLOCK_SIZE) && buffer_is_zero(cur_buf, cluster_size)) { ret =3D blk_pwrite_zeroes(blk, cur_addr, cluster_size, --=20 2.24.1