On Sat, 19 May 2007, jidong xiao wrote:

> By the way,I remember in drivers/usb/storage/scsiglue.c, there is a chunk of
> comments about scatter-gather buffers.

> Regarding this, I have one question:
> "except at the beginning and the end, scatter-gather buffers follow page
> boundaries", why? i.e. Is there any specific reason that sg buffers should
> follow page boundaries? Then why the beinging and the end are exceptions?

The buffers follow page boundaries because they are allocated as groups
of pages.  At least, that's how the kernel allocates them.  A buffer
can also be created to map data in userspace, and a buffer occupying
contiguous user (or virtual) addresses will in general end up lying in
a discontiguous set of pages -- because virtual memory is managed in
units of pages.

The end might not lie on a page boundary because the total amount of
data might not fill out all of the last page.

The beginning is subject only to the alignment specified by the
blk_queue_dma_alignment() setting.  Hence it might not lie on a page
boundary.

Alan Stern


-------------------------------------------------------------------------
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/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to