From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org
Cc: linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kernel-team-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
newella-b10kYP2dOMg@public.gmane.org,
josef-DigfWCa+lFGyeJad7bwFQA@public.gmane.org,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: [PATCH 2/5] block: add request->io_data_len
Date: Wed, 8 Apr 2020 16:14:47 -0400 [thread overview]
Message-ID: <20200408201450.3959560-3-tj@kernel.org> (raw)
In-Reply-To: <20200408201450.3959560-1-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Currently, at the time of completeion, there's no way of knowing how big a
request was. blk-iocost will need this information to account for IO size when
calculating expected latencies.
This patch adds rq->io_data_len which remembers blk_rq_bytes() at the time the
request gets issued. The field is enabled iff CONFIG_BLK_IO_DATA_LEN is set and
doesn't increase the size of the struct even when enabled.
Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
block/Kconfig | 3 +++
block/blk-mq.c | 6 ++++++
include/linux/blkdev.h | 8 ++++++++
3 files changed, 17 insertions(+)
diff --git a/block/Kconfig b/block/Kconfig
index 3bc76bb113a0..48308e600dc8 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -26,6 +26,9 @@ menuconfig BLOCK
if BLOCK
+config BLK_RQ_IO_DATA_LEN
+ bool
+
config BLK_RQ_ALLOC_TIME
bool
diff --git a/block/blk-mq.c b/block/blk-mq.c
index f6291ceedee4..64ed22712fe4 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -415,6 +415,9 @@ struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op,
return ERR_PTR(-EWOULDBLOCK);
rq->__data_len = 0;
+#ifdef CONFIG_BLK_RQ_IO_DATA_LEN
+ rq->io_data_len = 0;
+#endif
rq->__sector = (sector_t) -1;
rq->bio = rq->biotail = NULL;
return rq;
@@ -655,6 +658,9 @@ void blk_mq_start_request(struct request *rq)
trace_block_rq_issue(q, rq);
+#ifdef CONFIG_BLK_RQ_IO_DATA_LEN
+ rq->io_data_len = blk_rq_bytes(rq);
+#endif
if (test_bit(QUEUE_FLAG_STATS, &q->queue_flags)) {
rq->io_start_time_ns = ktime_get_ns();
rq->stats_sectors = blk_rq_sectors(rq);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 32868fbedc9e..bfd34c6a27ef 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -142,6 +142,14 @@ struct request {
/* the following two fields are internal, NEVER access directly */
unsigned int __data_len; /* total data len */
+#ifdef CONFIG_BLK_RQ_IO_DATA_LEN
+ /*
+ * Total data len at the time of issue. This doesn't get deducted by
+ * blk_update_request() and can be used by completion path to determine
+ * the request size.
+ */
+ unsigned int io_data_len;
+#endif
sector_t __sector; /* sector cursor */
struct bio *bio;
--
2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@vger.kernel.org, cgroups@vger.kernel.org,
newella@fb.com, josef@toxicpanda.com, Tejun Heo <tj@kernel.org>
Subject: [PATCH 2/5] block: add request->io_data_len
Date: Wed, 8 Apr 2020 16:14:47 -0400 [thread overview]
Message-ID: <20200408201450.3959560-3-tj@kernel.org> (raw)
In-Reply-To: <20200408201450.3959560-1-tj@kernel.org>
Currently, at the time of completeion, there's no way of knowing how big a
request was. blk-iocost will need this information to account for IO size when
calculating expected latencies.
This patch adds rq->io_data_len which remembers blk_rq_bytes() at the time the
request gets issued. The field is enabled iff CONFIG_BLK_IO_DATA_LEN is set and
doesn't increase the size of the struct even when enabled.
Signed-off-by: Tejun Heo <tj@kernel.org>
---
block/Kconfig | 3 +++
block/blk-mq.c | 6 ++++++
include/linux/blkdev.h | 8 ++++++++
3 files changed, 17 insertions(+)
diff --git a/block/Kconfig b/block/Kconfig
index 3bc76bb113a0..48308e600dc8 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -26,6 +26,9 @@ menuconfig BLOCK
if BLOCK
+config BLK_RQ_IO_DATA_LEN
+ bool
+
config BLK_RQ_ALLOC_TIME
bool
diff --git a/block/blk-mq.c b/block/blk-mq.c
index f6291ceedee4..64ed22712fe4 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -415,6 +415,9 @@ struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op,
return ERR_PTR(-EWOULDBLOCK);
rq->__data_len = 0;
+#ifdef CONFIG_BLK_RQ_IO_DATA_LEN
+ rq->io_data_len = 0;
+#endif
rq->__sector = (sector_t) -1;
rq->bio = rq->biotail = NULL;
return rq;
@@ -655,6 +658,9 @@ void blk_mq_start_request(struct request *rq)
trace_block_rq_issue(q, rq);
+#ifdef CONFIG_BLK_RQ_IO_DATA_LEN
+ rq->io_data_len = blk_rq_bytes(rq);
+#endif
if (test_bit(QUEUE_FLAG_STATS, &q->queue_flags)) {
rq->io_start_time_ns = ktime_get_ns();
rq->stats_sectors = blk_rq_sectors(rq);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 32868fbedc9e..bfd34c6a27ef 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -142,6 +142,14 @@ struct request {
/* the following two fields are internal, NEVER access directly */
unsigned int __data_len; /* total data len */
+#ifdef CONFIG_BLK_RQ_IO_DATA_LEN
+ /*
+ * Total data len at the time of issue. This doesn't get deducted by
+ * blk_update_request() and can be used by completion path to determine
+ * the request size.
+ */
+ unsigned int io_data_len;
+#endif
sector_t __sector; /* sector cursor */
struct bio *bio;
--
2.25.1
next prev parent reply other threads:[~2020-04-08 20:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-08 20:14 [PATCHSET block/for-5.8] iocost: improve use_delay and latency target handling Tejun Heo
2020-04-08 20:14 ` [PATCH 1/5] blk-iocost: switch to fixed non-auto-decaying use_delay Tejun Heo
2020-04-08 20:14 ` [PATCH 3/5] blk-iocost: account for IO size when testing latencies Tejun Heo
[not found] ` <20200408201450.3959560-1-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2020-04-08 20:14 ` Tejun Heo [this message]
2020-04-08 20:14 ` [PATCH 2/5] block: add request->io_data_len Tejun Heo
2020-04-09 1:44 ` Ming Lei
[not found] ` <20200409014406.GA370295-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2020-04-09 2:11 ` Tejun Heo
2020-04-09 2:11 ` Tejun Heo
[not found] ` <20200409021119.GJ162390-qYNAdHglDFBN0TnZuCh8vA@public.gmane.org>
2020-04-09 2:38 ` Ming Lei
2020-04-09 2:38 ` Ming Lei
[not found] ` <20200409023857.GB370295-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2020-04-09 5:08 ` Pavel Begunkov
2020-04-09 5:08 ` Pavel Begunkov
2020-04-13 14:02 ` Tejun Heo
2020-04-13 13:56 ` Tejun Heo
2020-04-13 13:56 ` Tejun Heo
2020-04-09 3:44 ` Bart Van Assche
[not found] ` <b027a718-1c76-6e34-1edb-5435a5605d35-HInyCGIudOg@public.gmane.org>
2020-04-13 13:52 ` Tejun Heo
2020-04-13 13:52 ` Tejun Heo
2020-04-08 20:14 ` [PATCH 4/5] iocost_monitor: exit successfully if interval is zero Tejun Heo
2020-04-08 20:14 ` Tejun Heo
2020-04-08 20:14 ` [PATCH 5/5] iocost_monitor: drop string wrap around numbers when outputting json Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200408201450.3959560-3-tj@kernel.org \
--to=tj-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=josef-DigfWCa+lFGyeJad7bwFQA@public.gmane.org \
--cc=kernel-team-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=newella-b10kYP2dOMg@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.