dm mpath: support discard

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>

authored by Mike Snitzer and committed by Alasdair G Kergon 959eb4e5 7b76ec11

+10
+10
drivers/md/dm-mpath.c
··· 893 } 894 895 ti->num_flush_requests = 1; 896 897 return 0; 898 ··· 1271 return 0; /* I/O complete */ 1272 1273 if (error == -EOPNOTSUPP) 1274 return error; 1275 1276 if (mpio->pgpath)
··· 893 } 894 895 ti->num_flush_requests = 1; 896 + ti->num_discard_requests = 1; 897 898 return 0; 899 ··· 1270 return 0; /* I/O complete */ 1271 1272 if (error == -EOPNOTSUPP) 1273 + return error; 1274 + 1275 + if (clone->cmd_flags & REQ_DISCARD) 1276 + /* 1277 + * Pass all discard request failures up. 1278 + * FIXME: only fail_path if the discard failed due to a 1279 + * transport problem. This requires precise understanding 1280 + * of the underlying failure (e.g. the SCSI sense). 1281 + */ 1282 return error; 1283 1284 if (mpio->pgpath)