Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5d1a536621403b442eef60ddd35e6b7a46fb04b7
Commit:     5d1a536621403b442eef60ddd35e6b7a46fb04b7
Parent:     54866f032307063776b4eff7eadb131d47f9f9b4
Author:     Aaron Carroll <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 30 10:40:12 2007 +0100
Committer:  Jens Axboe <[EMAIL PROTECTED]>
CommitDate: Fri Nov 2 08:47:25 2007 +0100

    Deadline iosched: Factor out finding latter reques
    
    Factor finding the next request in sector-sorted order into
    a function deadline_latter_request.
    
    Signed-off-by: Aaron Carroll <[EMAIL PROTECTED]>
    Signed-off-by: Jens Axboe <[EMAIL PROTECTED]>
---
 block/deadline-iosched.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c
index 1a511ff..a44437e 100644
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -55,6 +55,20 @@ static void deadline_move_request(struct deadline_data *, 
struct request *);
 
 #define RQ_RB_ROOT(dd, rq)     (&(dd)->sort_list[rq_data_dir((rq))])
 
+/*
+ * get the request after `rq' in sector-sorted order
+ */
+static inline struct request *
+deadline_latter_request(struct request *rq)
+{
+       struct rb_node *node = rb_next(&rq->rb_node);
+
+       if (node)
+               return rb_entry_rq(node);
+
+       return NULL;
+}
+
 static void
 deadline_add_rq_rb(struct deadline_data *dd, struct request *rq)
 {
@@ -74,13 +88,8 @@ deadline_del_rq_rb(struct deadline_data *dd, struct request 
*rq)
 {
        const int data_dir = rq_data_dir(rq);
 
-       if (dd->next_rq[data_dir] == rq) {
-               struct rb_node *rbnext = rb_next(&rq->rb_node);
-
-               dd->next_rq[data_dir] = NULL;
-               if (rbnext)
-                       dd->next_rq[data_dir] = rb_entry_rq(rbnext);
-       }
+       if (dd->next_rq[data_dir] == rq)
+               dd->next_rq[data_dir] = deadline_latter_request(rq);
 
        elv_rb_del(RQ_RB_ROOT(dd, rq), rq);
 }
@@ -198,14 +207,11 @@ static void
 deadline_move_request(struct deadline_data *dd, struct request *rq)
 {
        const int data_dir = rq_data_dir(rq);
-       struct rb_node *rbnext = rb_next(&rq->rb_node);
 
        dd->next_rq[READ] = NULL;
        dd->next_rq[WRITE] = NULL;
+       dd->next_rq[data_dir] = deadline_latter_request(rq);
 
-       if (rbnext)
-               dd->next_rq[data_dir] = rb_entry_rq(rbnext);
-       
        dd->last_sector = rq->sector + rq->nr_sectors;
 
        /*
-
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