Mods for Linux 3.0 and fix a typo
authorCharles Manning <cdhmanning@gmail.com>
Sun, 14 Aug 2011 23:40:30 +0000 (11:40 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Sun, 14 Aug 2011 23:40:30 +0000 (11:40 +1200)
Roll in NCB's patch and some other changes for Linux 3.0.
Also fix a dumb type retired_writes->retried_writes

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
patch-ker.sh
yaffs_guts.c
yaffs_guts.h
yaffs_vfs_multi.c
yaffs_vfs_single.c

index 44152c8b8f20270b0cf8b73ce65415454ba87c79..ed54d53505eb37821617d6ae3c12eee7c21536af 100755 (executable)
@@ -92,7 +92,7 @@ PATCHLEVEL=`grep -s PATCHLEVEL <$LINUXDIR/Makefile | head -n 1 | sed s/'PATCHLEV
 SUBLEVEL=`grep -s SUBLEVEL <$LINUXDIR/Makefile | head -n 1 | sed s/'SUBLEVEL = '//`
 
 # Can we handle this version?
 SUBLEVEL=`grep -s SUBLEVEL <$LINUXDIR/Makefile | head -n 1 | sed s/'SUBLEVEL = '//`
 
 # Can we handle this version?
-if [ $VERSION -ne 2  -o $PATCHLEVEL -lt 6  ]
+if [ $VERSION$PATCHLEVEL -lt 26  ]
 then
        echo "Cannot patch kernel version $VERSION.$PATCHLEVEL.$SUBLEVEL, must be 2.6.x or higher"
        exit 1;
 then
        echo "Cannot patch kernel version $VERSION.$PATCHLEVEL.$SUBLEVEL, must be 2.6.x or higher"
        exit 1;
index d72aa5ba9e5a59c1c3722664fccd881b7694d3c1..9ade09b54e51680c7c507b3bc21566108144bbc6 100644 (file)
@@ -598,7 +598,7 @@ static int yaffs_write_new_chunk(struct yaffs_dev *dev,
                yaffs_trace(YAFFS_TRACE_ERROR,
                        "**>> yaffs write required %d attempts",
                        attempts);
                yaffs_trace(YAFFS_TRACE_ERROR,
                        "**>> yaffs write required %d attempts",
                        attempts);
-               dev->n_retired_writes += (attempts - 1);
+               dev->n_retried_writes += (attempts - 1);
        }
 
        return chunk;
        }
 
        return chunk;
@@ -4878,7 +4878,7 @@ int yaffs_guts_initialise(struct yaffs_dev *dev)
        dev->n_page_writes = 0;
        dev->n_erasures = 0;
        dev->n_gc_copies = 0;
        dev->n_page_writes = 0;
        dev->n_erasures = 0;
        dev->n_gc_copies = 0;
-       dev->n_retired_writes = 0;
+       dev->n_retried_writes = 0;
 
        dev->n_retired_blocks = 0;
 
 
        dev->n_retired_blocks = 0;
 
index 6ec8a47b1d45d89413e9f999d8daaa2fc51f3bf3..490122aa16679ae8d46162f083a88661e50c1795 100644 (file)
@@ -744,7 +744,7 @@ struct yaffs_dev {
        u32 oldest_dirty_gc_count;
        u32 n_gc_blocks;
        u32 bg_gcs;
        u32 oldest_dirty_gc_count;
        u32 n_gc_blocks;
        u32 bg_gcs;
-       u32 n_retired_writes;
+       u32 n_retried_writes;
        u32 n_retired_blocks;
        u32 n_ecc_fixed;
        u32 n_ecc_unfixed;
        u32 n_retired_blocks;
        u32 n_ecc_fixed;
        u32 n_ecc_unfixed;
index 966df484835990673eb43167ea4b4338113512ad..b8e51243051a27fc7a17c3b79dbbfd72555699b1 100644 (file)
@@ -72,7 +72,9 @@
 #include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/proc_fs.h>
 #include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/proc_fs.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39))
 #include <linux/smp_lock.h>
 #include <linux/smp_lock.h>
+#endif
 #include <linux/pagemap.h>
 #include <linux/mtd/mtd.h>
 #include <linux/interrupt.h>
 #include <linux/pagemap.h>
 #include <linux/mtd/mtd.h>
 #include <linux/interrupt.h>
@@ -237,7 +239,9 @@ static int yaffs_file_flush(struct file *file, fl_owner_t id);
 static int yaffs_file_flush(struct file *file);
 #endif
 
 static int yaffs_file_flush(struct file *file);
 #endif
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync);
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
 static int yaffs_sync_object(struct file *file, int datasync);
 #else
 static int yaffs_sync_object(struct file *file, struct dentry *dentry,
 static int yaffs_sync_object(struct file *file, int datasync);
 #else
 static int yaffs_sync_object(struct file *file, struct dentry *dentry,
@@ -1826,7 +1830,9 @@ static int yaffs_symlink(struct inode *dir, struct dentry *dentry,
        return -ENOMEM;
 }
 
        return -ENOMEM;
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+static int yaffs_sync_object(struct file *file, loff_t start, loff_t end, int datasync)
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
 static int yaffs_sync_object(struct file *file, int datasync)
 #else
 static int yaffs_sync_object(struct file *file, struct dentry *dentry,
 static int yaffs_sync_object(struct file *file, int datasync)
 #else
 static int yaffs_sync_object(struct file *file, struct dentry *dentry,
@@ -2973,7 +2979,13 @@ static int yaffs_internal_read_super_mtd(struct super_block *sb, void *data,
        return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL;
 }
 
        return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL;
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+static struct dentry *yaffs_mount(struct file_system_type *fs_type, int flags,
+        const char *dev_name, void *data)
+{
+    return mount_bdev(fs_type, flags, dev_name, data, yaffs_internal_read_super_mtd);
+}
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
 static int yaffs_read_super(struct file_system_type *fs,
                            int flags, const char *dev_name,
                            void *data, struct vfsmount *mnt)
 static int yaffs_read_super(struct file_system_type *fs,
                            int flags, const char *dev_name,
                            void *data, struct vfsmount *mnt)
@@ -2996,8 +3008,12 @@ static struct super_block *yaffs_read_super(struct file_system_type *fs,
 static struct file_system_type yaffs_fs_type = {
        .owner = THIS_MODULE,
        .name = "yaffs",
 static struct file_system_type yaffs_fs_type = {
        .owner = THIS_MODULE,
        .name = "yaffs",
-       .get_sb = yaffs_read_super,
-       .kill_sb = kill_block_super,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+        .mount = yaffs_mount,
+#else
+        .get_sb = yaffs_read_super,
+#endif
+       .kill_sb = kill_block_super,
        .fs_flags = FS_REQUIRES_DEV,
 };
 #else
        .fs_flags = FS_REQUIRES_DEV,
 };
 #else
@@ -3019,7 +3035,13 @@ static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data,
        return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL;
 }
 
        return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL;
 }
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+static struct dentry *yaffs2_mount(struct file_system_type *fs_type, int flags,
+        const char *dev_name, void *data)
+{
+        return mount_bdev(fs_type, flags, dev_name, data, yaffs2_internal_read_super_mtd);
+}
+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
 static int yaffs2_read_super(struct file_system_type *fs,
                             int flags, const char *dev_name, void *data,
                             struct vfsmount *mnt)
 static int yaffs2_read_super(struct file_system_type *fs,
                             int flags, const char *dev_name, void *data,
                             struct vfsmount *mnt)
@@ -3041,8 +3063,12 @@ static struct super_block *yaffs2_read_super(struct file_system_type *fs,
 static struct file_system_type yaffs2_fs_type = {
        .owner = THIS_MODULE,
        .name = "yaffs2",
 static struct file_system_type yaffs2_fs_type = {
        .owner = THIS_MODULE,
        .name = "yaffs2",
-       .get_sb = yaffs2_read_super,
-       .kill_sb = kill_block_super,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
+        .mount = yaffs2_mount,
+#else
+        .get_sb = yaffs2_read_super,
+#endif
+       .kill_sb = kill_block_super,
        .fs_flags = FS_REQUIRES_DEV,
 };
 #else
        .fs_flags = FS_REQUIRES_DEV,
 };
 #else
@@ -3112,8 +3138,8 @@ static char *yaffs_dump_dev_part1(char *buf, struct yaffs_dev *dev)
                                dev->oldest_dirty_gc_count);
        buf += sprintf(buf, "n_gc_blocks.......... %u\n", dev->n_gc_blocks);
        buf += sprintf(buf, "bg_gcs............... %u\n", dev->bg_gcs);
                                dev->oldest_dirty_gc_count);
        buf += sprintf(buf, "n_gc_blocks.......... %u\n", dev->n_gc_blocks);
        buf += sprintf(buf, "bg_gcs............... %u\n", dev->bg_gcs);
-       buf += sprintf(buf, "n_retired_writes..... %u\n",
-                               dev->n_retired_writes);
+       buf += sprintf(buf, "n_retried_writes..... %u\n",
+                               dev->n_retried_writes);
        buf += sprintf(buf, "n_retired_blocks..... %u\n",
                                dev->n_retired_blocks);
        buf += sprintf(buf, "n_ecc_fixed.......... %u\n", dev->n_ecc_fixed);
        buf += sprintf(buf, "n_retired_blocks..... %u\n",
                                dev->n_retired_blocks);
        buf += sprintf(buf, "n_ecc_fixed.......... %u\n", dev->n_ecc_fixed);
index 64e590c7fd24852d898b9b82c59fc76f7c354679..f8228457e18697ddfd73900d29fca6736fb578a1 100644 (file)
@@ -2391,7 +2391,7 @@ static char *yaffs_dump_dev_part1(char *buf, struct yaffs_dev *dev)
        buf += sprintf(buf, "n_gc_blocks........... %u\n", dev->n_gc_blocks);
        buf += sprintf(buf, "bg_gcs................ %u\n", dev->bg_gcs);
        buf +=
        buf += sprintf(buf, "n_gc_blocks........... %u\n", dev->n_gc_blocks);
        buf += sprintf(buf, "bg_gcs................ %u\n", dev->bg_gcs);
        buf +=
-           sprintf(buf, "n_retired_writes...... %u\n", dev->n_retired_writes);
+           sprintf(buf, "n_retried_writes...... %u\n", dev->n_retried_writes);
        buf +=
            sprintf(buf, "n_retired_blocks...... %u\n", dev->n_retired_blocks);
        buf += sprintf(buf, "n_ecc_fixed........... %u\n", dev->n_ecc_fixed);
        buf +=
            sprintf(buf, "n_retired_blocks...... %u\n", dev->n_retired_blocks);
        buf += sprintf(buf, "n_ecc_fixed........... %u\n", dev->n_ecc_fixed);