Skip to content

Commit

Permalink
dm mpath: support discard
Browse files Browse the repository at this point in the history
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 <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
  • Loading branch information
snitm authored and kergon committed Aug 12, 2010
1 parent 7b76ec1 commit 959eb4e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/md/dm-mpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 959eb4e

Please sign in to comment.