Commit db0a2e00 authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe

block: clear drain buffer if draining for write command

Clear drain buffer before chaining if the command in question is a
write.
Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 2fb98e84
...@@ -221,6 +221,9 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq, ...@@ -221,6 +221,9 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
} /* segments in rq */ } /* segments in rq */
if (q->dma_drain_size && q->dma_drain_needed(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->page_link &= ~0x02;
sg = sg_next(sg); sg = sg_next(sg);
sg_set_page(sg, virt_to_page(q->dma_drain_buffer), sg_set_page(sg, virt_to_page(q->dma_drain_buffer),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment