Re: [PATCH 14/16] block: switch polling to be bio based

From
chenxiang (M) <hidden>
Date
2021-11-03 07:11:32
Also in
linux-fsdevel, linux-nvme
Reply to
Christoph Hellwig, 2021-10-12
Hi Christoph,


在 2021/10/12 19:12, Christoph Hellwig 写道:
Replace the blk_poll interface that requires the caller to keep a queue
and cookie from the submissions with polling based on the bio.

Polling for the bio itself leads to a few advantages:

  - the cookie construction can made entirely private in blk-mq.c
  - the caller does not need to remember the request_queue and cookie
    separately and thus sidesteps their lifetime issues
  - keeping the device and the cookie inside the bio allows to trivially
    support polling BIOs remapping by stacking drivers
  - a lot of code to propagate the cookie back up the submission path can
    be removed entirely.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Mark Wunderlich <redacted>
---
......
quoted hunk ↗ jump to hunk
  /**
   * blk_cloned_rq_check_limits - Helper function to check a cloned request
   *                              for the new queue limits
diff --git a/block/blk-exec.c b/block/blk-exec.c
index 1fa7f25e57262..55f0cd34b37b9 100644
--- a/block/blk-exec.c
+++ b/block/blk-exec.c
@@ -65,13 +65,19 @@ EXPORT_SYMBOL_GPL(blk_execute_rq_nowait);
  
  static bool blk_rq_is_poll(struct request *rq)
  {
-	return rq->mq_hctx && rq->mq_hctx->type == HCTX_TYPE_POLL;
+	if (!rq->mq_hctx)
+		return false;
+	if (rq->mq_hctx->type != HCTX_TYPE_POLL)
+		return false;
+	if (WARN_ON_ONCE(!rq->bio))
+		return false;
+	return true;
  }
  
  static void blk_rq_poll_completion(struct request *rq, struct completion *wait)
  {
  	do {
-		blk_poll(rq->q, request_to_qc_t(rq->mq_hctx, rq), 0);
+		bio_poll(rq->bio, 0);
  		cond_resched();
  	} while (!completion_done(wait));
  }
For some scsi command sent by function __scsi_execute() without data, it has request but no bio (bufflen = 0),
then how to use bio_poll() for them ?

Best Regards,
Xiang Chen
Thread (35 messages) 35 messages, 7 authors, last reply 2021-11-03
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help