linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: account statistics for passthrough requests
@ 2019-10-10 23:36 Logan Gunthorpe
  2019-10-10 23:52 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Logan Gunthorpe @ 2019-10-10 23:36 UTC (permalink / raw)
  To: linux-block, linux-kernel, Jens Axboe
  Cc: Stephen Bates, Logan Gunthorpe, Christoph Hellwig

Presently, passthrough requests are not accounted for because
blk_do_io_stat() expressly rejects them. Based on some digging
in the history, this doesn't seem like a concious decision but
one that evolved from the change from blk_fs_request() to
blk_rq_is_passthrough().

To support this, call blk_account_io_start() in blk_execute_rq_nowait()
and remove the passthrough check in blk_do_io_stat().

Link: https://lore.kernel.org/linux-block/20191010100526.GA27209@lst.de/
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@lst.de>
---

This change is needed for the NVMe-of passthru work that is in progress.
Christoph suggested sending it as its own patch. (See the link
in the commit message for more information.)

 block/blk-exec.c | 2 ++
 block/blk.h      | 7 ++-----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/block/blk-exec.c b/block/blk-exec.c
index 1db44ca0f4a6..e20a852ae432 100644
--- a/block/blk-exec.c
+++ b/block/blk-exec.c
@@ -55,6 +55,8 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
 	rq->rq_disk = bd_disk;
 	rq->end_io = done;

+	blk_account_io_start(rq, true);
+
 	/*
 	 * don't check dying flag for MQ because the request won't
 	 * be reused after dying flag is set
diff --git a/block/blk.h b/block/blk.h
index 47fba9362e60..2bea40180b6f 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -242,14 +242,11 @@ int blk_dev_init(void);
  * Contribute to IO statistics IFF:
  *
  *	a) it's attached to a gendisk, and
- *	b) the queue had IO stats enabled when this request was started, and
- *	c) it's a file system request
+ *	b) the queue had IO stats enabled when this request was started
  */
 static inline bool blk_do_io_stat(struct request *rq)
 {
-	return rq->rq_disk &&
-	       (rq->rq_flags & RQF_IO_STAT) &&
-		!blk_rq_is_passthrough(rq);
+	return rq->rq_disk && (rq->rq_flags & RQF_IO_STAT);
 }

 static inline void req_set_nomerge(struct request_queue *q, struct request *req)
--
2.20.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: account statistics for passthrough requests
  2019-10-10 23:36 [PATCH] block: account statistics for passthrough requests Logan Gunthorpe
@ 2019-10-10 23:52 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-10-10 23:52 UTC (permalink / raw)
  To: Logan Gunthorpe, linux-block, linux-kernel
  Cc: Stephen Bates, Christoph Hellwig

On 10/10/19 5:36 PM, Logan Gunthorpe wrote:
> Presently, passthrough requests are not accounted for because
> blk_do_io_stat() expressly rejects them. Based on some digging
> in the history, this doesn't seem like a concious decision but
> one that evolved from the change from blk_fs_request() to
> blk_rq_is_passthrough().
> 
> To support this, call blk_account_io_start() in blk_execute_rq_nowait()
> and remove the passthrough check in blk_do_io_stat().

Looks good to me, applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-10 23:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 23:36 [PATCH] block: account statistics for passthrough requests Logan Gunthorpe
2019-10-10 23:52 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).