From nobody Sun May 19 09:08:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690976893; cv=none; d=zohomail.com; s=zohoarc; b=jbAWnUGmbjww9z6d17BGyJR/FvgyPrsZpRwBmdIelbPtB9JgrydLZz2TCksMC0O3le3WOxc1UCOXZfhHS2QdpxZ6lR11ki64Lx2XIa185RpAkD2z+tGkaUhZ8JtEQgQLgHxGKU6relAv5vmE8PeBpLGcOdZH5l44OB1vXvwCRBY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690976893; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Or32zodnLjtzAnx8u8flo/F9BR1MOMkRDUm93LAht4c=; b=UEbgpfRmoLeXQeqxU+3/N0auTEW/RvCAqsspVQVyinSvbB/lUwkjqTeGcIDnuiK3huotMsjRduHUnBeQYGAjZA1p/O5OVvNG0nc1a9pkDnXzvJsp1NS7uvGoWWCnIgZ1mCYD0kcUWmtd/txJhSCNcaqXS0FSd1Ol0+0PMIthfU4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1690976893473248.15443084336903; Wed, 2 Aug 2023 04:48:13 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-552-atVY0_joPNCUVahf8dM8-A-1; Wed, 02 Aug 2023 07:48:08 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2AFF18AE94A; Wed, 2 Aug 2023 11:48:04 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5CCE4F7FAD; Wed, 2 Aug 2023 11:48:04 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4A3BD1947220; Wed, 2 Aug 2023 11:48:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3ADD81946A43 for ; Wed, 2 Aug 2023 11:48:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2BF22C57963; Wed, 2 Aug 2023 11:48:02 +0000 (UTC) Received: from fedora.. (unknown [10.43.2.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7C37C57964 for ; Wed, 2 Aug 2023 11:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690976892; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Or32zodnLjtzAnx8u8flo/F9BR1MOMkRDUm93LAht4c=; b=hF4wrgWc/NL1+ntRJtYbQ1mkWvg7KkvL+Bd+bwEm1nZXZ9ZLm5I7v7KcqzQ9yuYL1Oj4CQ 6uHhaXmjsHnpUrtF+/eH9Y/GlJyM4hd4wMy4c7kOtGY+jpyfIri0oIHZMo2fLrHblQ0YaN Mq80js7VRRpTU9RIsk/jIzIbUiugvv0= X-MC-Unique: atVY0_joPNCUVahf8dM8-A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH 1/5] conf: add support for discard_granularity Date: Wed, 2 Aug 2023 13:47:14 +0200 Message-ID: <0371454e3c171a4d4f3da92041c11949354bcb4e.1690975692.git.khanicov@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690976894973100007 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Kristina Hanicova --- docs/formatdomain.rst | 6 +++++- src/conf/domain_conf.c | 12 +++++++++++- src/conf/domain_conf.h | 1 + src/conf/domain_validate.c | 3 ++- src/conf/schemas/domaincommon.rng | 5 +++++ src/qemu/qemu_domain.c | 2 ++ 6 files changed, 26 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index cd9cb02bf8..0d0812f08c 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2588,7 +2588,7 @@ paravirtualized driver is specified via the ``disk`` = element. - + @@ -3435,6 +3435,10 @@ paravirtualized driver is specified via the ``disk``= element. this would be the value returned by the BLKPBSZGET ioctl and describ= es the disk's hardware sector size which can be relevant for the alignment = of disk data. + ``discard_granularity`` + The smallest amount of data that can be discarded in a single operat= ion. + It impacts the unmap operations and it must be a multiple of a + ``logical_block_size``. =20 Filesystems ~~~~~~~~~~~ diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5ac5c0b771..950c9049ba 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8055,6 +8055,10 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt, if (virXMLPropUInt(blockioNode, "physical_block_size", 10, VIR_XML= _PROP_NONE, &def->blockio.physical_block_size) < 0) return NULL; + + if (virXMLPropUInt(blockioNode, "discard_granularity", 10, VIR_XML= _PROP_NONE, + &def->blockio.discard_granularity) < 0) + return NULL; } =20 if ((driverNode =3D virXPathNode("./driver", ctxt))) { @@ -22035,7 +22039,8 @@ virDomainDiskBlockIoDefFormat(virBuffer *buf, virDomainDiskDef *def) { if (def->blockio.logical_block_size > 0 || - def->blockio.physical_block_size > 0) { + def->blockio.physical_block_size > 0 || + def->blockio.discard_granularity > 0) { virBufferAddLit(buf, "blockio.logical_block_size > 0) { virBufferAsprintf(buf, @@ -22047,6 +22052,11 @@ virDomainDiskBlockIoDefFormat(virBuffer *buf, " physical_block_size=3D'%u'", def->blockio.physical_block_size); } + if (def->blockio.discard_granularity > 0) { + virBufferAsprintf(buf, + " discard_granularity=3D'%u'", + def->blockio.discard_granularity); + } virBufferAddLit(buf, "/>\n"); } } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c857ba556f..1621876a21 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -579,6 +579,7 @@ struct _virDomainDiskDef { struct { unsigned int logical_block_size; unsigned int physical_block_size; + unsigned int discard_granularity; } blockio; =20 virDomainBlockIoTuneInfo blkdeviotune; diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index ad383b604e..7e00b6451a 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -466,7 +466,8 @@ virDomainDiskVhostUserValidate(const virDomainDiskDef *= disk) } =20 if (disk->blockio.logical_block_size > 0 || - disk->blockio.physical_block_size > 0) { + disk->blockio.physical_block_size > 0 || + disk->blockio.discard_granularity > 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("blockio is not supported with vhostuser disk")); return -1; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index c2f56b0490..ee9c408a21 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -2476,6 +2476,11 @@ + + + + +