summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2013-08-20 15:05:17 -0400
committerChanho Park <chanho61.park@samsung.com>2014-11-18 11:47:03 +0900
commit02358d2bc9f4074c9e70e2158303071eebedf4dc (patch)
treeea853653047c5e68bf209d9c4784a35e3b9df773 /include
parente85f5ae83463ce344978e5192beb7499c5756371 (diff)
downloadlinux-3.10-02358d2bc9f4074c9e70e2158303071eebedf4dc.tar.gz
linux-3.10-02358d2bc9f4074c9e70e2158303071eebedf4dc.tar.bz2
linux-3.10-02358d2bc9f4074c9e70e2158303071eebedf4dc.zip
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> [backport] Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com> Change-Id: Icd721ff57c6d127e7acb0bf17d233d0a50ff24da
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 2913b86eb12..69ed5f5e9f6 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)
}
/**
+ * div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder
+ */
+static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)
+{
+ *remainder = dividend % divisor;
+ return dividend / divisor;
+}
+
+/**
* div64_u64 - unsigned 64bit divide with 64bit divisor
*/
static inline u64 div64_u64(u64 dividend, u64 divisor)
@@ -63,6 +72,10 @@ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);
#endif
+#ifndef div64_u64_rem
+extern u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder);
+#endif
+
#ifndef div64_u64
extern u64 div64_u64(u64 dividend, u64 divisor);
#endif