1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-27 18:15:00 +02:00

generic: replace yaffs-2.6.39 patch

Use backported upstream patches instead.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34032 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2012-10-31 15:12:45 +00:00
parent a47c91cfbd
commit ddec1a3035
10 changed files with 404 additions and 400 deletions

View File

@ -1,147 +0,0 @@
--- a/fs/yaffs2/yaffs_vfs_glue.c
+++ b/fs/yaffs2/yaffs_vfs_glue.c
@@ -72,7 +72,7 @@
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/proc_fs.h>
-#include <linux/smp_lock.h>
+#include <linux/mutex.h>
#include <linux/pagemap.h>
#include <linux/mtd/mtd.h>
#include <linux/interrupt.h>
@@ -97,6 +97,8 @@
#include <asm/div64.h>
+static DEFINE_MUTEX(yaffs_mutex);
+
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
#include <linux/statfs.h>
@@ -1538,7 +1540,7 @@ static loff_t yaffs_dir_llseek(struct fi
{
long long retval;
- lock_kernel();
+ mutex_lock(&yaffs_mutex);
switch (origin){
case 2:
@@ -1555,7 +1557,7 @@ static loff_t yaffs_dir_llseek(struct fi
retval = offset;
}
- unlock_kernel();
+ mutex_unlock(&yaffs_mutex);
return retval;
}
@@ -3087,98 +3089,52 @@ static struct super_block *yaffs_interna
return sb;
}
-
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
static int yaffs_internal_read_super_mtd(struct super_block *sb, void *data,
int silent)
{
return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL;
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
-static int yaffs_read_super(struct file_system_type *fs,
+static struct dentry *yaffs_read_super(struct file_system_type *fs,
int flags, const char *dev_name,
- void *data, struct vfsmount *mnt)
-{
-
- return get_sb_bdev(fs, flags, dev_name, data,
- yaffs_internal_read_super_mtd, mnt);
-}
-#else
-static struct super_block *yaffs_read_super(struct file_system_type *fs,
- int flags, const char *dev_name,
- void *data)
+ void *data)
{
- return get_sb_bdev(fs, flags, dev_name, data,
+ return mount_bdev(fs, flags, dev_name, data,
yaffs_internal_read_super_mtd);
}
-#endif
static struct file_system_type yaffs_fs_type = {
.owner = THIS_MODULE,
.name = "yaffs",
- .get_sb = yaffs_read_super,
+ .mount = yaffs_read_super,
.kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV,
};
-#else
-static struct super_block *yaffs_read_super(struct super_block *sb, void *data,
- int silent)
-{
- return yaffs_internal_read_super(1, sb, data, silent);
-}
-
-static DECLARE_FSTYPE(yaffs_fs_type, "yaffs", yaffs_read_super,
- FS_REQUIRES_DEV);
-#endif
-
#ifdef CONFIG_YAFFS_YAFFS2
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data,
int silent)
{
return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL;
}
-#if (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 struct dentry *yaffs2_read_super(struct file_system_type *fs,
+ int flags, const char *dev_name,
+ void *data)
{
- return get_sb_bdev(fs, flags, dev_name, data,
- yaffs2_internal_read_super_mtd, mnt);
+ return mount_bdev(fs, flags, dev_name, data,
+ yaffs_internal_read_super_mtd);
}
-#else
-static struct super_block *yaffs2_read_super(struct file_system_type *fs,
- int flags, const char *dev_name,
- void *data)
-{
-
- return get_sb_bdev(fs, flags, dev_name, data,
- yaffs2_internal_read_super_mtd);
-}
-#endif
static struct file_system_type yaffs2_fs_type = {
.owner = THIS_MODULE,
.name = "yaffs2",
- .get_sb = yaffs2_read_super,
+ .mount = yaffs2_read_super,
.kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV,
};
-#else
-static struct super_block *yaffs2_read_super(struct super_block *sb,
- void *data, int silent)
-{
- return yaffs_internal_read_super(2, sb, data, silent);
-}
-
-static DECLARE_FSTYPE(yaffs2_fs_type, "yaffs2", yaffs2_read_super,
- FS_REQUIRES_DEV);
-#endif
#endif /* CONFIG_YAFFS_YAFFS2 */

View File

@ -0,0 +1,72 @@
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;

View File

@ -0,0 +1,110 @@
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

View File

@ -36,19 +36,7 @@
static void yaffs_put_super(struct super_block *sb);
static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
@@ -238,7 +261,10 @@ 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(3, 2, 0))
+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,
@@ -513,7 +539,7 @@ static unsigned yaffs_gc_control_callbac
@@ -513,7 +536,7 @@ static unsigned yaffs_gc_control_callbac
{
return yaffs_gc_control;
}
@ -57,7 +45,7 @@
static void yaffs_gross_lock(yaffs_dev_t *dev)
{
T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current));
@@ -1362,7 +1388,7 @@ static void yaffs_fill_inode_from_obj(st
@@ -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;
@ -66,7 +54,7 @@
T(YAFFS_TRACE_OS,
(TSTR("yaffs_fill_inode mode %x uid %d gid %d size %d count %d\n"),
@@ -1810,10 +1836,9 @@ static int yaffs_unlink(struct inode *di
@@ -1784,10 +1807,9 @@ static int yaffs_unlink(struct inode *di
retVal = yaffs_unlinker(obj, dentry->d_name.name);
if (retVal == YAFFS_OK) {
@ -78,7 +66,7 @@
update_dir_time(dir);
return 0;
}
@@ -1844,7 +1869,8 @@ static int yaffs_link(struct dentry *old
@@ -1818,7 +1840,8 @@ static int yaffs_link(struct dentry *old
obj);
if (link) {
@ -88,19 +76,7 @@
d_instantiate(dentry, old_dentry->d_inode);
atomic_inc(&old_dentry->d_inode->i_count);
T(YAFFS_TRACE_OS,
@@ -1894,7 +1920,10 @@ static int yaffs_symlink(struct inode *d
return -ENOMEM;
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0))
+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,
@@ -1961,11 +1990,9 @@ static int yaffs_rename(struct inode *ol
@@ -1937,11 +1960,9 @@ static int yaffs_rename(struct inode *ol
yaffs_gross_unlock(dev);
if (retVal == YAFFS_OK) {
@ -115,7 +91,7 @@
update_dir_time(old_dir);
if(old_dir != new_dir)
update_dir_time(new_dir);
@@ -1985,7 +2012,7 @@ static int yaffs_setattr(struct dentry *
@@ -1961,7 +1982,7 @@ static int yaffs_setattr(struct dentry *
(TSTR("yaffs_setattr of object %d\n"),
yaffs_InodeToObject(inode)->obj_id));
@ -124,7 +100,7 @@
if (attr->ia_valid & ATTR_SIZE &&
(attr->ia_size >> 31))
error = -EINVAL;
@@ -2216,7 +2243,7 @@ static void yaffs_flush_inodes(struct su
@@ -2192,7 +2213,7 @@ static void yaffs_flush_inodes(struct su
{
struct inode *iptr;
yaffs_obj_t *obj;
@ -133,7 +109,7 @@
list_for_each_entry(iptr,&sb->s_inodes, i_sb_list){
obj = yaffs_InodeToObject(iptr);
if(obj){
@@ -2230,10 +2257,10 @@ static void yaffs_flush_inodes(struct su
@@ -2206,10 +2227,10 @@ static void yaffs_flush_inodes(struct su
static void yaffs_flush_super(struct super_block *sb, int do_checkpoint)
{
@ -146,7 +122,7 @@
yaffs_flush_inodes(sb);
yaffs_update_dirty_dirs(dev);
yaffs_flush_whole_cache(dev);
@@ -2301,7 +2328,7 @@ static int yaffs_do_sync_fs(struct super
@@ -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.
*
@ -155,7 +131,7 @@
* 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.
@@ -2872,7 +2899,7 @@ static struct super_block *yaffs_interna
@@ -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);
@ -164,7 +140,7 @@
if(!dev || !context ){
if(dev)
kfree(dev);
@@ -2905,7 +2932,7 @@ static struct super_block *yaffs_interna
@@ -2881,7 +2902,7 @@ static struct super_block *yaffs_interna
#else
sb->u.generic_sbp = dev;
#endif
@ -173,7 +149,7 @@
dev->driver_context = mtd;
param->name = mtd->name;
@@ -3005,7 +3032,7 @@ static struct super_block *yaffs_interna
@@ -2981,7 +3002,7 @@ static struct super_block *yaffs_interna
param->gc_control = yaffs_gc_control_callback;
yaffs_dev_to_lc(dev)->superBlock= sb;
@ -182,7 +158,7 @@
#ifndef CONFIG_YAFFS_DOES_ECC
param->use_nand_ecc = 1;
@@ -3047,10 +3074,10 @@ static struct super_block *yaffs_interna
@@ -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"));
@ -195,16 +171,7 @@
if(!context->bgThread)
param->defered_dir_update = 0;
@@ -3125,7 +3152,7 @@ static struct dentry *yaffs2_read_super(
void *data)
{
return mount_bdev(fs, flags, dev_name, data,
- yaffs_internal_read_super_mtd);
+ yaffs2_internal_read_super_mtd);
}
static struct file_system_type yaffs2_fs_type = {
@@ -3240,7 +3267,7 @@ static int yaffs_proc_read(char *page,
@@ -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);
@ -213,7 +180,7 @@
break;
}
mutex_unlock(&yaffs_context_lock);
@@ -3267,7 +3294,7 @@ static int yaffs_stats_proc_read(char *p
@@ -3309,7 +3330,7 @@ static int yaffs_stats_proc_read(char *p
int erasedChunks;
erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block;

View File

@ -1,6 +1,6 @@
--- a/fs/yaffs2/yaffs_vfs_glue.c
+++ b/fs/yaffs2/yaffs_vfs_glue.c
@@ -274,8 +274,13 @@ static int yaffs_sync_object(struct file
@@ -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))
@ -14,7 +14,7 @@
static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
struct nameidata *n);
#else
@@ -287,9 +292,17 @@ static int yaffs_link(struct dentry *old
@@ -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);
@ -33,7 +33,7 @@
static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
dev_t dev);
#else
@@ -1708,7 +1721,10 @@ out:
@@ -1679,7 +1692,10 @@ out:
#define YCRED(x) (x->cred)
#endif
@ -45,7 +45,7 @@
static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
dev_t rdev)
#else
@@ -1798,7 +1814,11 @@ static int yaffs_mknod(struct inode *dir
@@ -1769,7 +1785,11 @@ static int yaffs_mknod(struct inode *dir
return error;
}
@ -57,7 +57,7 @@
{
int retVal;
T(YAFFS_TRACE_OS, (TSTR("yaffs_mkdir\n")));
@@ -1806,7 +1826,10 @@ static int yaffs_mkdir(struct inode *dir
@@ -1777,7 +1797,10 @@ static int yaffs_mkdir(struct inode *dir
return retVal;
}

View File

@ -1,147 +0,0 @@
--- a/fs/yaffs2/yaffs_vfs_glue.c
+++ b/fs/yaffs2/yaffs_vfs_glue.c
@@ -72,7 +72,7 @@
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/proc_fs.h>
-#include <linux/smp_lock.h>
+#include <linux/mutex.h>
#include <linux/pagemap.h>
#include <linux/mtd/mtd.h>
#include <linux/interrupt.h>
@@ -97,6 +97,8 @@
#include <asm/div64.h>
+static DEFINE_MUTEX(yaffs_mutex);
+
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
#include <linux/statfs.h>
@@ -1538,7 +1540,7 @@ static loff_t yaffs_dir_llseek(struct fi
{
long long retval;
- lock_kernel();
+ mutex_lock(&yaffs_mutex);
switch (origin){
case 2:
@@ -1555,7 +1557,7 @@ static loff_t yaffs_dir_llseek(struct fi
retval = offset;
}
- unlock_kernel();
+ mutex_unlock(&yaffs_mutex);
return retval;
}
@@ -3087,98 +3089,52 @@ static struct super_block *yaffs_interna
return sb;
}
-
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
static int yaffs_internal_read_super_mtd(struct super_block *sb, void *data,
int silent)
{
return yaffs_internal_read_super(1, sb, data, silent) ? 0 : -EINVAL;
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
-static int yaffs_read_super(struct file_system_type *fs,
+static struct dentry *yaffs_read_super(struct file_system_type *fs,
int flags, const char *dev_name,
- void *data, struct vfsmount *mnt)
-{
-
- return get_sb_bdev(fs, flags, dev_name, data,
- yaffs_internal_read_super_mtd, mnt);
-}
-#else
-static struct super_block *yaffs_read_super(struct file_system_type *fs,
- int flags, const char *dev_name,
- void *data)
+ void *data)
{
- return get_sb_bdev(fs, flags, dev_name, data,
+ return mount_bdev(fs, flags, dev_name, data,
yaffs_internal_read_super_mtd);
}
-#endif
static struct file_system_type yaffs_fs_type = {
.owner = THIS_MODULE,
.name = "yaffs",
- .get_sb = yaffs_read_super,
+ .mount = yaffs_read_super,
.kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV,
};
-#else
-static struct super_block *yaffs_read_super(struct super_block *sb, void *data,
- int silent)
-{
- return yaffs_internal_read_super(1, sb, data, silent);
-}
-
-static DECLARE_FSTYPE(yaffs_fs_type, "yaffs", yaffs_read_super,
- FS_REQUIRES_DEV);
-#endif
-
#ifdef CONFIG_YAFFS_YAFFS2
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data,
int silent)
{
return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL;
}
-#if (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 struct dentry *yaffs2_read_super(struct file_system_type *fs,
+ int flags, const char *dev_name,
+ void *data)
{
- return get_sb_bdev(fs, flags, dev_name, data,
- yaffs2_internal_read_super_mtd, mnt);
+ return mount_bdev(fs, flags, dev_name, data,
+ yaffs_internal_read_super_mtd);
}
-#else
-static struct super_block *yaffs2_read_super(struct file_system_type *fs,
- int flags, const char *dev_name,
- void *data)
-{
-
- return get_sb_bdev(fs, flags, dev_name, data,
- yaffs2_internal_read_super_mtd);
-}
-#endif
static struct file_system_type yaffs2_fs_type = {
.owner = THIS_MODULE,
.name = "yaffs2",
- .get_sb = yaffs2_read_super,
+ .mount = yaffs2_read_super,
.kill_sb = kill_block_super,
.fs_flags = FS_REQUIRES_DEV,
};
-#else
-static struct super_block *yaffs2_read_super(struct super_block *sb,
- void *data, int silent)
-{
- return yaffs_internal_read_super(2, sb, data, silent);
-}
-
-static DECLARE_FSTYPE(yaffs2_fs_type, "yaffs2", yaffs2_read_super,
- FS_REQUIRES_DEV);
-#endif
#endif /* CONFIG_YAFFS_YAFFS2 */

View File

@ -0,0 +1,72 @@
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;

View File

@ -0,0 +1,110 @@
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

View File

@ -36,19 +36,7 @@
static void yaffs_put_super(struct super_block *sb);
static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
@@ -238,7 +261,10 @@ 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(3, 2, 0))
+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,
@@ -513,7 +539,7 @@ static unsigned yaffs_gc_control_callbac
@@ -513,7 +536,7 @@ static unsigned yaffs_gc_control_callbac
{
return yaffs_gc_control;
}
@ -57,7 +45,7 @@
static void yaffs_gross_lock(yaffs_dev_t *dev)
{
T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current));
@@ -1362,7 +1388,7 @@ static void yaffs_fill_inode_from_obj(st
@@ -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;
@ -66,7 +54,7 @@
T(YAFFS_TRACE_OS,
(TSTR("yaffs_fill_inode mode %x uid %d gid %d size %d count %d\n"),
@@ -1810,10 +1836,9 @@ static int yaffs_unlink(struct inode *di
@@ -1784,10 +1807,9 @@ static int yaffs_unlink(struct inode *di
retVal = yaffs_unlinker(obj, dentry->d_name.name);
if (retVal == YAFFS_OK) {
@ -78,7 +66,7 @@
update_dir_time(dir);
return 0;
}
@@ -1844,7 +1869,8 @@ static int yaffs_link(struct dentry *old
@@ -1818,7 +1840,8 @@ static int yaffs_link(struct dentry *old
obj);
if (link) {
@ -88,19 +76,7 @@
d_instantiate(dentry, old_dentry->d_inode);
atomic_inc(&old_dentry->d_inode->i_count);
T(YAFFS_TRACE_OS,
@@ -1894,7 +1920,10 @@ static int yaffs_symlink(struct inode *d
return -ENOMEM;
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34))
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0))
+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,
@@ -1961,11 +1990,9 @@ static int yaffs_rename(struct inode *ol
@@ -1937,11 +1960,9 @@ static int yaffs_rename(struct inode *ol
yaffs_gross_unlock(dev);
if (retVal == YAFFS_OK) {
@ -115,7 +91,7 @@
update_dir_time(old_dir);
if(old_dir != new_dir)
update_dir_time(new_dir);
@@ -1985,7 +2012,7 @@ static int yaffs_setattr(struct dentry *
@@ -1961,7 +1982,7 @@ static int yaffs_setattr(struct dentry *
(TSTR("yaffs_setattr of object %d\n"),
yaffs_InodeToObject(inode)->obj_id));
@ -124,7 +100,7 @@
if (attr->ia_valid & ATTR_SIZE &&
(attr->ia_size >> 31))
error = -EINVAL;
@@ -2216,7 +2243,7 @@ static void yaffs_flush_inodes(struct su
@@ -2192,7 +2213,7 @@ static void yaffs_flush_inodes(struct su
{
struct inode *iptr;
yaffs_obj_t *obj;
@ -133,7 +109,7 @@
list_for_each_entry(iptr,&sb->s_inodes, i_sb_list){
obj = yaffs_InodeToObject(iptr);
if(obj){
@@ -2230,10 +2257,10 @@ static void yaffs_flush_inodes(struct su
@@ -2206,10 +2227,10 @@ static void yaffs_flush_inodes(struct su
static void yaffs_flush_super(struct super_block *sb, int do_checkpoint)
{
@ -146,7 +122,7 @@
yaffs_flush_inodes(sb);
yaffs_update_dirty_dirs(dev);
yaffs_flush_whole_cache(dev);
@@ -2301,7 +2328,7 @@ static int yaffs_do_sync_fs(struct super
@@ -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.
*
@ -155,7 +131,7 @@
* 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.
@@ -2872,7 +2899,7 @@ static struct super_block *yaffs_interna
@@ -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);
@ -164,7 +140,7 @@
if(!dev || !context ){
if(dev)
kfree(dev);
@@ -2905,7 +2932,7 @@ static struct super_block *yaffs_interna
@@ -2881,7 +2902,7 @@ static struct super_block *yaffs_interna
#else
sb->u.generic_sbp = dev;
#endif
@ -173,7 +149,7 @@
dev->driver_context = mtd;
param->name = mtd->name;
@@ -3005,7 +3032,7 @@ static struct super_block *yaffs_interna
@@ -2981,7 +3002,7 @@ static struct super_block *yaffs_interna
param->gc_control = yaffs_gc_control_callback;
yaffs_dev_to_lc(dev)->superBlock= sb;
@ -182,7 +158,7 @@
#ifndef CONFIG_YAFFS_DOES_ECC
param->use_nand_ecc = 1;
@@ -3047,10 +3074,10 @@ static struct super_block *yaffs_interna
@@ -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"));
@ -195,16 +171,7 @@
if(!context->bgThread)
param->defered_dir_update = 0;
@@ -3125,7 +3152,7 @@ static struct dentry *yaffs2_read_super(
void *data)
{
return mount_bdev(fs, flags, dev_name, data,
- yaffs_internal_read_super_mtd);
+ yaffs2_internal_read_super_mtd);
}
static struct file_system_type yaffs2_fs_type = {
@@ -3240,7 +3267,7 @@ static int yaffs_proc_read(char *page,
@@ -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);
@ -213,7 +180,7 @@
break;
}
mutex_unlock(&yaffs_context_lock);
@@ -3267,7 +3294,7 @@ static int yaffs_stats_proc_read(char *p
@@ -3309,7 +3330,7 @@ static int yaffs_stats_proc_read(char *p
int erasedChunks;
erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block;

View File

@ -1,6 +1,6 @@
--- a/fs/yaffs2/yaffs_vfs_glue.c
+++ b/fs/yaffs2/yaffs_vfs_glue.c
@@ -274,8 +274,13 @@ static int yaffs_sync_object(struct file
@@ -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))
@ -14,7 +14,7 @@
static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
struct nameidata *n);
#else
@@ -287,9 +292,17 @@ static int yaffs_link(struct dentry *old
@@ -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);
@ -33,7 +33,7 @@
static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
dev_t dev);
#else
@@ -1708,7 +1721,10 @@ out:
@@ -1679,7 +1692,10 @@ out:
#define YCRED(x) (x->cred)
#endif
@ -45,7 +45,7 @@
static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
dev_t rdev)
#else
@@ -1798,7 +1814,11 @@ static int yaffs_mknod(struct inode *dir
@@ -1769,7 +1785,11 @@ static int yaffs_mknod(struct inode *dir
return error;
}
@ -57,7 +57,7 @@
{
int retVal;
T(YAFFS_TRACE_OS, (TSTR("yaffs_mkdir\n")));
@@ -1806,7 +1826,10 @@ static int yaffs_mkdir(struct inode *dir
@@ -1777,7 +1797,10 @@ static int yaffs_mkdir(struct inode *dir
return retVal;
}