Skip to content

Commit

Permalink
block: clear drain buffer if draining for write command
Browse files Browse the repository at this point in the history
Clear drain buffer before chaining if the command in question is a
write.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Feb 19, 2008
1 parent 2fb98e8 commit db0a2e0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions block/blk-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
} /* segments in rq */

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),
Expand Down

0 comments on commit db0a2e0

Please sign in to comment.