[dm-devel] [PATCH 1 of 2] DM Snapshot: allow chunksize smaller than pagesize

Jonathan Brassow jbrassow at redhat.com
Wed Sep 23 14:57:58 UTC 2009


Patch name: dm-snapshot-allow-chunksize-smaller-than-pagesize.patch

Allow chunksize smaller than pagesize.

There is no such restriction that page_size <= chunk_size. Page size
varies between computers (and sometimes varies between different kernels
on the same computer), so it isn't sensible to make the storage format
dependent on the computer.

When reading on-disk structure, the kernel allows pagesize >= chunksize.
There used to be some bugs when creating a snapshot on x86 and moving it
to ppc64 with 64k page size caused crashes, but it was fixed long time
ago.  So there is no need to check the user-supplied chunk_size relative
to page_size.

Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>
Reviewed-by: Mike Snitzer <snitzer at redhat.com>
Reviewed-by: Jonathan Brassow <jbrassow at redhat.com>

Index: linux-2.6/drivers/md/dm-exception-store.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-exception-store.c
+++ linux-2.6/drivers/md/dm-exception-store.c
@@ -138,16 +138,6 @@ int dm_exception_store_type_unregister(s
 }
 EXPORT_SYMBOL(dm_exception_store_type_unregister);
 
-/*
- * Round a number up to the nearest 'size' boundary.  size must
- * be a power of 2.
- */
-static ulong round_up(ulong n, ulong size)
-{
-	size--;
-	return (n + size) & ~size;
-}
-
 static int set_chunk_size(struct dm_exception_store *store,
 			  const char *chunk_size_arg, char **error)
 {
@@ -165,12 +155,6 @@ static int set_chunk_size(struct dm_exce
 		return 0;
 	}
 
-	/*
-	 * Chunk size must be multiple of page size.  Silently
-	 * round up if it's not.
-	 */
-	chunk_size_ulong = round_up(chunk_size_ulong, PAGE_SIZE >> 9);
-
 	return dm_exception_store_set_chunk_size(store, chunk_size_ulong,
 						 error);
 }




More information about the dm-devel mailing list