Skip to content

Commit 71fe07d

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: remove request ref_count
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 5953316 commit 71fe07d

File tree

3 files changed

+0
-12
lines changed

3 files changed

+0
-12
lines changed

block/blk-core.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ void blk_rq_init(struct request_queue *q, struct request *rq)
145145
rq->cmd = rq->__cmd;
146146
rq->cmd_len = BLK_MAX_CDB;
147147
rq->tag = -1;
148-
rq->ref_count = 1;
149148
rq->start_time = jiffies;
150149
set_start_time_ns(rq);
151150
rq->part = NULL;
@@ -1272,8 +1271,6 @@ void __blk_put_request(struct request_queue *q, struct request *req)
12721271
{
12731272
if (unlikely(!q))
12741273
return;
1275-
if (unlikely(--req->ref_count))
1276-
return;
12771274

12781275
blk_pm_put_request(req);
12791276

block/blk-exec.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ static void blk_end_sync_rq(struct request *rq, int error)
2424
struct completion *waiting = rq->end_io_data;
2525

2626
rq->end_io_data = NULL;
27-
__blk_put_request(rq->q, rq);
2827

2928
/*
3029
* 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,
103102
int err = 0;
104103
unsigned long hang_check;
105104

106-
/*
107-
* we need an extra reference to the request, so we can look at
108-
* it after io completion
109-
*/
110-
rq->ref_count++;
111-
112105
if (!rq->sense) {
113106
memset(sense, 0, sizeof(sense));
114107
rq->sense = sense;

include/linux/blkdev.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,6 @@ struct request {
160160

161161
unsigned short ioprio;
162162

163-
int ref_count;
164-
165163
void *special; /* opaque pointer available for LLD use */
166164
char *buffer; /* kaddr of the current segment if available */
167165

0 commit comments

Comments
 (0)