From patchwork Mon Sep 27 15:50:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christian Schoenebeck X-Patchwork-Id: 12520277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5B67C433F5 for ; Mon, 27 Sep 2021 16:12:26 +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 80C1760D42 for ; Mon, 27 Sep 2021 16:12:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 80C1760D42 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=crudebyte.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:51200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUtEv-0003c1-Iw for qemu-devel@archiver.kernel.org; Mon, 27 Sep 2021 12:12:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUtDb-00028x-05 for qemu-devel@nongnu.org; Mon, 27 Sep 2021 12:11:03 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:36719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUtDZ-0001SN-Ky for qemu-devel@nongnu.org; Mon, 27 Sep 2021 12:11:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Content-Transfer-Encoding:Content-Type: MIME-Version:Subject:Date:From:References:In-Reply-To:Message-Id:Content-ID: Content-Description; bh=KjW0FdByYiNjWRRemmOXkRC6wmk7QwbmkjtN0R9DSeE=; b=jX6GY NmBUcvL4HyGSrIXL44htjvh1GSVBL75YSya4tU/sBJfDC0R+DLV+6yJ144tXkm9mFV2txeufPhQM+ Acw1QmPUfUHZh5nNcgNb+XkuMPR4HLY2IZlB6PWBV93D5BY8sueRPAK7d1TqSbolWBCcdVfHiUmEa Z+tBe2p5vx/uZPicLv6sfq0LkQB/QU0zBXMJG2Oobnzi3SmsPdOIMoHIpAwAPTyhR+h8k8AHd5H+E Bz0Gq9hnDAEWoa0sGHrGewzGB0R3fUbeIBJL+z6YcQJZ57vmKC6BOo8KvQGXUNGi4YrG7fUw48iCu YZVEQ9uiqkc9K9HQtEc7c6vJAYGog==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 27 Sep 2021 17:50:36 +0200 Subject: [PATCH 2/2] 9pfs: simplify blksize_to_iounit() MIME-Version: 1.0 To: qemu-devel@nongnu.org Cc: =?unknown-8bit?b?R3JlZyBLdXJ6IDxncm91Z0BrYW9kLm9yZz4s?= =?unknown-8bit?q?_Philippe_Mathieu-Daud=C3=A9_=3Cphilmd=40redhat=2Ecom=3E?= Received-SPF: none client-ip=91.194.90.13; envelope-from=b84eb324d2ebdcc6f9c442c97b5b4d01eecb4f43@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Use QEMU_ALIGN_DOWN() macro to reduce code and to make it more human readable. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Reviewed-by: Philippe Mathieu-Daudé --- hw/9pfs/9p.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index c65584173a..29cc19c90a 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1280,8 +1280,7 @@ static int32_t blksize_to_iounit(const V9fsPDU *pdu, int32_t blksize) * as well as less than (client msize - P9_IOHDRSZ) */ if (blksize) { - iounit = blksize; - iounit *= (s->msize - P9_IOHDRSZ) / blksize; + iounit = QEMU_ALIGN_DOWN(s->msize - P9_IOHDRSZ, blksize); } if (!iounit) { iounit = s->msize - P9_IOHDRSZ;