]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - block/blk-merge.c
x86: add comments to describe the new api's in cacheflush.h
[linux-2.6-omap-h63xx.git] / block / blk-merge.c
index 5023f0b08073f7a0e52563987911f88916d80052..0f58616bcd7f183514c43eb913f0e0c23c855215 100644 (file)
@@ -32,7 +32,7 @@ void blk_recalc_rq_sectors(struct request *rq, int nsect)
                 * size, something has gone terribly wrong
                 */
                if (rq->nr_sectors < rq->current_nr_sectors) {
-                       printk("blk: request botched\n");
+                       printk(KERN_ERR "blk: request botched\n");
                        rq->nr_sectors = rq->current_nr_sectors;
                }
        }
@@ -220,7 +220,10 @@ new_segment:
                bvprv = bvec;
        } /* segments in rq */
 
-       if (q->dma_drain_size) {
+       if (q->dma_drain_size && q->dma_drain_needed(rq)) {
+               if (rq->cmd_flags & REQ_RW)
+                       memset(q->dma_drain_buffer, 0, q->dma_drain_size);
+
                sg->page_link &= ~0x02;
                sg = sg_next(sg);
                sg_set_page(sg, virt_to_page(q->dma_drain_buffer),
@@ -228,6 +231,7 @@ new_segment:
                            ((unsigned long)q->dma_drain_buffer) &
                            (PAGE_SIZE - 1));
                nsegs++;
+               rq->extra_len += q->dma_drain_size;
        }
 
        if (sg)
@@ -235,7 +239,6 @@ new_segment:
 
        return nsegs;
 }
-
 EXPORT_SYMBOL(blk_rq_map_sg);
 
 static inline int ll_new_mergeable(struct request_queue *q,
@@ -305,8 +308,8 @@ int ll_back_merge_fn(struct request_queue *q, struct request *req,
        if (unlikely(!bio_flagged(bio, BIO_SEG_VALID)))
                blk_recount_segments(q, bio);
        len = req->biotail->bi_hw_back_size + bio->bi_hw_front_size;
-       if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(req->biotail), __BVEC_START(bio)) &&
-           !BIOVEC_VIRT_OVERSIZE(len)) {
+       if (BIOVEC_VIRT_MERGEABLE(__BVEC_END(req->biotail), __BVEC_START(bio))
+           && !BIOVEC_VIRT_OVERSIZE(len)) {
                int mergeable =  ll_new_mergeable(q, req, bio);
 
                if (mergeable) {
@@ -321,7 +324,7 @@ int ll_back_merge_fn(struct request_queue *q, struct request *req,
        return ll_new_hw_segment(q, req, bio);
 }
 
-int ll_front_merge_fn(struct request_queue *q, struct request *req, 
+int ll_front_merge_fn(struct request_queue *q, struct request *req,
                      struct bio *bio)
 {
        unsigned short max_sectors;
@@ -388,7 +391,8 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
 
        total_hw_segments = req->nr_hw_segments + next->nr_hw_segments;
        if (blk_hw_contig_segment(q, req->biotail, next->bio)) {
-               int len = req->biotail->bi_hw_back_size + next->bio->bi_hw_front_size;
+               int len = req->biotail->bi_hw_back_size +
+                               next->bio->bi_hw_front_size;
                /*
                 * propagate the combined length to the end of the requests
                 */
@@ -454,8 +458,14 @@ static int attempt_merge(struct request_queue *q, struct request *req,
        elv_merge_requests(q, req, next);
 
        if (req->rq_disk) {
+               struct hd_struct *part
+                       = get_part(req->rq_disk, req->sector);
                disk_round_stats(req->rq_disk);
                req->rq_disk->in_flight--;
+               if (part) {
+                       part_round_stats(part);
+                       part->in_flight--;
+               }
        }
 
        req->ioprio = ioprio_best(req->ioprio, next->ioprio);