All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Dharm <mdharm-scsi@one-eyed-alien.net>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Kai Mäkisara" <kai.makisara@kolumbus.fi>,
	"Douglas Gilbert" <dougg@torque.net>,
	"James Bottomley" <James.Bottomley@steeleye.com>,
	"Patrick Mansfield" <patmans@us.ibm.com>,
	"Jens Axboe" <axboe@suse.de>, "Oliver Neukum" <oliver@neukum.org>,
	"SCSI development list" <linux-scsi@vger.kernel.org>,
	"USB development list" <linux-usb-devel@lists.sourceforge.net>
Subject: Re: PATCH: (as141) Unaligned scatter-gather buffers and usb-storage
Date: Sun, 4 Jan 2004 16:41:58 -0800	[thread overview]
Message-ID: <20040105004158.GA30408@one-eyed-alien.net> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0311211249230.1381-100000@ida.rowland.org>

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

Is there any indication that the SCSI parts of this patch will get
accepted?

Matt

On Fri, Nov 21, 2003 at 01:03:05PM -0500, Alan Stern wrote:
> I'm not sure whether Jens is objecting to adding the extra member to the
> host template or to making the default alignment something other than 512.  
> Here's my attempt at a compromise patch, which boils the area of
> disagreement between Kai and Jens down to a single line of code (plus a
> comment).  It doesn't change the host template and it shouldn't slow down
> any tape I/O programs when using a non-USB device.
> 
> If there aren't any more objections to this, I urge James to apply the
> SCSI parts to a post-2.6.0-final tree, and likewise for Matt and the USB 
> part.
> 
> Alan Stern
> 
> 
> ===== scsiglue.c 1.60 vs edited =====
> --- 1.60/drivers/usb/storage/scsiglue.c	Fri Oct 24 14:53:38 2003
> +++ edited/drivers/usb/storage/scsiglue.c	Fri Nov 21 12:45:21 2003
> @@ -65,6 +65,16 @@
>  
>  static int slave_configure (struct scsi_device *sdev)
>  {
> +	/* Scatter-gather buffers (all but the last) must have a length
> +	 * divisible by the bulk maxpacket size.  Otherwise a data packet
> +	 * would end up being short, causing a premature end to the data
> +	 * transfer.  Since high-speed bulk pipes have a maxpacket size
> +	 * of 512, we'll use that as the scsi device queue's DMA alignment
> +	 * mask.  Guaranteeing proper alignment of the first buffer will
> +	 * have the desired effect because, except at the beginning and
> +	 * the end, scatter-gather buffers follow page boundaries. */
> +	blk_queue_dma_alignment(sdev->request_queue, (512 - 1));
> +
>  	/* this is to satisify the compiler, tho I don't think the 
>  	 * return code is ever checked anywhere. */
>  	return 0;
> ===== sg.c 1.48 vs edited =====
> --- 1.48/drivers/scsi/sg.c	Fri Oct 24 14:53:37 2003
> +++ edited/drivers/scsi/sg.c	Fri Nov 21 12:28:52 2003
> @@ -1741,7 +1741,11 @@
>  	int sg_tablesize = sfp->parentdp->sg_tablesize;
>  	struct scatterlist *sgl;
>  	int mx_sc_elems, res;
> +	struct scsi_device *sdev = sfp->parentdp->device;
>  
> +	if (((unsigned long)hp->dxferp &
> +			queue_dma_alignment(sdev->request_queue)) != 0)
> +		return 1;
>  	mx_sc_elems = sg_build_sgat(schp, sfp, sg_tablesize);
>          if (mx_sc_elems <= 0) {
>                  return 1;
> ===== st.c 1.45 vs edited =====
> --- 1.45/drivers/scsi/st.c	Fri Sep  5 12:16:40 2003
> +++ edited/drivers/scsi/st.c	Fri Nov 21 12:30:34 2003
> @@ -1267,7 +1267,8 @@
>  		i = STp->try_dio && try_rdio;
>  	else
>  		i = STp->try_dio && try_wdio;
> -	if (i) {
> +	if (i && ((unsigned int)buf & queue_dma_alignment(
> +					STp->device->request_queue)) == 0) {
>  		i = st_map_user_pages(&(STbp->sg[0]), STbp->use_sg,
>  				      (unsigned long)buf, count, (is_read ? READ : WRITE),
>  				      STp->max_pfn);
> ===== scsi_scan.c 1.52 vs edited =====
> --- 1.52/drivers/scsi/scsi_scan.c	Fri Oct 24 14:53:37 2003
> +++ edited/drivers/scsi/scsi_scan.c	Fri Nov 21 12:34:00 2003
> @@ -231,6 +231,15 @@
>  	sdev->request_queue->queuedata = sdev;
>  	scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
>  
> +	/*
> +	 * Set the queue's mask to require a mere 8-byte alignment for
> +	 * DMA buffers, rather than the default 512.  This shouldn't
> +	 * inconvenience any user programs and should be okay for most
> +	 * host adapters.  A host driver can alter this mask in its
> +	 * slave_alloc() or slave_configure() callback if necessary.
> +	 */
> +	blk_queue_dma_alignment(sdev->request_queue, (8 - 1));
> +
>  	if (shost->hostt->slave_alloc) {
>  		if (shost->hostt->slave_alloc(sdev))
>  			goto out_free_queue;

-- 
Matthew Dharm                              Home: mdharm-usb@one-eyed-alien.net 
Maintainer, Linux USB Mass Storage Driver

I need a computer?
					-- Customer
User Friendly, 2/19/1998

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2004-01-05  0:41 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1068207145.3fab8c2988d43@webmail.netregistry.net>
2003-11-07 16:21 ` usb-storage and Sony Handycam Alan Stern
2003-11-07 17:29   ` Patrick Mansfield
2003-11-07 19:49     ` Alan Stern
2003-11-08  2:54       ` Dmitri Katchalov
2003-11-08  6:34         ` Patrick Mansfield
2003-11-08 13:29           ` Dmitri Katchalov
2003-11-08 16:28           ` Alan Stern
2003-11-08 20:37             ` Patrick Mansfield
2003-11-09  3:47               ` [linux-usb-devel] " Alan Stern
2003-11-09  8:45                 ` Dmitri Katchalov
2003-11-10 20:45                   ` Patrick Mansfield
2003-11-10 17:59                 ` Patrick Mansfield
2003-11-10 18:46                   ` Alan Stern
2003-11-10 19:04                     ` [linux-usb-devel] " Patrick Mansfield
2003-11-10 19:57                       ` Alan Stern
2003-11-10 22:46                     ` Sancho Dauskardt
2003-11-18 15:20                   ` Unaligned scatter-gather buffers and usb-storage Alan Stern
2003-11-18 22:37                     ` Patrick Mansfield
2003-11-19  8:47                       ` Jens Axboe
2003-11-19 13:01                         ` [linux-usb-devel] " Oliver Neukum
2003-11-19 13:04                           ` Jens Axboe
2003-11-19 14:37                             ` James Bottomley
2003-11-19 14:39                               ` Jens Axboe
2003-11-19 14:58                                 ` James Bottomley
2003-11-19 15:00                                   ` [linux-usb-devel] " Jens Axboe
2003-11-19 16:56                                     ` Kai Makisara
2003-11-19 20:19                                       ` Jens Axboe
2003-11-19 22:06                                         ` Kai Makisara
2003-11-20  6:53                                           ` Jens Axboe
2003-11-20 15:20                                             ` Alan Stern
2003-11-20 15:30                                               ` Jens Axboe
2003-11-20 16:09                                                 ` Alan Stern
2003-11-20 16:24                                                   ` Jens Axboe
2003-11-20 16:28                                                 ` [linux-usb-devel] " Oliver Neukum
2003-11-20 19:23                                                   ` Kai Makisara
2003-11-20 17:18                                               ` Kai Makisara
2003-11-20 19:18                                                 ` [linux-usb-devel] " Kai Mäkisara
2003-11-21 18:03                                                   ` PATCH: (as141) " Alan Stern
2003-11-21 20:07                                                     ` Kai Makisara
2003-12-01  1:30                                                     ` Matthew Dharm
2004-01-05  0:41                                                     ` Matthew Dharm [this message]
2004-01-05 10:08                                                       ` Jens Axboe
2004-01-05 21:58                                                         ` PATCH: (as141b) " Alan Stern
2004-01-06 11:28                                                           ` Oliver Neukum
2004-01-06 16:10                                                             ` Alan Stern
2004-02-02 15:51                                                           ` James Bottomley
2004-02-03 15:47                                                             ` Alan Stern
2004-02-03 15:55                                                               ` James Bottomley
2004-02-03 16:02                                                               ` Matthew Wilcox
2003-11-19 15:44                         ` Alan Stern
2003-11-19 15:49                           ` Jens Axboe
2003-11-19 16:58                             ` Alan Stern
2003-11-19 17:03                               ` Jens Axboe
2003-11-07 22:09     ` usb-storage and Sony Handycam Alan Stern

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=20040105004158.GA30408@one-eyed-alien.net \
    --to=mdharm-scsi@one-eyed-alien.net \
    --cc=James.Bottomley@steeleye.com \
    --cc=axboe@suse.de \
    --cc=dougg@torque.net \
    --cc=kai.makisara@kolumbus.fi \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=oliver@neukum.org \
    --cc=patmans@us.ibm.com \
    --cc=stern@rowland.harvard.edu \
    /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 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.