block: share request flush fields with elevator_private
Flush requests are never put on the IO scheduler. Convert request structure's elevator_private* into an array and have the flush fields share a union with it. Reclaim the space lost in 'struct request' by moving 'completion_data' back in the union with 'rb_node'. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Acked-by: Vivek Goyal <vgoyal@redhat.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
This commit is contained in:
@ -54,9 +54,9 @@ static const int cfq_hist_divisor = 4;
|
|||||||
#define CFQQ_SEEKY(cfqq) (hweight32(cfqq->seek_history) > 32/8)
|
#define CFQQ_SEEKY(cfqq) (hweight32(cfqq->seek_history) > 32/8)
|
||||||
|
|
||||||
#define RQ_CIC(rq) \
|
#define RQ_CIC(rq) \
|
||||||
((struct cfq_io_context *) (rq)->elevator_private)
|
((struct cfq_io_context *) (rq)->elevator_private[0])
|
||||||
#define RQ_CFQQ(rq) (struct cfq_queue *) ((rq)->elevator_private2)
|
#define RQ_CFQQ(rq) (struct cfq_queue *) ((rq)->elevator_private[1])
|
||||||
#define RQ_CFQG(rq) (struct cfq_group *) ((rq)->elevator_private3)
|
#define RQ_CFQG(rq) (struct cfq_group *) ((rq)->elevator_private[2])
|
||||||
|
|
||||||
static struct kmem_cache *cfq_pool;
|
static struct kmem_cache *cfq_pool;
|
||||||
static struct kmem_cache *cfq_ioc_pool;
|
static struct kmem_cache *cfq_ioc_pool;
|
||||||
@ -3589,12 +3589,12 @@ static void cfq_put_request(struct request *rq)
|
|||||||
|
|
||||||
put_io_context(RQ_CIC(rq)->ioc);
|
put_io_context(RQ_CIC(rq)->ioc);
|
||||||
|
|
||||||
rq->elevator_private = NULL;
|
rq->elevator_private[0] = NULL;
|
||||||
rq->elevator_private2 = NULL;
|
rq->elevator_private[1] = NULL;
|
||||||
|
|
||||||
/* Put down rq reference on cfqg */
|
/* Put down rq reference on cfqg */
|
||||||
cfq_put_cfqg(RQ_CFQG(rq));
|
cfq_put_cfqg(RQ_CFQG(rq));
|
||||||
rq->elevator_private3 = NULL;
|
rq->elevator_private[2] = NULL;
|
||||||
|
|
||||||
cfq_put_queue(cfqq);
|
cfq_put_queue(cfqq);
|
||||||
}
|
}
|
||||||
@ -3685,9 +3685,9 @@ new_queue:
|
|||||||
|
|
||||||
spin_unlock_irqrestore(q->queue_lock, flags);
|
spin_unlock_irqrestore(q->queue_lock, flags);
|
||||||
|
|
||||||
rq->elevator_private = cic;
|
rq->elevator_private[0] = cic;
|
||||||
rq->elevator_private2 = cfqq;
|
rq->elevator_private[1] = cfqq;
|
||||||
rq->elevator_private3 = cfq_ref_get_cfqg(cfqq->cfqg);
|
rq->elevator_private[2] = cfq_ref_get_cfqg(cfqq->cfqg);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
queue_fail:
|
queue_fail:
|
||||||
|
@ -764,7 +764,7 @@ int elv_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask)
|
|||||||
if (e->ops->elevator_set_req_fn)
|
if (e->ops->elevator_set_req_fn)
|
||||||
return e->ops->elevator_set_req_fn(q, rq, gfp_mask);
|
return e->ops->elevator_set_req_fn(q, rq, gfp_mask);
|
||||||
|
|
||||||
rq->elevator_private = NULL;
|
rq->elevator_private[0] = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,25 +99,26 @@ struct request {
|
|||||||
/*
|
/*
|
||||||
* The rb_node is only used inside the io scheduler, requests
|
* The rb_node is only used inside the io scheduler, requests
|
||||||
* are pruned when moved to the dispatch queue. So let the
|
* are pruned when moved to the dispatch queue. So let the
|
||||||
* flush fields share space with the rb_node.
|
* completion_data share space with the rb_node.
|
||||||
*/
|
*/
|
||||||
union {
|
union {
|
||||||
struct rb_node rb_node; /* sort/lookup */
|
struct rb_node rb_node; /* sort/lookup */
|
||||||
struct {
|
void *completion_data;
|
||||||
unsigned int seq;
|
|
||||||
struct list_head list;
|
|
||||||
} flush;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void *completion_data;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Three pointers are available for the IO schedulers, if they need
|
* Three pointers are available for the IO schedulers, if they need
|
||||||
* more they have to dynamically allocate it.
|
* more they have to dynamically allocate it. Flush requests are
|
||||||
|
* never put on the IO scheduler. So let the flush fields share
|
||||||
|
* space with the three elevator_private pointers.
|
||||||
*/
|
*/
|
||||||
void *elevator_private;
|
union {
|
||||||
void *elevator_private2;
|
void *elevator_private[3];
|
||||||
void *elevator_private3;
|
struct {
|
||||||
|
unsigned int seq;
|
||||||
|
struct list_head list;
|
||||||
|
} flush;
|
||||||
|
};
|
||||||
|
|
||||||
struct gendisk *rq_disk;
|
struct gendisk *rq_disk;
|
||||||
unsigned long start_time;
|
unsigned long start_time;
|
||||||
|
Reference in New Issue
Block a user