Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4171641pxj; Tue, 25 May 2021 01:53:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaVROq9/jcew2sGCOYb6c39lpvDO7tMFCb5a5qTdXbjGjR2qLI7hj+svkshqTvpHaMhDdK X-Received: by 2002:a17:906:8389:: with SMTP id p9mr28369131ejx.106.1621932837326; Tue, 25 May 2021 01:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621932837; cv=none; d=google.com; s=arc-20160816; b=lQBoH/ifsdLb+hPf+Au4ovRr1D5RntoDCKKuYxpuk6yfcjcmf/0JpGEj8pzo2othRD 25zneB58YTyEhiCKH6Juu58MnGMHNBql6kYjXq7EzCi/VhePCxdXZT4kh5mcd/ylkb96 6XliiSQFZVqIVCm1T8pb0RgQvpEs91tNrFUu1zJYM2MCPhrsaaxAJMI7F4y/JsM7S9fY BV6jHBoo9hiTMTkiml7Lib54kOEZm1G2dMhKLO8jeOllTF9NjWxnK1yv62Tvm0HaG6GW a6j6qMqLWZWFhMLpzetKt3/3aOUFtYbG8wChZgHSWpO9XmwCIgIFPlHD6BKQAeoBAEe5 tN6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-disposition :mime-version:user-agent:in-reply-to:references:subject:cc:to:from :message-id:date; bh=ksq9CUfaaIYt80MCdskXeGK8uNcDmGnbDvWQhihB0Dk=; b=Gu7BjY3CHq9OOq3BZghzFDCwXCKs54+QvFQBC5dnCdixNWauinurEx2tizWQEwgTX5 QeAOBBwhTx1gWOiMDq4ORB+Ppiws0maEdzzgFm8pzOMPpBBE5SdpBcSmmbkFqc46D6ib B1NmvFz73yaAAYBRCVHv5PCAunG0jndb/KqOKNb85WN69fuDQv0RkOS0FoZuA+VkMLYO Cw8j5TCW4WBhlxtp2QCu+OEul+YpEa4MfEomK3FqFUWR4KAb/79sfBq5s+W4qjaqPyqM 1rf2UEiK3FvGhkwWIrNPPBeGhUU9UnfHD5Og/y9Fou50ZHU+gP9BCu4xbXhz+02Iwv60 EMyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l1si10458543edq.336.2021.05.25.01.53.34; Tue, 25 May 2021 01:53:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231515AbhEYIfi convert rfc822-to-8bit (ORCPT + 99 others); Tue, 25 May 2021 04:35:38 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:38888 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231282AbhEYIff (ORCPT ); Tue, 25 May 2021 04:35:35 -0400 Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4Fq6n90HXKzBByZ; Tue, 25 May 2021 10:34:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bCjmXtHDn76g; Tue, 25 May 2021 10:34:04 +0200 (CEST) Received: from vm-hermes.si.c-s.fr (vm-hermes.si.c-s.fr [192.168.25.253]) by pegase1.c-s.fr (Postfix) with ESMTP id 4Fq6n86QgLzBBxw; Tue, 25 May 2021 10:34:04 +0200 (CEST) Received: by vm-hermes.si.c-s.fr (Postfix, from userid 33) id 2C5DBBBC; Tue, 25 May 2021 10:38:30 +0200 (CEST) Received: from 37.173.125.11 ([37.173.125.11]) by messagerie.c-s.fr (Horde Framework) with HTTP; Tue, 25 May 2021 10:38:30 +0200 Date: Tue, 25 May 2021 10:38:30 +0200 Message-ID: <20210525103830.Horde.TfZkOjej0Mdf8d8SMAnj2w1@messagerie.c-s.fr> From: Christophe Leroy To: Wu Bo Cc: linfeilong@huawei.com, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-fsdevel@vger.kernel.org, davem@davemloft.net, herbert@gondor.apana.org.au, viro@zeniv.linux.org.uk Subject: Re: [PATCH 2/2] fs: direct-io: use DIV_ROUND_UP helper macro for calculations References: <1621930520-515336-1-git-send-email-wubo40@huawei.com> <1621930520-515336-3-git-send-email-wubo40@huawei.com> In-Reply-To: <1621930520-515336-3-git-send-email-wubo40@huawei.com> User-Agent: Internet Messaging Program (IMP) H5 (6.2.3) Content-Type: text/plain; charset=UTF-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Wu Bo a écrit : > From: Wu Bo > > Replace open coded divisor calculations with the DIV_ROUND_UP kernel > macro for better readability. > > Signed-off-by: Wu Bo > --- > fs/direct-io.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/direct-io.c b/fs/direct-io.c > index b2e86e7..6e7d402 100644 > --- a/fs/direct-io.c > +++ b/fs/direct-io.c > @@ -195,7 +195,7 @@ static inline int dio_refill_pages(struct dio > *dio, struct dio_submit *sdio) > iov_iter_advance(sdio->iter, ret); > ret += sdio->from; > sdio->head = 0; > - sdio->tail = (ret + PAGE_SIZE - 1) / PAGE_SIZE; > + sdio->tail = DIV_ROUND_UP(ret, PAGE_SIZE); Use PFN_UP() instead. > sdio->to = ((ret - 1) & (PAGE_SIZE - 1)) + 1; > return 0; > } > -- > 1.8.3.1