83db1b8a2ec9a5055c0901ed0aa50227569cfe66
[openwrt/svn-archive/archive.git] / target / linux / generic-2.6 / patches-2.6.25 / 511-yaffs_2.6.25_fix.patch
1 Index: linux-2.6.25.4/fs/yaffs2/yaffs_fs.c
2 ===================================================================
3 --- linux-2.6.25.4.orig/fs/yaffs2/yaffs_fs.c
4 +++ linux-2.6.25.4/fs/yaffs2/yaffs_fs.c
5 @@ -181,7 +181,13 @@ static int yaffs_statfs(struct super_blo
6 #else
7 static int yaffs_statfs(struct super_block *sb, struct statfs *buf);
8 #endif
9 +
10 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
11 +static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino);
12 +#else
13 static void yaffs_read_inode(struct inode *inode);
14 +#endif
15 +
16
17 static void yaffs_put_inode(struct inode *inode);
18 static void yaffs_delete_inode(struct inode *);
19 @@ -284,7 +290,9 @@ static struct file_operations yaffs_dir_
20
21 static struct super_operations yaffs_super_ops = {
22 .statfs = yaffs_statfs,
23 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
24 .read_inode = yaffs_read_inode,
25 +#endif
26 .put_inode = yaffs_put_inode,
27 .put_super = yaffs_put_super,
28 .delete_inode = yaffs_delete_inode,
29 @@ -844,11 +852,17 @@ struct inode *yaffs_get_inode(struct sup
30 T(YAFFS_TRACE_OS,
31 (KERN_DEBUG "yaffs_get_inode for object %d\n", obj->objectId));
32
33 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
34 + inode = yaffs_iget(sb, obj->objectId);
35 + if (IS_ERR(inode))
36 + return NULL;
37 +#else
38 inode = iget(sb, obj->objectId);
39
40 /* NB Side effect: iget calls back to yaffs_read_inode(). */
41 /* iget also increments the inode's i_count */
42 /* NB You can't be holding grossLock or deadlock will happen! */
43 +#endif
44
45 return inode;
46 }
47 @@ -1427,6 +1441,39 @@ static int yaffs_sync_fs(struct super_bl
48 }
49
50
51 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
52 +static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino)
53 +{
54 + yaffs_Object *obj;
55 + yaffs_Device *dev = yaffs_SuperToDevice(sb);
56 + struct inode *inode;
57 +
58 + T(YAFFS_TRACE_OS,
59 + (KERN_DEBUG "yaffs_iget for %lu\n", ino));
60 +
61 + inode = iget_locked(sb, ino);
62 + if (!inode)
63 + return ERR_PTR(-ENOMEM);
64 + if (!(inode->i_state & I_NEW))
65 + return inode;
66 +
67 + /* NB This is called as a side effect of other functions, but
68 + * we had to release the lock to prevent deadlocks, so
69 + * need to lock again.
70 + */
71 +
72 + yaffs_GrossLock(dev);
73 +
74 + obj = yaffs_FindObjectByNumber(dev, inode->i_ino);
75 +
76 + yaffs_FillInodeFromObject(inode, obj);
77 +
78 + yaffs_GrossUnlock(dev);
79 +
80 + unlock_new_inode(inode);
81 + return inode;
82 +}
83 +#else
84 static void yaffs_read_inode(struct inode *inode)
85 {
86 /* NB This is called as a side effect of other functions, but
87 @@ -1448,6 +1495,7 @@ static void yaffs_read_inode(struct inod
88
89 yaffs_GrossUnlock(dev);
90 }
91 +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) */
92
93 static LIST_HEAD(yaffs_dev_list);
94