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

Jörn Engel joern at wohnheim.fh-wedel.de
Mon Aug 15 10:32:41 EDT 2005


On Mon, 15 August 2005 18:19:07 +0400, Artem B. Bityuckiy wrote:
> 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];

How about encapsulating all the page handling code in - say -
mm/slab.c and just handling single objects? ;)

Jörn

-- 
Unless something dramatically changes, by 2015 we'll be largely
wondering what all the fuss surrounding Linux was really about.
-- Rob Enderle




More information about the linux-mtd mailing list