From mboxrd@z Thu Jan 1 00:00:00 1970 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 C79FAC433F5 for ; Mon, 27 Sep 2021 16:29:59 +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 87C9260F9B for ; Mon, 27 Sep 2021 16:29:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 87C9260F9B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:42954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUtVu-0000i7-IQ for qemu-devel@archiver.kernel.org; Mon, 27 Sep 2021 12:29:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUtUi-0007Ih-Fn for qemu-devel@nongnu.org; Mon, 27 Sep 2021 12:28:44 -0400 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:47601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUtUg-0000Ao-Mv for qemu-devel@nongnu.org; Mon, 27 Sep 2021 12:28:44 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-458-SyGz2NCYPEu4OkpebxTplA-1; Mon, 27 Sep 2021 12:28:38 -0400 X-MC-Unique: SyGz2NCYPEu4OkpebxTplA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 972021006AA3; Mon, 27 Sep 2021 16:28:37 +0000 (UTC) Received: from bahia.huguette (unknown [10.39.192.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E8E81972E; Mon, 27 Sep 2021 16:28:32 +0000 (UTC) Date: Mon, 27 Sep 2021 18:28:31 +0200 From: Greg Kurz To: Christian Schoenebeck Subject: Re: [PATCH 2/2] 9pfs: simplify blksize_to_iounit() Message-ID: <20210927182831.2cee0cf8@bahia.huguette> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=groug@kaod.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: softfail client-ip=205.139.111.44; envelope-from=groug@kaod.org; helo=us-smtp-delivery-44.mimecast.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no 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: , Cc: Philippe =?UTF-8?B?TWF0aGlldS1EYXVkw6k=?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Mon, 27 Sep 2021 17:50:36 +0200 Christian Schoenebeck wrote: > Use QEMU_ALIGN_DOWN() macro to reduce code and to make it > more human readable. >=20 > Suggested-by: Philippe Mathieu-Daud=C3=A9 > Signed-off-by: Christian Schoenebeck > --- Reviewed-by: Greg Kurz > hw/9pfs/9p.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) >=20 > 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 =3D blksize; > - iounit *=3D (s->msize - P9_IOHDRSZ) / blksize; > + iounit =3D QEMU_ALIGN_DOWN(s->msize - P9_IOHDRSZ, blksize); > } > if (!iounit) { > iounit =3D s->msize - P9_IOHDRSZ;