linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Douglas Gilbert <dougg@torque.net>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: linux-scsi@vger.kernel.org, FUJITA Tomonori <tomof@acm.org>
Subject: Re: [PATCH 19/33] scsi_debug: support sg chaining
Date: Sat, 08 Sep 2007 10:53:31 -0400	[thread overview]
Message-ID: <46E2B76B.6050703@torque.net> (raw)
In-Reply-To: <11845792682668-git-send-email-jens.axboe@oracle.com>

Jens Axboe wrote:
> Cc: dgilbert@interlog.com
> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
> ---
>  drivers/scsi/scsi_debug.c |   30 ++++++++++++++++--------------
>  1 files changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 4cd9c58..46a3e07 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -38,6 +38,7 @@
>  #include <linux/proc_fs.h>
>  #include <linux/vmalloc.h>
>  #include <linux/moduleparam.h>
> +#include <linux/scatterlist.h>
>  
>  #include <linux/blkdev.h>
>  #include "scsi.h"
> @@ -600,7 +601,7 @@ static int fill_from_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr,
>  	int k, req_len, act_len, len, active;
>  	void * kaddr;
>  	void * kaddr_off;
> -	struct scatterlist * sgpnt;
> +	struct scatterlist * sg;
>  
>  	if (0 == scp->request_bufflen)
>  		return 0;
> @@ -619,16 +620,16 @@ static int fill_from_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr,
>  			scp->resid = req_len - act_len;
>  		return 0;
>  	}
> -	sgpnt = (struct scatterlist *)scp->request_buffer;
>  	active = 1;
> -	for (k = 0, req_len = 0, act_len = 0; k < scp->use_sg; ++k, ++sgpnt) {
> +	req_len = act_len = 0;
> +	scsi_for_each_sg(scp, sg, scp->use_sg, k) {
>  		if (active) {
>  			kaddr = (unsigned char *)
> -				kmap_atomic(sgpnt->page, KM_USER0);
> +				kmap_atomic(sg->page, KM_USER0);
>  			if (NULL == kaddr)
>  				return (DID_ERROR << 16);
> -			kaddr_off = (unsigned char *)kaddr + sgpnt->offset;
> -			len = sgpnt->length;
> +			kaddr_off = (unsigned char *)kaddr + sg->offset;
> +			len = sg->length;
>  			if ((req_len + len) > arr_len) {
>  				active = 0;
>  				len = arr_len - req_len;
> @@ -637,7 +638,7 @@ static int fill_from_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr,
>  			kunmap_atomic(kaddr, KM_USER0);
>  			act_len += len;
>  		}
> -		req_len += sgpnt->length;
> +		req_len += sg->length;
>  	}
>  	if (scp->resid)
>  		scp->resid -= act_len;
> @@ -653,7 +654,7 @@ static int fetch_to_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr,
>  	int k, req_len, len, fin;
>  	void * kaddr;
>  	void * kaddr_off;
> -	struct scatterlist * sgpnt;
> +	struct scatterlist * sg;
>  
>  	if (0 == scp->request_bufflen)
>  		return 0;
> @@ -668,13 +669,14 @@ static int fetch_to_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr,
>  		memcpy(arr, scp->request_buffer, len);
>  		return len;
>  	}
> -	sgpnt = (struct scatterlist *)scp->request_buffer;
> -	for (k = 0, req_len = 0, fin = 0; k < scp->use_sg; ++k, ++sgpnt) {
> -		kaddr = (unsigned char *)kmap_atomic(sgpnt->page, KM_USER0);
> +	sg = scsi_sglist(scp);
> +	req_len = fin = 0;
> +	for (k = 0; k < scp->use_sg; ++k, sg = sg_next(sg)) {
> +		kaddr = (unsigned char *)kmap_atomic(sg->page, KM_USER0);
>  		if (NULL == kaddr)
>  			return -1;
> -		kaddr_off = (unsigned char *)kaddr + sgpnt->offset;
> -		len = sgpnt->length;
> +		kaddr_off = (unsigned char *)kaddr + sg->offset;
> +		len = sg->length;
>  		if ((req_len + len) > max_arr_len) {
>  			len = max_arr_len - req_len;
>  			fin = 1;
> @@ -683,7 +685,7 @@ static int fetch_to_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr,
>  		kunmap_atomic(kaddr, KM_USER0);
>  		if (fin)
>  			return req_len + len;
> -		req_len += sgpnt->length;
> +		req_len += sg->length;
>  	}
>  	return req_len;
>  }

Signed-off-by: Douglas Gilbert <dougg@torque.net>


In a post titled: "Re: [PATCH 4/9] scsi_debug: convert to
                   use the data buffer accessors"
FUJITA Tomonori wrote:
> On Fri, 07 Sep 2007 15:12:06 -0400
> Douglas Gilbert <dougg@torque.net> wrote:
>
>> FUJITA Tomonori wrote:
>>> From: Boaz Harrosh <bharrosh@panasas.com>
>>>
>>> - remove the unnecessary map_single path.
>>>
>>> - convert to use the new accessors for the sg lists and the
>>> parameters.
>>>
>>> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
>> Signed-off-by: Douglas Gilbert <dougg@torque.net>
>
> This patch is on the top of the following patch:
>
> http://git.kernel.org/?p=linux/kernel/git/axboe/linux-2.6-block.git;a=commitdiff;h=63499aaafa6ec0c107a925574c2af84a2cd86703
>
> Can we get your ACK on this too?

Done.

> Probably, it would be fine to integrate these patches.

Yes that is fine.

When the dust settles, I can send a patch of my various mode
and log pages additions to scsi_debug in my working copy.

Doug Gilbert


  reply	other threads:[~2007-09-08 14:54 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-16  9:47 [PATCH 00/33] SG table chaining support Jens Axboe
2007-07-16  9:47 ` [PATCH 01/33] crypto: don't pollute the global namespace with sg_next() Jens Axboe
2007-07-16  9:47 ` [PATCH 02/33] Add sg helpers for iterating over a scatterlist table Jens Axboe
2007-07-16  9:47 ` [PATCH 03/33] block: convert to using sg helpers Jens Axboe
2007-07-16 19:21   ` Bartlomiej Zolnierkiewicz
2007-07-16 19:14     ` Jens Axboe
2007-07-16  9:47 ` [PATCH 04/33] scsi: " Jens Axboe
2007-07-16  9:47 ` [PATCH 05/33] Add chained sg support to linux/scatterlist.h Jens Axboe
2007-07-16 19:21   ` Bartlomiej Zolnierkiewicz
2007-07-16 19:15     ` Jens Axboe
2007-07-16  9:47 ` [PATCH 06/33] i386 dma_map_sg: convert to using sg helpers Jens Axboe
2007-07-16  9:47 ` [PATCH 07/33] i386: enable sg chaining Jens Axboe
2007-07-16  9:47 ` [PATCH 08/33] swiotlb: sg chaining support Jens Axboe
2007-07-16  9:47 ` [PATCH 09/33] x86-64: update iommu/dma mapping functions to sg helpers Jens Axboe
2007-07-16 20:06   ` Andrew Morton
2007-07-16 20:10     ` Jens Axboe
2007-07-16 20:34       ` Andrew Morton
2007-07-16 22:08         ` Muli Ben-Yehuda
2007-07-17  7:38           ` Jens Axboe
2007-07-17  8:49             ` Muli Ben-Yehuda
2007-07-17  8:51               ` Jens Axboe
2007-07-17  9:00                 ` Muli Ben-Yehuda
2007-07-17  7:02         ` Jens Axboe
2007-07-17  7:56           ` Jens Axboe
2007-07-17 11:03   ` Muli Ben-Yehuda
2007-07-17 11:05     ` Jens Axboe
2007-07-17 11:10       ` Muli Ben-Yehuda
2007-07-16  9:47 ` [PATCH 10/33] x86-64: enable sg chaining Jens Axboe
2007-07-16  9:47 ` [PATCH 11/33] IA64: sg chaining support Jens Axboe
2007-07-16  9:47 ` [PATCH 12/33] PPC: " Jens Axboe
2007-07-16  9:47 ` [PATCH 13/33] SPARC: " Jens Axboe
2007-07-16 11:29   ` David Miller
2007-07-16  9:47 ` [PATCH 14/33] SPARC64: " Jens Axboe
2007-07-16 11:29   ` David Miller
2007-07-16  9:47 ` [PATCH 15/33] scsi: simplify scsi_free_sgtable() Jens Axboe
2007-07-16  9:47 ` [PATCH 16/33] SCSI: support for allocating large scatterlists Jens Axboe
2007-07-16  9:47 ` [PATCH 17/33] ll_rw_blk: temporarily enable max_segments tweaking Jens Axboe
2007-07-16  9:47 ` [PATCH 18/33] libata: convert to using sg helpers Jens Axboe
2007-07-16  9:47 ` [PATCH 19/33] scsi_debug: support sg chaining Jens Axboe
2007-09-08 14:53   ` Douglas Gilbert [this message]
2007-07-16  9:47 ` [PATCH 20/33] scsi generic: sg chaining support Jens Axboe
2007-07-16  9:47 ` [PATCH 21/33] qla1280: " Jens Axboe
2007-07-16  9:47 ` [PATCH 22/33] aic94xx: " Jens Axboe
2007-07-16  9:47 ` [PATCH 23/33] qlogicpti: " Jens Axboe
2007-07-16  9:47 ` [PATCH 24/33] ide-scsi: " Jens Axboe
2007-07-18 21:03   ` Bartlomiej Zolnierkiewicz
2007-07-16  9:47 ` [PATCH 25/33] gdth: " Jens Axboe
2007-07-16  9:47 ` [PATCH 26/33] aha1542: convert to use the data buffer accessors Jens Axboe
2007-07-16  9:47 ` [PATCH 27/33] advansys: " Jens Axboe
2007-07-16  9:47 ` [PATCH 28/33] ia64 simscsi: convert to use " Jens Axboe
2007-07-16  9:47 ` [PATCH 29/33] infiniband: sg chaining support Jens Axboe
2007-07-16 13:21   ` FUJITA Tomonori
2007-07-16 13:26     ` Jens Axboe
2007-07-16  9:47 ` [PATCH 30/33] USB storage: " Jens Axboe
2007-07-17  6:12   ` Greg KH
2007-07-17  7:01     ` Jens Axboe
2007-07-17  7:05       ` Greg KH
2007-07-17  7:07         ` Jens Axboe
2007-07-16  9:47 ` [PATCH 31/33] Fusion: " Jens Axboe
2007-07-16 13:20   ` FUJITA Tomonori
2007-07-16 13:25     ` Jens Axboe
2007-07-16  9:47 ` [PATCH 32/33] i2o: " Jens Axboe
2007-07-16  9:47 ` [PATCH 33/33] IDE: " Jens Axboe
2007-07-18 20:56   ` Bartlomiej Zolnierkiewicz
2007-07-19  6:19     ` Jens Axboe
2007-07-16 13:19 ` [PATCH 00/33] SG table " FUJITA Tomonori
2007-07-16 13:23   ` Jens Axboe
2007-07-16 13:19 ` FUJITA Tomonori
2007-07-16 13:24   ` Jens Axboe
2007-07-16 14:05 ` John Stoffel
2007-07-16 14:23   ` Martin K. Petersen
2007-07-16 14:43     ` Jens Axboe
2007-07-16 16:02     ` Kai Makisara
2007-07-16 16:43       ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2007-07-17 13:40 [PATCH 19/33] scsi_debug: support sg chaining Boaz Harrosh
2007-07-17 14:11 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46E2B76B.6050703@torque.net \
    --to=dougg@torque.net \
    --cc=jens.axboe@oracle.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tomof@acm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).