Commit c56ec763 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block:
  [BLOCK] blk_rq_map_sg() next_sg fixup
  Revert "[SCSI] Remove full sg table memset()"
parents fb9fc395 ba951841
...@@ -1322,8 +1322,8 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq, ...@@ -1322,8 +1322,8 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
struct scatterlist *sglist) struct scatterlist *sglist)
{ {
struct bio_vec *bvec, *bvprv; struct bio_vec *bvec, *bvprv;
struct scatterlist *next_sg, *sg;
struct req_iterator iter; struct req_iterator iter;
struct scatterlist *sg;
int nsegs, cluster; int nsegs, cluster;
nsegs = 0; nsegs = 0;
...@@ -1333,7 +1333,7 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq, ...@@ -1333,7 +1333,7 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
* for each bio in rq * for each bio in rq
*/ */
bvprv = NULL; bvprv = NULL;
sg = next_sg = &sglist[0]; sg = NULL;
rq_for_each_segment(bvec, rq, iter) { rq_for_each_segment(bvec, rq, iter) {
int nbytes = bvec->bv_len; int nbytes = bvec->bv_len;
...@@ -1349,8 +1349,10 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq, ...@@ -1349,8 +1349,10 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
sg->length += nbytes; sg->length += nbytes;
} else { } else {
new_segment: new_segment:
sg = next_sg; if (!sg)
next_sg = sg_next(sg); sg = sglist;
else
sg = sg_next(sg);
memset(sg, 0, sizeof(*sg)); memset(sg, 0, sizeof(*sg));
sg->page = bvec->bv_page; sg->page = bvec->bv_page;
......
...@@ -764,6 +764,8 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask) ...@@ -764,6 +764,8 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask)
if (unlikely(!sgl)) if (unlikely(!sgl))
goto enomem; goto enomem;
memset(sgl, 0, sizeof(*sgl) * sgp->size);
/* /*
* first loop through, set initial index and return value * first loop through, set initial index and return value
*/ */
......
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