Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286262
b: refs/heads/master
c: 7683084
h: refs/heads/master
v: v3
  • Loading branch information
Matthew Wilcox committed Nov 4, 2011
1 parent 6f70333 commit 5c18cf5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1974b1ae8852324a75fb8cfecbc7b758fd5a2c3c
refs/heads/master: 768308400f5b4ce665a072eb976a851978b7706e
24 changes: 15 additions & 9 deletions trunk/drivers/block/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,19 +392,25 @@ static struct nvme_prps *nvme_setup_prps(struct nvme_dev *dev,
static int nvme_map_bio(struct device *dev, struct nvme_bio *nbio,
struct bio *bio, enum dma_data_direction dma_dir, int psegs)
{
struct bio_vec *bvec;
struct scatterlist *sg = nbio->sg;
int i, nsegs;
struct bio_vec *bvec, *bvprv = NULL;
struct scatterlist *sg = NULL;
int i, nsegs = 0;

sg_init_table(sg, psegs);
sg_init_table(nbio->sg, psegs);
bio_for_each_segment(bvec, bio, i) {
sg_set_page(sg, bvec->bv_page, bvec->bv_len, bvec->bv_offset);
sg++;
/* XXX: handle non-mergable here */
nsegs++;
if (bvprv && BIOVEC_PHYS_MERGEABLE(bvprv, bvec)) {
sg->length += bvec->bv_len;
} else {
/* Check bvprv && offset == 0 */
sg = sg ? sg + 1 : nbio->sg;
sg_set_page(sg, bvec->bv_page, bvec->bv_len,
bvec->bv_offset);
nsegs++;
}
bvprv = bvec;
}
nbio->nents = nsegs;

sg_mark_end(sg);
return dma_map_sg(dev, nbio->sg, nbio->nents, dma_dir);
}

Expand Down

0 comments on commit 5c18cf5

Please sign in to comment.