public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: linux-block@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 17/17] null_blk: remove legacy IO path
Date: Thu, 11 Oct 2018 10:59:09 -0600	[thread overview]
Message-ID: <20181011165909.32615-18-axboe@kernel.dk> (raw)
In-Reply-To: <20181011165909.32615-1-axboe@kernel.dk>

We're planning on removing this code completely, kill the old
path.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 drivers/block/null_blk_main.c | 96 +++--------------------------------
 1 file changed, 6 insertions(+), 90 deletions(-)

diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index 093b614d6524..8142cc8ff952 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -616,10 +616,6 @@ static void end_cmd(struct nullb_cmd *cmd)
 	case NULL_Q_MQ:
 		blk_mq_end_request(cmd->rq, cmd->error);
 		return;
-	case NULL_Q_RQ:
-		INIT_LIST_HEAD(&cmd->rq->queuelist);
-		blk_end_request_all(cmd->rq, cmd->error);
-		break;
 	case NULL_Q_BIO:
 		cmd->bio->bi_status = cmd->error;
 		bio_endio(cmd->bio);
@@ -627,15 +623,6 @@ static void end_cmd(struct nullb_cmd *cmd)
 	}
 
 	free_cmd(cmd);
-
-	/* Restart queue if needed, as we are freeing a tag */
-	if (queue_mode == NULL_Q_RQ && blk_queue_stopped(q)) {
-		unsigned long flags;
-
-		spin_lock_irqsave(q->queue_lock, flags);
-		blk_start_queue_async(q);
-		spin_unlock_irqrestore(q->queue_lock, flags);
-	}
 }
 
 static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer)
@@ -1197,17 +1184,8 @@ static blk_status_t null_handle_cmd(struct nullb_cmd *cmd)
 			/* race with timer */
 			if (atomic_long_read(&nullb->cur_bytes) > 0)
 				null_restart_queue_async(nullb);
-			if (dev->queue_mode == NULL_Q_RQ) {
-				struct request_queue *q = nullb->q;
-
-				spin_lock_irq(q->queue_lock);
-				rq->rq_flags |= RQF_DONTPREP;
-				blk_requeue_request(q, rq);
-				spin_unlock_irq(q->queue_lock);
-				return BLK_STS_OK;
-			} else
-				/* requeue request */
-				return BLK_STS_DEV_RESOURCE;
+			/* requeue request */
+			return BLK_STS_DEV_RESOURCE;
 		}
 	}
 
@@ -1278,9 +1256,6 @@ static blk_status_t null_handle_cmd(struct nullb_cmd *cmd)
 		case NULL_Q_MQ:
 			blk_mq_complete_request(cmd->rq);
 			break;
-		case NULL_Q_RQ:
-			blk_complete_request(cmd->rq);
-			break;
 		case NULL_Q_BIO:
 			/*
 			 * XXX: no proper submitting cpu information available.
@@ -1349,30 +1324,6 @@ static blk_qc_t null_queue_bio(struct request_queue *q, struct bio *bio)
 	return BLK_QC_T_NONE;
 }
 
-static enum blk_eh_timer_return null_rq_timed_out_fn(struct request *rq)
-{
-	pr_info("null: rq %p timed out\n", rq);
-	__blk_complete_request(rq);
-	return BLK_EH_DONE;
-}
-
-static int null_rq_prep_fn(struct request_queue *q, struct request *req)
-{
-	struct nullb *nullb = q->queuedata;
-	struct nullb_queue *nq = nullb_to_queue(nullb);
-	struct nullb_cmd *cmd;
-
-	cmd = alloc_cmd(nq, 0);
-	if (cmd) {
-		cmd->rq = req;
-		req->special = cmd;
-		return BLKPREP_OK;
-	}
-	blk_stop_queue(q);
-
-	return BLKPREP_DEFER;
-}
-
 static bool should_timeout_request(struct request *rq)
 {
 #ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION
@@ -1391,27 +1342,6 @@ static bool should_requeue_request(struct request *rq)
 	return false;
 }
 
-static void null_request_fn(struct request_queue *q)
-{
-	struct request *rq;
-
-	while ((rq = blk_fetch_request(q)) != NULL) {
-		struct nullb_cmd *cmd = rq->special;
-
-		/* just ignore the request */
-		if (should_timeout_request(rq))
-			continue;
-		if (should_requeue_request(rq)) {
-			blk_requeue_request(q, rq);
-			continue;
-		}
-
-		spin_unlock_irq(q->queue_lock);
-		null_handle_cmd(cmd);
-		spin_lock_irq(q->queue_lock);
-	}
-}
-
 static enum blk_eh_timer_return null_timeout_rq(struct request *rq, bool res)
 {
 	pr_info("null: rq %p timed out\n", rq);
@@ -1766,24 +1696,6 @@ static int null_add_dev(struct nullb_device *dev)
 		rv = init_driver_queues(nullb);
 		if (rv)
 			goto out_cleanup_blk_queue;
-	} else {
-		nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock,
-						dev->home_node);
-		if (!nullb->q) {
-			rv = -ENOMEM;
-			goto out_cleanup_queues;
-		}
-
-		if (!null_setup_fault())
-			goto out_cleanup_blk_queue;
-
-		blk_queue_prep_rq(nullb->q, null_rq_prep_fn);
-		blk_queue_softirq_done(nullb->q, null_softirq_done_fn);
-		blk_queue_rq_timed_out(nullb->q, null_rq_timed_out_fn);
-		nullb->q->rq_timeout = 5 * HZ;
-		rv = init_driver_queues(nullb);
-		if (rv)
-			goto out_cleanup_blk_queue;
 	}
 
 	if (dev->mbps) {
@@ -1865,6 +1777,10 @@ static int __init null_init(void)
 		return -EINVAL;
 	}
 
+	if (g_queue_mode == NULL_Q_RQ) {
+		pr_err("null_blk: legacy IO path no longer available\n");
+		return -EINVAL;
+	}
 	if (g_queue_mode == NULL_Q_MQ && g_use_per_node_hctx) {
 		if (g_submit_queues != nr_online_nodes) {
 			pr_warn("null_blk: submit_queues param is set to %u.\n",
-- 
2.17.1

  parent reply	other threads:[~2018-10-11 16:59 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11 16:58 [PATCHSET 0/17] Convert drivers to blk-mq Jens Axboe
2018-10-11 16:58 ` [PATCH 01/17] sunvdc: convert " Jens Axboe
2018-10-15 10:38   ` Ming Lei
2018-10-15 14:19     ` Jens Axboe
2018-10-15 14:50       ` Jens Axboe
2018-10-11 16:58 ` [PATCH 02/17] sx8: " Jens Axboe
2018-10-11 16:58 ` [PATCH 03/17] ps3disk: " Jens Axboe
2018-10-12 22:47   ` Geoff Levand
2018-10-13  0:58     ` Jens Axboe
2018-10-15 16:22       ` Geoff Levand
2018-10-15 16:27         ` Jens Axboe
2018-10-15 16:47           ` Jens Axboe
2018-10-15 18:23           ` Geoff Levand
2018-10-15 18:38             ` Jens Axboe
2018-10-15 19:09               ` Jens Axboe
2018-10-15 19:24               ` Geoff Levand
2018-10-15 19:30                 ` Jens Axboe
2018-10-11 16:58 ` [PATCH 04/17] paride: convert pcd " Jens Axboe
2018-10-11 16:58 ` [PATCH 05/17] paride: convert pd " Jens Axboe
2018-10-11 16:58 ` [PATCH 06/17] paride: convert pf " Jens Axboe
2018-10-11 16:58 ` [PATCH 07/17] uml: convert ubd " Jens Axboe
2018-10-15 10:27   ` Ming Lei
2018-10-15 14:16     ` Jens Axboe
2018-10-11 16:59 ` [PATCH 08/17] ms_block: convert " Jens Axboe
2018-10-14  6:30   ` Maxim Levitsky
2018-10-11 16:59 ` [PATCH 09/17] mspro_block: " Jens Axboe
2018-10-11 16:59 ` [PATCH 10/17] gdrom: " Jens Axboe
2018-10-11 16:59 ` [PATCH 11/17] z2ram: " Jens Axboe
2018-10-11 16:59 ` [PATCH 12/17] blk-mq-sched: export way for drivers to insert request Jens Axboe
2018-10-14 18:49   ` Christoph Hellwig
2018-10-14 18:56     ` Jens Axboe
2018-10-11 16:59 ` [PATCH 13/17] ide: convert to blk-mq Jens Axboe
2018-10-11 16:59 ` [PATCH 14/17] aoe: convert aoeblk " Jens Axboe
2018-10-12 11:28   ` Ed Cashin
2018-10-12 14:20     ` Jens Axboe
2018-10-12 16:17       ` Ed Cashin
2018-10-12 16:23         ` Jens Axboe
2018-10-12 16:26           ` Ed Cashin
2018-10-14  0:48             ` Ed Cashin
2018-10-14 18:44               ` Jens Axboe
2018-10-11 16:59 ` [PATCH 15/17] xsysace: convert " Jens Axboe
2018-10-12  5:46   ` Michal Simek
2018-10-11 16:59 ` [PATCH 16/17] mtd_blkdevs: " Jens Axboe
2018-10-11 21:03   ` Richard Weinberger
2018-10-11 21:14     ` Jens Axboe
2018-10-11 21:18       ` Richard Weinberger
2018-10-11 21:21         ` Jens Axboe
2018-10-11 21:31           ` Richard Weinberger
2018-10-11 16:59 ` Jens Axboe [this message]
2018-10-12  6:56   ` [PATCH 17/17] null_blk: remove legacy IO path Dongli Zhang
2018-10-12  8:51     ` Johannes Thumshirn
2018-10-12 14:18       ` Jens Axboe
2018-10-12 17:24   ` Sébastien Boisvert
2018-10-12 17:30     ` Jens Axboe
2018-10-12 17:37       ` Sébastien Boisvert
2018-10-12 17:50         ` Jens Axboe

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=20181011165909.32615-18-axboe@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox