diff options
author | Keith Busch <keith.busch@intel.com> | 2018-01-09 20:04:16 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-01-10 18:52:16 +0100 |
commit | 9111e5686c8cf3905191d4feb819acd874437500 (patch) | |
tree | 6b7e7242d973d3fd2e80f5e2d45304c5246d519f | |
parent | nvme/multipath: Consult blk_status_t for failover (diff) | |
download | linux-9111e5686c8cf3905191d4feb819acd874437500.tar.xz linux-9111e5686c8cf3905191d4feb819acd874437500.zip |
block: Provide blk_status_t decoding for path errors
This patch provides a common decoder for block status path related errors
that may be retried so various entities wishing to consult this do not
have to duplicate this decision.
Acked-by: Mike Snitzer <snitzer@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | include/linux/blk_types.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index a1e628e032da..2d973ac54b09 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -39,6 +39,34 @@ typedef u8 __bitwise blk_status_t; #define BLK_STS_AGAIN ((__force blk_status_t)12) +/** + * blk_path_error - returns true if error may be path related + * @error: status the request was completed with + * + * Description: + * This classifies block error status into non-retryable errors and ones + * that may be successful if retried on a failover path. + * + * Return: + * %false - retrying failover path will not help + * %true - may succeed if retried + */ +static inline bool blk_path_error(blk_status_t error) +{ + switch (error) { + case BLK_STS_NOTSUPP: + case BLK_STS_NOSPC: + case BLK_STS_TARGET: + case BLK_STS_NEXUS: + case BLK_STS_MEDIUM: + case BLK_STS_PROTECTION: + return false; + } + + /* Anything else could be a path failure, so should be retried */ + return true; +} + struct blk_issue_stat { u64 stat; }; |