Subject: [PATCHES] Re: next-20080723: build fails for dm-snapshot.ko

From: Mikulas Patocka <[email-masked]>
Date: Wed, 23 Jul 2008 17:16:02 -0400 (EDT)

Hi

Here is the patch for the problem.

Mikulas

---

Use sector_div to properly handle 64-bit modulo on 32-bit machines.

Signed-off-by: Mikulas Patocka <[email-masked]>

---
 drivers/md/dm-exception-store.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux-2.6.26-fast/drivers/md/dm-exception-store.c
===================================================================
--- linux-2.6.26-fast.orig/drivers/md/dm-exception-store.c	2008-07-23 21:21:50.000000000 +0200
+++ linux-2.6.26-fast/drivers/md/dm-exception-store.c	2008-07-23 22:34:54.000000000 +0200
@@ -520,6 +520,7 @@ static int persistent_prepare(struct exc
 {
 	struct pstore *ps = get_info(store);
 	uint32_t stride;
+	chunk_t next_free;
 	sector_t size = get_dev_size(store->snap->cow->bdev);
 
 	/* Is there enough room ? */
@@ -533,7 +534,8 @@ static int persistent_prepare(struct exc
 	 * into account the location of the metadata chunks.
 	 */
 	stride = (ps->exceptions_per_area + 1);
-	if ((++ps->next_free % stride) == 1)
+	next_free = ++ps->next_free;
+	if (sector_div(next_free, stride) == 1)
 		ps->next_free++;
 
 	atomic_inc(&ps->pending_count);