aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2013-08-20 15:05:17 -0400
committerMike Snitzer <snitzer@redhat.com>2013-08-23 09:02:14 -0400
commiteb18cba78c2b9250663021e17e1e9cc34630e92a (patch)
treee12eaa9ab3e5fddfd27f7697e7f5b0baf00150e5 /include
parentf722063ee01c0060488e1000006405449451cfa0 (diff)
math64: New separate div64_u64_rem helper
Commit f792685006274a850e6cc0ea9ade275ccdfc90bc ("math64: New div64_u64_rem helper") implemented div64_u64 in terms of div64_u64_rem. But div64_u64_rem was removed because it slowed down div64_u64 (and there were no other users of div64_u64_rem). Device Mapper's I/O statistics support has a need for div64_u64_rem; reintroduce this helper as a separate method that doesn't slow down div64_u64, especially on 32-bit systems. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: Stanislaw Gruszka <sgruszka@redhat.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/math64.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/math64.h b/include/linux/math64.h
index 2913b86eb12a..69ed5f5e9f6e 100644
--- a/include/linux/math64.h
+++ b/include/linux/math64.h
@@ -31,6 +31,15 @@ static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
31} 31}
32 32
33/** 33/**
34 * div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder
35 */
36static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)
37{
38 *remainder = dividend % divisor;
39 return dividend / divisor;
40}
41
42/**
34 * div64_u64 - unsigned 64bit divide with 64bit divisor 43 * div64_u64 - unsigned 64bit divide with 64bit divisor
35 */ 44 */
36static inline u64 div64_u64(u64 dividend, u64 divisor) 45static inline u64 div64_u64(u64 dividend, u64 divisor)
@@ -63,6 +72,10 @@ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
63extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder); 72extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);
64#endif 73#endif
65 74
75#ifndef div64_u64_rem
76extern u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder);
77#endif
78
66#ifndef div64_u64 79#ifndef div64_u64
67extern u64 div64_u64(u64 dividend, u64 divisor); 80extern u64 div64_u64(u64 dividend, u64 divisor);
68#endif 81#endif