Commit 7aeacf98 authored by Jens Axboe's avatar Jens Axboe

[BLOCK] blk_rq_map_sg: force clear termination bit

Since blk_rq_map_sg() sets the termination bit at the end of the sg
table, we could see it prematurely on the next mapping unless we
force drivers to do a full sg_init_table() prior to each mapping. So
force clear the termination bit to avoid having to put that clear in
the driver for every mapping.
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent ad0d4083
...@@ -1351,8 +1351,20 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq, ...@@ -1351,8 +1351,20 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
new_segment: new_segment:
if (!sg) if (!sg)
sg = sglist; sg = sglist;
else else {
/*
* If the driver previously mapped a shorter
* list, we could see a termination bit
* prematurely unless it fully inits the sg
* table on each mapping. We KNOW that there
* must be more entries here or the driver
* would be buggy, so force clear the
* termination bit to avoid doing a full
* sg_init_table() in drivers for each command.
*/
sg->page_link &= ~0x02;
sg = sg_next(sg); sg = sg_next(sg);
}
sg_set_page(sg, bvec->bv_page); sg_set_page(sg, bvec->bv_page);
sg->length = nbytes; sg->length = nbytes;
......
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