btrfs: move math functions to misc.h
authorDavid Sterba <dsterba@suse.com>
Wed, 21 Aug 2019 16:54:28 +0000 (18:54 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 9 Sep 2019 12:59:15 +0000 (14:59 +0200)
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c
fs/btrfs/block-rsv.c
fs/btrfs/extent-tree.c
fs/btrfs/math.h [deleted file]
fs/btrfs/misc.h
fs/btrfs/space-info.c
fs/btrfs/volumes.c

index c912ee26e85da8107c1eb425f085d0446a18739a..9a09f459337b90fe1da8e6069e6c664bf3768508 100644 (file)
@@ -1,5 +1,6 @@
 // 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
index 698470b9f32d358612d1d27233f6f5ad7517afd3..ef8b8ae2738615e859f52606bc294897ecd571ab 100644 (file)
@@ -1,9 +1,9 @@
 // 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,
index 795b592e5269d3fa9031ec76ea9e1fdf573f828b..2bf5dad82bf1dad27ea798217a7e90af1b734aa4 100644 (file)
@@ -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"
diff --git a/fs/btrfs/math.h b/fs/btrfs/math.h
deleted file mode 100644 (file)
index 75246f2..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* 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
index ef3901238ddd5369f55e79c0314e5027c561bbf6..7d564924dfeb9f463e1e067db1a8ccaf447f084e 100644 (file)
@@ -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
index 13a4326c8821d97e655b34e00a3daf25c502fb07..bea7ae0a9739d4758dd7d7f8d3cee2ea1570ebbf 100644 (file)
@@ -1,5 +1,6 @@
 // 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,
index 8bfc41f1b3b63c235b4775c63a270a880641587b..02976c174f32c0abad6d745952bd566c253029bb 100644 (file)
@@ -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"