Re: [PATCH v3] Re: another unusual flag for a really limited device

Doug Maxey <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Wed, 28 Nov 2007 14:31:27 EST, Alan Stern wrote:
> On Wed, 28 Nov 2007, Doug Maxey wrote:
>
> > +	/* And at least one more device needs an even smaller max.
> > +	 * When testing the native PAGE_SIZE, clamp at 8k.  No need
> > +	 * allow a 64K or even 16M page in there.
> > +	 */
>
> Why not combine the code for the two flags, as shown in the partial
> patch below?
>
> Also, trying to clamp at 8 KB is futile.

Alright.  I was thinking of the remote possibility that the platform
could use use something 64k or larger as the native page size, which
would defeat trying to limit the device.  If there were any other
devices out there that required this, and the administrator tried to
stick one in a powerpc, for example, the code would not have the
desired result.

> Read the source code for
> blk_queue_max_sectors() in drivers/block/ll_rw_blk.c and you'll see.

will do.

>
> Alan Stern
>
>
> Index: usb-2.6/drivers/usb/storage/scsiglue.c
> ===================================================================
> --- usb-2.6.orig/drivers/usb/storage/scsiglue.c
> +++ usb-2.6/drivers/usb/storage/scsiglue.c
> @@ -113,10 +113,19 @@ static int slave_configure(struct scsi_d
>  	/* Many devices have trouble transfering more than 32KB at a time,
>  	 * while others have trouble with more than 64K. At this time we
>  	 * are limiting both to 32K (64 sectores).
> +	 *
> +	 * Some other devices have trouble transferring even that much.
> +	 * We'll limit them to PAGE_CACHE_SIZE, which is the minimum.
>  	 */
> -	if ((us->flags & US_FL_MAX_SECTORS_64) &&
> -			sdev->request_queue->max_sectors > 64)
> -		blk_queue_max_sectors(sdev->request_queue, 64);
> +	if (us->flags & (US_FL_MAX_SECTORS_64 | US_FL_MAX_SECTORS_MIN)) {
> +		unsigned int max_sectors = 64;
> +
> +		if (us->flags & US_FL_MAX_SECTORS_MIN)
> +			max_sectors = PAGE_CACHE_SIZE >> 9;
> +		if (sdev->request_queue->max_sectors > max_sectors)
> +			blk_queue_max_sectors(sdev->request_queue,
> +					max_sectors);
> +	}
>
>  	/* We can't put these settings in slave_alloc() because that gets
>  	 * called before the device type is known.  Consequently these
>





-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.