projects/linux·commit 959eb4e5

dm mpath: support discard

959eb4e5 · Mike Snitzer <[email protected]> · 2010-08-12 04:14:32 +01:00

Enable discard support in the DM multipath target.

This discard support depends on a few discard-specific fixes to the
block layer's request stacking driver methods.

Discard requests are optional so don't allow a failed discard to trigger
path failures.  If there is a real problem with a given path the
barriers associated with the discard (either before or after the
discard) will cause path failure.  That said, unconditionally passing
discard failures up the stack is not ideal.  This must be fixed once DM
has more information about the nature of the underlying storage failure.

Signed-off-by: Mike Snitzer <[email protected]>
Signed-off-by: Alasdair G Kergon <[email protected]>
Cc: Kiyoshi Ueda <[email protected]>
Commit
959eb4e5592cc0b0b07db0ca30d2b1efd790020f
Parents
7b76ec11

Changes

1 files changed · +10 −0

FileStatusAddDelContent
drivers/md/dm-mpath.cmodified+10−0View file

drivers/md/dm-mpath.c

View file
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index da2223a..487ecda 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -893,6 +893,7 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc,
}
ti->num_flush_requests = 1;
+ ti->num_discard_requests = 1;
return 0;
@@ -1272,6 +1273,15 @@ static int do_end_io(struct multipath *m, struct request *clone,
if (error == -EOPNOTSUPP)
return error;
+ if (clone->cmd_flags & REQ_DISCARD)
+ /*
+ * Pass all discard request failures up.
+ * FIXME: only fail_path if the discard failed due to a
+ * transport problem. This requires precise understanding
+ * of the underlying failure (e.g. the SCSI sense).
+ */
+ return error;
+
if (mpio->pgpath)
fail_path(mpio->pgpath);