From patchwork Sat Feb 20 17:39:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 8367531 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5B4BAC0553 for ; Sat, 20 Feb 2016 17:40:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CA09B2034C for ; Sat, 20 Feb 2016 17:40:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2FAC12013A for ; Sat, 20 Feb 2016 17:40:23 +0000 (UTC) Received: from localhost ([::1]:34455 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXBW2-0004Ec-IU for patchwork-qemu-devel@patchwork.kernel.org; Sat, 20 Feb 2016 12:40:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXBVl-00045V-TQ for qemu-devel@nongnu.org; Sat, 20 Feb 2016 12:40:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXBVl-0000Kq-5I for qemu-devel@nongnu.org; Sat, 20 Feb 2016 12:40:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33861) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXBVj-0000Ih-5d; Sat, 20 Feb 2016 12:40:03 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id C51F7C000706; Sat, 20 Feb 2016 17:40:02 +0000 (UTC) Received: from localhost (ovpn-116-33.ams2.redhat.com [10.36.116.33]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1KHe1vE003686 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 20 Feb 2016 12:40:02 -0500 From: Max Reitz To: qemu-block@nongnu.org Date: Sat, 20 Feb 2016 18:39:51 +0100 Message-Id: <1455989993-1917-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1455989993-1917-1-git-send-email-mreitz@redhat.com> References: <1455989993-1917-1-git-send-email-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Fam Zheng , qemu-devel@nongnu.org, Max Reitz Subject: [Qemu-devel] [PATCH 2/4] block/null-{co, aio}: Return zeros when read X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, we do not define exactly what is returned when read, but having a reliable source of zeros is always nice. Signed-off-by: Max Reitz --- block/null.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/null.c b/block/null.c index d90165d..ad883d9 100644 --- a/block/null.c +++ b/block/null.c @@ -90,6 +90,7 @@ static coroutine_fn int null_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { + qemu_iovec_memset(qiov, 0, 0, nb_sectors * BDRV_SECTOR_SIZE); return null_co_common(bs); } @@ -159,6 +160,7 @@ static BlockAIOCB *null_aio_readv(BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque) { + qemu_iovec_memset(qiov, 0, 0, nb_sectors * BDRV_SECTOR_SIZE); return null_aio_common(bs, cb, opaque); }