提交 f14fa693 编写于 作者: M Mikulas Patocka 提交者: Alasdair G Kergon

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: NMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
上级 f09996c9
...@@ -16,8 +16,7 @@ Parameters: <num devs> <chunk size> [<dev path> <offset>]+ ...@@ -16,8 +16,7 @@ Parameters: <num devs> <chunk size> [<dev path> <offset>]+
<offset>: Starting sector within the device. <offset>: Starting sector within the device.
One or more underlying devices can be specified. The striped device size must 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 be a multiple of the chunk size multiplied by the number of underlying devices.
devices.
Example scripts Example scripts
......
...@@ -132,7 +132,6 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) ...@@ -132,7 +132,6 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
return -EINVAL; return -EINVAL;
} }
width = ti->len;
if (sector_div(width, stripes)) { if (sector_div(width, stripes)) {
ti->error = "Target length not divisible by " ti->error = "Target length not divisible by "
"number of stripes"; "number of stripes";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册