Commit 784352fe authored by David Sterba's avatar David Sterba

btrfs: move math functions to misc.h

Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 602cbe91
// SPDX-License-Identifier: GPL-2.0
#include "misc.h"
#include "ctree.h"
#include "block-group.h"
#include "space-info.h"
......@@ -13,7 +14,6 @@
#include "sysfs.h"
#include "tree-log.h"
#include "delalloc-space.h"
#include "math.h"
/*
* Return target flags in extended format or 0 if restripe for this chunk_type
......
// SPDX-License-Identifier: GPL-2.0
#include "misc.h"
#include "ctree.h"
#include "block-rsv.h"
#include "space-info.h"
#include "math.h"
#include "transaction.h"
static u64 block_rsv_release_bytes(struct btrfs_fs_info *fs_info,
......
......@@ -25,7 +25,6 @@
#include "locking.h"
#include "free-space-cache.h"
#include "free-space-tree.h"
#include "math.h"
#include "sysfs.h"
#include "qgroup.h"
#include "ref-verify.h"
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2012 Fujitsu. All rights reserved.
* Written by Miao Xie <miaox@cn.fujitsu.com>
*/
#ifndef BTRFS_MATH_H
#define BTRFS_MATH_H
#include <asm/div64.h>
static inline u64 div_factor(u64 num, int factor)
{
if (factor == 10)
return num;
num *= factor;
return div_u64(num, 10);
}
static inline u64 div_factor_fine(u64 num, int factor)
{
if (factor == 100)
return num;
num *= factor;
return div_u64(num, 100);
}
#endif
......@@ -5,6 +5,7 @@
#include <linux/sched.h>
#include <linux/wait.h>
#include <asm/div64.h>
#define in_range(b, first, len) ((b) >= (first) && (b) < (first) + (len))
......@@ -30,4 +31,20 @@ static inline void cond_wake_up_nomb(struct wait_queue_head *wq)
wake_up(wq);
}
static inline u64 div_factor(u64 num, int factor)
{
if (factor == 10)
return num;
num *= factor;
return div_u64(num, 10);
}
static inline u64 div_factor_fine(u64 num, int factor)
{
if (factor == 100)
return num;
num *= factor;
return div_u64(num, 100);
}
#endif
// SPDX-License-Identifier: GPL-2.0
#include "misc.h"
#include "ctree.h"
#include "space-info.h"
#include "sysfs.h"
......@@ -7,7 +8,6 @@
#include "free-space-cache.h"
#include "ordered-data.h"
#include "transaction.h"
#include "math.h"
#include "block-group.h"
u64 btrfs_space_info_used(struct btrfs_space_info *s_info,
......
......@@ -14,6 +14,7 @@
#include <linux/semaphore.h>
#include <linux/uuid.h>
#include <linux/list_sort.h>
#include "misc.h"
#include "ctree.h"
#include "extent_map.h"
#include "disk-io.h"
......@@ -24,7 +25,6 @@
#include "async-thread.h"
#include "check-integrity.h"
#include "rcu-string.h"
#include "math.h"
#include "dev-replace.h"
#include "sysfs.h"
#include "tree-checker.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment