Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cad9751642b62cbb5f62feedc546b4f7890497d4
Commit:     cad9751642b62cbb5f62feedc546b4f7890497d4
Parent:     958b7f37ee0fb2846c8d44310a68ae9605614ff9
Author:     Jens Axboe <[EMAIL PROTECTED]>
AuthorDate: Sun Jan 14 22:26:09 2007 +1100
Committer:  Jens Axboe <[EMAIL PROTECTED]>
CommitDate: Sun Feb 11 23:14:44 2007 +0100

    elevator: abstract out the activate and deactivate functions
    
    Signed-off-by: Jens Axboe <[EMAIL PROTECTED]>
---
 block/elevator.c |   29 ++++++++++++++++++++---------
 1 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/block/elevator.c b/block/elevator.c
index f6dafa8..d037623 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -269,6 +269,22 @@ void elevator_exit(elevator_t *e)
 
 EXPORT_SYMBOL(elevator_exit);
 
+static void elv_activate_rq(request_queue_t *q, struct request *rq)
+{
+       elevator_t *e = q->elevator;
+
+       if (e->ops->elevator_activate_req_fn)
+               e->ops->elevator_activate_req_fn(q, rq);
+}
+
+static void elv_deactivate_rq(request_queue_t *q, struct request *rq)
+{
+       elevator_t *e = q->elevator;
+
+       if (e->ops->elevator_deactivate_req_fn)
+               e->ops->elevator_deactivate_req_fn(q, rq);
+}
+
 static inline void __elv_rqhash_del(struct request *rq)
 {
        hlist_del_init(&rq->hash);
@@ -498,16 +514,14 @@ void elv_merge_requests(request_queue_t *q, struct 
request *rq,
 
 void elv_requeue_request(request_queue_t *q, struct request *rq)
 {
-       elevator_t *e = q->elevator;
-
        /*
         * it already went through dequeue, we need to decrement the
         * in_flight count again
         */
        if (blk_account_rq(rq)) {
                q->in_flight--;
-               if (blk_sorted_rq(rq) && e->ops->elevator_deactivate_req_fn)
-                       e->ops->elevator_deactivate_req_fn(q, rq);
+               if (blk_sorted_rq(rq))
+                       elv_deactivate_rq(q, rq);
        }
 
        rq->cmd_flags &= ~REQ_STARTED;
@@ -700,16 +714,13 @@ struct request *elv_next_request(request_queue_t *q)
 
        while ((rq = __elv_next_request(q)) != NULL) {
                if (!(rq->cmd_flags & REQ_STARTED)) {
-                       elevator_t *e = q->elevator;
-
                        /*
                         * This is the first time the device driver
                         * sees this request (possibly after
                         * requeueing).  Notify IO scheduler.
                         */
-                       if (blk_sorted_rq(rq) &&
-                           e->ops->elevator_activate_req_fn)
-                               e->ops->elevator_activate_req_fn(q, rq);
+                       if (blk_sorted_rq(rq))
+                               elv_activate_rq(q, rq);
 
                        /*
                         * just mark as started even if we don't start
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to