提交 49171e5c 编写于 作者: J Jens Axboe 提交者: Jens Axboe

[PATCH] Remove struct request_list from struct request

It is always identical to &q->rq, and we only use it for detecting
whether this request came out of our mempool or not. So replace it
with an additional ->flags bit flag.
Signed-off-by: NJens Axboe <axboe@suse.de>
上级 c00895ab
...@@ -452,7 +452,6 @@ static void queue_flush(request_queue_t *q, unsigned which) ...@@ -452,7 +452,6 @@ static void queue_flush(request_queue_t *q, unsigned which)
rq->elevator_private = NULL; rq->elevator_private = NULL;
rq->elevator_private2 = NULL; rq->elevator_private2 = NULL;
rq->rq_disk = q->bar_rq.rq_disk; rq->rq_disk = q->bar_rq.rq_disk;
rq->rl = NULL;
rq->end_io = end_io; rq->end_io = end_io;
q->prepare_flush_fn(q, rq); q->prepare_flush_fn(q, rq);
...@@ -480,7 +479,6 @@ static inline struct request *start_ordered(request_queue_t *q, ...@@ -480,7 +479,6 @@ static inline struct request *start_ordered(request_queue_t *q,
rq->cmd_flags |= q->ordered & QUEUE_ORDERED_FUA ? REQ_FUA : 0; rq->cmd_flags |= q->ordered & QUEUE_ORDERED_FUA ? REQ_FUA : 0;
rq->elevator_private = NULL; rq->elevator_private = NULL;
rq->elevator_private2 = NULL; rq->elevator_private2 = NULL;
rq->rl = NULL;
init_request_from_bio(rq, q->orig_bar_rq->bio); init_request_from_bio(rq, q->orig_bar_rq->bio);
rq->end_io = bar_end_io; rq->end_io = bar_end_io;
...@@ -2018,7 +2016,7 @@ blk_alloc_request(request_queue_t *q, int rw, struct bio *bio, ...@@ -2018,7 +2016,7 @@ blk_alloc_request(request_queue_t *q, int rw, struct bio *bio,
* first three bits are identical in rq->cmd_flags and bio->bi_rw, * first three bits are identical in rq->cmd_flags and bio->bi_rw,
* see bio.h and blkdev.h * see bio.h and blkdev.h
*/ */
rq->cmd_flags = rw; rq->cmd_flags = rw | REQ_ALLOCED;
if (priv) { if (priv) {
if (unlikely(elv_set_request(q, rq, bio, gfp_mask))) { if (unlikely(elv_set_request(q, rq, bio, gfp_mask))) {
...@@ -2196,7 +2194,6 @@ static struct request *get_request(request_queue_t *q, int rw, struct bio *bio, ...@@ -2196,7 +2194,6 @@ static struct request *get_request(request_queue_t *q, int rw, struct bio *bio,
ioc->nr_batch_requests--; ioc->nr_batch_requests--;
rq_init(q, rq); rq_init(q, rq);
rq->rl = rl;
blk_add_trace_generic(q, bio, rw, BLK_TA_GETRQ); blk_add_trace_generic(q, bio, rw, BLK_TA_GETRQ);
out: out:
...@@ -2681,8 +2678,6 @@ EXPORT_SYMBOL_GPL(disk_round_stats); ...@@ -2681,8 +2678,6 @@ EXPORT_SYMBOL_GPL(disk_round_stats);
*/ */
void __blk_put_request(request_queue_t *q, struct request *req) void __blk_put_request(request_queue_t *q, struct request *req)
{ {
struct request_list *rl = req->rl;
if (unlikely(!q)) if (unlikely(!q))
return; return;
if (unlikely(--req->ref_count)) if (unlikely(--req->ref_count))
...@@ -2691,13 +2686,12 @@ void __blk_put_request(request_queue_t *q, struct request *req) ...@@ -2691,13 +2686,12 @@ void __blk_put_request(request_queue_t *q, struct request *req)
elv_completed_request(q, req); elv_completed_request(q, req);
req->rq_status = RQ_INACTIVE; req->rq_status = RQ_INACTIVE;
req->rl = NULL;
/* /*
* Request may not have originated from ll_rw_blk. if not, * Request may not have originated from ll_rw_blk. if not,
* it didn't come out of our reserved rq pools * it didn't come out of our reserved rq pools
*/ */
if (rl) { if (req->cmd_flags & REQ_ALLOCED) {
int rw = rq_data_dir(req); int rw = rq_data_dir(req);
int priv = req->cmd_flags & REQ_ELVPRIV; int priv = req->cmd_flags & REQ_ELVPRIV;
......
...@@ -180,6 +180,7 @@ enum rq_flag_bits { ...@@ -180,6 +180,7 @@ enum rq_flag_bits {
__REQ_PREEMPT, /* set for "ide_preempt" requests */ __REQ_PREEMPT, /* set for "ide_preempt" requests */
__REQ_ORDERED_COLOR, /* is before or after barrier */ __REQ_ORDERED_COLOR, /* is before or after barrier */
__REQ_RW_SYNC, /* request is sync (O_DIRECT) */ __REQ_RW_SYNC, /* request is sync (O_DIRECT) */
__REQ_ALLOCED, /* request came from our alloc pool */
__REQ_NR_BITS, /* stops here */ __REQ_NR_BITS, /* stops here */
}; };
...@@ -199,6 +200,7 @@ enum rq_flag_bits { ...@@ -199,6 +200,7 @@ enum rq_flag_bits {
#define REQ_PREEMPT (1 << __REQ_PREEMPT) #define REQ_PREEMPT (1 << __REQ_PREEMPT)
#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR) #define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
#define REQ_RW_SYNC (1 << __REQ_RW_SYNC) #define REQ_RW_SYNC (1 << __REQ_RW_SYNC)
#define REQ_ALLOCED (1 << __REQ_ALLOCED)
#define BLK_MAX_CDB 16 #define BLK_MAX_CDB 16
...@@ -264,7 +266,6 @@ struct request { ...@@ -264,7 +266,6 @@ struct request {
int ref_count; int ref_count;
request_queue_t *q; request_queue_t *q;
struct request_list *rl;
void *special; void *special;
char *buffer; char *buffer;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册