diff options
author | Ferenc Havasi <havasi@inf.u-szeged.hu> | 2005-08-31 09:51:04 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-11-06 15:08:27 -0500 |
commit | 4ce1f562189696605a84813cf71847c0cc698414 (patch) | |
tree | 1ec543b00db38f5ae8db38f0f881db11ebb5d010 /fs/jffs2 | |
parent | f0507530cbedf37515e0d803c332cdb81b34e71a (diff) |
[JFFS2] Remove support for virtual blocks
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 <havasi@inf.u-szeged.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2')
-rw-r--r-- | fs/jffs2/build.c | 6 | ||||
-rw-r--r-- | fs/jffs2/fs.c | 19 | ||||
-rw-r--r-- | fs/jffs2/nodelist.h | 7 | ||||
-rw-r--r-- | fs/jffs2/super.c | 4 |
4 files changed, 13 insertions, 23 deletions
diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c index 8e2f1f4e8aa3..1522eace932e 100644 --- a/fs/jffs2/build.c +++ b/fs/jffs2/build.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: build.c,v 1.76 2005/07/30 15:29:27 lunn Exp $ | 10 | * $Id: build.c,v 1.77 2005/08/31 13:51:00 havasi Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -318,7 +318,7 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c) | |||
318 | c->free_size = c->flash_size; | 318 | c->free_size = c->flash_size; |
319 | c->nr_blocks = c->flash_size / c->sector_size; | 319 | c->nr_blocks = c->flash_size / c->sector_size; |
320 | #ifndef __ECOS | 320 | #ifndef __ECOS |
321 | if (c->mtd->flags & MTD_NO_VIRTBLOCKS) | 321 | if (jffs2_blocks_use_vmalloc(c)) |
322 | c->blocks = vmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks); | 322 | c->blocks = vmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks); |
323 | else | 323 | else |
324 | #endif | 324 | #endif |
@@ -356,7 +356,7 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c) | |||
356 | jffs2_free_ino_caches(c); | 356 | jffs2_free_ino_caches(c); |
357 | jffs2_free_raw_node_refs(c); | 357 | jffs2_free_raw_node_refs(c); |
358 | #ifndef __ECOS | 358 | #ifndef __ECOS |
359 | if (c->mtd->flags & MTD_NO_VIRTBLOCKS) | 359 | if (jffs2_blocks_use_vmalloc(c)) |
360 | vfree(c->blocks); | 360 | vfree(c->blocks); |
361 | else | 361 | else |
362 | #endif | 362 | #endif |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 79b4bdc76f7a..c99451ae4b77 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: fs.c,v 1.62 2005/08/06 04:51:30 nico Exp $ | 10 | * $Id: fs.c,v 1.64 2005/09/01 08:42:31 havasi Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -457,19 +457,8 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent) | |||
457 | #endif | 457 | #endif |
458 | 458 | ||
459 | c->flash_size = c->mtd->size; | 459 | c->flash_size = c->mtd->size; |
460 | |||
461 | /* | ||
462 | * Check, if we have to concatenate physical blocks to larger virtual blocks | ||
463 | * to reduce the memorysize for c->blocks. (kmalloc allows max. 128K allocation) | ||
464 | */ | ||
465 | c->sector_size = c->mtd->erasesize; | 460 | c->sector_size = c->mtd->erasesize; |
466 | blocks = c->flash_size / c->sector_size; | 461 | blocks = c->flash_size / c->sector_size; |
467 | if (!(c->mtd->flags & MTD_NO_VIRTBLOCKS)) { | ||
468 | while ((blocks * sizeof (struct jffs2_eraseblock)) > (128 * 1024)) { | ||
469 | blocks >>= 1; | ||
470 | c->sector_size <<= 1; | ||
471 | } | ||
472 | } | ||
473 | 462 | ||
474 | /* | 463 | /* |
475 | * Size alignment check | 464 | * Size alignment check |
@@ -480,10 +469,6 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent) | |||
480 | c->flash_size / 1024); | 469 | c->flash_size / 1024); |
481 | } | 470 | } |
482 | 471 | ||
483 | if (c->sector_size != c->mtd->erasesize) | ||
484 | printk(KERN_INFO "jffs2: Erase block size too small (%dKiB). Using virtual blocks size (%dKiB) instead\n", | ||
485 | c->mtd->erasesize / 1024, c->sector_size / 1024); | ||
486 | |||
487 | if (c->flash_size < 5*c->sector_size) { | 472 | if (c->flash_size < 5*c->sector_size) { |
488 | printk(KERN_ERR "jffs2: Too few erase blocks (%d)\n", c->flash_size / c->sector_size); | 473 | printk(KERN_ERR "jffs2: Too few erase blocks (%d)\n", c->flash_size / c->sector_size); |
489 | return -EINVAL; | 474 | return -EINVAL; |
@@ -533,7 +518,7 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent) | |||
533 | iput(root_i); | 518 | iput(root_i); |
534 | jffs2_free_ino_caches(c); | 519 | jffs2_free_ino_caches(c); |
535 | jffs2_free_raw_node_refs(c); | 520 | jffs2_free_raw_node_refs(c); |
536 | if (c->mtd->flags & MTD_NO_VIRTBLOCKS) | 521 | if (jffs2_blocks_use_vmalloc(c)) |
537 | vfree(c->blocks); | 522 | vfree(c->blocks); |
538 | else | 523 | else |
539 | kfree(c->blocks); | 524 | kfree(c->blocks); |
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h index ce47d5530a70..1533af8b3959 100644 --- a/fs/jffs2/nodelist.h +++ b/fs/jffs2/nodelist.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: nodelist.h,v 1.138 2005/08/17 13:46:23 dedekind Exp $ | 10 | * $Id: nodelist.h,v 1.139 2005/08/31 13:51:00 havasi Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -197,6 +197,11 @@ struct jffs2_eraseblock | |||
197 | struct jffs2_raw_node_ref *gc_node; /* Next node to be garbage collected */ | 197 | struct jffs2_raw_node_ref *gc_node; /* Next node to be garbage collected */ |
198 | }; | 198 | }; |
199 | 199 | ||
200 | static inline int jffs2_blocks_use_vmalloc(struct jffs2_sb_info *c) | ||
201 | { | ||
202 | return ((c->flash_size / c->sector_size) * sizeof (struct jffs2_eraseblock)) > (128 * 1024); | ||
203 | } | ||
204 | |||
200 | /* Calculate totlen from surrounding nodes or eraseblock */ | 205 | /* Calculate totlen from surrounding nodes or eraseblock */ |
201 | static inline uint32_t __ref_totlen(struct jffs2_sb_info *c, | 206 | static inline uint32_t __ref_totlen(struct jffs2_sb_info *c, |
202 | struct jffs2_eraseblock *jeb, | 207 | struct jffs2_eraseblock *jeb, |
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index aaf9475cfb6a..58496a03a1d2 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * | 7 | * |
8 | * For licensing information, see the file 'LICENCE' in this directory. | 8 | * For licensing information, see the file 'LICENCE' in this directory. |
9 | * | 9 | * |
10 | * $Id: super.c,v 1.107 2005/07/12 16:37:08 dedekind Exp $ | 10 | * $Id: super.c,v 1.108 2005/08/31 13:51:00 havasi Exp $ |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -284,7 +284,7 @@ static void jffs2_put_super (struct super_block *sb) | |||
284 | up(&c->alloc_sem); | 284 | up(&c->alloc_sem); |
285 | jffs2_free_ino_caches(c); | 285 | jffs2_free_ino_caches(c); |
286 | jffs2_free_raw_node_refs(c); | 286 | jffs2_free_raw_node_refs(c); |
287 | if (c->mtd->flags & MTD_NO_VIRTBLOCKS) | 287 | if (jffs2_blocks_use_vmalloc(c)) |
288 | vfree(c->blocks); | 288 | vfree(c->blocks); |
289 | else | 289 | else |
290 | kfree(c->blocks); | 290 | kfree(c->blocks); |