From nobody Sat Feb 7 18:29:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; spf=pass (zoho.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=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1570848078; cv=none; d=zoho.com; s=zohoarc; b=e2mNttlCKKLmqsR2+IemgP0BOvopaZ6ebrFJkErWBLfL5L8MHPU/edpgTsBTUtLRPOEAIrMvCJacEjeReKEJD4YY5bJtFAHJriEW/bD4vULlJ37Oss0OAEk5n/sC5tDa5Td8lH/fGNihGb/BIkOVoJhoUVX+ocjo0M5VtE9r048= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570848078; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=8Qtusb7GCfoLVRsmIr/aL5ArMTwiKfL6/RCH5Yb0Nzo=; b=kJq4/8Bpb4ujpRTdjzw4w3OBcWNkKMqMo4RyGR2fwQ0qFQT6xvgze8v4H3iWZgXy/7pB4F11bCcEDhXZPz8+k7UDFGzY7SThvhMGK+wV7gljOi148v5PadM92DaRsACR23uuWYnmitS//p0qKBvZeIyJVuM0zck2Y4f8673Dguc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1570848078656652.03163895017; Fri, 11 Oct 2019 19:41:18 -0700 (PDT) Received: from localhost ([::1]:58356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJ7LJ-0005MQ-Fb for importer@patchew.org; Fri, 11 Oct 2019 22:41:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54816) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJ7KA-00045i-OG for qemu-devel@nongnu.org; Fri, 11 Oct 2019 22:40:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iJ7K9-0001IK-Ov for qemu-devel@nongnu.org; Fri, 11 Oct 2019 22:40:06 -0400 Received: from mga17.intel.com ([192.55.52.151]:11741) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iJ7K9-0001Hj-Gb for qemu-devel@nongnu.org; Fri, 11 Oct 2019 22:40:05 -0400 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2019 19:40:04 -0700 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga006.fm.intel.com with ESMTP; 11 Oct 2019 19:40:03 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,286,1566889200"; d="scan'208";a="395935154" From: Wei Yang To: quintela@redhat.com, dgilbert@redhat.com Subject: [PATCH 1/2] migration/compress: compress QEMUFile is not writable Date: Sat, 12 Oct 2019 10:39:31 +0800 Message-Id: <20191012023932.1863-2-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191012023932.1863-1-richardw.yang@linux.intel.com> References: <20191012023932.1863-1-richardw.yang@linux.intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.151 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: qemu-devel@nongnu.org, Wei Yang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We open a file with empty_ops for compress QEMUFile, which means this is not writable. Signed-off-by: Wei Yang Reviewed-by: Juan Quintela --- migration/qemu-file.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 26fb25ddc1..f3d99a96ec 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -744,11 +744,8 @@ static int qemu_compress_data(z_stream *stream, uint8_= t *dest, size_t dest_len, /* Compress size bytes of data start at p and store the compressed * data to the buffer of f. * - * When f is not writable, return -1 if f has no space to save the - * compressed data. - * When f is wirtable and it has no space to save the compressed data, - * do fflush first, if f still has no space to save the compressed - * data, return -1. + * Since the file is dummy file with empty_ops, return -1 if f has no spac= e to + * save the compressed data. */ ssize_t qemu_put_compression_data(QEMUFile *f, z_stream *stream, const uint8_t *p, size_t size) @@ -756,14 +753,7 @@ ssize_t qemu_put_compression_data(QEMUFile *f, z_strea= m *stream, ssize_t blen =3D IO_BUF_SIZE - f->buf_index - sizeof(int32_t); =20 if (blen < compressBound(size)) { - if (!qemu_file_is_writable(f)) { - return -1; - } - qemu_fflush(f); - blen =3D IO_BUF_SIZE - sizeof(int32_t); - if (blen < compressBound(size)) { - return -1; - } + return -1; } =20 blen =3D qemu_compress_data(stream, f->buf + f->buf_index + sizeof(int= 32_t), --=20 2.17.1