On Mon, Jul 16 2007, FUJITA Tomonori wrote: > From: Jens Axboe <jens.axboe@xxxxxxxxxx> > Subject: [PATCH 29/33] infiniband: sg chaining support > Date: Mon, 16 Jul 2007 11:47:43 +0200 > > > @@ -226,7 +228,8 @@ static int iser_sg_to_page_vec(struct iser_data_buf *data, > > struct iser_page_vec *page_vec, > > struct ib_device *ibdev) > > { > > - struct scatterlist *sg = (struct scatterlist *)data->buf; > > + struct scatterlist *sgl = (struct scatterlist *)data->buf; > > + struct scatterlist *sg; > > u64 first_addr, last_addr, page; > > int end_aligned; > > unsigned int cur_page = 0; > > @@ -234,14 +237,14 @@ static int iser_sg_to_page_vec(struct iser_data_buf *data, > > int i; > > > > /* compute the offset of first element */ > > - page_vec->offset = (u64) sg[0].offset & ~MASK_4K; > > + page_vec->offset = (u64) sgl[0].offset & ~MASK_4K; > > > > - for (i = 0; i < data->dma_nents; i++) { > > - unsigned int dma_len = ib_sg_dma_len(ibdev, &sg[i]); > > + for_each_sg(sgl, sg, data->dma_nents, i) { > > + unsigned int dma_len = ib_sg_dma_len(ibdev, sg); > > > > total_sz += dma_len; > > > > - first_addr = ib_sg_dma_address(ibdev, &sg[i]); > > + first_addr = ib_sg_dma_address(ibdev, sg); > > last_addr = first_addr + dma_len; > > > > end_aligned = !(last_addr & ~MASK_4K); > > @@ -249,9 +252,9 @@ static int iser_sg_to_page_vec(struct iser_data_buf *data, > > /* continue to collect page fragments till aligned or SG ends */ > > while (!end_aligned && (i + 1 < data->dma_nents)) { > > i++; > > Do we need to replace i++ with sg = sg_next(sg) here? We do, updating the patch. Thanks for your review! -- Jens Axboe - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html