aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/fs.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/jffs2/fs.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'fs/jffs2/fs.c')
-rw-r--r--fs/jffs2/fs.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 6b2964a19850..46ad619b6124 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -21,7 +21,6 @@
21#include <linux/vmalloc.h> 21#include <linux/vmalloc.h>
22#include <linux/vfs.h> 22#include <linux/vfs.h>
23#include <linux/crc32.h> 23#include <linux/crc32.h>
24#include <linux/smp_lock.h>
25#include "nodelist.h" 24#include "nodelist.h"
26 25
27static int jffs2_flash_setup(struct jffs2_sb_info *c); 26static int jffs2_flash_setup(struct jffs2_sb_info *c);
@@ -358,7 +357,7 @@ error:
358 return ERR_PTR(ret); 357 return ERR_PTR(ret);
359} 358}
360 359
361void jffs2_dirty_inode(struct inode *inode) 360void jffs2_dirty_inode(struct inode *inode, int flags)
362{ 361{
363 struct iattr iattr; 362 struct iattr iattr;
364 363
@@ -391,7 +390,6 @@ int jffs2_remount_fs (struct super_block *sb, int *flags, char *data)
391 This also catches the case where it was stopped and this 390 This also catches the case where it was stopped and this
392 is just a remount to restart it. 391 is just a remount to restart it.
393 Flush the writebuffer, if neccecary, else we loose it */ 392 Flush the writebuffer, if neccecary, else we loose it */
394 lock_kernel();
395 if (!(sb->s_flags & MS_RDONLY)) { 393 if (!(sb->s_flags & MS_RDONLY)) {
396 jffs2_stop_garbage_collect_thread(c); 394 jffs2_stop_garbage_collect_thread(c);
397 mutex_lock(&c->alloc_sem); 395 mutex_lock(&c->alloc_sem);
@@ -403,8 +401,6 @@ int jffs2_remount_fs (struct super_block *sb, int *flags, char *data)
403 jffs2_start_garbage_collect_thread(c); 401 jffs2_start_garbage_collect_thread(c);
404 402
405 *flags |= MS_NOATIME; 403 *flags |= MS_NOATIME;
406
407 unlock_kernel();
408 return 0; 404 return 0;
409} 405}
410 406
@@ -478,6 +474,25 @@ struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_i
478 return inode; 474 return inode;
479} 475}
480 476
477static int calculate_inocache_hashsize(uint32_t flash_size)
478{
479 /*
480 * Pick a inocache hash size based on the size of the medium.
481 * Count how many megabytes we're dealing with, apply a hashsize twice
482 * that size, but rounding down to the usual big powers of 2. And keep
483 * to sensible bounds.
484 */
485
486 int size_mb = flash_size / 1024 / 1024;
487 int hashsize = (size_mb * 2) & ~0x3f;
488
489 if (hashsize < INOCACHE_HASHSIZE_MIN)
490 return INOCACHE_HASHSIZE_MIN;
491 if (hashsize > INOCACHE_HASHSIZE_MAX)
492 return INOCACHE_HASHSIZE_MAX;
493
494 return hashsize;
495}
481 496
482int jffs2_do_fill_super(struct super_block *sb, void *data, int silent) 497int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
483{ 498{
@@ -524,7 +539,8 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
524 if (ret) 539 if (ret)
525 return ret; 540 return ret;
526 541
527 c->inocache_list = kcalloc(INOCACHE_HASHSIZE, sizeof(struct jffs2_inode_cache *), GFP_KERNEL); 542 c->inocache_hashsize = calculate_inocache_hashsize(c->flash_size);
543 c->inocache_list = kcalloc(c->inocache_hashsize, sizeof(struct jffs2_inode_cache *), GFP_KERNEL);
528 if (!c->inocache_list) { 544 if (!c->inocache_list) {
529 ret = -ENOMEM; 545 ret = -ENOMEM;
530 goto out_wbuf; 546 goto out_wbuf;