Prev: [PATCH] arch/tile: support backtracing on TILE-Gx
Next: USB: Gadget: g_multi: added INF file for gadget with multiple configurations
From: Maxim Levitsky on 13 Aug 2010 09:30
I currently am writing a block driver for Legacy Memory sticks.
I have few questions about that type of data my ->request will receive
First of all I think that by default, driver receives requests that
contains just one sector and it isn't in high memory.
However I am opting in to allow to receive requests that have many
sectors span several memory regions, and be in highmem).
The request is converted to scatterlist upon which I operate.
(Untill this point I did the same think Alex does in mspro_blk.c)
For simplicity lets assume 512 byte hardware sector size.
However is there a guarantee that incoming memory segments will be
aligned on 512 byte boundary?
If this isn't true I run into 2 problems:
1. Sector can span 2 pages. Therefore if I decide to do pio, and I use
kmap_atomic (because of highmem), I need first map 1st page, read/write
it, unmap it, and then then do the same with 2nd page.
2. Sectors can span 2 memory regions.
This is even worse. For DMA I would need to bounce the sector.
Also it becames very difficult to handle input on sector by sector basis
(short of bouncing everything...)
If the above is true (I hope), then I have different problem.
The problem is that I will have small buffer that will contain few
I currently allocate it using kmalloc.
However I want to send that buffer to same functions that deal with IO,
therefore I need it to be aligned on 512 byte boundary.
Is there a way to allocate aligned memory (short of allocating more and
aligning pointer manually which I hate to do)
Maybe I should just use __get_free_pages?
(I will need a buffer of page or two (once per driver load) I think).
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/