This patchset is replace open coded divisor calculations with the
DIV_ROUND_UP kernel macro for better readability.
Wu Bo (2):
crypto: af_alg - use DIV_ROUND_UP helper macro for calculations
fs: direct-io: use DIV_ROUND_UP helper macro for calculations
crypto/af_alg.c | 2 +-
fs/direct-io.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--
1.8.3.1
From: Wu Bo <[email protected]>
Replace open coded divisor calculations with the DIV_ROUND_UP kernel
macro for better readability.
Signed-off-by: Wu Bo <[email protected]>
---
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);
sdio->to = ((ret - 1) & (PAGE_SIZE - 1)) + 1;
return 0;
}
--
1.8.3.1
Wu Bo <[email protected]> a écrit :
> From: Wu Bo <[email protected]>
>
> Replace open coded divisor calculations with the DIV_ROUND_UP kernel
> macro for better readability.
>
> Signed-off-by: Wu Bo <[email protected]>
> ---
> 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
Wu Bo <[email protected]> a écrit :
> This patchset is replace open coded divisor calculations with the
> DIV_ROUND_UP kernel macro for better readability.
We call it a series not a patchset.
PFN_UP() from pfn.h should be used instead of DIV_ROUND_UP() I believe.
>
> Wu Bo (2):
> crypto: af_alg - use DIV_ROUND_UP helper macro for calculations
> fs: direct-io: use DIV_ROUND_UP helper macro for calculations
>
> crypto/af_alg.c | 2 +-
> fs/direct-io.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> --
> 1.8.3.1