Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block
Browse files Browse the repository at this point in the history
* '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()"
  • Loading branch information
Linus Torvalds committed Oct 17, 2007
2 parents fb9fc39 + ba95184 commit c56ec76
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions block/ll_rw_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1322,8 +1322,8 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
struct scatterlist *sglist)
{
struct bio_vec *bvec, *bvprv;
struct scatterlist *next_sg, *sg;
struct req_iterator iter;
struct scatterlist *sg;
int nsegs, cluster;

nsegs = 0;
Expand All @@ -1333,7 +1333,7 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
* for each bio in rq
*/
bvprv = NULL;
sg = next_sg = &sglist[0];
sg = NULL;
rq_for_each_segment(bvec, rq, iter) {
int nbytes = bvec->bv_len;

Expand All @@ -1349,8 +1349,10 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
sg->length += nbytes;
} else {
new_segment:
sg = next_sg;
next_sg = sg_next(sg);
if (!sg)
sg = sglist;
else
sg = sg_next(sg);

memset(sg, 0, sizeof(*sg));
sg->page = bvec->bv_page;
Expand Down
2 changes: 2 additions & 0 deletions drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,8 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask)
if (unlikely(!sgl))
goto enomem;

memset(sgl, 0, sizeof(*sgl) * sgp->size);

/*
* first loop through, set initial index and return value
*/
Expand Down

0 comments on commit c56ec76

Please sign in to comment.