From: Mikulas Patocka Date: Fri, 27 Jul 2012 14:08:00 +0000 (+0100) Subject: dm stripe: fix size test X-Git-Tag: v3.6-rc1~56^2~53 X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=f14fa693c93078444b5e95d7cad78ead0383ad50;p=~andy%2Flinux dm stripe: fix size test dm-stripe is supposed to ensure that all the space allocated to the stripes is fully used and that all stripes are the same size. This patch fixes the test. It checks that device length is divisible by the chunk size and checks that the resulting quotient is divisible by the number of stripes (which is equivalent to testing if device length is divisible by chunk_size * stripes). Previously, the code only tested that the number of sectors in the target was divisible by each of the chunk size and the number of stripes separately, which could leave entire stripes unused. (A setup that genuinely needs some stripes to be shorter than others can be created by concatenating striped targets.) Signed-off-by: Mikulas Patocka Signed-off-by: Alasdair G Kergon --- diff --git a/Documentation/device-mapper/striped.txt b/Documentation/device-mapper/striped.txt index f34d3236b9d..953fe1d6806 100644 --- a/Documentation/device-mapper/striped.txt +++ b/Documentation/device-mapper/striped.txt @@ -16,8 +16,7 @@ Parameters: [ ]+ : Starting sector within the device. One or more underlying devices can be specified. The striped device size must -be a multiple of the chunk size and a multiple of the number of underlying -devices. +be a multiple of the chunk size multiplied by the number of underlying devices. Example scripts diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index 183db5d3e48..1f6316ed2b3 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c @@ -132,7 +132,6 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) return -EINVAL; } - width = ti->len; if (sector_div(width, stripes)) { ti->error = "Target length not divisible by " "number of stripes";