]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - include/linux/blk_types.h
Merge branches 'for-4.11/upstream-fixes', 'for-4.12/accutouch', 'for-4.12/cp2112...
[mirror_ubuntu-artful-kernel.git] / include / linux / blk_types.h
index 519ea2c9df612becf997cf8fafbc1411ce6cd4be..d703acb55d0f0d196296ef4d82f4e97a5efd9c3a 100644 (file)
@@ -162,6 +162,13 @@ enum req_opf {
        /* write the zero filled sector many times */
        REQ_OP_WRITE_ZEROES     = 8,
 
+       /* SCSI passthrough using struct scsi_request */
+       REQ_OP_SCSI_IN          = 32,
+       REQ_OP_SCSI_OUT         = 33,
+       /* Driver private requests */
+       REQ_OP_DRV_IN           = 34,
+       REQ_OP_DRV_OUT          = 35,
+
        REQ_OP_LAST,
 };
 
@@ -220,6 +227,15 @@ static inline bool op_is_write(unsigned int op)
        return (op & 1);
 }
 
+/*
+ * Check if the bio or request is one that needs special treatment in the
+ * flush state machine.
+ */
+static inline bool op_is_flush(unsigned int op)
+{
+       return op & (REQ_FUA | REQ_PREFLUSH);
+}
+
 /*
  * Reads are always treated as synchronous, as are requests with the FUA or
  * PREFLUSH flag.  Other operations may be marked as synchronous using the
@@ -232,22 +248,29 @@ static inline bool op_is_sync(unsigned int op)
 }
 
 typedef unsigned int blk_qc_t;
-#define BLK_QC_T_NONE  -1U
-#define BLK_QC_T_SHIFT 16
+#define BLK_QC_T_NONE          -1U
+#define BLK_QC_T_SHIFT         16
+#define BLK_QC_T_INTERNAL      (1U << 31)
 
 static inline bool blk_qc_t_valid(blk_qc_t cookie)
 {
        return cookie != BLK_QC_T_NONE;
 }
 
-static inline blk_qc_t blk_tag_to_qc_t(unsigned int tag, unsigned int queue_num)
+static inline blk_qc_t blk_tag_to_qc_t(unsigned int tag, unsigned int queue_num,
+                                      bool internal)
 {
-       return tag | (queue_num << BLK_QC_T_SHIFT);
+       blk_qc_t ret = tag | (queue_num << BLK_QC_T_SHIFT);
+
+       if (internal)
+               ret |= BLK_QC_T_INTERNAL;
+
+       return ret;
 }
 
 static inline unsigned int blk_qc_t_to_queue_num(blk_qc_t cookie)
 {
-       return cookie >> BLK_QC_T_SHIFT;
+       return (cookie & ~BLK_QC_T_INTERNAL) >> BLK_QC_T_SHIFT;
 }
 
 static inline unsigned int blk_qc_t_to_tag(blk_qc_t cookie)
@@ -255,6 +278,11 @@ static inline unsigned int blk_qc_t_to_tag(blk_qc_t cookie)
        return cookie & ((1u << BLK_QC_T_SHIFT) - 1);
 }
 
+static inline bool blk_qc_t_is_internal(blk_qc_t cookie)
+{
+       return (cookie & BLK_QC_T_INTERNAL) != 0;
+}
+
 struct blk_issue_stat {
        u64 time;
 };