Skip to content

Commit

Permalink
block: remove request ref_count
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Hellwig authored and axboe committed Oct 25, 2013
1 parent 5953316 commit 71fe07d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 12 deletions.
3 changes: 0 additions & 3 deletions block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
7 changes: 0 additions & 7 deletions block/blk-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions include/linux/blkdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down

0 comments on commit 71fe07d

Please sign in to comment.