On 2008-11-15 11:46 +0000, Wookey wrote:
> I've just tried yaffs (2007-12-14 vintage) on 2.6.27 instead of 2.6.25
> where it was OK, and it seems that put_inode is no longer a feature of
> super_operations struct.
>
> Has anyone already fixed up 2.6.27 or do I need to work this out?
Apparently not, so I fettled it up:
2 fixes:
1) change in proc-creation semantics
2) put_inode seems to have gone from super_operations struct.
Apparently this has been tried since 2.6.22
So far as I can tell it's not doing anything, so I just got rid of it.
Not sure if we should be doing something else instead?
Anyway. here's the patch:
which also includes the changes someone did for 2.6.25:
read_inode->yaffs_iget
I can check this in if no objections. It seems to work (no extensive
testing done, but nothing broke yet).
Index: linux-2.6.27.5/fs/yaffs2/yaffs_fs.c
===================================================================
--- linux-2.6.27.5.orig/fs/yaffs2/yaffs_fs.c 2008-11-19 13:16:05.000000000 +0000
+++ linux-2.6.27.5/fs/yaffs2/yaffs_fs.c 2008-11-19 13:25:45.000000000 +0000
@@ -181,9 +181,8 @@
#else
static int yaffs_statfs(struct super_block *sb, struct statfs *buf);
#endif
-static void yaffs_read_inode(struct inode *inode);
+static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino);
-static void yaffs_put_inode(struct inode *inode);
static void yaffs_delete_inode(struct inode *);
static void yaffs_clear_inode(struct inode *);
@@ -284,8 +283,6 @@
static struct super_operations yaffs_super_ops = {
.statfs = yaffs_statfs,
- .read_inode = yaffs_read_inode,
- .put_inode = yaffs_put_inode,
.put_super = yaffs_put_super,
.delete_inode = yaffs_delete_inode,
.clear_inode = yaffs_clear_inode,
@@ -429,16 +426,6 @@
}
-/* For now put inode is just for debugging
- * Put inode is called when the inode **structure** is put.
- */
-static void yaffs_put_inode(struct inode *inode)
-{
- T(YAFFS_TRACE_OS,
- ("yaffs_put_inode: ino %d, count %d\n", (int)inode->i_ino,
- atomic_read(&inode->i_count)));
-
-}
/* clear is called to tell the fs to release any per-inode data it holds */
static void yaffs_clear_inode(struct inode *inode)
@@ -844,7 +831,9 @@
T(YAFFS_TRACE_OS,
(KERN_DEBUG "yaffs_get_inode for object %d\n", obj->objectId));
- inode = iget(sb, obj->objectId);
+ inode = yaffs_iget(sb, obj->objectId);
+ if (IS_ERR(inode))
+ return NULL;
/* NB Side effect: iget calls back to yaffs_read_inode(). */
/* iget also increments the inode's i_count */
@@ -1427,19 +1416,25 @@
}
-static void yaffs_read_inode(struct inode *inode)
+static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino)
{
- /* NB This is called as a side effect of other functions, but
- * we had to release the lock to prevent deadlocks, so
- * need to lock again.
- */
-
+ struct inode *inode;
yaffs_Object *obj;
- yaffs_Device *dev = yaffs_SuperToDevice(inode->i_sb);
+ yaffs_Device *dev = yaffs_SuperToDevice(sb);
T(YAFFS_TRACE_OS,
- (KERN_DEBUG "yaffs_read_inode for %d\n", (int)inode->i_ino));
+ (KERN_DEBUG "yaffs_iget for %lu\n", ino));
+ inode = iget_locked(sb, ino);
+ if (!inode)
+ return ERR_PTR(-ENOMEM);
+ if (!(inode->i_state & I_NEW))
+ return inode;
+
+ /* NB This is called as a side effect of other functions, but
+ * we had to release the lock to prevent deadlocks, so
+ * need to lock again.
+ */
yaffs_GrossLock(dev);
obj = yaffs_FindObjectByNumber(dev, inode->i_ino);
@@ -1447,6 +1442,9 @@
yaffs_FillInodeFromObject(inode, obj);
yaffs_GrossUnlock(dev);
+
+ unlock_new_inode(inode);
+ return inode;
}
static LIST_HEAD(yaffs_dev_list);
@@ -2229,7 +2227,7 @@
/* Install the proc_fs entry */
my_proc_entry = create_proc_entry("yaffs",
S_IRUGO | S_IFREG,
- &proc_root);
+ NULL);
if (my_proc_entry) {
my_proc_entry->write_proc = yaffs_proc_write;
@@ -2275,7 +2273,7 @@
T(YAFFS_TRACE_ALWAYS, ("yaffs " __DATE__ " " __TIME__
" removing. \n"));
- remove_proc_entry("yaffs", &proc_root);
+ remove_proc_entry("yaffs", NULL);
fsinst = fs_to_install;
Wookey
--
Principal hats: Balloonz - Toby Churchill - Aleph One - Debian
http://wookware.org/