diff options
author | NeilBrown <neilb@suse.de> | 2012-11-19 03:11:26 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-11-20 09:42:56 +0100 |
commit | 4ac6875eeb97a49bad7bc8d56b5ec935904fc6e7 (patch) | |
tree | 3443bf90a75f43f118487bcb822ff5e511ee3e3b /drivers/md | |
parent | md: make sure everything is freed when dm-raid stops an array. (diff) | |
download | linux-4ac6875eeb97a49bad7bc8d56b5ec935904fc6e7.tar.xz linux-4ac6875eeb97a49bad7bc8d56b5ec935904fc6e7.zip |
md/raid5: round discard alignment up to power of 2.
blkdev_issue_discard currently assumes that the granularity
is a power of 2. So in raid5, round the chosen number up to
avoid embarrassment.
Cc: Shaohua Li <shli@kernel.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/raid5.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index c5439dce0295..baea94f0670a 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5529,6 +5529,10 @@ static int run(struct mddev *mddev) * discard data disk but write parity disk */ stripe = stripe * PAGE_SIZE; + /* Round up to power of 2, as discard handling + * currently assumes that */ + while ((stripe-1) & stripe) + stripe = (stripe | (stripe-1)) + 1; mddev->queue->limits.discard_alignment = stripe; mddev->queue->limits.discard_granularity = stripe; /* |