1 --- a/fs/yaffs2/yaffs_vfs_glue.c
2 +++ b/fs/yaffs2/yaffs_vfs_glue.c
3 @@ -220,6 +220,29 @@ static struct inode *yaffs_iget(struct s
4 #define yaffs_SuperToDevice(sb) ((yaffs_dev_t *)sb->u.generic_sbp)
7 +#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0))
8 +static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink)
10 + set_nlink(inode, nlink);
13 +static inline void yaffs_dec_link_count(struct inode *inode)
15 + inode_dec_link_count(inode);
18 +static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink)
20 + inode->i_nlink = nlink;
23 +static inline void yaffs_dec_link_count(struct inode *inode)
26 + mark_inode_dirty(inode)
31 #define update_dir_time(dir) do {\
32 (dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \
33 @@ -1362,7 +1385,7 @@ static void yaffs_fill_inode_from_obj(st
34 inode->i_size = yaffs_get_obj_length(obj);
35 inode->i_blocks = (inode->i_size + 511) >> 9;
37 - inode->i_nlink = yaffs_get_obj_link_count(obj);
38 + yaffs_set_nlink(inode, yaffs_get_obj_link_count(obj));
41 (TSTR("yaffs_fill_inode mode %x uid %d gid %d size %d count %d\n"),
42 @@ -1784,10 +1807,9 @@ static int yaffs_unlink(struct inode *di
43 retVal = yaffs_unlinker(obj, dentry->d_name.name);
45 if (retVal == YAFFS_OK) {
46 - dentry->d_inode->i_nlink--;
47 + yaffs_dec_link_count(dentry->d_inode);
49 yaffs_gross_unlock(dev);
50 - mark_inode_dirty(dentry->d_inode);
54 @@ -1818,7 +1840,8 @@ static int yaffs_link(struct dentry *old
58 - old_dentry->d_inode->i_nlink = yaffs_get_obj_link_count(obj);
59 + yaffs_set_nlink(old_dentry->d_inode,
60 + yaffs_get_obj_link_count(obj));
61 d_instantiate(dentry, old_dentry->d_inode);
62 atomic_inc(&old_dentry->d_inode->i_count);
64 @@ -1937,11 +1960,9 @@ static int yaffs_rename(struct inode *ol
65 yaffs_gross_unlock(dev);
67 if (retVal == YAFFS_OK) {
69 - new_dentry->d_inode->i_nlink--;
70 - mark_inode_dirty(new_dentry->d_inode);
74 + yaffs_dec_link_count(new_dentry->d_inode);
76 update_dir_time(old_dir);
77 if(old_dir != new_dir)
78 update_dir_time(new_dir);