Skip to content

Commit

Permalink
[JFFS2] Remove support for virtual blocks
Browse files Browse the repository at this point in the history
Remove support for virtual blocks, which are build by
concatenation of multiple physical erase blocks.

For more information please read the MTD mailing list thread
"[PATCH] remove support for virtual blocks"

Signed-off-by: Ferenc Havasi <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
  • Loading branch information
Ferenc Havasi authored and Thomas Gleixner committed Nov 6, 2005
1 parent f050753 commit 4ce1f56
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.
6 changes: 3 additions & 3 deletions fs/jffs2/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: build.c,v 1.76 2005/07/30 15:29:27 lunn Exp $
* $Id: build.c,v 1.77 2005/08/31 13:51:00 havasi Exp $
*
*/

Expand Down Expand Up @@ -318,7 +318,7 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c)
c->free_size = c->flash_size;
c->nr_blocks = c->flash_size / c->sector_size;
#ifndef __ECOS
if (c->mtd->flags & MTD_NO_VIRTBLOCKS)
if (jffs2_blocks_use_vmalloc(c))
c->blocks = vmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks);
else
#endif
Expand Down Expand Up @@ -356,7 +356,7 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c)
jffs2_free_ino_caches(c);
jffs2_free_raw_node_refs(c);
#ifndef __ECOS
if (c->mtd->flags & MTD_NO_VIRTBLOCKS)
if (jffs2_blocks_use_vmalloc(c))
vfree(c->blocks);
else
#endif
Expand Down
19 changes: 2 additions & 17 deletions fs/jffs2/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: fs.c,v 1.62 2005/08/06 04:51:30 nico Exp $
* $Id: fs.c,v 1.64 2005/09/01 08:42:31 havasi Exp $
*
*/

Expand Down Expand Up @@ -457,19 +457,8 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
#endif

c->flash_size = c->mtd->size;

/*
* Check, if we have to concatenate physical blocks to larger virtual blocks
* to reduce the memorysize for c->blocks. (kmalloc allows max. 128K allocation)
*/
c->sector_size = c->mtd->erasesize;
blocks = c->flash_size / c->sector_size;
if (!(c->mtd->flags & MTD_NO_VIRTBLOCKS)) {
while ((blocks * sizeof (struct jffs2_eraseblock)) > (128 * 1024)) {
blocks >>= 1;
c->sector_size <<= 1;
}
}

/*
* Size alignment check
Expand All @@ -480,10 +469,6 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
c->flash_size / 1024);
}

if (c->sector_size != c->mtd->erasesize)
printk(KERN_INFO "jffs2: Erase block size too small (%dKiB). Using virtual blocks size (%dKiB) instead\n",
c->mtd->erasesize / 1024, c->sector_size / 1024);

if (c->flash_size < 5*c->sector_size) {
printk(KERN_ERR "jffs2: Too few erase blocks (%d)\n", c->flash_size / c->sector_size);
return -EINVAL;
Expand Down Expand Up @@ -533,7 +518,7 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
iput(root_i);
jffs2_free_ino_caches(c);
jffs2_free_raw_node_refs(c);
if (c->mtd->flags & MTD_NO_VIRTBLOCKS)
if (jffs2_blocks_use_vmalloc(c))
vfree(c->blocks);
else
kfree(c->blocks);
Expand Down
7 changes: 6 additions & 1 deletion fs/jffs2/nodelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: nodelist.h,v 1.138 2005/08/17 13:46:23 dedekind Exp $
* $Id: nodelist.h,v 1.139 2005/08/31 13:51:00 havasi Exp $
*
*/

Expand Down Expand Up @@ -197,6 +197,11 @@ struct jffs2_eraseblock
struct jffs2_raw_node_ref *gc_node; /* Next node to be garbage collected */
};

static inline int jffs2_blocks_use_vmalloc(struct jffs2_sb_info *c)
{
return ((c->flash_size / c->sector_size) * sizeof (struct jffs2_eraseblock)) > (128 * 1024);
}

/* Calculate totlen from surrounding nodes or eraseblock */
static inline uint32_t __ref_totlen(struct jffs2_sb_info *c,
struct jffs2_eraseblock *jeb,
Expand Down
4 changes: 2 additions & 2 deletions fs/jffs2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: super.c,v 1.107 2005/07/12 16:37:08 dedekind Exp $
* $Id: super.c,v 1.108 2005/08/31 13:51:00 havasi Exp $
*
*/

Expand Down Expand Up @@ -284,7 +284,7 @@ static void jffs2_put_super (struct super_block *sb)
up(&c->alloc_sem);
jffs2_free_ino_caches(c);
jffs2_free_raw_node_refs(c);
if (c->mtd->flags & MTD_NO_VIRTBLOCKS)
if (jffs2_blocks_use_vmalloc(c))
vfree(c->blocks);
else
kfree(c->blocks);
Expand Down

0 comments on commit 4ce1f56

Please sign in to comment.