Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
authorDavid Woodhouse <dwmw2@infradead.org>
Fri, 27 Apr 2007 18:16:19 +0000 (19:16 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Fri, 27 Apr 2007 18:16:19 +0000 (19:16 +0100)
Conflicts:

drivers/mtd/Kconfig

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
1  2 
drivers/mtd/Kconfig
fs/jffs2/fs.c
fs/jffs2/os-linux.h
fs/jffs2/wbuf.c

diff --combined drivers/mtd/Kconfig
@@@ -1,6 -1,8 +1,6 @@@
  # $Id: Kconfig,v 1.11 2005/11/07 11:14:19 gleixner Exp $
  
 -menu "Memory Technology Devices (MTD)"
 -
 -config MTD
 +menuconfig MTD
        tristate "Memory Technology Device (MTD) support"
        help
          Memory Technology Devices are flash, RAM and similar chips, often
          them. It will also allow you to select individual drivers for
          particular hardware and users of MTD devices. If unsure, say N.
  
 +if MTD
 +
  config MTD_DEBUG
        bool "Debugging"
 -      depends on MTD
        help
          This turns on low-level debugging for the entire MTD sub-system.
          Normally, you should say 'N'.
@@@ -28,6 -29,7 +28,6 @@@ config MTD_DEBUG_VERBOS
  
  config MTD_CONCAT
        tristate "MTD concatenating support"
 -      depends on MTD
        help
          Support for concatenating several MTD devices into a single
          (virtual) one. This allows you to have -for example- a JFFS(2)
@@@ -36,6 -38,7 +36,6 @@@
  
  config MTD_PARTITIONS
        bool "MTD partitioning support"
 -      depends on MTD
        help
          If you have a device which needs to divide its flash chip(s) up
          into multiple 'partitions', each of which appears to the user as
@@@ -150,9 -153,11 +150,9 @@@ config MTD_AFS_PART
          'armflash' map driver (CONFIG_MTD_ARMFLASH) does this, for example.
  
  comment "User Modules And Translation Layers"
 -      depends on MTD
  
  config MTD_CHAR
        tristate "Direct char device access to MTD devices"
 -      depends on MTD
        help
          This provides a character device for each MTD device present in
          the system, allowing the user to read and write directly to the
  
  config MTD_BLKDEVS
        tristate "Common interface to block layer for MTD 'translation layers'"
 -      depends on MTD && BLOCK
 +      depends on BLOCK
        default n
  
  config MTD_BLOCK
        tristate "Caching block device access to MTD devices"
 -      depends on MTD && BLOCK
 +      depends on BLOCK
        select MTD_BLKDEVS
        ---help---
          Although most flash chips have an erase size too large to be useful
  
  config MTD_BLOCK_RO
        tristate "Readonly block device access to MTD devices"
 -      depends on MTD_BLOCK!=y && MTD && BLOCK
 +      depends on MTD_BLOCK!=y && BLOCK
        select MTD_BLKDEVS
        help
          This allows you to mount read-only file systems (such as cramfs)
  
  config FTL
        tristate "FTL (Flash Translation Layer) support"
 -      depends on MTD && BLOCK
 +      depends on BLOCK
        select MTD_BLKDEVS
        ---help---
          This provides support for the original Flash Translation Layer which
  
  config NFTL
        tristate "NFTL (NAND Flash Translation Layer) support"
 -      depends on MTD && BLOCK
 +      depends on BLOCK
        select MTD_BLKDEVS
        ---help---
          This provides support for the NAND Flash Translation Layer which is
@@@ -242,7 -247,7 +242,7 @@@ config NFTL_R
  
  config INFTL
        tristate "INFTL (Inverse NAND Flash Translation Layer) support"
 -      depends on MTD && BLOCK
 +      depends on BLOCK
        select MTD_BLKDEVS
        ---help---
          This provides support for the Inverse NAND Flash Translation
  
  config RFD_FTL
          tristate "Resident Flash Disk (Flash Translation Layer) support"
 -      depends on MTD && BLOCK
 +      depends on BLOCK
        select MTD_BLKDEVS
        ---help---
          This provides support for the flash translation layer known
  
  config SSFDC
        tristate "NAND SSFDC (SmartMedia) read only translation layer"
 -      depends on MTD && BLOCK
 +      depends on BLOCK
        select MTD_BLKDEVS
        help
          This enables read only access to SmartMedia formatted NAND
@@@ -287,4 -292,7 +287,6 @@@ source "drivers/mtd/nand/Kconfig
  
  source "drivers/mtd/onenand/Kconfig"
  
 -endmenu
 -
+ source "drivers/mtd/ubi/Kconfig"
 +endif # MTD
diff --combined fs/jffs2/fs.c
@@@ -1,12 -1,14 +1,12 @@@
  /*
   * JFFS2 -- Journalling Flash File System, Version 2.
   *
 - * Copyright (C) 2001-2003 Red Hat, Inc.
 + * Copyright © 2001-2007 Red Hat, Inc.
   *
   * Created by David Woodhouse <dwmw2@infradead.org>
   *
   * For licensing information, see the file 'LICENCE' in this directory.
   *
 - * $Id: fs.c,v 1.66 2005/09/27 13:17:29 dedekind Exp $
 - *
   */
  
  #include <linux/capability.h>
@@@ -670,6 -672,13 +670,13 @@@ static int jffs2_flash_setup(struct jff
                        return ret;
        }
  
+       /* and an UBI volume */
+       if (jffs2_ubivol(c)) {
+               ret = jffs2_ubivol_setup(c);
+               if (ret)
+                       return ret;
+       }
        return ret;
  }
  
@@@ -688,4 -697,9 +695,9 @@@ void jffs2_flash_cleanup(struct jffs2_s
        if (jffs2_nor_wbuf_flash(c)) {
                jffs2_nor_wbuf_flash_cleanup(c);
        }
+       /* and an UBI volume */
+       if (jffs2_ubivol(c)) {
+               jffs2_ubivol_cleanup(c);
+       }
  }
diff --combined fs/jffs2/os-linux.h
@@@ -1,12 -1,14 +1,12 @@@
  /*
   * JFFS2 -- Journalling Flash File System, Version 2.
   *
 - * Copyright (C) 2002-2003 Red Hat, Inc.
 + * Copyright © 2001-2007 Red Hat, Inc.
   *
   * Created by David Woodhouse <dwmw2@infradead.org>
   *
   * For licensing information, see the file 'LICENCE' in this directory.
   *
 - * $Id: os-linux.h,v 1.64 2005/09/30 13:59:13 dedekind Exp $
 - *
   */
  
  #ifndef __JFFS2_OS_LINUX_H__
@@@ -96,6 -98,9 +96,9 @@@ static inline void jffs2_init_inode_inf
  #define jffs2_nor_wbuf_flash(c) (0)
  #define jffs2_nor_wbuf_flash_setup(c) (0)
  #define jffs2_nor_wbuf_flash_cleanup(c) do {} while (0)
+ #define jffs2_ubivol(c) (0)
+ #define jffs2_ubivol_setup(c) (0)
+ #define jffs2_ubivol_cleanup(c) do {} while (0)
  
  #else /* NAND and/or ECC'd NOR support present */
  
@@@ -131,6 -136,9 +134,9 @@@ void jffs2_nand_flash_cleanup(struct jf
  #define jffs2_dataflash(c) (c->mtd->type == MTD_DATAFLASH)
  int jffs2_dataflash_setup(struct jffs2_sb_info *c);
  void jffs2_dataflash_cleanup(struct jffs2_sb_info *c);
+ #define jffs2_ubivol(c) (c->mtd->type == MTD_UBIVOLUME)
+ int jffs2_ubivol_setup(struct jffs2_sb_info *c);
+ void jffs2_ubivol_cleanup(struct jffs2_sb_info *c);
  
  #define jffs2_nor_wbuf_flash(c) (c->mtd->type == MTD_NORFLASH && ! (c->mtd->flags & MTD_BIT_WRITEABLE))
  int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c);
diff --combined fs/jffs2/wbuf.c
@@@ -1,14 -1,16 +1,14 @@@
  /*
   * JFFS2 -- Journalling Flash File System, Version 2.
   *
 - * Copyright (C) 2001-2003 Red Hat, Inc.
 - * Copyright (C) 2004 Thomas Gleixner <tglx@linutronix.de>
 + * Copyright © 2001-2007 Red Hat, Inc.
 + * Copyright © 2004 Thomas Gleixner <tglx@linutronix.de>
   *
   * Created by David Woodhouse <dwmw2@infradead.org>
   * Modified debugged and enhanced by Thomas Gleixner <tglx@linutronix.de>
   *
   * For licensing information, see the file 'LICENCE' in this directory.
   *
 - * $Id: wbuf.c,v 1.100 2005/09/30 13:59:13 dedekind Exp $
 - *
   */
  
  #include <linux/kernel.h>
@@@ -343,9 -345,6 +343,9 @@@ static void jffs2_wbuf_recover(struct j
                return;
        }
  
 +      /* The summary is not recovered, so it must be disabled for this erase block */
 +      jffs2_sum_disable_collecting(c->summary);
 +
        ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, nr_refile);
        if (ret) {
                printk(KERN_WARNING "Failed to allocate node refs for wbuf recovery. Data loss ensues.\n");
@@@ -968,9 -967,9 +968,9 @@@ exit
  
  static const struct jffs2_unknown_node oob_cleanmarker =
  {
 -      .magic = cpu_to_je16(JFFS2_MAGIC_BITMASK),
 -      .nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER),
 -      .totlen = cpu_to_je32(8)
 +      .magic = constant_cpu_to_je16(JFFS2_MAGIC_BITMASK),
 +      .nodetype = constant_cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER),
 +      .totlen = constant_cpu_to_je32(8)
  };
  
  /*
@@@ -1209,3 -1208,27 +1209,27 @@@ int jffs2_nor_wbuf_flash_setup(struct j
  void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) {
        kfree(c->wbuf);
  }
+ int jffs2_ubivol_setup(struct jffs2_sb_info *c) {
+       c->cleanmarker_size = 0;
+       if (c->mtd->writesize == 1)
+               /* We do not need write-buffer */
+               return 0;
+       init_rwsem(&c->wbuf_sem);
+       c->wbuf_pagesize =  c->mtd->writesize;
+       c->wbuf_ofs = 0xFFFFFFFF;
+       c->wbuf = kmalloc(c->wbuf_pagesize, GFP_KERNEL);
+       if (!c->wbuf)
+               return -ENOMEM;
+       printk(KERN_INFO "JFFS2 write-buffering enabled buffer (%d) erasesize (%d)\n", c->wbuf_pagesize, c->sector_size);
+       return 0;
+ }
+ void jffs2_ubivol_cleanup(struct jffs2_sb_info *c) {
+       kfree(c->wbuf);
+ }