aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/generic/patches-3.9/500-yaffs-Kbuild-integration.patch18
-rw-r--r--target/linux/generic/patches-3.9/501-yaffs-Fix-directory-unlinking-in-yaffs1-mode.patch31
-rw-r--r--target/linux/generic/patches-3.9/502-yaffs-Switch-from-semaphores-to-mutexes.patch138
-rw-r--r--target/linux/generic/patches-3.9/503-yaffs-Replace-yaffs_dir_llseek-with-Linux-generic-ll.patch72
-rw-r--r--target/linux/generic/patches-3.9/504-yaffs-Mods-for-Linux-3.0-and-fix-a-typo.patch110
-rw-r--r--target/linux/generic/patches-3.9/505-yaffs-3.2-use-MTD_OPS_AUTO_OOB.patch54
-rw-r--r--target/linux/generic/patches-3.9/506-yaffs-3.2-dont-use-i_nlink-directly.patch78
-rw-r--r--target/linux/generic/patches-3.9/507-yaffs-3.3_fix.patch71
-rw-r--r--target/linux/generic/patches-3.9/508-yaffs-3.3-use-mtd_-helpers.patch160
-rw-r--r--target/linux/generic/patches-3.9/509-yaffs-3.4-add-underscore-to-mtd-internal-names.patch72
-rw-r--r--target/linux/generic/patches-3.9/510-yaffs-3.4-use-d_make_root.patch14
-rw-r--r--target/linux/generic/patches-3.9/511-yaffs-3.5-use-clear_inode.patch15
-rw-r--r--target/linux/generic/patches-3.9/512-yaffs-3.5-convert-to-use-kuid_t-kgid_t.patch570
-rw-r--r--target/linux/generic/patches-3.9/513-yaffs-3.6-fix-dir_inode-ops.patch60
-rw-r--r--target/linux/generic/patches-3.9/514-yaffs-3.6-use-delayed-work-instead-of-write_super.patch180
15 files changed, 0 insertions, 1643 deletions
diff --git a/target/linux/generic/patches-3.9/500-yaffs-Kbuild-integration.patch b/target/linux/generic/patches-3.9/500-yaffs-Kbuild-integration.patch
deleted file mode 100644
index 3940c1050e..0000000000
--- a/target/linux/generic/patches-3.9/500-yaffs-Kbuild-integration.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/fs/Kconfig
-+++ b/fs/Kconfig
-@@ -39,6 +39,7 @@ source "fs/gfs2/Kconfig"
- source "fs/ocfs2/Kconfig"
- source "fs/btrfs/Kconfig"
- source "fs/nilfs2/Kconfig"
-+source "fs/yaffs2/Kconfig"
-
- endif # BLOCK
-
---- a/fs/Makefile
-+++ b/fs/Makefile
-@@ -128,3 +128,5 @@ obj-$(CONFIG_F2FS_FS) += f2fs/
- obj-y += exofs/ # Multiple modules
- obj-$(CONFIG_CEPH_FS) += ceph/
- obj-$(CONFIG_PSTORE) += pstore/
-+obj-$(CONFIG_YAFFS_FS) += yaffs2/
-+
diff --git a/target/linux/generic/patches-3.9/501-yaffs-Fix-directory-unlinking-in-yaffs1-mode.patch b/target/linux/generic/patches-3.9/501-yaffs-Fix-directory-unlinking-in-yaffs1-mode.patch
deleted file mode 100644
index d2bad01016..0000000000
--- a/target/linux/generic/patches-3.9/501-yaffs-Fix-directory-unlinking-in-yaffs1-mode.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 2505e8b0a13d3d5c5bbeaaae4eb889864f44c9df Mon Sep 17 00:00:00 2001
-From: Charles Manning <cdhmanning@gmail.com>
-Date: Thu, 3 Feb 2011 05:55:30 +1300
-Subject: [PATCH] yaffs: Fix directory unlinking in yaffs1 mode
-
-commit 964b3425a71890e6701c830e38b04d8557c04f49 upstream.
-
-Treat both yaffs2 and yaffs1 paths the same.
-
-Signed-off-by: Charles Manning <cdhmanning@gmail.com>
----
- yaffs_guts.c | 8 +-------
- 1 file changed, 1 insertion(+), 7 deletions(-)
-
---- a/fs/yaffs2/yaffs_guts.c
-+++ b/fs/yaffs2/yaffs_guts.c
-@@ -1708,13 +1708,7 @@ static int yaffs_change_obj_name(yaffs_o
- YBUG();
- }
-
-- /* TODO: Do we need this different handling for YAFFS2 and YAFFS1?? */
-- if (obj->my_dev->param.is_yaffs2)
-- unlinkOp = (new_dir == obj->my_dev->unlinked_dir);
-- else
-- unlinkOp = (new_dir == obj->my_dev->unlinked_dir
-- && obj->variant_type == YAFFS_OBJECT_TYPE_FILE);
--
-+ unlinkOp = (new_dir == obj->my_dev->unlinked_dir);
- deleteOp = (new_dir == obj->my_dev->del_dir);
-
- existingTarget = yaffs_find_by_name(new_dir, new_name);
diff --git a/target/linux/generic/patches-3.9/502-yaffs-Switch-from-semaphores-to-mutexes.patch b/target/linux/generic/patches-3.9/502-yaffs-Switch-from-semaphores-to-mutexes.patch
deleted file mode 100644
index 8d1872e3fb..0000000000
--- a/target/linux/generic/patches-3.9/502-yaffs-Switch-from-semaphores-to-mutexes.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-From c0c289363e84c53b5872f7c0c5069045096dca07 Mon Sep 17 00:00:00 2001
-From: Charles Manning <cdhmanning@gmail.com>
-Date: Wed, 3 Nov 2010 16:01:12 +1300
-Subject: [PATCH] yaffs: Switch from semaphores to mutexes
-
-commit 73c54aa8c1de3f61a4c211cd47431293a6092f18 upstream.
-
-Mutex is faster and init_MUTEX has been deprecated, so we'll just switch
-to mutexes.
-
-Signed-off-by: Charles Manning <cdhmanning@gmail.com>
----
- yaffs_linux.h | 2 +-
- yaffs_vfs.c | 24 ++++++++++++------------
- yaffs_vfs_multi.c | 26 +++++++++++++-------------
- 3 files changed, 26 insertions(+), 26 deletions(-)
-
---- a/fs/yaffs2/yaffs_linux.h
-+++ b/fs/yaffs2/yaffs_linux.h
-@@ -25,7 +25,7 @@ struct yaffs_LinuxContext {
- struct super_block * superBlock;
- struct task_struct *bgThread; /* Background thread for this device */
- int bgRunning;
-- struct semaphore grossLock; /* Gross locking semaphore */
-+ struct mutex grossLock; /* Gross locking mutex*/
- __u8 *spareBuffer; /* For mtdif2 use. Don't know the size of the buffer
- * at compile time so we have to allocate it.
- */
---- a/fs/yaffs2/yaffs_vfs_glue.c
-+++ b/fs/yaffs2/yaffs_vfs_glue.c
-@@ -515,14 +515,14 @@ static unsigned yaffs_gc_control_callbac
- static void yaffs_gross_lock(yaffs_dev_t *dev)
- {
- T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current));
-- down(&(yaffs_dev_to_lc(dev)->grossLock));
-+ mutex_lock(&(yaffs_dev_to_lc(dev)->grossLock));
- T(YAFFS_TRACE_LOCK, (TSTR("yaffs locked %p\n"), current));
- }
-
- static void yaffs_gross_unlock(yaffs_dev_t *dev)
- {
- T(YAFFS_TRACE_LOCK, (TSTR("yaffs unlocking %p\n"), current));
-- up(&(yaffs_dev_to_lc(dev)->grossLock));
-+ mutex_unlock(&(yaffs_dev_to_lc(dev)->grossLock));
- }
-
- #ifdef YAFFS_COMPILE_EXPORTFS
-@@ -2542,7 +2542,7 @@ static void yaffs_read_inode(struct inod
- #endif
-
- static YLIST_HEAD(yaffs_context_list);
--struct semaphore yaffs_context_lock;
-+struct mutex yaffs_context_lock;
-
- static void yaffs_put_super(struct super_block *sb)
- {
-@@ -2568,9 +2568,9 @@ static void yaffs_put_super(struct super
-
- yaffs_gross_unlock(dev);
-
-- down(&yaffs_context_lock);
-+ mutex_lock(&yaffs_context_lock);
- ylist_del_init(&(yaffs_dev_to_lc(dev)->contextList));
-- up(&yaffs_context_lock);
-+ mutex_unlock(&yaffs_context_lock);
-
- if (yaffs_dev_to_lc(dev)->spareBuffer) {
- YFREE(yaffs_dev_to_lc(dev)->spareBuffer);
-@@ -3016,7 +3016,7 @@ static struct super_block *yaffs_interna
- param->skip_checkpt_rd = options.skip_checkpoint_read;
- param->skip_checkpt_wr = options.skip_checkpoint_write;
-
-- down(&yaffs_context_lock);
-+ mutex_lock(&yaffs_context_lock);
- /* Get a mount id */
- found = 0;
- for(mount_id=0; ! found; mount_id++){
-@@ -3030,13 +3030,13 @@ static struct super_block *yaffs_interna
- context->mount_id = mount_id;
-
- ylist_add_tail(&(yaffs_dev_to_lc(dev)->contextList), &yaffs_context_list);
-- up(&yaffs_context_lock);
-+ mutex_unlock(&yaffs_context_lock);
-
- /* Directory search handling...*/
- YINIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->searchContexts));
- param->remove_obj_fn = yaffs_remove_obj_callback;
-
-- init_MUTEX(&(yaffs_dev_to_lc(dev)->grossLock));
-+ mutex_init(&(yaffs_dev_to_lc(dev)->grossLock));
-
- yaffs_gross_lock(dev);
-
-@@ -3268,7 +3268,7 @@ static int yaffs_proc_read(char *page,
- else {
- step-=2;
-
-- down(&yaffs_context_lock);
-+ mutex_lock(&yaffs_context_lock);
-
- /* Locate and print the Nth entry. Order N-squared but N is small. */
- ylist_for_each(item, &yaffs_context_list) {
-@@ -3287,7 +3287,7 @@ static int yaffs_proc_read(char *page,
-
- break;
- }
-- up(&yaffs_context_lock);
-+ mutex_unlock(&yaffs_context_lock);
- }
-
- return buf - page < count ? buf - page : count;
-@@ -3301,7 +3301,7 @@ static int yaffs_stats_proc_read(char *p
- char *buf = page;
- int n = 0;
-
-- down(&yaffs_context_lock);
-+ mutex_lock(&yaffs_context_lock);
-
- /* Locate and print the Nth entry. Order N-squared but N is small. */
- ylist_for_each(item, &yaffs_context_list) {
-@@ -3317,7 +3317,7 @@ static int yaffs_stats_proc_read(char *p
- dev->bg_gcs, dev->oldest_dirty_gc_count,
- dev->n_obj, dev->n_tnodes);
- }
-- up(&yaffs_context_lock);
-+ mutex_unlock(&yaffs_context_lock);
-
-
- return buf - page < count ? buf - page : count;
-@@ -3494,7 +3494,7 @@ static int __init init_yaffs_fs(void)
-
-
-
-- init_MUTEX(&yaffs_context_lock);
-+ mutex_init(&yaffs_context_lock);
-
- /* Install the proc_fs entries */
- my_proc_entry = create_proc_entry("yaffs",
diff --git a/target/linux/generic/patches-3.9/503-yaffs-Replace-yaffs_dir_llseek-with-Linux-generic-ll.patch b/target/linux/generic/patches-3.9/503-yaffs-Replace-yaffs_dir_llseek-with-Linux-generic-ll.patch
deleted file mode 100644
index d283e8559c..0000000000
--- a/target/linux/generic/patches-3.9/503-yaffs-Replace-yaffs_dir_llseek-with-Linux-generic-ll.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From cd6657c4bde20886b0805ea9f2cbac7ec25ac2e5 Mon Sep 17 00:00:00 2001
-From: Charles Manning <cdhmanning@gmail.com>
-Date: Tue, 30 Nov 2010 16:01:28 +1300
-Subject: [PATCH 1/2] yaffs: Replace yaffs_dir_llseek with Linux generic
- llseek
-
-commit ed8188fb7659cfb65b5adbe154d143190ade0324 upstream.
-
-There was not much point in having the yaffs version as it is
-functionally equivalent to the kernel one.
-
-This also gets rid of using BKL in yaffs2.
-
-Signed-off-by: Charles Manning <cdhmanning@gmail.com>
----
- yaffs_vfs.c | 30 +-----------------------------
- yaffs_vfs_multi.c | 30 +-----------------------------
- 2 files changed, 2 insertions(+), 58 deletions(-)
-
---- a/fs/yaffs2/yaffs_vfs_glue.c
-+++ b/fs/yaffs2/yaffs_vfs_glue.c
-@@ -342,8 +342,6 @@ static int yaffs_follow_link(struct dent
-
- static void yaffs_touch_super(yaffs_dev_t *dev);
-
--static loff_t yaffs_dir_llseek(struct file *file, loff_t offset, int origin);
--
- static int yaffs_vfs_setattr(struct inode *, struct iattr *);
-
-
-@@ -460,7 +458,7 @@ static const struct file_operations yaff
- .read = generic_read_dir,
- .readdir = yaffs_readdir,
- .fsync = yaffs_sync_object,
-- .llseek = yaffs_dir_llseek,
-+ .llseek = generic_file_llseek,
- };
-
- static const struct super_operations yaffs_super_ops = {
-@@ -1534,32 +1532,6 @@ static void yaffs_release_space(struct f
- }
-
-
--static loff_t yaffs_dir_llseek(struct file *file, loff_t offset, int origin)
--{
-- long long retval;
--
-- lock_kernel();
--
-- switch (origin){
-- case 2:
-- offset += i_size_read(file->f_path.dentry->d_inode);
-- break;
-- case 1:
-- offset += file->f_pos;
-- }
-- retval = -EINVAL;
--
-- if (offset >= 0){
-- if (offset != file->f_pos)
-- file->f_pos = offset;
--
-- retval = offset;
-- }
-- unlock_kernel();
-- return retval;
--}
--
--
- static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
- {
- yaffs_obj_t *obj;
diff --git a/target/linux/generic/patches-3.9/504-yaffs-Mods-for-Linux-3.0-and-fix-a-typo.patch b/target/linux/generic/patches-3.9/504-yaffs-Mods-for-Linux-3.0-and-fix-a-typo.patch
deleted file mode 100644
index 1b814e97fd..0000000000
--- a/target/linux/generic/patches-3.9/504-yaffs-Mods-for-Linux-3.0-and-fix-a-typo.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-From e1537a700c2e750c5eacc5ad93f30821f1e94424 Mon Sep 17 00:00:00 2001
-From: Charles Manning <cdhmanning@gmail.com>
-Date: Mon, 15 Aug 2011 11:40:30 +1200
-Subject: [PATCH 2/2] Mods for Linux 3.0 and fix a typo
-
-commit a7b5dcf904ba6f7890e4b77ce1f56388b855d0f6 upstream.
-
-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 | 2 +-
- yaffs_vfs_glue.c | 42 ++++++++++++++++++++++++++++++++++--------
- 2 files changed, 35 insertions(+), 9 deletions(-)
-
---- a/fs/yaffs2/yaffs_vfs_glue.c
-+++ b/fs/yaffs2/yaffs_vfs_glue.c
-@@ -72,7 +72,9 @@
- #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>
-+#endif
- #include <linux/pagemap.h>
- #include <linux/mtd/mtd.h>
- #include <linux/interrupt.h>
-@@ -236,7 +238,9 @@ static int yaffs_file_flush(struct file
- 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,
-@@ -1864,7 +1868,9 @@ static int yaffs_symlink(struct inode *d
- 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,
-@@ -3067,7 +3073,13 @@ static int yaffs_internal_read_super_mtd
- 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)
-@@ -3090,8 +3102,12 @@ static struct super_block *yaffs_read_su
- 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
-@@ -3115,7 +3131,13 @@ static int yaffs2_internal_read_super_mt
- 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)
-@@ -3137,8 +3159,12 @@ static struct super_block *yaffs2_read_s
- 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
diff --git a/target/linux/generic/patches-3.9/505-yaffs-3.2-use-MTD_OPS_AUTO_OOB.patch b/target/linux/generic/patches-3.9/505-yaffs-3.2-use-MTD_OPS_AUTO_OOB.patch
deleted file mode 100644
index 463f4a208b..0000000000
--- a/target/linux/generic/patches-3.9/505-yaffs-3.2-use-MTD_OPS_AUTO_OOB.patch
+++ /dev/null
@@ -1,54 +0,0 @@
---- a/fs/yaffs2/yaffs_mtdif1.c
-+++ b/fs/yaffs2/yaffs_mtdif1.c
-@@ -127,7 +127,7 @@ int nandmtd1_WriteChunkWithTagsToNAND(ya
- #endif
-
- memset(&ops, 0, sizeof(ops));
-- ops.mode = MTD_OOB_AUTO;
-+ ops.mode = MTD_OPS_AUTO_OOB;
- ops.len = (data) ? chunkBytes : 0;
- ops.ooblen = YTAG1_SIZE;
- ops.datbuf = (__u8 *)data;
-@@ -179,7 +179,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
- int deleted;
-
- memset(&ops, 0, sizeof(ops));
-- ops.mode = MTD_OOB_AUTO;
-+ ops.mode = MTD_OPS_AUTO_OOB;
- ops.len = (data) ? chunkBytes : 0;
- ops.ooblen = YTAG1_SIZE;
- ops.datbuf = data;
---- a/fs/yaffs2/yaffs_mtdif2.c
-+++ b/fs/yaffs2/yaffs_mtdif2.c
-@@ -71,7 +71,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya
- yaffs_PackTags2(&pt, tags, !dev->param.no_tags_ecc);
-
- #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
-- ops.mode = MTD_OOB_AUTO;
-+ ops.mode = MTD_OPS_AUTO_OOB;
- ops.ooblen = (dev->param.inband_tags) ? 0 : packed_tags_size;
- ops.len = dev->param.total_bytes_per_chunk;
- ops.ooboffs = 0;
-@@ -136,7 +136,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y
- retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk,
- &dummy, data);
- else if (tags) {
-- ops.mode = MTD_OOB_AUTO;
-+ ops.mode = MTD_OPS_AUTO_OOB;
- ops.ooblen = packed_tags_size;
- ops.len = data ? dev->data_bytes_per_chunk : packed_tags_size;
- ops.ooboffs = 0;
---- a/fs/yaffs2/yaffs_mtdif.h
-+++ b/fs/yaffs2/yaffs_mtdif.h
-@@ -24,4 +24,11 @@ extern struct nand_oobinfo yaffs_noeccin
- #endif
- int nandmtd_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
- int nandmtd_InitialiseNAND(yaffs_dev_t *dev);
-+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
-+#include <mtd/mtd-abi.h>
-+#else
-+#define MTD_OPS_AUTO_OOB MTD_OOB_AUTO
-+#endif
-+
- #endif
diff --git a/target/linux/generic/patches-3.9/506-yaffs-3.2-dont-use-i_nlink-directly.patch b/target/linux/generic/patches-3.9/506-yaffs-3.2-dont-use-i_nlink-directly.patch
deleted file mode 100644
index 91e8281196..0000000000
--- a/target/linux/generic/patches-3.9/506-yaffs-3.2-dont-use-i_nlink-directly.patch
+++ /dev/null
@@ -1,78 +0,0 @@
---- a/fs/yaffs2/yaffs_vfs_glue.c
-+++ b/fs/yaffs2/yaffs_vfs_glue.c
-@@ -220,6 +220,29 @@ static struct inode *yaffs_iget(struct s
- #define yaffs_SuperToDevice(sb) ((yaffs_dev_t *)sb->u.generic_sbp)
- #endif
-
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0))
-+static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink)
-+{
-+ set_nlink(inode, nlink);
-+}
-+
-+static inline void yaffs_dec_link_count(struct inode *inode)
-+{
-+ inode_dec_link_count(inode);
-+}
-+#else
-+static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink)
-+{
-+ inode->i_nlink = nlink;
-+}
-+
-+static inline void yaffs_dec_link_count(struct inode *inode)
-+{
-+ inode->i_nlink--;
-+ mark_inode_dirty(inode)
-+}
-+#endif
-+
-
- #define update_dir_time(dir) do {\
- (dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \
-@@ -1362,7 +1385,7 @@ static void yaffs_fill_inode_from_obj(st
- inode->i_size = yaffs_get_obj_length(obj);
- inode->i_blocks = (inode->i_size + 511) >> 9;
-
-- inode->i_nlink = yaffs_get_obj_link_count(obj);
-+ yaffs_set_nlink(inode, yaffs_get_obj_link_count(obj));
-
- T(YAFFS_TRACE_OS,
- (TSTR("yaffs_fill_inode mode %x uid %d gid %d size %d count %d\n"),
-@@ -1784,10 +1807,9 @@ static int yaffs_unlink(struct inode *di
- retVal = yaffs_unlinker(obj, dentry->d_name.name);
-
- if (retVal == YAFFS_OK) {
-- dentry->d_inode->i_nlink--;
-+ yaffs_dec_link_count(dentry->d_inode);
- dir->i_version++;
- yaffs_gross_unlock(dev);
-- mark_inode_dirty(dentry->d_inode);
- update_dir_time(dir);
- return 0;
- }
-@@ -1818,7 +1840,8 @@ static int yaffs_link(struct dentry *old
- obj);
-
- if (link) {
-- old_dentry->d_inode->i_nlink = yaffs_get_obj_link_count(obj);
-+ yaffs_set_nlink(old_dentry->d_inode,
-+ yaffs_get_obj_link_count(obj));
- d_instantiate(dentry, old_dentry->d_inode);
- atomic_inc(&old_dentry->d_inode->i_count);
- T(YAFFS_TRACE_OS,
-@@ -1937,11 +1960,9 @@ static int yaffs_rename(struct inode *ol
- yaffs_gross_unlock(dev);
-
- if (retVal == YAFFS_OK) {
-- if (target) {
-- new_dentry->d_inode->i_nlink--;
-- mark_inode_dirty(new_dentry->d_inode);
-- }
--
-+ if (target)
-+ yaffs_dec_link_count(new_dentry->d_inode);
-+
- update_dir_time(old_dir);
- if(old_dir != new_dir)
- update_dir_time(new_dir);
diff --git a/target/linux/generic/patches-3.9/507-yaffs-3.3_fix.patch b/target/linux/generic/patches-3.9/507-yaffs-3.3_fix.patch
deleted file mode 100644
index d823fc49c4..0000000000
--- a/target/linux/generic/patches-3.9/507-yaffs-3.3_fix.patch
+++ /dev/null
@@ -1,71 +0,0 @@
---- a/fs/yaffs2/yaffs_vfs_glue.c
-+++ b/fs/yaffs2/yaffs_vfs_glue.c
-@@ -273,8 +273,13 @@ static int yaffs_sync_object(struct file
- static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir);
-
- #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
-+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
-+ struct nameidata *n);
-+#else
- static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode,
- struct nameidata *n);
-+#endif
- static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
- struct nameidata *n);
- #else
-@@ -286,9 +291,17 @@ static int yaffs_link(struct dentry *old
- static int yaffs_unlink(struct inode *dir, struct dentry *dentry);
- static int yaffs_symlink(struct inode *dir, struct dentry *dentry,
- const char *symname);
-+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
-+static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
-+#else
- static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode);
-+#endif
-
--#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
-+static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
-+ dev_t dev);
-+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
- static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
- dev_t dev);
- #else
-@@ -1679,7 +1692,10 @@ out:
- #define YCRED(x) (x->cred)
- #endif
-
--#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
-+static int yaffs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
-+ dev_t rdev)
-+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
- static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
- dev_t rdev)
- #else
-@@ -1769,7 +1785,11 @@ static int yaffs_mknod(struct inode *dir
- return error;
- }
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
-+static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
-+#else
- static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
-+#endif
- {
- int retVal;
- T(YAFFS_TRACE_OS, (TSTR("yaffs_mkdir\n")));
-@@ -1777,7 +1797,10 @@ static int yaffs_mkdir(struct inode *dir
- return retVal;
- }
-
--#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
-+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
-+ struct nameidata *n)
-+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
- static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode,
- struct nameidata *n)
- #else
diff --git a/target/linux/generic/patches-3.9/508-yaffs-3.3-use-mtd_-helpers.patch b/target/linux/generic/patches-3.9/508-yaffs-3.3-use-mtd_-helpers.patch
deleted file mode 100644
index 65d45a0be1..0000000000
--- a/target/linux/generic/patches-3.9/508-yaffs-3.3-use-mtd_-helpers.patch
+++ /dev/null
@@ -1,160 +0,0 @@
---- a/fs/yaffs2/yaffs_mtdif1.c
-+++ b/fs/yaffs2/yaffs_mtdif1.c
-@@ -133,7 +133,7 @@ int nandmtd1_WriteChunkWithTagsToNAND(ya
- ops.datbuf = (__u8 *)data;
- ops.oobbuf = (__u8 *)&pt1;
-
-- retval = mtd->write_oob(mtd, addr, &ops);
-+ retval = mtd_write_oob(mtd, addr, &ops);
- if (retval) {
- T(YAFFS_TRACE_MTD,
- (TSTR("write_oob failed, chunk %d, mtd error %d"TENDSTR),
-@@ -194,7 +194,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
- /* Read page and oob using MTD.
- * Check status and determine ECC result.
- */
-- retval = mtd->read_oob(mtd, addr, &ops);
-+ retval = mtd_read_oob(mtd, addr, &ops);
- if (retval) {
- T(YAFFS_TRACE_MTD,
- (TSTR("read_oob failed, chunk %d, mtd error %d"TENDSTR),
-@@ -218,7 +218,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
- /* fall into... */
- default:
- rettags(etags, YAFFS_ECC_RESULT_UNFIXED, 0);
-- etags->block_bad = (mtd->block_isbad)(mtd, addr);
-+ etags->block_bad = mtd_block_isbad(mtd, addr);
- return YAFFS_FAIL;
- }
-
-@@ -286,7 +286,7 @@ int nandmtd1_MarkNANDBlockBad(struct yaf
-
- T(YAFFS_TRACE_BAD_BLOCKS,(TSTR("marking block %d bad"TENDSTR), block_no));
-
-- retval = mtd->block_markbad(mtd, (loff_t)blocksize * block_no);
-+ retval = mtd_block_markbad(mtd, (loff_t)blocksize * block_no);
- return (retval) ? YAFFS_FAIL : YAFFS_OK;
- }
-
-@@ -336,7 +336,7 @@ int nandmtd1_QueryNANDBlock(struct yaffs
- return YAFFS_FAIL;
-
- retval = nandmtd1_ReadChunkWithTagsFromNAND(dev, chunkNo, NULL, &etags);
-- etags.block_bad = (mtd->block_isbad)(mtd, addr);
-+ etags.block_bad = mtd_block_isbad(mtd, addr);
- if (etags.block_bad) {
- T(YAFFS_TRACE_BAD_BLOCKS,
- (TSTR("block %d is marked bad"TENDSTR), block_no));
---- a/fs/yaffs2/yaffs_vfs_glue.c
-+++ b/fs/yaffs2/yaffs_vfs_glue.c
-@@ -2607,8 +2607,8 @@ static void yaffs_MTDPutSuper(struct sup
- {
- struct mtd_info *mtd = yaffs_dev_to_mtd(yaffs_SuperToDevice(sb));
-
-- if (mtd->sync)
-- mtd->sync(mtd);
-+ if (mtd)
-+ mtd_sync(mtd);
-
- put_mtd_device(mtd);
- }
---- a/fs/yaffs2/yaffs_mtdif2.c
-+++ b/fs/yaffs2/yaffs_mtdif2.c
-@@ -77,7 +77,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(ya
- ops.ooboffs = 0;
- ops.datbuf = (__u8 *)data;
- ops.oobbuf = (dev->param.inband_tags) ? NULL : packed_tags_ptr;
-- retval = mtd->write_oob(mtd, addr, &ops);
-+ retval = mtd_write_oob(mtd, addr, &ops);
-
- #else
- if (!dev->param.inband_tags) {
-@@ -133,7 +133,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y
-
- #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
- if (dev->param.inband_tags || (data && !tags))
-- retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk,
-+ retval = mtd_read(mtd, addr, dev->param.total_bytes_per_chunk,
- &dummy, data);
- else if (tags) {
- ops.mode = MTD_OPS_AUTO_OOB;
-@@ -142,7 +142,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(y
- ops.ooboffs = 0;
- ops.datbuf = data;
- ops.oobbuf = yaffs_dev_to_lc(dev)->spareBuffer;
-- retval = mtd->read_oob(mtd, addr, &ops);
-+ retval = mtd_read_oob(mtd, addr, &ops);
- }
- #else
- if (!dev->param.inband_tags && data && tags) {
-@@ -201,7 +201,7 @@ int nandmtd2_MarkNANDBlockBad(struct yaf
- (TSTR("nandmtd2_MarkNANDBlockBad %d" TENDSTR), block_no));
-
- retval =
-- mtd->block_markbad(mtd,
-+ mtd_block_markbad(mtd,
- block_no * dev->param.chunks_per_block *
- dev->param.total_bytes_per_chunk);
-
-@@ -221,7 +221,7 @@ int nandmtd2_QueryNANDBlock(struct yaffs
- T(YAFFS_TRACE_MTD,
- (TSTR("nandmtd2_QueryNANDBlock %d" TENDSTR), block_no));
- retval =
-- mtd->block_isbad(mtd,
-+ mtd_block_isbad(mtd,
- block_no * dev->param.chunks_per_block *
- dev->param.total_bytes_per_chunk);
-
---- a/fs/yaffs2/yaffs_mtdif.h
-+++ b/fs/yaffs2/yaffs_mtdif.h
-@@ -31,4 +31,39 @@ int nandmtd_InitialiseNAND(yaffs_dev_t *
- #define MTD_OPS_AUTO_OOB MTD_OOB_AUTO
- #endif
-
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0))
-+static inline int mtd_erase(struct mdt_info *mtd, struct erase_info *ei)
-+{
-+ return mtd->erase(mtd, ei);
-+}
-+
-+static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs)
-+{
-+ return mtd->block_mark_bad(mtd, ofs);
-+}
-+
-+static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)
-+{
-+ return mtd->block_is_bad(mtd, ofs);
-+}
-+
-+static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from,
-+ struct mtd_oob_ops *ops)
-+{
-+ return mtd->read_oob(mtd, from, ops);
-+}
-+
-+static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
-+ struct mtd_oob_ops *ops)
-+{
-+ return mtd->write_oob(mtd, to, ops);
-+}
-+
-+static inline void mtd_sync(struct mtd_info *mtd)
-+{
-+ if (mtd->sync)
-+ mtd->sync(mtd);
-+}
-+#endif
-+
- #endif
---- a/fs/yaffs2/yaffs_mtdif.c
-+++ b/fs/yaffs2/yaffs_mtdif.c
-@@ -41,7 +41,7 @@ int nandmtd_EraseBlockInNAND(yaffs_dev_t
- ei.callback = NULL;
- ei.priv = (u_long) dev;
-
-- retval = mtd->erase(mtd, &ei);
-+ retval = mtd_erase(mtd, &ei);
-
- if (retval == 0)
- return YAFFS_OK;
diff --git a/target/linux/generic/patches-3.9/509-yaffs-3.4-add-underscore-to-mtd-internal-names.patch b/target/linux/generic/patches-3.9/509-yaffs-3.4-add-underscore-to-mtd-internal-names.patch
deleted file mode 100644
index 14f342da80..0000000000
--- a/target/linux/generic/patches-3.9/509-yaffs-3.4-add-underscore-to-mtd-internal-names.patch
+++ /dev/null
@@ -1,72 +0,0 @@
---- a/fs/yaffs2/yaffs_vfs_glue.c
-+++ b/fs/yaffs2/yaffs_vfs_glue.c
-@@ -2793,6 +2793,15 @@ static struct super_block *yaffs_interna
- return NULL;
- }
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
-+ T(YAFFS_TRACE_OS, (TSTR(" erase %p\n"), mtd->_erase));
-+ T(YAFFS_TRACE_OS, (TSTR(" read %p\n"), mtd->_read));
-+ T(YAFFS_TRACE_OS, (TSTR(" write %p\n"), mtd->_write));
-+ T(YAFFS_TRACE_OS, (TSTR(" readoob %p\n"), mtd->_read_oob));
-+ T(YAFFS_TRACE_OS, (TSTR(" writeoob %p\n"), mtd->_write_oob));
-+ T(YAFFS_TRACE_OS, (TSTR(" block_isbad %p\n"), mtd->_block_isbad));
-+ T(YAFFS_TRACE_OS, (TSTR(" block_markbad %p\n"), mtd->_block_markbad));
-+#else
- T(YAFFS_TRACE_OS, (TSTR(" erase %p\n"), mtd->erase));
- T(YAFFS_TRACE_OS, (TSTR(" read %p\n"), mtd->read));
- T(YAFFS_TRACE_OS, (TSTR(" write %p\n"), mtd->write));
-@@ -2800,6 +2809,7 @@ static struct super_block *yaffs_interna
- T(YAFFS_TRACE_OS, (TSTR(" writeoob %p\n"), mtd->write_oob));
- T(YAFFS_TRACE_OS, (TSTR(" block_isbad %p\n"), mtd->block_isbad));
- T(YAFFS_TRACE_OS, (TSTR(" block_markbad %p\n"), mtd->block_markbad));
-+#endif
- T(YAFFS_TRACE_OS, (TSTR(" %s %d\n"), WRITE_SIZE_STR, WRITE_SIZE(mtd)));
- T(YAFFS_TRACE_OS, (TSTR(" oobsize %d\n"), mtd->oobsize));
- T(YAFFS_TRACE_OS, (TSTR(" erasesize %d\n"), mtd->erasesize));
-@@ -2828,6 +2838,15 @@ static struct super_block *yaffs_interna
-
- if (yaffs_version == 2) {
- /* Check for version 2 style functions */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
-+ if (!mtd->_erase ||
-+ !mtd->_block_isbad ||
-+ !mtd->_block_markbad ||
-+ !mtd->_read ||
-+ !mtd->_write ||
-+ !mtd->_read_oob ||
-+ !mtd->_write_oob) {
-+#else
- if (!mtd->erase ||
- !mtd->block_isbad ||
- !mtd->block_markbad ||
-@@ -2839,6 +2858,7 @@ static struct super_block *yaffs_interna
- !mtd->write_ecc ||
- !mtd->read_ecc || !mtd->read_oob || !mtd->write_oob) {
- #endif
-+#endif
- T(YAFFS_TRACE_ALWAYS,
- (TSTR("yaffs: MTD device does not support required "
- "functions\n")));
-@@ -2855,6 +2875,13 @@ static struct super_block *yaffs_interna
- }
- } else {
- /* Check for V1 style functions */
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
-+ if (!mtd->_erase ||
-+ !mtd->_read ||
-+ !mtd->_write ||
-+ !mtd->_read_oob ||
-+ !mtd->_write_oob) {
-+#else
- if (!mtd->erase ||
- !mtd->read ||
- !mtd->write ||
-@@ -2864,6 +2891,7 @@ static struct super_block *yaffs_interna
- !mtd->write_ecc ||
- !mtd->read_ecc || !mtd->read_oob || !mtd->write_oob) {
- #endif
-+#endif
- T(YAFFS_TRACE_ALWAYS,
- (TSTR("yaffs: MTD device does not support required "
- "functions\n")));
diff --git a/target/linux/generic/patches-3.9/510-yaffs-3.4-use-d_make_root.patch b/target/linux/generic/patches-3.9/510-yaffs-3.4-use-d_make_root.patch
deleted file mode 100644
index 0ef59d606e..0000000000
--- a/target/linux/generic/patches-3.9/510-yaffs-3.4-use-d_make_root.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/fs/yaffs2/yaffs_vfs_glue.c
-+++ b/fs/yaffs2/yaffs_vfs_glue.c
-@@ -3119,7 +3119,11 @@ static struct super_block *yaffs_interna
-
- T(YAFFS_TRACE_OS, (TSTR("yaffs_read_super: got root inode\n")));
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
-+ root = d_make_root(inode);
-+#else
- root = d_alloc_root(inode);
-+#endif
-
- T(YAFFS_TRACE_OS, (TSTR("yaffs_read_super: d_alloc_root done\n")));
-
diff --git a/target/linux/generic/patches-3.9/511-yaffs-3.5-use-clear_inode.patch b/target/linux/generic/patches-3.9/511-yaffs-3.5-use-clear_inode.patch
deleted file mode 100644
index f4479675a2..0000000000
--- a/target/linux/generic/patches-3.9/511-yaffs-3.5-use-clear_inode.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- a/fs/yaffs2/yaffs_vfs_glue.c
-+++ b/fs/yaffs2/yaffs_vfs_glue.c
-@@ -924,7 +924,11 @@ static void yaffs_evict_inode( struct in
- if (!inode->i_nlink && !is_bad_inode(inode))
- deleteme = 1;
- truncate_inode_pages(&inode->i_data,0);
-- end_writeback(inode);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
-+ clear_inode(inode);
-+#else
-+ end_writeback(inode);
-+#endif
-
- if(deleteme && obj){
- dev = obj->my_dev;
diff --git a/target/linux/generic/patches-3.9/512-yaffs-3.5-convert-to-use-kuid_t-kgid_t.patch b/target/linux/generic/patches-3.9/512-yaffs-3.5-convert-to-use-kuid_t-kgid_t.patch
deleted file mode 100644
index 1ca189d2ee..0000000000
--- a/target/linux/generic/patches-3.9/512-yaffs-3.5-convert-to-use-kuid_t-kgid_t.patch
+++ /dev/null
@@ -1,570 +0,0 @@
---- a/fs/yaffs2/yaffs_vfs_glue.c
-+++ b/fs/yaffs2/yaffs_vfs_glue.c
-@@ -243,11 +243,10 @@ static inline void yaffs_dec_link_count(
- }
- #endif
-
--
- #define update_dir_time(dir) do {\
- (dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \
- } while(0)
--
-+
- static void yaffs_put_super(struct super_block *sb);
-
- static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
-@@ -397,6 +396,33 @@ static struct address_space_operations y
- #endif
- };
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0))
-+#define YCRED_FSUID() from_kuid(&init_user_ns, current_fsuid())
-+#define YCRED_FSGID() from_kgid(&init_user_ns, current_fsgid())
-+#else
-+#define YCRED_FSUID() YCRED(current)->fsuid
-+#define YCRED_FSGID() YCRED(current)->fsgid
-+
-+static inline uid_t i_uid_read(const struct inode *inode)
-+{
-+ return inode->i_uid;
-+}
-+
-+static inline gid_t i_gid_read(const struct inode *inode)
-+{
-+ return inode->i_gid;
-+}
-+
-+static inline void i_uid_write(struct inode *inode, uid_t uid)
-+{
-+ inode->i_uid = uid;
-+}
-+
-+static inline void i_gid_write(struct inode *inode, gid_t gid)
-+{
-+ inode->i_gid = gid;
-+}
-+#endif
-
- #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22))
- static const struct file_operations yaffs_file_operations = {
-@@ -549,7 +575,7 @@ static unsigned yaffs_gc_control_callbac
- {
- return yaffs_gc_control;
- }
--
-+
- static void yaffs_gross_lock(yaffs_dev_t *dev)
- {
- T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current));
-@@ -1379,8 +1405,8 @@ static void yaffs_fill_inode_from_obj(st
-
- inode->i_ino = obj->obj_id;
- inode->i_mode = obj->yst_mode;
-- inode->i_uid = obj->yst_uid;
-- inode->i_gid = obj->yst_gid;
-+ i_uid_write(inode, obj->yst_uid);
-+ i_gid_write(inode, obj->yst_gid);
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
- inode->i_blksize = inode->i_sb->s_blocksize;
- #endif
-@@ -1406,7 +1432,7 @@ static void yaffs_fill_inode_from_obj(st
-
- T(YAFFS_TRACE_OS,
- (TSTR("yaffs_fill_inode mode %x uid %d gid %d size %d count %d\n"),
-- inode->i_mode, inode->i_uid, inode->i_gid,
-+ inode->i_mode, i_uid_read(inode), i_gid_read(inode),
- (int)inode->i_size, atomic_read(&inode->i_count)));
-
- switch (obj->yst_mode & S_IFMT) {
-@@ -1715,8 +1741,8 @@ static int yaffs_mknod(struct inode *dir
- yaffs_obj_t *parent = yaffs_InodeToObject(dir);
-
- int error = -ENOSPC;
-- uid_t uid = YCRED(current)->fsuid;
-- gid_t gid = (dir->i_mode & S_ISGID) ? dir->i_gid : YCRED(current)->fsgid;
-+ uid_t uid = YCRED_FSUID();
-+ gid_t gid = (dir->i_mode & S_ISGID) ? i_gid_read(dir) : YCRED_FSGID();
-
- if ((dir->i_mode & S_ISGID) && S_ISDIR(mode))
- mode |= S_ISGID;
-@@ -1892,8 +1918,8 @@ static int yaffs_symlink(struct inode *d
- {
- yaffs_obj_t *obj;
- yaffs_dev_t *dev;
-- uid_t uid = YCRED(current)->fsuid;
-- gid_t gid = (dir->i_mode & S_ISGID) ? dir->i_gid : YCRED(current)->fsgid;
-+ uid_t uid = YCRED_FSUID();
-+ gid_t gid = (dir->i_mode & S_ISGID) ? i_gid_read(dir) : YCRED_FSGID();
-
- T(YAFFS_TRACE_OS, (TSTR("yaffs_symlink\n")));
-
-@@ -2009,7 +2035,7 @@ static int yaffs_setattr(struct dentry *
- (TSTR("yaffs_setattr of object %d\n"),
- yaffs_InodeToObject(inode)->obj_id));
-
-- /* Fail if a requested resize >= 2GB */
-+ /* Fail if a requested resize >= 2GB */
- if (attr->ia_valid & ATTR_SIZE &&
- (attr->ia_size >> 31))
- error = -EINVAL;
-@@ -2240,7 +2266,7 @@ static void yaffs_flush_inodes(struct su
- {
- struct inode *iptr;
- yaffs_obj_t *obj;
--
-+
- list_for_each_entry(iptr,&sb->s_inodes, i_sb_list){
- obj = yaffs_InodeToObject(iptr);
- if(obj){
-@@ -2254,10 +2280,10 @@ static void yaffs_flush_inodes(struct su
-
- static void yaffs_flush_super(struct super_block *sb, int do_checkpoint)
- {
-- yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
-+ yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
- if(!dev)
- return;
--
-+
- yaffs_flush_inodes(sb);
- yaffs_update_dirty_dirs(dev);
- yaffs_flush_whole_cache(dev);
-@@ -2325,7 +2351,7 @@ static int yaffs_do_sync_fs(struct super
- * yaffs_bg_start() launches the background thread.
- * yaffs_bg_stop() cleans up the background thread.
- *
-- * NB:
-+ * NB:
- * The thread should only run after the yaffs is initialised
- * The thread should be stopped before yaffs is unmounted.
- * The thread should not do any writing while the fs is in read only.
-@@ -2924,7 +2950,7 @@ static struct super_block *yaffs_interna
-
- dev = kmalloc(sizeof(yaffs_dev_t), GFP_KERNEL);
- context = kmalloc(sizeof(struct yaffs_LinuxContext),GFP_KERNEL);
--
-+
- if(!dev || !context ){
- if(dev)
- kfree(dev);
-@@ -2957,7 +2983,7 @@ static struct super_block *yaffs_interna
- #else
- sb->u.generic_sbp = dev;
- #endif
--
-+
- dev->driver_context = mtd;
- param->name = mtd->name;
-
-@@ -3057,7 +3083,7 @@ static struct super_block *yaffs_interna
- param->gc_control = yaffs_gc_control_callback;
-
- yaffs_dev_to_lc(dev)->superBlock= sb;
--
-+
-
- #ifndef CONFIG_YAFFS_DOES_ECC
- param->use_nand_ecc = 1;
-@@ -3099,10 +3125,10 @@ static struct super_block *yaffs_interna
- T(YAFFS_TRACE_OS,
- (TSTR("yaffs_read_super: guts initialised %s\n"),
- (err == YAFFS_OK) ? "OK" : "FAILED"));
--
-+
- if(err == YAFFS_OK)
- yaffs_bg_start(dev);
--
-+
- if(!context->bgThread)
- param->defered_dir_update = 0;
-
-@@ -3345,7 +3371,7 @@ static int yaffs_proc_read(char *page,
- buf += sprintf(buf,"\n");
- else {
- step-=2;
--
-+
- mutex_lock(&yaffs_context_lock);
-
- /* Locate and print the Nth entry. Order N-squared but N is small. */
-@@ -3362,7 +3388,7 @@ static int yaffs_proc_read(char *page,
- buf = yaffs_dump_dev_part0(buf, dev);
- } else
- buf = yaffs_dump_dev_part1(buf, dev);
--
-+
- break;
- }
- mutex_unlock(&yaffs_context_lock);
-@@ -3389,7 +3415,7 @@ static int yaffs_stats_proc_read(char *p
- int erasedChunks;
-
- erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block;
--
-+
- buf += sprintf(buf,"%d, %d, %d, %u, %u, %u, %u\n",
- n, dev->n_free_chunks, erasedChunks,
- dev->bg_gcs, dev->oldest_dirty_gc_count,
---- a/fs/yaffs2/yaffs_guts.c
-+++ b/fs/yaffs2/yaffs_guts.c
-@@ -370,7 +370,7 @@ static int yaffs_verify_chunk_written(ya
- yaffs_ext_tags tempTags;
- __u8 *buffer = yaffs_get_temp_buffer(dev,__LINE__);
- int result;
--
-+
- result = yaffs_rd_chunk_tags_nand(dev,nand_chunk,buffer,&tempTags);
- if(memcmp(buffer,data,dev->data_bytes_per_chunk) ||
- tempTags.obj_id != tags->obj_id ||
-@@ -424,7 +424,7 @@ static int yaffs_write_new_chunk(struct
- * lot of checks that are most likely not needed.
- *
- * Mods to the above
-- * If an erase check fails or the write fails we skip the
-+ * If an erase check fails or the write fails we skip the
- * rest of the block.
- */
-
-@@ -486,7 +486,7 @@ static int yaffs_write_new_chunk(struct
- }
-
-
--
-+
- /*
- * Block retiring for handling a broken block.
- */
-@@ -496,7 +496,7 @@ static void yaffs_retire_block(yaffs_dev
- yaffs_block_info_t *bi = yaffs_get_block_info(dev, flash_block);
-
- yaffs2_checkpt_invalidate(dev);
--
-+
- yaffs2_clear_oldest_dirty_seq(dev,bi);
-
- if (yaffs_mark_bad(dev, flash_block) != YAFFS_OK) {
-@@ -899,7 +899,7 @@ static int yaffs_find_chunk_in_group(yaf
- for (j = 0; theChunk && j < dev->chunk_grp_size; j++) {
- if (yaffs_check_chunk_bit(dev, theChunk / dev->param.chunks_per_block,
- theChunk % dev->param.chunks_per_block)) {
--
-+
- if(dev->chunk_grp_size == 1)
- return theChunk;
- else {
-@@ -1802,7 +1802,7 @@ int yaffs_rename_obj(yaffs_obj_t *old_di
- yaffs_update_parent(old_dir);
- if(new_dir != old_dir)
- yaffs_update_parent(new_dir);
--
-+
- return result;
- }
- return YAFFS_FAIL;
-@@ -2125,7 +2125,7 @@ static int yaffs_gc_block(yaffs_dev_t *d
-
- if(bi->block_state == YAFFS_BLOCK_STATE_FULL)
- bi->block_state = YAFFS_BLOCK_STATE_COLLECTING;
--
-+
- bi->has_shrink_hdr = 0; /* clear the flag so that the block can erase */
-
- dev->gc_disable = 1;
-@@ -2207,7 +2207,7 @@ static int yaffs_gc_block(yaffs_dev_t *d
- * No need to copy this, just forget about it and
- * fix up the object.
- */
--
-+
- /* Free chunks already includes softdeleted chunks.
- * How ever this chunk is going to soon be really deleted
- * which will increment free chunks.
-@@ -2752,7 +2752,7 @@ int yaffs_put_chunk_in_file(yaffs_obj_t
- NULL);
- if (!tn)
- return YAFFS_FAIL;
--
-+
- if(!nand_chunk)
- /* Dummy insert, bail now */
- return YAFFS_OK;
-@@ -2881,7 +2881,7 @@ void yaffs_chunk_del(yaffs_dev_t *dev, i
- chunk_id));
-
- bi = yaffs_get_block_info(dev, block);
--
-+
- yaffs2_update_oldest_dirty_seq(dev, block, bi);
-
- T(YAFFS_TRACE_DELETION,
-@@ -2966,8 +2966,8 @@ static int yaffs_wr_data_obj(yaffs_obj_t
- (TSTR("Writing %d bytes to chunk!!!!!!!!!" TENDSTR), n_bytes));
- YBUG();
- }
--
--
-+
-+
- newChunkId =
- yaffs_write_new_chunk(dev, buffer, &newTags,
- useReserve);
-@@ -3795,14 +3795,14 @@ int yaffs_resize_file(yaffs_obj_t *in, l
-
- if (new_size == oldFileSize)
- return YAFFS_OK;
--
-+
- if(new_size > oldFileSize){
- yaffs2_handle_hole(in,new_size);
- in->variant.file_variant.file_size = new_size;
- } else {
-- /* new_size < oldFileSize */
-+ /* new_size < oldFileSize */
- yaffs_resize_file_down(in, new_size);
-- }
-+ }
-
- /* Write a new object header to reflect the resize.
- * show we've shrunk the file, if need be
-@@ -4231,7 +4231,7 @@ static void yaffs_strip_deleted_objs(yaf
- * This fixes the problem where directories might have inadvertently been deleted
- * leaving the object "hanging" without being rooted in the directory tree.
- */
--
-+
- static int yaffs_has_null_parent(yaffs_dev_t *dev, yaffs_obj_t *obj)
- {
- return (obj == dev->del_dir ||
-@@ -4262,7 +4262,7 @@ static void yaffs_fix_hanging_objs(yaffs
- if (lh) {
- obj = ylist_entry(lh, yaffs_obj_t, hash_link);
- parent= obj->parent;
--
-+
- if(yaffs_has_null_parent(dev,obj)){
- /* These directories are not hanging */
- hanging = 0;
-@@ -4311,7 +4311,7 @@ static void yaffs_del_dir_contents(yaffs
-
- if(dir->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY)
- YBUG();
--
-+
- ylist_for_each_safe(lh, n, &dir->variant.dir_variant.children) {
- if (lh) {
- obj = ylist_entry(lh, yaffs_obj_t, siblings);
-@@ -4325,10 +4325,10 @@ static void yaffs_del_dir_contents(yaffs
- /* Need to use UnlinkObject since Delete would not handle
- * hardlinked objects correctly.
- */
-- yaffs_unlink_obj(obj);
-+ yaffs_unlink_obj(obj);
- }
- }
--
-+
- }
-
- static void yaffs_empty_l_n_f(yaffs_dev_t *dev)
-@@ -4410,7 +4410,7 @@ static void yaffs_check_obj_details_load
- * If the directory updating is defered then yaffs_update_dirty_dirs must be
- * called periodically.
- */
--
-+
- static void yaffs_update_parent(yaffs_obj_t *obj)
- {
- yaffs_dev_t *dev;
-@@ -4422,8 +4422,8 @@ static void yaffs_update_parent(yaffs_ob
- obj->dirty = 1;
- obj->yst_mtime = obj->yst_ctime = Y_CURRENT_TIME;
- if(dev->param.defered_dir_update){
-- struct ylist_head *link = &obj->variant.dir_variant.dirty;
--
-+ struct ylist_head *link = &obj->variant.dir_variant.dirty;
-+
- if(ylist_empty(link)){
- ylist_add(link,&dev->dirty_dirs);
- T(YAFFS_TRACE_BACKGROUND, (TSTR("Added object %d to dirty directories" TENDSTR),obj->obj_id));
-@@ -4446,7 +4446,7 @@ void yaffs_update_dirty_dirs(yaffs_dev_t
- while(!ylist_empty(&dev->dirty_dirs)){
- link = dev->dirty_dirs.next;
- ylist_del_init(link);
--
-+
- dS=ylist_entry(link,yaffs_dir_s,dirty);
- oV = ylist_entry(dS,yaffs_obj_variant,dir_variant);
- obj = ylist_entry(oV,yaffs_obj_t,variant);
-@@ -4474,7 +4474,7 @@ static void yaffs_remove_obj_from_dir(ya
-
- ylist_del_init(&obj->siblings);
- obj->parent = NULL;
--
-+
- yaffs_verify_dir(parent);
- }
-
-@@ -4645,7 +4645,7 @@ yaffs_obj_t *yaffs_get_equivalent_obj(ya
- * system to share files.
- *
- * These automatic unicode are stored slightly differently...
-- * - If the name can fit in the ASCII character space then they are saved as
-+ * - If the name can fit in the ASCII character space then they are saved as
- * ascii names as per above.
- * - If the name needs Unicode then the name is saved in Unicode
- * starting at oh->name[1].
-@@ -4686,7 +4686,7 @@ static void yaffs_load_name_from_oh(yaff
- asciiOhName++;
- n--;
- }
-- } else
-+ } else
- yaffs_strncpy(name,ohName+1, bufferSize -1);
- } else
- #endif
-@@ -4705,7 +4705,7 @@ static void yaffs_load_oh_from_name(yaff
-
- isAscii = 1;
- w = name;
--
-+
- /* Figure out if the name will fit in ascii character set */
- while(isAscii && *w){
- if((*w) & 0xff00)
-@@ -4729,7 +4729,7 @@ static void yaffs_load_oh_from_name(yaff
- yaffs_strncpy(ohName+1,name, YAFFS_MAX_NAME_LENGTH -2);
- }
- }
-- else
-+ else
- #endif
- yaffs_strncpy(ohName,name, YAFFS_MAX_NAME_LENGTH - 1);
-
-@@ -4738,12 +4738,12 @@ static void yaffs_load_oh_from_name(yaff
- int yaffs_get_obj_name(yaffs_obj_t * obj, YCHAR * name, int buffer_size)
- {
- memset(name, 0, buffer_size * sizeof(YCHAR));
--
-+
- yaffs_check_obj_details_loaded(obj);
-
- if (obj->obj_id == YAFFS_OBJECTID_LOSTNFOUND) {
- yaffs_strncpy(name, YAFFS_LOSTNFOUND_NAME, buffer_size - 1);
-- }
-+ }
- #ifdef CONFIG_YAFFS_SHORT_NAMES_IN_RAM
- else if (obj->short_name[0]) {
- yaffs_strcpy(name, obj->short_name);
-@@ -4861,9 +4861,9 @@ int yaffs_set_attribs(yaffs_obj_t *obj,
- if (valid & ATTR_MODE)
- obj->yst_mode = attr->ia_mode;
- if (valid & ATTR_UID)
-- obj->yst_uid = attr->ia_uid;
-+ obj->yst_uid = ia_uid_read(attr);
- if (valid & ATTR_GID)
-- obj->yst_gid = attr->ia_gid;
-+ obj->yst_gid = ia_gid_read(attr);
-
- if (valid & ATTR_ATIME)
- obj->yst_atime = Y_TIME_CONVERT(attr->ia_atime);
-@@ -4886,9 +4886,9 @@ int yaffs_get_attribs(yaffs_obj_t *obj,
-
- attr->ia_mode = obj->yst_mode;
- valid |= ATTR_MODE;
-- attr->ia_uid = obj->yst_uid;
-+ ia_uid_write(attr, obj->yst_uid);
- valid |= ATTR_UID;
-- attr->ia_gid = obj->yst_gid;
-+ ia_gid_write(attr, obj->yst_gid);
- valid |= ATTR_GID;
-
- Y_TIME_CONVERT(attr->ia_atime) = obj->yst_atime;
---- a/fs/yaffs2/yportenv.h
-+++ b/fs/yaffs2/yportenv.h
-@@ -170,7 +170,7 @@
- #define O_RDWR 02
- #endif
-
--#ifndef O_CREAT
-+#ifndef O_CREAT
- #define O_CREAT 0100
- #endif
-
-@@ -218,7 +218,7 @@
- #define EACCES 13
- #endif
-
--#ifndef EXDEV
-+#ifndef EXDEV
- #define EXDEV 18
- #endif
-
-@@ -281,7 +281,7 @@
- #define S_IFREG 0100000
- #endif
-
--#ifndef S_IREAD
-+#ifndef S_IREAD
- #define S_IREAD 0000400
- #endif
-
---- a/fs/yaffs2/devextras.h
-+++ b/fs/yaffs2/devextras.h
-@@ -87,6 +87,8 @@ struct iattr {
- unsigned int ia_attr_flags;
- };
-
-+/* TODO: add ia_* functions */
-+
- #endif
-
- #else
-@@ -95,7 +97,48 @@ struct iattr {
- #include <linux/fs.h>
- #include <linux/stat.h>
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0))
-+static inline uid_t ia_uid_read(const struct iattr *iattr)
-+{
-+ return from_kuid(&init_user_ns, iattr->ia_uid);
-+}
-+
-+static inline gid_t ia_gid_read(const struct iattr *iattr)
-+{
-+ return from_kgid(&init_user_ns, iattr->ia_gid);
-+}
-+
-+static inline void ia_uid_write(struct iattr *iattr, uid_t uid)
-+{
-+ iattr->ia_uid = make_kuid(&init_user_ns, uid);
-+}
-+
-+static inline void ia_gid_write(struct iattr *iattr, gid_t gid)
-+{
-+ iattr->ia_gid = make_kgid(&init_user_ns, gid);
-+}
-+#else
-+static inline uid_t ia_uid_read(const struct iattr *iattr)
-+{
-+ return iattr->ia_uid;
-+}
-+
-+static inline gid_t ia_gid_read(const struct iattr *inode)
-+{
-+ return iattr->ia_gid;
-+}
-+
-+static inline void ia_uid_write(struct iattr *iattr, uid_t uid)
-+{
-+ iattr->ia_uid = uid;
-+}
-+
-+static inline void ia_gid_write(struct iattr *iattr, gid_t gid)
-+{
-+ iattr->ia_gid = gid;
-+}
- #endif
-
-+#endif
-
- #endif
diff --git a/target/linux/generic/patches-3.9/513-yaffs-3.6-fix-dir_inode-ops.patch b/target/linux/generic/patches-3.9/513-yaffs-3.6-fix-dir_inode-ops.patch
deleted file mode 100644
index 220927a535..0000000000
--- a/target/linux/generic/patches-3.9/513-yaffs-3.6-fix-dir_inode-ops.patch
+++ /dev/null
@@ -1,60 +0,0 @@
---- a/fs/yaffs2/yaffs_vfs_glue.c
-+++ b/fs/yaffs2/yaffs_vfs_glue.c
-@@ -271,20 +271,29 @@ static int yaffs_sync_object(struct file
-
- static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir);
-
--#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
--#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
-+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
-+ bool excl);
-+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
- static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *n);
--#else
-+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
- static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode,
- struct nameidata *n);
-+#else
-+static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode);
- #endif
-+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
-+static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
-+ unsigned int flags);
-+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
- static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
- struct nameidata *n);
- #else
--static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode);
- static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry);
- #endif
-+
- static int yaffs_link(struct dentry *old_dentry, struct inode *dir,
- struct dentry *dentry);
- static int yaffs_unlink(struct inode *dir, struct dentry *dentry);
-@@ -837,7 +846,10 @@ struct inode *yaffs_get_inode(struct sup
- /*
- * Lookup is used to find objects in the fs
- */
--#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
-+static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
-+ unsigned int flags)
-+#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
-
- static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
- struct nameidata *n)
-@@ -1827,7 +1839,10 @@ static int yaffs_mkdir(struct inode *dir
- return retVal;
- }
-
--#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
-+static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
-+ bool excl)
-+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0))
- static int yaffs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
- struct nameidata *n)
- #elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
diff --git a/target/linux/generic/patches-3.9/514-yaffs-3.6-use-delayed-work-instead-of-write_super.patch b/target/linux/generic/patches-3.9/514-yaffs-3.6-use-delayed-work-instead-of-write_super.patch
deleted file mode 100644
index c6ecddf0b2..0000000000
--- a/target/linux/generic/patches-3.9/514-yaffs-3.6-use-delayed-work-instead-of-write_super.patch
+++ /dev/null
@@ -1,180 +0,0 @@
---- a/fs/yaffs2/yaffs_vfs_glue.c
-+++ b/fs/yaffs2/yaffs_vfs_glue.c
-@@ -393,6 +393,84 @@ static void yaffs_touch_super(yaffs_dev_
- static int yaffs_vfs_setattr(struct inode *, struct iattr *);
-
-
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
-+
-+#define yaffs_super_to_dev(sb) ((struct yaffs_dev_s *)sb->s_fs_info)
-+
-+static inline struct yaffs_LinuxContext *
-+yaffs_sb_to_ylc(struct super_block *sb)
-+{
-+ struct yaffs_dev_s *ydev;
-+ struct yaffs_LinuxContext *ylc;
-+
-+ ydev = yaffs_super_to_dev(sb);
-+ ylc = yaffs_dev_to_lc(ydev);
-+ return ylc;
-+}
-+
-+static inline struct super_block *yaffs_work_to_sb(struct work_struct *work)
-+{
-+ struct delayed_work *dwork;
-+ struct yaffs_LinuxContext *ylc;
-+
-+ dwork = container_of(work, struct delayed_work, work);
-+ ylc = container_of(dwork, struct yaffs_LinuxContext, sb_sync_dwork);
-+ return ylc->superBlock;
-+}
-+
-+static void yaffs_sb_sync_dwork_func(struct work_struct *work)
-+{
-+ struct super_block *sb = yaffs_work_to_sb(work);
-+
-+ yaffs_write_super(sb);
-+}
-+
-+static void yaffs_init_sb_sync_dwork(struct yaffs_LinuxContext *ylc)
-+{
-+ INIT_DELAYED_WORK(&ylc->sb_sync_dwork, yaffs_sb_sync_dwork_func);
-+}
-+
-+static void yaffs_cancel_sb_sync_dwork(struct super_block *sb)
-+{
-+ struct yaffs_LinuxContext *ylc = yaffs_sb_to_ylc(sb);
-+
-+ cancel_delayed_work_sync(&ylc->sb_sync_dwork);
-+}
-+
-+static inline bool yaffs_sb_is_dirty(struct super_block *sb)
-+{
-+ struct yaffs_LinuxContext *ylc = yaffs_sb_to_ylc(sb);
-+
-+ return !!ylc->sb_dirty;
-+}
-+
-+static inline void yaffs_sb_set_dirty(struct super_block *sb, int dirty)
-+{
-+ struct yaffs_LinuxContext *ylc = yaffs_sb_to_ylc(sb);
-+
-+ if (ylc->sb_dirty == dirty)
-+ return;
-+
-+ ylc->sb_dirty = dirty;
-+ if (dirty)
-+ queue_delayed_work(system_long_wq, &ylc->sb_sync_dwork,
-+ msecs_to_jiffies(5000));
-+}
-+#else
-+static inline bool yaffs_sb_is_dirty(struct super_block *sb)
-+{
-+ return !!sb->s_dirt;
-+}
-+
-+static inline void yaffs_sb_set_dirty(struct super_block *sb, int dirty)
-+{
-+ sb->s_dirt = dirty;
-+}
-+
-+static inline void yaffs_init_sb_sync_dwork(struct yaffs_LinuxContext *ylc) {}
-+static inline void yaffs_cancel_sb_sync_dwork(struct super_block *sb) {}
-+#endif /* >= 3.6.0 */
-+
- static struct address_space_operations yaffs_file_address_operations = {
- .readpage = yaffs_readpage,
- .writepage = yaffs_writepage,
-@@ -553,7 +631,9 @@ static const struct super_operations yaf
- .clear_inode = yaffs_clear_inode,
- #endif
- .sync_fs = yaffs_sync_fs,
-+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
- .write_super = yaffs_write_super,
-+#endif
- };
-
-
-@@ -2340,7 +2420,7 @@ static int yaffs_do_sync_fs(struct super
- T(YAFFS_TRACE_OS | YAFFS_TRACE_SYNC | YAFFS_TRACE_BACKGROUND,
- (TSTR("yaffs_do_sync_fs: gc-urgency %d %s %s%s\n"),
- gc_urgent,
-- sb->s_dirt ? "dirty" : "clean",
-+ yaffs_sb_is_dirty(sb) ? "dirty" : "clean",
- request_checkpoint ? "checkpoint requested" : "no checkpoint",
- oneshot_checkpoint ? " one-shot" : "" ));
-
-@@ -2349,9 +2429,9 @@ static int yaffs_do_sync_fs(struct super
- oneshot_checkpoint) &&
- !dev->is_checkpointed;
-
-- if (sb->s_dirt || do_checkpoint) {
-+ if (yaffs_sb_is_dirty(sb) || do_checkpoint) {
- yaffs_flush_super(sb, !dev->is_checkpointed && do_checkpoint);
-- sb->s_dirt = 0;
-+ yaffs_sb_set_dirty(sb, 0);
- if(oneshot_checkpoint)
- yaffs_auto_checkpoint &= ~4;
- }
-@@ -2627,6 +2707,8 @@ static void yaffs_put_super(struct super
-
- yaffs_flush_super(sb,1);
-
-+ yaffs_cancel_sb_sync_dwork(sb);
-+
- if (yaffs_dev_to_lc(dev)->putSuperFunc)
- yaffs_dev_to_lc(dev)->putSuperFunc(sb);
-
-@@ -2665,7 +2747,7 @@ static void yaffs_touch_super(yaffs_dev_
-
- T(YAFFS_TRACE_OS, (TSTR("yaffs_touch_super() sb = %p\n"), sb));
- if (sb)
-- sb->s_dirt = 1;
-+ yaffs_sb_set_dirty(sb, 1);
- }
-
- typedef struct {
-@@ -2991,6 +3073,8 @@ static struct super_block *yaffs_interna
- context->dev = dev;
- context->superBlock = sb;
-
-+ yaffs_init_sb_sync_dwork(context);
-+
- dev->read_only = read_only;
-
- #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
-@@ -3177,7 +3261,7 @@ static struct super_block *yaffs_interna
- return NULL;
- }
- sb->s_root = root;
-- sb->s_dirt = !dev->is_checkpointed;
-+ yaffs_sb_set_dirty(sb, !dev->is_checkpointed);
- T(YAFFS_TRACE_ALWAYS,
- (TSTR("yaffs_read_super: is_checkpointed %d\n"),
- dev->is_checkpointed));
---- a/fs/yaffs2/yaffs_linux.h
-+++ b/fs/yaffs2/yaffs_linux.h
-@@ -34,6 +34,11 @@ struct yaffs_LinuxContext {
-
- struct task_struct *readdirProcess;
- unsigned mount_id;
-+
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
-+ struct delayed_work sb_sync_dwork; /* superblock write-out work */
-+ int sb_dirty; /* superblock is dirty */
-+#endif
- };
-
- #define yaffs_dev_to_lc(dev) ((struct yaffs_LinuxContext *)((dev)->os_context))
---- a/fs/yaffs2/yportenv.h
-+++ b/fs/yaffs2/yportenv.h
-@@ -49,6 +49,9 @@
- #include <linux/slab.h>
- #include <linux/vmalloc.h>
- #include <linux/xattr.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
-+#include <linux/workqueue.h>
-+#endif
-
- #define YCHAR char
- #define YUCHAR unsigned char