public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: linux-kernel@vger.kernel.org
Cc: hch@infradead.org, Christoph Hellwig <hch@lst.de>,
	Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 04/11] block: remove request ref_count
Date: Thu, 24 Oct 2013 10:25:57 +0100	[thread overview]
Message-ID: <1382606764-8309-5-git-send-email-axboe@kernel.dk> (raw)
In-Reply-To: <1382606764-8309-1-git-send-email-axboe@kernel.dk>

From: Christoph Hellwig <hch@infradead.org>

This reference count has been around since before git history, but the only
place where it's used is in blk_execute_rq, and ther it is entirely useless
as it is incremented before submitting the request and decremented in the
end_io handler before waking up the submitter thread.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 block/blk-core.c       | 3 ---
 block/blk-exec.c       | 7 -------
 include/linux/blkdev.h | 2 --
 3 files changed, 12 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 213e9f0..18faa7e 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -145,7 +145,6 @@ void blk_rq_init(struct request_queue *q, struct request *rq)
 	rq->cmd = rq->__cmd;
 	rq->cmd_len = BLK_MAX_CDB;
 	rq->tag = -1;
-	rq->ref_count = 1;
 	rq->start_time = jiffies;
 	set_start_time_ns(rq);
 	rq->part = NULL;
@@ -1272,8 +1271,6 @@ void __blk_put_request(struct request_queue *q, struct request *req)
 {
 	if (unlikely(!q))
 		return;
-	if (unlikely(--req->ref_count))
-		return;
 
 	blk_pm_put_request(req);
 
diff --git a/block/blk-exec.c b/block/blk-exec.c
index ae4f27d..6b18d82 100644
--- a/block/blk-exec.c
+++ b/block/blk-exec.c
@@ -24,7 +24,6 @@ static void blk_end_sync_rq(struct request *rq, int error)
 	struct completion *waiting = rq->end_io_data;
 
 	rq->end_io_data = NULL;
-	__blk_put_request(rq->q, rq);
 
 	/*
 	 * complete last, if this is a stack request the process (and thus
@@ -103,12 +102,6 @@ int blk_execute_rq(struct request_queue *q, struct gendisk *bd_disk,
 	int err = 0;
 	unsigned long hang_check;
 
-	/*
-	 * we need an extra reference to the request, so we can look at
-	 * it after io completion
-	 */
-	rq->ref_count++;
-
 	if (!rq->sense) {
 		memset(sense, 0, sizeof(sense));
 		rq->sense = sense;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f5c7596..0a8da96 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -160,8 +160,6 @@ struct request {
 
 	unsigned short ioprio;
 
-	int ref_count;
-
 	void *special;		/* opaque pointer available for LLD use */
 	char *buffer;		/* kaddr of the current segment if available */
 
-- 
1.8.1.2


  parent reply	other threads:[~2013-10-24  9:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-24  9:25 Jens Axboe
2013-10-24  9:25 ` [PATCH 01/11] Export __smp_call_function_single() Jens Axboe
2013-10-24  9:50   ` Christoph Hellwig
2013-10-24 10:16     ` Jens Axboe
2013-10-24 12:50       ` Christoph Hellwig
2013-10-25 10:21   ` Ingo Molnar
2013-10-25 10:44     ` Jens Axboe
2013-10-25 10:45       ` Ingo Molnar
2013-10-24  9:25 ` [PATCH 02/11] smp: don't warn about csd->flags having CSD_FLAG_LOCK cleared for !wait Jens Axboe
2013-10-24  9:39   ` Christoph Hellwig
2013-10-24  9:25 ` [PATCH 03/11] block: make rq->cmd_flags be 64-bit Jens Axboe
2013-10-24  9:40   ` Christoph Hellwig
2013-10-24  9:25 ` Jens Axboe [this message]
2013-10-24  9:25 ` [PATCH 05/11] direct-io: only inc/dec inode->i_dio_count for file systems Jens Axboe
2013-10-24  9:46   ` Jens Axboe
2013-10-24  9:47     ` Christoph Hellwig
2013-10-24  9:49       ` Jens Axboe
2015-02-05 16:54         ` Mike Snitzer
2013-10-24  9:25 ` [PATCH 06/11] percpu_counter: make APIs irq safe Jens Axboe
2013-10-24  9:26 ` [PATCH 07/11] percpu_ida: make percpu_ida percpu size/batch configurable Jens Axboe
2013-10-24  9:26 ` [PATCH 08/11] percpu_ida: add percpu_ida_for_each_free Jens Axboe
2013-10-24  9:26 ` [PATCH 09/11] percpu_ida: add an API to return free tags Jens Axboe
2013-10-24  9:26 ` [PATCH 10/11] blk-mq: new multi-queue block IO queueing mechanism Jens Axboe
2013-10-24  9:39   ` Dave Jones
2013-10-24  9:50     ` Jens Axboe
2013-10-24  9:51   ` Christoph Hellwig
2013-10-24  9:26 ` [PATCH 11/11] null_blk: multi queue aware block test driver 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=1382606764-8309-5-git-send-email-axboe@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@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