diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2012-09-13 06:51:36 -0400 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2012-12-11 13:31:30 -0500 |
commit | 3fed40cc97f32bebfd34a55364de9b44dcbede59 (patch) | |
tree | e0e991e2d7ff5643c07f2b63395c0d9e744596ba /fs/btrfs/extent-tree.c | |
parent | 29594404d7fe73cd80eaa4ee8c43dcc53970c60e (diff) |
Btrfs: cleanup duplicated division functions
div_factor{_fine} has been implemented for two times, cleanup it.
And I move them into a independent file named math.h because they are
common math functions.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 3d3e2c17d8d..7563db782ab 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "volumes.h" | 33 | #include "volumes.h" |
34 | #include "locking.h" | 34 | #include "locking.h" |
35 | #include "free-space-cache.h" | 35 | #include "free-space-cache.h" |
36 | #include "math.h" | ||
36 | 37 | ||
37 | #undef SCRAMBLE_DELAYED_REFS | 38 | #undef SCRAMBLE_DELAYED_REFS |
38 | 39 | ||
@@ -649,24 +650,6 @@ void btrfs_clear_space_info_full(struct btrfs_fs_info *info) | |||
649 | rcu_read_unlock(); | 650 | rcu_read_unlock(); |
650 | } | 651 | } |
651 | 652 | ||
652 | static u64 div_factor(u64 num, int factor) | ||
653 | { | ||
654 | if (factor == 10) | ||
655 | return num; | ||
656 | num *= factor; | ||
657 | do_div(num, 10); | ||
658 | return num; | ||
659 | } | ||
660 | |||
661 | static u64 div_factor_fine(u64 num, int factor) | ||
662 | { | ||
663 | if (factor == 100) | ||
664 | return num; | ||
665 | num *= factor; | ||
666 | do_div(num, 100); | ||
667 | return num; | ||
668 | } | ||
669 | |||
670 | u64 btrfs_find_block_group(struct btrfs_root *root, | 653 | u64 btrfs_find_block_group(struct btrfs_root *root, |
671 | u64 search_start, u64 search_hint, int owner) | 654 | u64 search_start, u64 search_hint, int owner) |
672 | { | 655 | { |