From patchwork Thu Jan 31 15:19:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Garzarella X-Patchwork-Id: 10790797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6DD8E13A4 for ; Thu, 31 Jan 2019 15:21:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6074631394 for ; Thu, 31 Jan 2019 15:21:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54C6A313FB; Thu, 31 Jan 2019 15:21:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DE72A31394 for ; Thu, 31 Jan 2019 15:21:01 +0000 (UTC) Received: from localhost ([127.0.0.1]:56322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpE9E-0005MS-G1 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 31 Jan 2019 10:21:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpE7t-0004FD-L0 for qemu-devel@nongnu.org; Thu, 31 Jan 2019 10:19:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gpE7r-0007a3-Kz for qemu-devel@nongnu.org; Thu, 31 Jan 2019 10:19:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46786) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gpE7j-0007QQ-0i; Thu, 31 Jan 2019 10:19:27 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7316D88312; Thu, 31 Jan 2019 15:19:23 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-117-151.ams2.redhat.com [10.36.117.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2BA719492; Thu, 31 Jan 2019 15:19:15 +0000 (UTC) From: Stefano Garzarella To: qemu-devel@nongnu.org Date: Thu, 31 Jan 2019 16:19:09 +0100 Message-Id: <20190131151914.164903-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 31 Jan 2019 15:19:23 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 0/5] virtio-blk: add DISCARD and WRITE ZEROES features 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: Kevin Wolf , Laurent Vivier , Thomas Huth , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , "Dr . David Alan Gilbert" , Max Reitz , Stefan Hajnoczi , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This series adds the support of DISCARD and WRITE ZEROES commands and extends the virtio-blk-test to test WRITE_ZEROES command when the feature is enabled. v2: - added patch 1 to use virtio_blk_handle_rw_error() with discard operation - added patch 2 to make those new features machine-type dependent (thanks David) - fixed patch 3 (previously patch 1/2) adding more checks, block_acct_start() for WRITE_ZEROES requests, and configurable parameters to initialize the limits (max_sectors, wzeroes_may_unmap). (thanks Stefan) I moved in a new function the code to handle a single segment, in order to simplify the support of multiple segments in the future. - added patch 4 to change the assert on data_size following the discussion with Thomas, Changpeng, Michael, and Stefan (thanks all) - fixed patch 5 (previously patch 2/2) using local dwz_hdr variable instead of dynamic allocation (thanks Thomas) This series requires the new virtio headers from linux v5.0-rc1 already imported by Paolo: Based-on: <20190104082731.24967-1-pbonzini@redhat.com> Thanks, Stefano Stefano Garzarella (5): virtio-blk: add acct_failed param to virtio_blk_handle_rw_error() virtio-blk: add "discard-wzeroes" boolean property virtio-blk: add DISCARD and WRITE ZEROES features tests/virtio-blk: change assert on data_size in virtio_blk_request() tests/virtio-blk: add test for WRITE_ZEROES command hw/block/virtio-blk.c | 185 ++++++++++++++++++++++++++++++++- hw/core/machine.c | 1 + include/hw/virtio/virtio-blk.h | 3 + tests/virtio-blk-test.c | 75 ++++++++++++- 4 files changed, 259 insertions(+), 5 deletions(-) Reviewed-by: Michael S. Tsirkin