vserver 1.9.5.x5
[linux-2.6.git] / fs / jffs2 / fs.c
index 76d7279..3a72e6f 100644 (file)
@@ -3,11 +3,11 @@
  *
  * Copyright (C) 2001-2003 Red Hat, Inc.
  *
- * Created by David Woodhouse <dwmw2@redhat.com>
+ * Created by David Woodhouse <dwmw2@infradead.org>
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  *
- * $Id: fs.c,v 1.46 2004/07/13 08:56:54 dwmw2 Exp $
+ * $Id: fs.c,v 1.51 2004/11/28 12:19:37 dedekind Exp $
  *
  */
 
@@ -20,6 +20,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/pagemap.h>
 #include <linux/slab.h>
+#include <linux/vmalloc.h>
 #include <linux/vfs.h>
 #include <linux/crc32.h>
 #include "nodelist.h"
@@ -202,7 +203,7 @@ int jffs2_statfs(struct super_block *sb, struct kstatfs *buf)
 
        buf->f_bavail = buf->f_bfree = avail >> PAGE_SHIFT;
 
-       D1(jffs2_dump_block_lists(c));
+       D2(jffs2_dump_block_lists(c));
 
        spin_unlock(&c->erase_completion_lock);
 
@@ -426,7 +427,7 @@ struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_i
        inode->i_mode = jemode_to_cpu(ri->mode);
        inode->i_gid = je16_to_cpu(ri->gid);
        inode->i_uid = je16_to_cpu(ri->uid);
-       inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME;
+       inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
        ri->atime = ri->mtime = ri->ctime = cpu_to_je32(I_SEC(inode->i_mtime));
 
        inode->i_blksize = PAGE_SIZE;
@@ -463,11 +464,13 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
         */
        c->sector_size = c->mtd->erasesize; 
        blocks = c->flash_size / c->sector_size;
-       while ((blocks * sizeof (struct jffs2_eraseblock)) > (128 * 1024)) {
-               blocks >>= 1;
-               c->sector_size <<= 1;
-       }       
-       
+       if (!(c->mtd->flags & MTD_NO_VIRTBLOCKS)) {
+               while ((blocks * sizeof (struct jffs2_eraseblock)) > (128 * 1024)) {
+                       blocks >>= 1;
+                       c->sector_size <<= 1;
+               }       
+       }
+
        /*
         * Size alignment check
         */
@@ -533,7 +536,10 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
  out_nodes:
        jffs2_free_ino_caches(c);
        jffs2_free_raw_node_refs(c);
-       kfree(c->blocks);
+       if (c->mtd->flags & MTD_NO_VIRTBLOCKS)
+               vfree(c->blocks);
+       else
+               kfree(c->blocks);
  out_inohash:
        kfree(c->inocache_list);
  out_wbuf:
@@ -649,6 +655,11 @@ int jffs2_flash_setup(struct jffs2_sb_info *c) {
        }
 
        /* add setups for other bizarre flashes here... */
+       if (jffs2_nor_ecc(c)) {
+               ret = jffs2_nor_ecc_flash_setup(c);
+               if (ret)
+                       return ret;
+       }
        return ret;
 }
 
@@ -659,4 +670,7 @@ void jffs2_flash_cleanup(struct jffs2_sb_info *c) {
        }
 
        /* add cleanups for other bizarre flashes here... */
+       if (jffs2_nor_ecc(c)) {
+               jffs2_nor_ecc_flash_cleanup(c);
+       }
 }