From 26483819f89c5cf9d27620d70c95afeeeb9bece5 Mon Sep 17 00:00:00 2001 From: Shaohua Li Date: Mon, 13 Feb 2017 16:21:49 -0800 Subject: md: disable WRITE SAME if it fails in underlayer disks This makes md do the same thing as dm for write same IO failure. Please see 7eee4ae(dm: disable WRITE SAME if it fails) for details why we need this. We did a little bit different than dm. Instead of disabling writesame in the first IO error, we disable it till next writesame IO coming after the first IO error. This way we don't need to clone a bio. Also reported here: https://bugzilla.kernel.org/show_bug.cgi?id=118581 Suggested-by: NeilBrown Acked-by: NeilBrown Signed-off-by: Shaohua Li --- drivers/md/md.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/md/md.h') diff --git a/drivers/md/md.h b/drivers/md/md.h index 2a514036a83d..42f8398181a8 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -710,4 +710,11 @@ static inline void mddev_clear_unsupported_flags(struct mddev *mddev, { mddev->flags &= ~unsupported_flags; } + +static inline void mddev_check_writesame(struct mddev *mddev, struct bio *bio) +{ + if (bio_op(bio) == REQ_OP_WRITE_SAME && + !bdev_get_queue(bio->bi_bdev)->limits.max_write_same_sectors) + mddev->queue->limits.max_write_same_sectors = 0; +} #endif /* _MD_MD_H */ -- cgit v1.2.3