paride: dequeue in-flight request
authorTejun Heo <tj@kernel.org>
Fri, 8 May 2009 02:54:06 +0000 (11:54 +0900)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 11 May 2009 07:52:16 +0000 (09:52 +0200)
pd/pf/pcd have track in-flight request by pd/pf/pcd_req.  They can be
converted to dequeueing model by updating fetching and completion
paths.  Convert them.

Note that removal of elv_next_request() call from pf_next_buf()
doesn't make any functional difference.  The path is traveled only
during partial completion of a request and elv_next_request() call
must return the same request anyway.

[ Impact: dequeue in-flight request ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Tim Waugh <tim@cyberelk.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
drivers/block/paride/pcd.c
drivers/block/paride/pd.c
drivers/block/paride/pf.c

index 2d5dc0af55e4d0655b9c9d940d227a45ed4d3cbc..425f81586a3119c6d0843e7464f4649bbbb26e09 100644 (file)
@@ -719,9 +719,12 @@ static void do_pcd_request(struct request_queue * q)
        if (pcd_busy)
                return;
        while (1) {
-               pcd_req = elv_next_request(q);
-               if (!pcd_req)
-                       return;
+               if (!pcd_req) {
+                       pcd_req = elv_next_request(q);
+                       if (!pcd_req)
+                               return;
+                       blkdev_dequeue_request(pcd_req);
+               }
 
                if (rq_data_dir(pcd_req) == READ) {
                        struct pcd_unit *cd = pcd_req->rq_disk->private_data;
@@ -734,8 +737,10 @@ static void do_pcd_request(struct request_queue * q)
                        pcd_busy = 1;
                        ps_set_intr(do_pcd_read, NULL, 0, nice);
                        return;
-               } else
-                       __blk_end_request_cur(pcd_req, -EIO);
+               } else {
+                       __blk_end_request_all(pcd_req, -EIO);
+                       pcd_req = NULL;
+               }
        }
 }
 
@@ -744,7 +749,8 @@ static inline void next_request(int err)
        unsigned long saved_flags;
 
        spin_lock_irqsave(&pcd_lock, saved_flags);
-       __blk_end_request_cur(pcd_req, err);
+       if (!__blk_end_request_cur(pcd_req, err))
+               pcd_req = NULL;
        pcd_busy = 0;
        do_pcd_request(pcd_queue);
        spin_unlock_irqrestore(&pcd_lock, saved_flags);
index 9ec5d4ac0b644a42bb399bd2581e4f6c511eef7a..d2ca3f5520610d7fa0cccbebf60dddc25c7f3c10 100644 (file)
@@ -410,11 +410,14 @@ static void run_fsm(void)
                                pd_claimed = 0;
                                phase = NULL;
                                spin_lock_irqsave(&pd_lock, saved_flags);
-                               __blk_end_request_cur(pd_req,
-                                                     res == Ok ? 0 : -EIO);
-                               pd_req = elv_next_request(pd_queue);
-                               if (!pd_req)
-                                       stop = 1;
+                               if (!__blk_end_request_cur(pd_req,
+                                               res == Ok ? 0 : -EIO)) {
+                                       pd_req = elv_next_request(pd_queue);
+                                       if (!pd_req)
+                                               stop = 1;
+                                       else
+                                               blkdev_dequeue_request(pd_req);
+                               }
                                spin_unlock_irqrestore(&pd_lock, saved_flags);
                                if (stop)
                                        return;
@@ -706,6 +709,7 @@ static void do_pd_request(struct request_queue * q)
        pd_req = elv_next_request(q);
        if (!pd_req)
                return;
+       blkdev_dequeue_request(pd_req);
 
        schedule_fsm();
 }
index e88c889aa7f21770eee8348e0f92338f931e5b99..d6f7bd84ed392a2fa0ea34d75d7a8ac3c4d2994f 100644 (file)
@@ -752,10 +752,8 @@ static struct request_queue *pf_queue;
 
 static void pf_end_request(int err)
 {
-       if (pf_req) {
-               __blk_end_request_cur(pf_req, err);
+       if (pf_req && !__blk_end_request_cur(pf_req, err))
                pf_req = NULL;
-       }
 }
 
 static void do_pf_request(struct request_queue * q)
@@ -763,9 +761,12 @@ static void do_pf_request(struct request_queue * q)
        if (pf_busy)
                return;
 repeat:
-       pf_req = elv_next_request(q);
-       if (!pf_req)
-               return;
+       if (!pf_req) {
+               pf_req = elv_next_request(q);
+               if (!pf_req)
+                       return;
+               blkdev_dequeue_request(pf_req);
+       }
 
        pf_current = pf_req->rq_disk->private_data;
        pf_block = blk_rq_pos(pf_req);
@@ -806,7 +807,6 @@ static int pf_next_buf(void)
        if (!pf_count) {
                spin_lock_irqsave(&pf_spin_lock, saved_flags);
                pf_end_request(0);
-               pf_req = elv_next_request(pf_queue);
                spin_unlock_irqrestore(&pf_spin_lock, saved_flags);
                if (!pf_req)
                        return 1;