aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuoqing Jiang2021-10-04 23:34:52 +0800
committerJens Axboe2021-10-18 14:50:31 -0600
commitc6efe4341d1ff7719f9918ea23a34f055359eb02 (patch)
tree1874d5d1657f0e48acf3fa7226e1ea0c6e27ad20
parent2e94275ed582d9bfe1abc5d5ee565715cc3e6b38 (diff)
md/raid5: call roundup_pow_of_two in raid5_run
Let's call roundup_pow_of_two here instead of open code. Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev> Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/md/raid5.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 02ed53b20654..4ea9e7b647b0 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -7732,10 +7732,7 @@ static int raid5_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;
+ stripe = roundup_pow_of_two(stripe);
mddev->queue->limits.discard_alignment = stripe;
mddev->queue->limits.discard_granularity = stripe;