From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz
Subject: [PATCH] btrfs-progs: free-space-cache: Use DIV_ROUND_UP() to replace open code
Date: Mon, 5 Mar 2018 16:09:12 +0800 [thread overview]
Message-ID: <20180305080912.5417-1-wqu@suse.com> (raw)
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
free-space-cache.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/free-space-cache.c b/free-space-cache.c
index 50356d0462dd..f933f9f1cf3f 100644
--- a/free-space-cache.c
+++ b/free-space-cache.c
@@ -54,8 +54,7 @@ static int io_ctl_init(struct io_ctl *io_ctl, u64 size, u64 ino,
struct btrfs_root *root)
{
memset(io_ctl, 0, sizeof(struct io_ctl));
- io_ctl->num_pages = (size + root->fs_info->sectorsize - 1) /
- root->fs_info->sectorsize;
+ io_ctl->num_pages = DIV_ROUND_UP(size, root->fs_info->sectorsize);
io_ctl->buffer = kzalloc(size, GFP_NOFS);
if (!io_ctl->buffer)
return -ENOMEM;
--
2.16.2
next reply other threads:[~2018-03-05 8:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-05 8:09 Qu Wenruo [this message]
2018-03-05 21:39 ` [PATCH] btrfs-progs: free-space-cache: Use DIV_ROUND_UP() to replace open code David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180305080912.5417-1-wqu@suse.com \
--to=wqu@suse.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox