From patchwork Thu Jun 11 17:16:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 11600489 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDE536A2 for ; Thu, 11 Jun 2020 17:16:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BED8620829 for ; Thu, 11 Jun 2020 17:16:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BED8620829 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=openvz.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjQp1-0005Gi-0d for patchwork-qemu-devel@patchwork.kernel.org; Thu, 11 Jun 2020 13:16:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjQoJ-00043H-PE; Thu, 11 Jun 2020 13:16:15 -0400 Received: from relay.sw.ru ([185.231.240.75]:36376 helo=relay3.sw.ru) by eggs.gnu.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjQoF-0001fz-Po; Thu, 11 Jun 2020 13:16:15 -0400 Received: from [192.168.15.81] (helo=iris.sw.ru) by relay3.sw.ru with esmtp (Exim 4.93) (envelope-from ) id 1jjQo9-0000E7-HU; Thu, 11 Jun 2020 20:16:05 +0300 From: "Denis V. Lunev" To: qemu-block@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 0/2] block: propagate discard alignment from format drivers to the guest Date: Thu, 11 Jun 2020 20:16:06 +0300 Message-Id: <20200611171608.22052-1-den@openvz.org> X-Mailer: git-send-email 2.17.1 Received-SPF: pass client-ip=185.231.240.75; envelope-from=den@openvz.org; helo=relay3.sw.ru X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/11 13:11:47 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: Kevin Wolf , Fam Zheng , Eduardo Habkost , Max Reitz , Paolo Bonzini , "Denis V . Lunev" , John Snow Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Nowaday SCSI drivers in guests are able to align UNMAP requests before sending to the device. Right now QEMU provides an ability to set this via "discard_granularity" property of the block device which could be used by management layer. Though, in particular, from the point of QEMU, there is pdiscard_granularity on the format driver level, f.e. on QCOW2 or iSCSI. It would be beneficial to pass this value as a default for this property. Technically this should reduce the amount of use less UNMAP requests from the guest to the host. Basic test confirms this. Fedora 31 guest during 'fstrim /' on 32 Gb disk has issued 401/415 requests with/without proper alignment to QEMU. Changes from v2: - 172 iotest fixed Changes from v1: - fixed typos in description - added machine type compatibility layer as suggested by Kevin Signed-off-by: Denis V. Lunev CC: Kevin Wolf CC: Max Reitz CC: Eduardo Habkost CC: Marcel Apfelbaum CC: John Snow CC: Paolo Bonzini CC: Fam Zheng