nvmet: release a ns reference in nvmet_req_uninit if needed
[linux-2.6-microblaze.git] / include / linux / blk_types.h
index 96ac381..2d973ac 100644 (file)
@@ -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;
 };
@@ -163,6 +191,8 @@ struct bio {
  */
 #define BIO_RESET_BITS BVEC_POOL_OFFSET
 
+typedef __u32 __bitwise blk_mq_req_flags_t;
+
 /*
  * Operations and flags common to the bio and request structures.
  * We use 8 bits for encoding the operation, and the remaining 24 for flags.
@@ -225,11 +255,14 @@ enum req_flag_bits {
        __REQ_PREFLUSH,         /* request for cache flush */
        __REQ_RAHEAD,           /* read ahead, can fail anytime */
        __REQ_BACKGROUND,       /* background IO */
+       __REQ_NOWAIT,           /* Don't wait if request will block */
 
        /* command specific flags for REQ_OP_WRITE_ZEROES: */
        __REQ_NOUNMAP,          /* do not free blocks when zeroing */
 
-       __REQ_NOWAIT,           /* Don't wait if request will block */
+       /* for driver use */
+       __REQ_DRV,
+
        __REQ_NR_BITS,          /* stops here */
 };
 
@@ -246,9 +279,11 @@ enum req_flag_bits {
 #define REQ_PREFLUSH           (1ULL << __REQ_PREFLUSH)
 #define REQ_RAHEAD             (1ULL << __REQ_RAHEAD)
 #define REQ_BACKGROUND         (1ULL << __REQ_BACKGROUND)
+#define REQ_NOWAIT             (1ULL << __REQ_NOWAIT)
 
 #define REQ_NOUNMAP            (1ULL << __REQ_NOUNMAP)
-#define REQ_NOWAIT             (1ULL << __REQ_NOWAIT)
+
+#define REQ_DRV                        (1ULL << __REQ_DRV)
 
 #define REQ_FAILFAST_MASK \
        (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
@@ -330,11 +365,10 @@ static inline bool blk_qc_t_is_internal(blk_qc_t cookie)
 }
 
 struct blk_rq_stat {
-       s64 mean;
+       u64 mean;
        u64 min;
        u64 max;
-       s32 nr_samples;
-       s32 nr_batch;
+       u32 nr_samples;
        u64 batch;
 };