From nobody Wed Dec 17 05:40:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1654800597; cv=none; d=zohomail.com; s=zohoarc; b=EhZk3gMxOZJgyynZNa5DOCrKCc7W9Ymm3XwrtrZxw89xLKWIFZVZKde51k25hQOFLQfVsVzLhzxN42lB/eHSo8LSlDIGIPYIJNTMVVojzEvbgFT715f0HAr4PCngyM41P4tgUWzQWoX9mRDOqjiegEzrKI3DQJz2SHFCNHe7GTE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654800597; h=Content-Transfer-Encoding:Cc: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=AVFXcIblIZ7wyt78pu+fozyB70XxhKCqNq97rujT4xs=; b=V+QOr3JBtMOQZYgCGW+mrmvih5xDKEezy8fhgORG9sU6q8L+CIauwppcHozw0ShwPZ7ZxvBUm+r6PcfeKTdxfFhR/sAJaBPHVGJ2IQroHF37h/UQzYoxf3q6OAgBcltlB1cGZwKUqKd9nRYf62aqnYQo5KoTrKAMo1vx6OP2z4g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654800597760349.1248179517944; Thu, 9 Jun 2022 11:49:57 -0700 (PDT) Received: from localhost ([::1]:43990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzNEB-00061s-TA for importer@patchew.org; Thu, 09 Jun 2022 14:49:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzLro-0007rB-QJ for qemu-devel@nongnu.org; Thu, 09 Jun 2022 13:22:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45791) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzLrd-0003gY-St for qemu-devel@nongnu.org; Thu, 09 Jun 2022 13:22:37 -0400 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-460-A-xKZGsnNjmZ_nH-UkSsjQ-1; Thu, 09 Jun 2022 13:22:23 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 45975802804; Thu, 9 Jun 2022 17:22:23 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.195.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id A555F4010E32; Thu, 9 Jun 2022 17:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654795345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AVFXcIblIZ7wyt78pu+fozyB70XxhKCqNq97rujT4xs=; b=DagO1N5XL28XyetO2I3dXWAqDBGtiEfYyam6KTMvuIueTpQwp5GJPmti9CLyBwFOgrQgnw nzx18VYvLeXYuAgz1Ks92mau/AHy7UuGXeB8rllNgZlzh+ceLsbI1vo1UE+muvqbEUrkjZ yeBvKm8y2ES0BtjO184JW/K0xWjh8qE= X-MC-Unique: A-xKZGsnNjmZ_nH-UkSsjQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [PULL 12/18] vduse-blk: Add vduse-blk resize support Date: Thu, 9 Jun 2022 19:21:43 +0200 Message-Id: <20220609172149.293877-13-kwolf@redhat.com> In-Reply-To: <20220609172149.293877-1-kwolf@redhat.com> References: <20220609172149.293877-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654800599240100001 Content-Type: text/plain; charset="utf-8" From: Xie Yongji To support block resize, this uses vduse_dev_update_config() to update the capacity field in configuration space and inject config interrupt on the block resize callback. Signed-off-by: Xie Yongji Reviewed-by: Stefan Hajnoczi Message-Id: <20220523084611.91-8-xieyongji@bytedance.com> Signed-off-by: Kevin Wolf --- block/export/vduse-blk.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/block/export/vduse-blk.c b/block/export/vduse-blk.c index 143d58a3f2..1040130f52 100644 --- a/block/export/vduse-blk.c +++ b/block/export/vduse-blk.c @@ -184,6 +184,23 @@ static void blk_aio_detach(void *opaque) vblk_exp->export.ctx =3D NULL; } =20 +static void vduse_blk_resize(void *opaque) +{ + BlockExport *exp =3D opaque; + VduseBlkExport *vblk_exp =3D container_of(exp, VduseBlkExport, export); + struct virtio_blk_config config; + + config.capacity =3D + cpu_to_le64(blk_getlength(exp->blk) >> VIRTIO_BLK_SECTOR_BITS); + vduse_dev_update_config(vblk_exp->dev, sizeof(config.capacity), + offsetof(struct virtio_blk_config, capacity), + (char *)&config.capacity); +} + +static const BlockDevOps vduse_block_ops =3D { + .resize_cb =3D vduse_blk_resize, +}; + static int vduse_blk_exp_create(BlockExport *exp, BlockExportOptions *opts, Error **errp) { @@ -279,6 +296,8 @@ static int vduse_blk_exp_create(BlockExport *exp, Block= ExportOptions *opts, blk_add_aio_context_notifier(exp->blk, blk_aio_attached, blk_aio_detac= h, vblk_exp); =20 + blk_set_dev_ops(exp->blk, &vduse_block_ops, exp); + return 0; } =20 @@ -288,6 +307,7 @@ static void vduse_blk_exp_delete(BlockExport *exp) =20 blk_remove_aio_context_notifier(exp->blk, blk_aio_attached, blk_aio_de= tach, vblk_exp); + blk_set_dev_ops(exp->blk, NULL, NULL); vduse_dev_destroy(vblk_exp->dev); } =20 --=20 2.35.3