@@ -3800,6 +3800,16 @@ queue_fail:
return 1;
}
+static int cfq_get_request_context(struct request *rq)
+{
+ struct cfq_queue *cfqq = RQ_CFQQ(rq);
+
+ if (cfqq)
+ return cfqq->pid;
+
+ return 0;
+}
+
static void cfq_kick_queue(struct work_struct *work)
{
struct cfq_data *cfqd =
@@ -4211,6 +4221,7 @@ static struct elevator_type iosched_cfq = {
.elevator_latter_req_fn = elv_rb_latter_request,
.elevator_set_req_fn = cfq_set_request,
.elevator_put_req_fn = cfq_put_request,
+ .elevator_get_req_context_fn = cfq_get_request_context,
.elevator_may_queue_fn = cfq_may_queue,
.elevator_init_fn = cfq_init_queue,
.elevator_exit_fn = cfq_exit_queue,
@@ -551,6 +551,19 @@ static inline void blk_clear_queue_full(struct request_queue *q, int sync)
queue_flag_clear(QUEUE_FLAG_ASYNCFULL, q);
}
+static inline int elv_get_request_context(struct request_queue *q,
+ struct request *rq)
+{
+ struct elevator_queue *e = q->elevator;
+
+ if (!(rq->cmd_flags & REQ_ELVPRIV))
+ return 0;
+
+ if (e->ops->elevator_get_req_context_fn)
+ return e->ops->elevator_get_req_context_fn(rq);
+
+ return 0;
+}
/*
* mergeable request must not have _NOMERGE or _BARRIER bit set, nor may
@@ -26,6 +26,7 @@ typedef int (elevator_may_queue_fn) (struct request_queue *, int);
typedef int (elevator_set_req_fn) (struct request_queue *, struct request *, gfp_t);
typedef void (elevator_put_req_fn) (struct request *);
+typedef int (elevator_get_req_context_fn) (struct request *);
typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *);
typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *);
@@ -52,6 +53,7 @@ struct elevator_ops
elevator_set_req_fn *elevator_set_req_fn;
elevator_put_req_fn *elevator_put_req_fn;
+ elevator_get_req_context_fn *elevator_get_req_context_fn;
elevator_may_queue_fn *elevator_may_queue_fn;