block: trace completion of all bios.
[linux-2.6-block.git] / include / linux / blk_types.h
index d703acb55d0f0d196296ef4d82f4e97a5efd9c3a..72aa9519167ecde4fd236be3d9e4a2a01337d4bc 100644 (file)
@@ -17,6 +17,10 @@ struct io_context;
 struct cgroup_subsys_state;
 typedef void (bio_end_io_t) (struct bio *);
 
+struct blk_issue_stat {
+       u64 stat;
+};
+
 /*
  * main unit of I/O for the block layer and lower layers (ie drivers and
  * stacking drivers)
@@ -29,7 +33,7 @@ struct bio {
                                                 * top bits REQ_OP. Use
                                                 * accessors.
                                                 */
-       unsigned short          bi_flags;       /* status, command, etc */
+       unsigned short          bi_flags;       /* status, etc and bvec pool number */
        unsigned short          bi_ioprio;
 
        struct bvec_iter        bi_iter;
@@ -58,6 +62,10 @@ struct bio {
         */
        struct io_context       *bi_ioc;
        struct cgroup_subsys_state *bi_css;
+#ifdef CONFIG_BLK_DEV_THROTTLING_LOW
+       void                    *bi_cg_private;
+       struct blk_issue_stat   bi_issue_stat;
+#endif
 #endif
        union {
 #if defined(CONFIG_BLK_DEV_INTEGRITY)
@@ -102,12 +110,9 @@ struct bio {
 #define BIO_REFFED     8       /* bio has elevated ->bi_cnt */
 #define BIO_THROTTLED  9       /* This bio has already been subjected to
                                 * throttling rules. Don't do it again. */
-
-/*
- * Flags starting here get preserved by bio_reset() - this includes
- * BVEC_POOL_IDX()
- */
-#define BIO_RESET_BITS 10
+#define BIO_TRACE_COMPLETION 10        /* bio_endio() should trace the final completion
+                                * of this bio. */
+/* See BVEC_POOL_OFFSET below before adding new flags */
 
 /*
  * We support 6 different bvec pools, the last one is magic in that it
@@ -117,13 +122,22 @@ struct bio {
 #define BVEC_POOL_MAX          (BVEC_POOL_NR - 1)
 
 /*
- * Top 4 bits of bio flags indicate the pool the bvecs came from.  We add
+ * Top 3 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_BITS         (3)
 #define BVEC_POOL_OFFSET       (16 - BVEC_POOL_BITS)
 #define BVEC_POOL_IDX(bio)     ((bio)->bi_flags >> BVEC_POOL_OFFSET)
+#if (1<< BVEC_POOL_BITS) < (BVEC_POOL_NR+1)
+# error "BVEC_POOL_BITS is too small"
+#endif
+
+/*
+ * Flags starting here get preserved by bio_reset() - this includes
+ * only BVEC_POOL_IDX()
+ */
+#define BIO_RESET_BITS BVEC_POOL_OFFSET
 
 /*
  * Operations and flags common to the bio and request structures.
@@ -283,12 +297,6 @@ 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;
-};
-
-#define BLK_RQ_STAT_BATCH      64
-
 struct blk_rq_stat {
        s64 mean;
        u64 min;
@@ -296,7 +304,6 @@ struct blk_rq_stat {
        s32 nr_samples;
        s32 nr_batch;
        u64 batch;
-       s64 time;
 };
 
 #endif /* __LINUX_BLK_TYPES_H */