]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
MD: ignore discard request for hard disks of hybid raid1/raid10 array
authorShaohua Li <shli@kernel.org>
Sun, 28 Apr 2013 10:26:38 +0000 (18:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2013 03:08:23 +0000 (20:08 -0700)
commit 32f9f570d04461a41bdcd5c1d93b41ebc5ce182a upstream.

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.

Reported-and-tested-by: Markus <M4rkusXXL@web.de>
Signed-off-by: Shaohua Li <shli@fusionio.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/raid1.c
drivers/md/raid10.c

index fd86b372692db6d6bd5c6afdd498ae16be49f2c3..6af167f810900507184f291738647b45b890d1e3 100644 (file)
@@ -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);
index b3898d4114932baf07c7ae97c289327ceb9d8f3e..61ab219e2d392841579f4ebd6b444c4887200f8f 100644 (file)
@@ -1087,7 +1087,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);