Re: some questions about block and scatterlist

From: Jonathan Corbet
Date: Tue Nov 01 2011 - 10:26:56 EST


On Tue, 1 Nov 2011 19:32:38 +0900
loody <miloody@xxxxxxxxx> wrote:

> My questions are below:

As are some answers :)

> 1. Are all struct page 32-bit aligned?

Certainly, I would expect any structures found in the system memory map to
be so aligned, yes. If you've created an arbitrary one elsewhere I'm only
99% sure it would be.

> If so, where is this part of code for handleing struct page be 32-bits aligned?

Note that the size of struct page is carefully considered, and that they
are packed as densely as possible, both externally and internally. No
lesser alignment would make sense.

> 2. if the page of scatterlist is located at high mem, how does
> dma_map_sg mapping the virtual address?

That depends on a vast array of things. What are the addressing
capabilities of the target device? Is there an IOMMU involved?

> 3. in blk_rq_map_sg, it seems we only copy bvec->bv_page to sg->page_link
> why don't we add dma_address in bvec and send the bio directly to
> the lower level driver?

That would be a bit of a mixing of the layers, if nothing else.

> 4. if I plug a USB HD with 3 partitions, will there be 3 request_queues?

No, there is one request queue for the underlying device.

That's an interesting mix of questions. If you have more in the future,
you'll likely get more (and more clueful) responses if they're accompanied
by the code you're working on.

Thanks,

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/