diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-10-31 19:33:12 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2012-10-31 19:33:12 +0000 |
commit | a4126685c6a33ca434494b0e5c7f5df60f4e6405 (patch) | |
tree | 48a4bb160f0df7a471d252cc2a590300e70cc7a0 /target/linux | |
parent | 1fff98998c91c0a8f07eac83a64d4d23509b5a88 (diff) | |
download | master-31e0f0ae-a4126685c6a33ca434494b0e5c7f5df60f4e6405.tar.gz master-31e0f0ae-a4126685c6a33ca434494b0e5c7f5df60f4e6405.tar.bz2 master-31e0f0ae-a4126685c6a33ca434494b0e5c7f5df60f4e6405.zip |
generic: split yaffs-3.2-fix patch
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 34041
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/generic/patches-3.3/505-yaffs-3.2-use-MTD_OPS_AUTO_OOB.patch | 54 | ||||
-rw-r--r-- | target/linux/generic/patches-3.3/505-yaffs-3.2_fix.patch | 247 | ||||
-rw-r--r-- | target/linux/generic/patches-3.3/506-yaffs-3.2-dont-use-i_nlink-directly.patch | 78 | ||||
-rw-r--r-- | target/linux/generic/patches-3.3/507-yaffs-3.3_fix.patch (renamed from target/linux/generic/patches-3.3/506-yaffs-3.3_fix.patch) | 0 | ||||
-rw-r--r-- | target/linux/generic/patches-3.6/505-yaffs-3.2-use-MTD_OPS_AUTO_OOB.patch | 54 | ||||
-rw-r--r-- | target/linux/generic/patches-3.6/505-yaffs-3.2_fix.patch | 247 | ||||
-rw-r--r-- | target/linux/generic/patches-3.6/506-yaffs-3.2-dont-use-i_nlink-directly.patch | 78 | ||||
-rw-r--r-- | target/linux/generic/patches-3.6/507-yaffs-3.3_fix.patch (renamed from target/linux/generic/patches-3.6/506-yaffs-3.3_fix.patch) | 0 |
8 files changed, 264 insertions, 494 deletions
diff --git a/target/linux/generic/patches-3.3/505-yaffs-3.2-use-MTD_OPS_AUTO_OOB.patch b/target/linux/generic/patches-3.3/505-yaffs-3.2-use-MTD_OPS_AUTO_OOB.patch new file mode 100644 index 0000000000..463f4a208b --- /dev/null +++ b/target/linux/generic/patches-3.3/505-yaffs-3.2-use-MTD_OPS_AUTO_OOB.patch @@ -0,0 +1,54 @@ +--- 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.3/505-yaffs-3.2_fix.patch b/target/linux/generic/patches-3.3/505-yaffs-3.2_fix.patch deleted file mode 100644 index f65e6018bf..0000000000 --- a/target/linux/generic/patches-3.3/505-yaffs-3.2_fix.patch +++ /dev/null @@ -1,247 +0,0 @@ ---- a/fs/yaffs2/yaffs_vfs_glue.c -+++ b/fs/yaffs2/yaffs_vfs_glue.c -@@ -220,11 +220,34 @@ 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; \ - } 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, -@@ -513,7 +536,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)); -@@ -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); -@@ -1961,7 +1982,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; -@@ -2192,7 +2213,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){ -@@ -2206,10 +2227,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); -@@ -2277,7 +2298,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. -@@ -2848,7 +2869,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); -@@ -2881,7 +2902,7 @@ static struct super_block *yaffs_interna - #else - sb->u.generic_sbp = dev; - #endif -- -+ - dev->driver_context = mtd; - param->name = mtd->name; - -@@ -2981,7 +3002,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; -@@ -3023,10 +3044,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; - -@@ -3282,7 +3303,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); -@@ -3309,7 +3330,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_mtdif1.c -+++ b/fs/yaffs2/yaffs_mtdif1.c -@@ -34,6 +34,7 @@ - #include "linux/version.h" - #include "linux/types.h" - #include "linux/mtd/mtd.h" -+#include "mtd/mtd-abi.h" - - /* Don't compile this module if we don't have MTD's mtd_oob_ops interface */ - #if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) -@@ -127,7 +128,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 +180,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 -@@ -21,6 +21,7 @@ - #include "linux/mtd/mtd.h" - #include "linux/types.h" - #include "linux/time.h" -+#include "mtd/mtd-abi.h" - - #include "yaffs_packedtags2.h" - -@@ -71,7 +72,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 +137,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; diff --git a/target/linux/generic/patches-3.3/506-yaffs-3.2-dont-use-i_nlink-directly.patch b/target/linux/generic/patches-3.3/506-yaffs-3.2-dont-use-i_nlink-directly.patch new file mode 100644 index 0000000000..91e8281196 --- /dev/null +++ b/target/linux/generic/patches-3.3/506-yaffs-3.2-dont-use-i_nlink-directly.patch @@ -0,0 +1,78 @@ +--- 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.3/506-yaffs-3.3_fix.patch b/target/linux/generic/patches-3.3/507-yaffs-3.3_fix.patch index d823fc49c4..d823fc49c4 100644 --- a/target/linux/generic/patches-3.3/506-yaffs-3.3_fix.patch +++ b/target/linux/generic/patches-3.3/507-yaffs-3.3_fix.patch diff --git a/target/linux/generic/patches-3.6/505-yaffs-3.2-use-MTD_OPS_AUTO_OOB.patch b/target/linux/generic/patches-3.6/505-yaffs-3.2-use-MTD_OPS_AUTO_OOB.patch new file mode 100644 index 0000000000..463f4a208b --- /dev/null +++ b/target/linux/generic/patches-3.6/505-yaffs-3.2-use-MTD_OPS_AUTO_OOB.patch @@ -0,0 +1,54 @@ +--- 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.6/505-yaffs-3.2_fix.patch b/target/linux/generic/patches-3.6/505-yaffs-3.2_fix.patch deleted file mode 100644 index f65e6018bf..0000000000 --- a/target/linux/generic/patches-3.6/505-yaffs-3.2_fix.patch +++ /dev/null @@ -1,247 +0,0 @@ ---- a/fs/yaffs2/yaffs_vfs_glue.c -+++ b/fs/yaffs2/yaffs_vfs_glue.c -@@ -220,11 +220,34 @@ 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; \ - } 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, -@@ -513,7 +536,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)); -@@ -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); -@@ -1961,7 +1982,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; -@@ -2192,7 +2213,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){ -@@ -2206,10 +2227,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); -@@ -2277,7 +2298,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. -@@ -2848,7 +2869,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); -@@ -2881,7 +2902,7 @@ static struct super_block *yaffs_interna - #else - sb->u.generic_sbp = dev; - #endif -- -+ - dev->driver_context = mtd; - param->name = mtd->name; - -@@ -2981,7 +3002,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; -@@ -3023,10 +3044,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; - -@@ -3282,7 +3303,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); -@@ -3309,7 +3330,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_mtdif1.c -+++ b/fs/yaffs2/yaffs_mtdif1.c -@@ -34,6 +34,7 @@ - #include "linux/version.h" - #include "linux/types.h" - #include "linux/mtd/mtd.h" -+#include "mtd/mtd-abi.h" - - /* Don't compile this module if we don't have MTD's mtd_oob_ops interface */ - #if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17)) -@@ -127,7 +128,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 +180,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 -@@ -21,6 +21,7 @@ - #include "linux/mtd/mtd.h" - #include "linux/types.h" - #include "linux/time.h" -+#include "mtd/mtd-abi.h" - - #include "yaffs_packedtags2.h" - -@@ -71,7 +72,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 +137,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; diff --git a/target/linux/generic/patches-3.6/506-yaffs-3.2-dont-use-i_nlink-directly.patch b/target/linux/generic/patches-3.6/506-yaffs-3.2-dont-use-i_nlink-directly.patch new file mode 100644 index 0000000000..91e8281196 --- /dev/null +++ b/target/linux/generic/patches-3.6/506-yaffs-3.2-dont-use-i_nlink-directly.patch @@ -0,0 +1,78 @@ +--- 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.6/506-yaffs-3.3_fix.patch b/target/linux/generic/patches-3.6/507-yaffs-3.3_fix.patch index d823fc49c4..d823fc49c4 100644 --- a/target/linux/generic/patches-3.6/506-yaffs-3.3_fix.patch +++ b/target/linux/generic/patches-3.6/507-yaffs-3.3_fix.patch |