On Wed, Nov 19 2003, Alan Stern wrote:
> On Wed, 19 Nov 2003, Jens Axboe wrote:
> 
> > The queue already has such a restriction embedded, see bio_map_user()
> > and queue_dma_alignment().
> 
> Searching through the 2.6 kernel source gave some interesting results.
> 
> queue_dma_alignment() does nothing but set the dma_alignment field of the
> request queue structure.  The _only_ place this field is used is in
> fs/bio.c by __bio_map_user(), called from bio_map_user().  In turn, the
> _only_ place bio_map_user() is called is from drivers/block/scsi_ioctl.c,
> and that's only for a certain specific type of SCSI ioctl.  It's not on

It's for SG_IO.

> any main code path, and it wouldn't get invoked by anything using the st
> or sg drivers.  In fact, it looks like scsi_ioctl.c:scsi_cmd_ioctl() is
> only called from within the sd driver.

It's invoked from user space. Don't mix block and scsi scsi_ioctl() up.
bio_map_user() would be used by a block layer sg driver too, for
instance.

> So something needs to be fixed up.  Is there some spot in the block layer 
> that's supposed to be checking dma alignments but isn't doing so?

The queue dma alignment was added to better cater to cdrecord, for
instance. We need better than 512b granularity there, or you cannot use
DMA on certain types of burns (lots of sector types are non-2kb aligned
there).

If you can 512-byte align the data and transfer from user space, _that
is enough_. The program just needs to be aware of this, it's not an odd
restriction. There are just scenarious where you cannot do this, and
that is why I added the queue dma alignment attribute. To me, it doesn't
sound like your case applies.

-- 
Jens Axboe



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to