summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/misc.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/misc.h')
-rw-r--r--fs/btrfs/misc.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/btrfs/misc.h b/fs/btrfs/misc.h
index ef3901238ddd..7d564924dfeb 100644
--- a/fs/btrfs/misc.h
+++ b/fs/btrfs/misc.h
@@ -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