All of lore.kernel.org
 help / color / mirror / Atom feed
* use_sg != 0 assumption (was Re: [PATCH 5/9] Drop single buffer request support.)
       [not found]       ` <11787530043878-git-send-email-krh@redhat.com>
@ 2007-05-10 10:38         ` Stefan Richter
  2007-05-10 11:44           ` Christoph Hellwig
  2007-05-10 13:08           ` Kristian Høgsberg
       [not found]         ` <11787530054176-git-send-email-krh@redhat.com>
  1 sibling, 2 replies; 5+ messages in thread
From: Stefan Richter @ 2007-05-10 10:38 UTC (permalink / raw)
  To: Kristian Høgsberg; +Cc: linux1394-devel, linux-scsi

Kristian Høgsberg wrote:
> The SCSI layer only passes sg requests down, so drop the
> use_sg == 0, request_bufflen != 0 case.
> 
> Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
> ---
>  drivers/firewire/fw-sbp2.c |   43 +------------------------------------------
>  1 files changed, 1 insertions(+), 42 deletions(-)

[...]

> @@ -1063,21 +1035,8 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
>  		orb->request.misc |=
>  			COMMAND_ORB_DIRECTION(SBP2_DIRECTION_TO_MEDIA);
>  
> -	if (cmd->use_sg) {
> -		if (sbp2_command_orb_map_scatterlist(orb) < 0)
> -			goto fail_map_payload;
> -	} else if (cmd->request_bufflen > SBP2_MAX_SG_ELEMENT_LENGTH) {
> -		/*
> -		 * FIXME: Need to split this into a sg list... but
> -		 * could we get the scsi or blk layer to do that by
> -		 * reporting our max supported block size?
> -		 */
> -		fw_error("command > 64k\n");
> +	if (cmd->use_sg && sbp2_command_orb_map_scatterlist(orb) < 0)
>  		goto fail_map_payload;
> -	} else if (cmd->request_bufflen > 0) {
> -		if (sbp2_command_orb_map_buffer(orb) < 0)
> -			goto fail_map_payload;
> -	}
>  
>  	fw_memcpy_to_be32(&orb->request, &orb->request, sizeof orb->request);
>  

Would a BUG_ON(cmd->use_sg == 0); be in order?
-- 
Stefan Richter
-=====-=-=== -=-= -=-=-
http://arcgraph.de/sr/
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 6/9] Make scsi_host_template::proc_name const char * instead of char *.
       [not found]         ` <11787530054176-git-send-email-krh@redhat.com>
@ 2007-05-10 10:44           ` Stefan Richter
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Richter @ 2007-05-10 10:44 UTC (permalink / raw)
  To: James Bottomley, linux-scsi; +Cc: Kristian Høgsberg, linux1394-devel

[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]

Kristian Høgsberg wrote:
> Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
> ---
>  drivers/scsi/scsi_debug.c |    2 +-
>  include/scsi/scsi_host.h  |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 3e2930b..843f9c1 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -2876,7 +2876,7 @@ static int __init scsi_debug_init(void)
>  
>  	init_all_queued();
>  
> -	sdebug_driver_template.proc_name = (char *)sdebug_proc_name;
> +	sdebug_driver_template.proc_name = sdebug_proc_name;
>  
>  	host_to_add = scsi_debug_add_host;
>          scsi_debug_add_host = 0;
> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
> index 7f1f411..0dfb5c2 100644
> --- a/include/scsi/scsi_host.h
> +++ b/include/scsi/scsi_host.h
> @@ -343,7 +343,7 @@ struct scsi_host_template {
>  	/*
>  	 * Name of proc directory
>  	 */
> -	char *proc_name;
> +	const char *proc_name;
>  
>  	/*
>  	 * Used to store the procfs directory if a driver implements the

This has to go via James B and LSML.
-- 
Stefan Richter
-=====-=-=== -=-= -=-=-
http://arcgraph.de/sr/

[-- Attachment #2: Make-scsi_host_template-proc_name-const-char-instead-of-char.patch --]
[-- Type: text/plain, Size: 1167 bytes --]

From: =?utf-8?q?Kristian_H=C3=B8gsberg?= <krh@redhat.com>
Subject: [PATCH 6/9] Make scsi_host_template::proc_name const char * instead of char *.
Date: Wed,  9 May 2007 19:23:12 -0400

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
---
 drivers/scsi/scsi_debug.c |    2 +-
 include/scsi/scsi_host.h  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 3e2930b..843f9c1 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2876,7 +2876,7 @@ static int __init scsi_debug_init(void)
 
 	init_all_queued();
 
-	sdebug_driver_template.proc_name = (char *)sdebug_proc_name;
+	sdebug_driver_template.proc_name = sdebug_proc_name;
 
 	host_to_add = scsi_debug_add_host;
         scsi_debug_add_host = 0;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 7f1f411..0dfb5c2 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -343,7 +343,7 @@ struct scsi_host_template {
 	/*
 	 * Name of proc directory
 	 */
-	char *proc_name;
+	const char *proc_name;
 
 	/*
 	 * Used to store the procfs directory if a driver implements the


[-- Attachment #3: Type: text/plain, Size: 286 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: use_sg != 0 assumption (was Re: [PATCH 5/9] Drop single buffer request support.)
  2007-05-10 10:38         ` use_sg != 0 assumption (was Re: [PATCH 5/9] Drop single buffer request support.) Stefan Richter
@ 2007-05-10 11:44           ` Christoph Hellwig
  2007-05-10 13:09             ` Stefan Richter
  2007-05-10 13:08           ` Kristian Høgsberg
  1 sibling, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2007-05-10 11:44 UTC (permalink / raw)
  To: Stefan Richter; +Cc: Kristian H?gsberg, linux1394-devel, linux-scsi

On Thu, May 10, 2007 at 12:38:31PM +0200, Stefan Richter wrote:
> >  	fw_memcpy_to_be32(&orb->request, &orb->request, sizeof orb->request);
> >  
> 
> Would a BUG_ON(cmd->use_sg == 0); be in order?

I don't think we should put this into every driver.  If you want to
be sure this doesn't happen anymore put it just in front of the queuecommand
call.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: use_sg != 0 assumption (was Re: [PATCH 5/9] Drop single buffer request support.)
  2007-05-10 10:38         ` use_sg != 0 assumption (was Re: [PATCH 5/9] Drop single buffer request support.) Stefan Richter
  2007-05-10 11:44           ` Christoph Hellwig
@ 2007-05-10 13:08           ` Kristian Høgsberg
  1 sibling, 0 replies; 5+ messages in thread
From: Kristian Høgsberg @ 2007-05-10 13:08 UTC (permalink / raw)
  To: Stefan Richter; +Cc: linux1394-devel, linux-scsi

Stefan Richter wrote:
> Kristian Høgsberg wrote:
>> The SCSI layer only passes sg requests down, so drop the
>> use_sg == 0, request_bufflen != 0 case.
>>
>> Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
>> ---
>>  drivers/firewire/fw-sbp2.c |   43 +------------------------------------------
>>  1 files changed, 1 insertions(+), 42 deletions(-)
> 
> [...]
> 
>> @@ -1063,21 +1035,8 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
>>  		orb->request.misc |=
>>  			COMMAND_ORB_DIRECTION(SBP2_DIRECTION_TO_MEDIA);
>>  
>> -	if (cmd->use_sg) {
>> -		if (sbp2_command_orb_map_scatterlist(orb) < 0)
>> -			goto fail_map_payload;
>> -	} else if (cmd->request_bufflen > SBP2_MAX_SG_ELEMENT_LENGTH) {
>> -		/*
>> -		 * FIXME: Need to split this into a sg list... but
>> -		 * could we get the scsi or blk layer to do that by
>> -		 * reporting our max supported block size?
>> -		 */
>> -		fw_error("command > 64k\n");
>> +	if (cmd->use_sg && sbp2_command_orb_map_scatterlist(orb) < 0)
>>  		goto fail_map_payload;
>> -	} else if (cmd->request_bufflen > 0) {
>> -		if (sbp2_command_orb_map_buffer(orb) < 0)
>> -			goto fail_map_payload;
>> -	}
>>  
>>  	fw_memcpy_to_be32(&orb->request, &orb->request, sizeof orb->request);
>>  
> 
> Would a BUG_ON(cmd->use_sg == 0); be in order?

That's a good idea, though it needs to be

   BUG_ON(cmd->usg_sg == 0 && cmd->request_bufflen > 0);

since commands with no payload have use_sg == 0 and request_bufflen == 0.

Kristian


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: use_sg != 0 assumption (was Re: [PATCH 5/9] Drop single buffer request support.)
  2007-05-10 11:44           ` Christoph Hellwig
@ 2007-05-10 13:09             ` Stefan Richter
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Richter @ 2007-05-10 13:09 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Kristian H?gsberg, linux1394-devel, linux-scsi

Christoph Hellwig wrote:
> On Thu, May 10, 2007 at 12:38:31PM +0200, Stefan Richter wrote:
>> Would a BUG_ON(cmd->use_sg == 0); be in order?
> 
> I don't think we should put this into every driver.  If you want to
> be sure this doesn't happen anymore put it just in front of the queuecommand
> call.

Thanks for the pointer.  I'm just noticing that Jens Axboe has a patch
which puts BUG_ON(!cmd->use_sg); into scsi_lib.c's sg table allocation
path.  (The "Chaining sg lists for bio IO commands v3" patchset from a
few hours ago, part 11/13 "SCSI: support for allocating large
scatterlists".)
-- 
Stefan Richter
-=====-=-=== -=-= -=-=-
http://arcgraph.de/sr/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-05-10 15:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <11787529952207-git-send-email-krh@redhat.com>
     [not found] ` <11787530023454-git-send-email-krh@redhat.com>
     [not found]   ` <11787530031570-git-send-email-krh@redhat.com>
     [not found]     ` <11787530031450-git-send-email-krh@redhat.com>
     [not found]       ` <11787530043878-git-send-email-krh@redhat.com>
2007-05-10 10:38         ` use_sg != 0 assumption (was Re: [PATCH 5/9] Drop single buffer request support.) Stefan Richter
2007-05-10 11:44           ` Christoph Hellwig
2007-05-10 13:09             ` Stefan Richter
2007-05-10 13:08           ` Kristian Høgsberg
     [not found]         ` <11787530054176-git-send-email-krh@redhat.com>
2007-05-10 10:44           ` [PATCH 6/9] Make scsi_host_template::proc_name const char * instead of char * Stefan Richter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.