[PATCH]fs/jffs2/wbuf.c: add compatibility support for OOB data block

Artem B. Bityuckiy dedekind at infradead.org
Mon Aug 15 10:19:07 EDT 2005


On Mon, 2005-08-15 at 16:05 +0200, Jörn Engel wrote:
> Others are less external fragmentation and lower-order memory
> allocations.
> 
> Say, you need about 65k for your erase blocks.  With slab, you need to
> allocate roughly 17 pages of 4k each, plus slab overhead.  With
> kmalloc, you allocate 128k.  That's nearly twice what you need.
> 
> With slab, you allocate order-0 pages.  With kmalloc you allocate
> order-5 pages.  Ask Martin J Bligh about high-order allocations if you
> want to hear some spooky stories.
> 
> Going from kmalloc to vmalloc makes things even worse.
> 

Ok, how about just to allocate as many pages as we need, and make an
array of pointers to pages? Then the 'struct jffs2_eraseblock' object of
the eraseblock with offset 'offs' will be something like this:

blocks_per_page = PAGE_SIZE/sizeof(struct jffs2_eraseblock);
blknum = offs/c->erase_size;
pgidx = blknum/PAGE_SIZE;
blkidx = blknum - pgidx * blocks_per_page;

jeb = &c->blocks[pgidx][blkidx];

-- 
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.





More information about the linux-mtd mailing list