summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaohua Li <shli@kernel.org>2013-04-28 10:26:38 (GMT)
committerNeilBrown <neilb@suse.de>2013-04-30 04:49:36 (GMT)
commit32f9f570d04461a41bdcd5c1d93b41ebc5ce182a (patch)
tree82fe7220a3d3ea346ad372f2c14bc590cf7ccb82
parent486adf72ccc0c235754923d47a2270c5dcb0c98b (diff)
downloadlinux-fsl-qoriq-32f9f570d04461a41bdcd5c1d93b41ebc5ce182a.tar.xz
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: Markus <M4rkusXXL@web.de> Signed-off-by: Shaohua Li <shli@fusionio.com> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--drivers/md/raid1.c7
-rw-r--r--drivers/md/raid10.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index c055b92..851023e 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -981,7 +981,12 @@ 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;
- generic_make_request(bio);
+ 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;
}
kfree(plug);
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index c35d912..018741b 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1133,7 +1133,12 @@ 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;
- generic_make_request(bio);
+ 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;
}
kfree(plug);