>From e2693136fa64d5c9dde73d2d663bde84f8326877 Mon Sep 17 00:00:00 2001
From: Tejun Heo <[email protected]>
Date: Wed, 10 Jul 2019 14:18:12 -0700

request->pre_start_time is currently only used by the iocost
controller.  Let's omit the field if disabled and avoid wasting space
in struct request.

Signed-off-by: Tejun Heo <[email protected]>
Suggested-by: Jens Axboe <[email protected]>
---
The git branch is updated accordingly.

Thanks.

 block/blk-mq.c         | 2 ++
 include/linux/blkdev.h | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 90b46988cc02..ce96bcd7e260 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -325,7 +325,9 @@ static struct request *blk_mq_rq_ctx_init(struct 
blk_mq_alloc_data *data,
        RB_CLEAR_NODE(&rq->rb_node);
        rq->rq_disk = NULL;
        rq->part = NULL;
+#ifdef CONFIG_BLK_CGROUP_IOCOST
        rq->pre_start_time_ns = pre_start_time_ns;
+#endif
        if (blk_mq_need_time_stamp(rq))
                rq->start_time_ns = ktime_get_ns();
        else
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 4247a9bc44b7..2425af6d3f5e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -194,8 +194,10 @@ struct request {
 
        struct gendisk *rq_disk;
        struct hd_struct *part;
+#ifdef CONFIG_BLK_CGROUP_IOCOST
        /* Time that the first bio started allocating this request. */
        u64 pre_start_time_ns;
+#endif
        /* Time that this request was allocated for this IO. */
        u64 start_time_ns;
        /* Time that I/O was submitted to the device. */
@@ -635,8 +637,13 @@ bool blk_queue_flag_test_and_set(unsigned int flag, struct 
request_queue *q);
        test_bit(QUEUE_FLAG_SCSI_PASSTHROUGH, &(q)->queue_flags)
 #define blk_queue_pci_p2pdma(q)        \
        test_bit(QUEUE_FLAG_PCI_P2PDMA, &(q)->queue_flags)
+
+#ifdef CONFIG_BLK_CGROUP_IOCOST
 #define blk_queue_rec_prestart(q)      \
        test_bit(QUEUE_FLAG_REC_PRESTART, &(q)->queue_flags)
+#else
+#define blk_queue_rec_prestart(q)              false
+#endif
 
 #define blk_noretry_request(rq) \
        ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \
-- 
2.17.1

Reply via email to