<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From: Alasdair G Kergon &lt;agk@redhat.com&gt;

The snapshot chunk size must not exceed 512K or else bvec_alloc_bs()
will fail with 4K pages, and snapshot metadata needs to be usable
regardless of page size.

Signed-Off-By: Alasdair G Kergon &lt;agk@redhat.com&gt;
---

Index: linux-2.6.18-rc7/drivers/md/dm-snap.c
===================================================================
--- linux-2.6.18-rc7.orig/drivers/md/dm-snap.c	2006-10-13 17:10:21.000000000 +0100
+++ linux-2.6.18-rc7/drivers/md/dm-snap.c	2006-10-13 17:10:37.000000000 +0100
@@ -426,6 +426,13 @@ static int set_chunk_size(struct dm_snap
 		return -EINVAL;
 	}
 
+	/* Max chunk size determined by BIO_MAX_PAGES and smallest PAGE_SIZE */
+	if (chunk_size &gt; 1024) {
+		ti-&gt;error = "Chunk size may not exceed 512K";
+		r = -EINVAL;
+		goto bad3;
+	}
+
 	s-&gt;chunk_size = chunk_size;
 	s-&gt;chunk_mask = chunk_size - 1;
 	s-&gt;chunk_shift = ffs(chunk_size) - 1;
</pre></body></html>