From nobody Fri May 3 06:43:21 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652879762; cv=none; d=zohomail.com; s=zohoarc; b=PDBlZPMn8Ztaj+dS/btkchgUH3P9A5DApeviG66PwWxPcwlm9tYPzf+vWiME5TYO2wWx01gqqE99GRL0MgbtTDiIIasrpjHgMZMXDyX+4KCd1hR/SDUEYD06MGWu1HaZ2aNg+lO4o+D21v2Gb1JzwnjpSUavBqUEla40PN5/Cv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652879762; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=K801eJCmU2pj2pPB6zBLBAL3MRfzoEeZW44TvBJ7tvo=; b=Nfar+svsTywBCqtX3hpVFCFU/h/VvLo0N1wpipWiEOhvdvvXUHHYVVoE2o22YBvmDzKS6bPZQgJBl44nWQ0yh8vrc8rrKIn/soMU2Unvp4CcZbaT/T2y9x/XMgOjH2imu8h+B7wBjB20K3uxC783oGR9bhHc+iI2pwPSOYUCTfo= 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+importer2=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 1652879762578584.3562964078217; Wed, 18 May 2022 06:16:02 -0700 (PDT) Received: from localhost ([::1]:58184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nrJWz-0004Hh-Hr for importer2@patchew.org; Wed, 18 May 2022 09:16:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nrJR2-00054c-UR for qemu-devel@nongnu.org; Wed, 18 May 2022 09:09:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:57648) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nrJR1-0006wU-2o for qemu-devel@nongnu.org; Wed, 18 May 2022 09:09:52 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-191-ngHoSp9hM-2D9F5m28W-Cg-1; Wed, 18 May 2022 09:09:48 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3041A294EDC0; Wed, 18 May 2022 13:09:48 +0000 (UTC) Received: from localhost (unknown [10.39.192.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id 596B4492CA2; Wed, 18 May 2022 13:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652879390; 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; bh=K801eJCmU2pj2pPB6zBLBAL3MRfzoEeZW44TvBJ7tvo=; b=hXIvzrcTjSvD83btU/Re6gnwDsYrtilp9SoAA1S/xpcTAs9V3Yfsmpy7TvplJCuDZGrj9E 8PO2Kdy9AnmEKZRxl6bXEparvhMmvE6fJxoJfyS0K6nn5JuQhrrxasUxCwoRnDZr6H96bq scT+iWcwR9kZEPkbR2B41bxZ4Hvz5sE= X-MC-Unique: ngHoSp9hM-2D9F5m28W-Cg-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Paul Durrant , Stefano Stabellini , John Snow , Paolo Bonzini , "Michael S. Tsirkin" , xen-devel@lists.xenproject.org, qemu-block@nongnu.org, Fam Zheng , Anthony Perard , Kevin Wolf , Hanna Reitz , Coiby Xu , Xie Yongji Subject: [PATCH] block: get rid of blk->guest_block_size Date: Wed, 18 May 2022 14:09:45 +0100 Message-Id: <20220518130945.2657905-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652879764872100001 Content-Type: text/plain; charset="utf-8" Commit 1b7fd729559c ("block: rename buffer_alignment to guest_block_size") noted: At this point, the field is set by the device emulation, but completely ignored by the block layer. The last time the value of buffer_alignment/guest_block_size was actually used was before commit 339064d50639 ("block: Don't use guest sector size for qemu_blockalign()"). This value has not been used since 2013. Get rid of it. Cc: Xie Yongji Signed-off-by: Stefan Hajnoczi Reviewed-by: Alberto Faria Reviewed-by: Eric Blake Reviewed-by: Paul Durrant --- include/sysemu/block-backend-io.h | 1 - block/block-backend.c | 10 ---------- block/export/vhost-user-blk-server.c | 1 - hw/block/virtio-blk.c | 1 - hw/block/xen-block.c | 1 - hw/ide/core.c | 1 - hw/scsi/scsi-disk.c | 1 - hw/scsi/scsi-generic.c | 1 - 8 files changed, 17 deletions(-) diff --git a/include/sysemu/block-backend-io.h b/include/sysemu/block-backe= nd-io.h index 6517c39295..ccef514023 100644 --- a/include/sysemu/block-backend-io.h +++ b/include/sysemu/block-backend-io.h @@ -72,7 +72,6 @@ void blk_error_action(BlockBackend *blk, BlockErrorAction= action, void blk_iostatus_set_err(BlockBackend *blk, int error); int blk_get_max_iov(BlockBackend *blk); int blk_get_max_hw_iov(BlockBackend *blk); -void blk_set_guest_block_size(BlockBackend *blk, int align); =20 void blk_io_plug(BlockBackend *blk); void blk_io_unplug(BlockBackend *blk); diff --git a/block/block-backend.c b/block/block-backend.c index e0e1aff4b1..d4abdf8faa 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -56,9 +56,6 @@ struct BlockBackend { const BlockDevOps *dev_ops; void *dev_opaque; =20 - /* the block size for which the guest device expects atomicity */ - int guest_block_size; - /* If the BDS tree is removed, some of its options are stored here (wh= ich * can be used to restore those options in the new BDS on insert) */ BlockBackendRootState root_state; @@ -998,7 +995,6 @@ void blk_detach_dev(BlockBackend *blk, DeviceState *dev) blk->dev =3D NULL; blk->dev_ops =3D NULL; blk->dev_opaque =3D NULL; - blk->guest_block_size =3D 512; blk_set_perm(blk, 0, BLK_PERM_ALL, &error_abort); blk_unref(blk); } @@ -2100,12 +2096,6 @@ int blk_get_max_iov(BlockBackend *blk) return blk->root->bs->bl.max_iov; } =20 -void blk_set_guest_block_size(BlockBackend *blk, int align) -{ - IO_CODE(); - blk->guest_block_size =3D align; -} - void *blk_try_blockalign(BlockBackend *blk, size_t size) { IO_CODE(); diff --git a/block/export/vhost-user-blk-server.c b/block/export/vhost-user= -blk-server.c index a129204c44..b2e458ade3 100644 --- a/block/export/vhost-user-blk-server.c +++ b/block/export/vhost-user-blk-server.c @@ -495,7 +495,6 @@ static int vu_blk_exp_create(BlockExport *exp, BlockExp= ortOptions *opts, return -EINVAL; } vexp->blk_size =3D logical_block_size; - blk_set_guest_block_size(exp->blk, logical_block_size); =20 if (vu_opts->has_num_queues) { num_queues =3D vu_opts->num_queues; diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index cd804795c6..e9ba752f6b 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1228,7 +1228,6 @@ static void virtio_blk_device_realize(DeviceState *de= v, Error **errp) =20 s->change =3D qemu_add_vm_change_state_handler(virtio_blk_dma_restart_= cb, s); blk_set_dev_ops(s->blk, &virtio_block_ops, s); - blk_set_guest_block_size(s->blk, s->conf.conf.logical_block_size); =20 blk_iostatus_enable(s->blk); =20 diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 674953f1ad..345b284d70 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -243,7 +243,6 @@ static void xen_block_realize(XenDevice *xendev, Error = **errp) } =20 blk_set_dev_ops(blk, &xen_block_dev_ops, blockdev); - blk_set_guest_block_size(blk, conf->logical_block_size); =20 if (conf->discard_granularity =3D=3D -1) { conf->discard_granularity =3D conf->physical_block_size; diff --git a/hw/ide/core.c b/hw/ide/core.c index 3a5afff5d7..f7ec68513f 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2544,7 +2544,6 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, ID= EDriveKind kind, s->smart_selftest_count =3D 0; if (kind =3D=3D IDE_CD) { blk_set_dev_ops(blk, &ide_cd_block_ops, s); - blk_set_guest_block_size(blk, 2048); } else { if (!blk_is_inserted(s->blk)) { error_setg(errp, "Device needs media, but drive is empty"); diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 072686ed58..91acb5c0ce 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2419,7 +2419,6 @@ static void scsi_realize(SCSIDevice *dev, Error **err= p) } else { blk_set_dev_ops(s->qdev.conf.blk, &scsi_disk_block_ops, s); } - blk_set_guest_block_size(s->qdev.conf.blk, s->qdev.blocksize); =20 blk_iostatus_enable(s->qdev.conf.blk); =20 diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 0ab00ef85c..ada24d7486 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -321,7 +321,6 @@ static void scsi_read_complete(void * opaque, int ret) s->blocksize =3D ldl_be_p(&r->buf[8]); s->max_lba =3D ldq_be_p(&r->buf[0]); } - blk_set_guest_block_size(s->conf.blk, s->blocksize); =20 /* * Patch MODE SENSE device specific parameters if the BDS is opened --=20 2.36.1