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

Commit 32f9f570 authored by Shaohua Li's avatar Shaohua Li Committed by NeilBrown
Browse files

MD: ignore discard request for hard disks of hybid raid1/raid10 array



In SSD/hard disk hybid storage, discard request should be ignored for hard
disk. We used to be doing this way, but the unplug path forgets it.

This is suitable for stable tree since v3.6.

Cc: stable@vger.kernel.org
Reported-and-tested-by: default avatarMarkus <M4rkusXXL@web.de>
Signed-off-by: default avatarShaohua Li <shli@fusionio.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 486adf72
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -981,6 +981,11 @@ static void raid1_unplug(struct blk_plug_cb *cb, bool from_schedule)
	while (bio) { /* submit pending writes */
		struct bio *next = bio->bi_next;
		bio->bi_next = NULL;
		if (unlikely((bio->bi_rw & REQ_DISCARD) &&
		    !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
			/* Just ignore it */
			bio_endio(bio, 0);
		else
			generic_make_request(bio);
		bio = next;
	}
+6 −1
Original line number Diff line number Diff line
@@ -1133,6 +1133,11 @@ static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule)
	while (bio) { /* submit pending writes */
		struct bio *next = bio->bi_next;
		bio->bi_next = NULL;
		if (unlikely((bio->bi_rw & REQ_DISCARD) &&
		    !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
			/* Just ignore it */
			bio_endio(bio, 0);
		else
			generic_make_request(bio);
		bio = next;
	}