From: Mike Snitzer <snitzer@redhat.com>

Add do_div wrappers (dm_do_div and dm_do_mod) that don't modify the
dividend; these will be used by thin-pool and striped targets.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>

FIXME Do this directly inline instead of separate inline fns?

---
 include/linux/device-mapper.h |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

Index: linux/include/linux/device-mapper.h
===================================================================
--- linux.orig/include/linux/device-mapper.h
+++ linux/include/linux/device-mapper.h
@@ -508,6 +508,20 @@ static inline unsigned long to_bytes(sec
 	return (n << SECTOR_SHIFT);
 }
 
+/*
+ * do_div wrappers that don't modify the dividend
+ */
+static inline sector_t dm_do_div(sector_t a, uint32_t b)
+{
+	do_div(a, b);
+	return a;
+}
+
+static inline uint32_t dm_do_mod(sector_t a, uint32_t b)
+{
+	return do_div(a, b);
+}
+
 /*-----------------------------------------------------------------
  * Helper for block layer and dm core operations
  *---------------------------------------------------------------*/
