summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2018-03-05 16:09:12 +0800
committerDavid Sterba <dsterba@suse.com>2018-03-30 22:15:53 +0200
commitbb338fb0f0ac780e5f2806e0b50ef27e84701b7c (patch)
tree53c91128ad514db8e048facd191e3d2f76ea1e6f
parentf44a0550123be92245943d832df64134c5fd6241 (diff)
btrfs-progs: free-space-cache: Use DIV_ROUND_UP() to replace open code
Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--free-space-cache.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/free-space-cache.c b/free-space-cache.c
index 50356d04..f933f9f1 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;