[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210525103830.Horde.TfZkOjej0Mdf8d8SMAnj2w1@messagerie.c-s.fr>
Date: Tue, 25 May 2021 10:38:30 +0200
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Wu Bo <wubo40@...wei.com>
Cc: linfeilong@...wei.com, linux-kernel@...r.kernel.org,
linux-crypto@...r.kernel.org, linux-fsdevel@...r.kernel.org,
davem@...emloft.net, herbert@...dor.apana.org.au,
viro@...iv.linux.org.uk
Subject: Re: [PATCH 2/2] fs: direct-io: use DIV_ROUND_UP helper macro for
calculations
Wu Bo <wubo40@...wei.com> a écrit :
> From: Wu Bo <wubo40@...wei.com>
>
> Replace open coded divisor calculations with the DIV_ROUND_UP kernel
> macro for better readability.
>
> Signed-off-by: Wu Bo <wubo40@...wei.com>
> ---
> 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
Powered by blists - more mailing lists