Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ac6875e authored by NeilBrown's avatar NeilBrown
Browse files

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: default avatarNeilBrown <neilb@suse.de>
parent 5eff3c43
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;
		/*