Skip to contentSkip to conversation

dm-stripe: remove minimum stripe size

PATCH New Mikulas Patocka 1 participant 1 message Jun 18, 2012 Device mapper

lore
Share & tools
lore

Mikulas Patocka

author maintainer
#0 lore raw

PATCH 1/1 dm-stripe: remove minimum stripe size

dm-stripe: remove minimum stripe size

There is no technical limitation in device mapper that would prevent the dm-stripe target from using a stripe size smaller than page size.

This patch removes the limit and makes stripe volumes portable across architectures with different page size.

The patch also makes it reject stripe sizes that do not fit to 32 bits. (previously the upper bits were truncated)

---
 drivers/md/dm-stripe.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/dm-stripe.c +2 -2
Index: linux-3.4.2-fast/drivers/md/dm-stripe.c
===================================================================
@@ -96,7 +96,7 @@ static int stripe_ctr(struct dm_target *
 	struct stripe_c *sc;
 	sector_t width;
 	uint32_t stripes;
-	uint32_t chunk_size;
+	unsigned long chunk_size;
 	char *end;
 	int r;
 	unsigned int i;
@@ -113,7 +113,7 @@ static int stripe_ctr(struct dm_target *
 	}
 
 	chunk_size = simple_strtoul(argv[1], &end, 10);
-	if (*end || (chunk_size < (PAGE_SIZE >> SECTOR_SHIFT))) {
+	if (*end || !chunk_size || chunk_size != (uint32_t)chunk_size) {
 		ti->error = "Invalid chunk_size";
 		return -EINVAL;
 	}