From nobody Sat Feb 7 08:41:58 2026 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=1664557713; cv=none; d=zohomail.com; s=zohoarc; b=dez/Vk8/izwq8G8znIirMec8+mXJw+P3gb5Qpo9bvXuBqqFNAI3wDApj+rM3ShCnjyAbVQT+e9IpIAMArZahHIUupcTXwOHNbPR/ThZtvOtdEdQh3XsbNyWIU1WcLcZRiIU8r1LjbFLEm4yZIcev6nDerI1HiY3ZwEfPp6QfZXU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664557713; 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=94mQ6MvpdlUf4Z02g1zIymucwp0QBlCPiasoMcG5Bug=; b=mOa3IHxpaERLar9BhedkPQR39oMjDY1fDAQDv09JKkJmZQEYcR7ZAtBtEniG9nVpLsCLkiRiPMO20IiPRCUEFxS/kBu8NlupfbrsixnldmEHjZVov7J5ZcfAtbTcgP6km5NGamXcWuv0HYZiV6hm0Jf8LIpowq/g9bXcQFILNaY= 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 1664557713128854.9489972262104; Fri, 30 Sep 2022 10:08:33 -0700 (PDT) Received: from localhost ([::1]:36970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oeJV2-0007sa-0O for importer@patchew.org; Fri, 30 Sep 2022 13:08:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeJFs-0006g7-7X for qemu-devel@nongnu.org; Fri, 30 Sep 2022 12:52:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60775) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeJFq-0006gF-1L for qemu-devel@nongnu.org; Fri, 30 Sep 2022 12:52:51 -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-558-cFJ1JLTJNwO-89vbKhIcBQ-1; Fri, 30 Sep 2022 12:52:46 -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 CD1EB882824; Fri, 30 Sep 2022 16:52:45 +0000 (UTC) Received: from merkur.fritz.box (unknown [10.39.192.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17FA817582; Fri, 30 Sep 2022 16:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664556769; 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=94mQ6MvpdlUf4Z02g1zIymucwp0QBlCPiasoMcG5Bug=; b=Hx8Gl7DOhP8HMQAthJQxxTaa98dMRxDN3B8+t6o8Si4sIYzY8B6RN7VQJlTlU/ww0KsxD+ 0wcWEyVgXPEFpKY/cb8wYvdqQrd3z9YOyunrB+aVruDLFhdlBSfNTLg+DuZ/OtFEVFoRLx 1Y3d2Jl+eUGwlcJEy8sBNt/gIxnZ6P0= X-MC-Unique: cFJ1JLTJNwO-89vbKhIcBQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org Subject: [PULL 12/18] block: move bdrv_qiov_is_aligned to file-posix Date: Fri, 30 Sep 2022 18:52:16 +0200 Message-Id: <20220930165222.249716-13-kwolf@redhat.com> In-Reply-To: <20220930165222.249716-1-kwolf@redhat.com> References: <20220930165222.249716-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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 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: 1664557714856100001 Content-Type: text/plain; charset="utf-8" From: Keith Busch There is only user of bdrv_qiov_is_aligned(), so move the alignment function to there and make it static. Signed-off-by: Keith Busch Message-Id: <20220929200523.3218710-2-kbusch@meta.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- include/block/block-io.h | 1 - block/file-posix.c | 21 +++++++++++++++++++++ block/io.c | 21 --------------------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/include/block/block-io.h b/include/block/block-io.h index fd25ffa9be..492f95fc05 100644 --- a/include/block/block-io.h +++ b/include/block/block-io.h @@ -150,7 +150,6 @@ void *qemu_blockalign(BlockDriverState *bs, size_t size= ); void *qemu_blockalign0(BlockDriverState *bs, size_t size); void *qemu_try_blockalign(BlockDriverState *bs, size_t size); void *qemu_try_blockalign0(BlockDriverState *bs, size_t size); -bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov); =20 void bdrv_enable_copy_on_read(BlockDriverState *bs); void bdrv_disable_copy_on_read(BlockDriverState *bs); diff --git a/block/file-posix.c b/block/file-posix.c index 256de1f456..989dfc4586 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2061,6 +2061,27 @@ static int coroutine_fn raw_thread_pool_submit(Block= DriverState *bs, return thread_pool_submit_co(pool, func, arg); } =20 +/* + * Check if all memory in this vector is sector aligned. + */ +static bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov) +{ + int i; + size_t alignment =3D bdrv_min_mem_align(bs); + IO_CODE(); + + for (i =3D 0; i < qiov->niov; i++) { + if ((uintptr_t) qiov->iov[i].iov_base % alignment) { + return false; + } + if (qiov->iov[i].iov_len % alignment) { + return false; + } + } + + return true; +} + static int coroutine_fn raw_co_prw(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int= type) { diff --git a/block/io.c b/block/io.c index 51d8f943a4..c3200bcdff 100644 --- a/block/io.c +++ b/block/io.c @@ -3227,27 +3227,6 @@ void *qemu_try_blockalign0(BlockDriverState *bs, siz= e_t size) return mem; } =20 -/* - * Check if all memory in this vector is sector aligned. - */ -bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov) -{ - int i; - size_t alignment =3D bdrv_min_mem_align(bs); - IO_CODE(); - - for (i =3D 0; i < qiov->niov; i++) { - if ((uintptr_t) qiov->iov[i].iov_base % alignment) { - return false; - } - if (qiov->iov[i].iov_len % alignment) { - return false; - } - } - - return true; -} - void bdrv_io_plug(BlockDriverState *bs) { BdrvChild *child; --=20 2.37.3