Hi,
On Mon, Mar 31 at 08:19, Dirk Behme wrote:
> Matthias Fuchs wrote:
>> Hi,
>> did anybody spend some time in compiling yaffs for 2.6.25-rcX?
>> In February the iget() call got lost. So current yaffs does not compile in
>> recent kernels anymore.
>
> Yes, you are right. With 2.6.25-rc6 I get
...
> Looking at the quite good patch comment, fixing this should be easy (?).
>
> Anybody with a patch?
Well I had to put YAFFS2 into the 2.6.25 kernel on Friday and this is the
naive patch I came up with based on the example changes. It compiles and
works for me but I've only been using YAFFS for a total of 2 days. I've
done little more than "it doesn't smoke" testing.
--- linux-2.6.git/fs/yaffs2/yaffs_fs.c-orig 2008-04-17 08:49:19.000000000 +0100
+++ linux-2.6.git/fs/yaffs2/yaffs_fs.c 2008-04-17 10:09:40.000000000 +0100
@@ -181,7 +181,7 @@
#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 *);
@@ -284,7 +284,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,
@@ -844,7 +843,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 +1428,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 +1454,9 @@
yaffs_FillInodeFromObject(inode, obj);
yaffs_GrossUnlock(dev);
+
+ unlock_new_inode(inode);
+ return inode;
}
static LIST_HEAD(yaffs_dev_list);
--
Bob Dunlop
Guralp Systems Limited
http://www.guralp.com