Merge branch 'for-4.8/drivers' of git://git.kernel.dk/linux-block
[cascardo/linux.git] / include / linux / blk_types.h
index b588e96..f254eb2 100644 (file)
@@ -26,11 +26,11 @@ typedef void (bio_destructor_t) (struct bio *);
 struct bio {
        struct bio              *bi_next;       /* request queue link */
        struct block_device     *bi_bdev;
-       unsigned int            bi_flags;       /* status, command, etc */
        int                     bi_error;
        unsigned int            bi_rw;          /* bottom bits req flags,
                                                 * top bits REQ_OP
                                                 */
+       unsigned short          bi_flags;       /* status, command, etc */
        unsigned short          bi_ioprio;
 
        struct bvec_iter        bi_iter;
@@ -114,19 +114,25 @@ struct bio {
 
 /*
  * Flags starting here get preserved by bio_reset() - this includes
- * BIO_POOL_IDX()
+ * BVEC_POOL_IDX()
  */
-#define BIO_RESET_BITS 13
-#define BIO_OWNS_VEC   13      /* bio_free() should free bvec */
+#define BIO_RESET_BITS 10
 
 /*
- * top 4 bits of bio flags indicate the pool this bio came from
+ * We support 6 different bvec pools, the last one is magic in that it
+ * is backed by a mempool.
  */
-#define BIO_POOL_BITS          (4)
-#define BIO_POOL_NONE          ((1UL << BIO_POOL_BITS) - 1)
-#define BIO_POOL_OFFSET                (32 - BIO_POOL_BITS)
-#define BIO_POOL_MASK          (1UL << BIO_POOL_OFFSET)
-#define BIO_POOL_IDX(bio)      ((bio)->bi_flags >> BIO_POOL_OFFSET)
+#define BVEC_POOL_NR           6
+#define BVEC_POOL_MAX          (BVEC_POOL_NR - 1)
+
+/*
+ * Top 4 bits of bio flags indicate the pool the bvecs came from.  We add
+ * 1 to the actual index so that 0 indicates that there are no bvecs to be
+ * freed.
+ */
+#define BVEC_POOL_BITS         (4)
+#define BVEC_POOL_OFFSET       (16 - BVEC_POOL_BITS)
+#define BVEC_POOL_IDX(bio)     ((bio)->bi_flags >> BVEC_POOL_OFFSET)
 
 #endif /* CONFIG_BLOCK */
 
@@ -143,7 +149,6 @@ enum rq_flag_bits {
        __REQ_SYNC,             /* request is sync (sync write or read) */
        __REQ_META,             /* metadata io request */
        __REQ_PRIO,             /* boost priority in cfq */
-       __REQ_SECURE,           /* secure discard (used with REQ_OP_DISCARD) */
 
        __REQ_NOIDLE,           /* don't anticipate more IO after this one */
        __REQ_INTEGRITY,        /* I/O includes block integrity payload */
@@ -192,7 +197,7 @@ enum rq_flag_bits {
        (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
 #define REQ_COMMON_MASK \
        (REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | REQ_NOIDLE | \
-        REQ_PREFLUSH | REQ_FUA | REQ_SECURE | REQ_INTEGRITY | REQ_NOMERGE)
+        REQ_PREFLUSH | REQ_FUA | REQ_INTEGRITY | REQ_NOMERGE)
 #define REQ_CLONE_MASK         REQ_COMMON_MASK
 
 /* This mask is used for both bio and request merge checking */
@@ -219,7 +224,6 @@ enum rq_flag_bits {
 #define REQ_FLUSH_SEQ          (1ULL << __REQ_FLUSH_SEQ)
 #define REQ_IO_STAT            (1ULL << __REQ_IO_STAT)
 #define REQ_MIXED_MERGE                (1ULL << __REQ_MIXED_MERGE)
-#define REQ_SECURE             (1ULL << __REQ_SECURE)
 #define REQ_PM                 (1ULL << __REQ_PM)
 #define REQ_HASHED             (1ULL << __REQ_HASHED)
 #define REQ_MQ_INFLIGHT                (1ULL << __REQ_MQ_INFLIGHT)
@@ -228,6 +232,7 @@ enum req_op {
        REQ_OP_READ,
        REQ_OP_WRITE,
        REQ_OP_DISCARD,         /* request to discard sectors */
+       REQ_OP_SECURE_ERASE,    /* request to securely erase sectors */
        REQ_OP_WRITE_SAME,      /* write same block many times */
        REQ_OP_FLUSH,           /* request for cache flush */
 };