diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-29 08:51:56 +1100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-29 08:51:56 +1100 |
commit | 8d01eddf292dcd78b640418c80fb300532799cd4 (patch) | |
tree | dd7f816423463e5ad10f15af22fdbd5b75cc6184 /block/elevator.c | |
parent | f0f0052069989b80d2a3e50c9cd2f2a650bc1aea (diff) | |
parent | fa0ccd837e3dddb44c7db2f128a8bb7e4eabc21a (diff) |
Merge branch 'for-2.6.25' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.25' of git://git.kernel.dk/linux-2.6-block:
block: implement drain buffers
__bio_clone: don't calculate hw/phys segment counts
block: allow queue dma_alignment of zero
blktrace: Add blktrace ioctls to SCSI generic devices
Diffstat (limited to 'block/elevator.c')
-rw-r--r-- | block/elevator.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/block/elevator.c b/block/elevator.c index f9736fbdab03..8cd5775acd7a 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -741,7 +741,21 @@ struct request *elv_next_request(struct request_queue *q) q->boundary_rq = NULL; } - if ((rq->cmd_flags & REQ_DONTPREP) || !q->prep_rq_fn) + if (rq->cmd_flags & REQ_DONTPREP) + break; + + if (q->dma_drain_size && rq->data_len) { + /* + * make sure space for the drain appears we + * know we can do this because max_hw_segments + * has been adjusted to be one fewer than the + * device can handle + */ + rq->nr_phys_segments++; + rq->nr_hw_segments++; + } + + if (!q->prep_rq_fn) break; ret = q->prep_rq_fn(q, rq); @@ -754,6 +768,16 @@ struct request *elv_next_request(struct request_queue *q) * avoid resource deadlock. REQ_STARTED will * prevent other fs requests from passing this one. */ + if (q->dma_drain_size && rq->data_len && + !(rq->cmd_flags & REQ_DONTPREP)) { + /* + * remove the space for the drain we added + * so that we don't add it again + */ + --rq->nr_phys_segments; + --rq->nr_hw_segments; + } + rq = NULL; break; } else if (ret == BLKPREP_KILL) { |