]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - block/blk-core.c
Merge branches 'pm-cpufreq', 'pm-cpuidle' and 'pm-devfreq'
[karo-tx-linux.git] / block / blk-core.c
index c580b0138a7f3713486dc1005d47a75a357a24d2..a7421b772d0e0e3f4b8372fbc11aefd83763d30a 100644 (file)
@@ -648,13 +648,19 @@ int blk_init_rl(struct request_list *rl, struct request_queue *q,
        if (!rl->rq_pool)
                return -ENOMEM;
 
+       if (rl != &q->root_rl)
+               WARN_ON_ONCE(!blk_get_queue(q));
+
        return 0;
 }
 
-void blk_exit_rl(struct request_list *rl)
+void blk_exit_rl(struct request_queue *q, struct request_list *rl)
 {
-       if (rl->rq_pool)
+       if (rl->rq_pool) {
                mempool_destroy(rl->rq_pool);
+               if (rl != &q->root_rl)
+                       blk_put_queue(q);
+       }
 }
 
 struct request_queue *blk_alloc_queue(gfp_t gfp_mask)
@@ -2644,8 +2650,6 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
                return false;
        }
 
-       WARN_ON_ONCE(req->rq_flags & RQF_SPECIAL_PAYLOAD);
-
        req->__data_len -= total_bytes;
 
        /* update sector only for requests with clear definition of sector */
@@ -2658,17 +2662,19 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
                req->cmd_flags |= req->bio->bi_opf & REQ_FAILFAST_MASK;
        }
 
-       /*
-        * If total number of sectors is less than the first segment
-        * size, something has gone terribly wrong.
-        */
-       if (blk_rq_bytes(req) < blk_rq_cur_bytes(req)) {
-               blk_dump_rq_flags(req, "request botched");
-               req->__data_len = blk_rq_cur_bytes(req);
-       }
+       if (!(req->rq_flags & RQF_SPECIAL_PAYLOAD)) {
+               /*
+                * If total number of sectors is less than the first segment
+                * size, something has gone terribly wrong.
+                */
+               if (blk_rq_bytes(req) < blk_rq_cur_bytes(req)) {
+                       blk_dump_rq_flags(req, "request botched");
+                       req->__data_len = blk_rq_cur_bytes(req);
+               }
 
-       /* recalculate the number of segments */
-       blk_recalc_rq_segments(req);
+               /* recalculate the number of segments */
+               blk_recalc_rq_segments(req);
+       }
 
        return true;
 }