linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: use DIV_ROUND_UP helper macro for calculations
@ 2021-05-25  7:40 Wu Bo
  2021-06-01  6:10 ` Wu Bo
  2021-06-21  8:32 ` Miklos Szeredi
  0 siblings, 2 replies; 3+ messages in thread
From: Wu Bo @ 2021-05-25  7:40 UTC (permalink / raw)
  To: miklos, linux-fsdevel, linux-kernel; +Cc: linfeilong, wubo40

From: Wu Bo <wubo40@huawei.com>

Replace open coded divisor calculations with the DIV_ROUND_UP kernel
macro for better readability.

Signed-off-by: Wu Bo <wubo40@huawei.com>
---
 fs/fuse/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 09ef2a4..62443eb 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1405,7 +1405,7 @@ static int fuse_get_user_pages(struct fuse_args_pages *ap, struct iov_iter *ii,
 		nbytes += ret;
 
 		ret += start;
-		npages = (ret + PAGE_SIZE - 1) / PAGE_SIZE;
+		npages = DIV_ROUND_UP(ret, PAGE_SIZE);
 
 		ap->descs[ap->num_pages].offset = start;
 		fuse_page_descs_length_init(ap->descs, ap->num_pages, npages);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fuse: use DIV_ROUND_UP helper macro for calculations
  2021-05-25  7:40 [PATCH] fuse: use DIV_ROUND_UP helper macro for calculations Wu Bo
@ 2021-06-01  6:10 ` Wu Bo
  2021-06-21  8:32 ` Miklos Szeredi
  1 sibling, 0 replies; 3+ messages in thread
From: Wu Bo @ 2021-06-01  6:10 UTC (permalink / raw)
  To: miklos, linux-fsdevel, linux-kernel; +Cc: linfeilong

ping ...

On 2021/5/25 15:40, Wu Bo wrote:
> From: Wu Bo <wubo40@huawei.com>
> 
> Replace open coded divisor calculations with the DIV_ROUND_UP kernel
> macro for better readability.
> 
> Signed-off-by: Wu Bo <wubo40@huawei.com>
> ---
>   fs/fuse/file.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index 09ef2a4..62443eb 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -1405,7 +1405,7 @@ static int fuse_get_user_pages(struct fuse_args_pages *ap, struct iov_iter *ii,
>   		nbytes += ret;
>   
>   		ret += start;
> -		npages = (ret + PAGE_SIZE - 1) / PAGE_SIZE;
> +		npages = DIV_ROUND_UP(ret, PAGE_SIZE);
>   
>   		ap->descs[ap->num_pages].offset = start;
>   		fuse_page_descs_length_init(ap->descs, ap->num_pages, npages);
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fuse: use DIV_ROUND_UP helper macro for calculations
  2021-05-25  7:40 [PATCH] fuse: use DIV_ROUND_UP helper macro for calculations Wu Bo
  2021-06-01  6:10 ` Wu Bo
@ 2021-06-21  8:32 ` Miklos Szeredi
  1 sibling, 0 replies; 3+ messages in thread
From: Miklos Szeredi @ 2021-06-21  8:32 UTC (permalink / raw)
  To: Wu Bo; +Cc: linux-fsdevel, linux-kernel, linfeilong

On Tue, 25 May 2021 at 09:15, Wu Bo <wubo40@huawei.com> wrote:
>
> From: Wu Bo <wubo40@huawei.com>
>
> Replace open coded divisor calculations with the DIV_ROUND_UP kernel
> macro for better readability.

Applied, thanks.

Miklos

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-21  8:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25  7:40 [PATCH] fuse: use DIV_ROUND_UP helper macro for calculations Wu Bo
2021-06-01  6:10 ` Wu Bo
2021-06-21  8:32 ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).