--- a/fs/yaffs2/yaffs_vfs_glue.c +++ b/fs/yaffs2/yaffs_vfs_glue.c @@ -220,6 +220,29 @@ static struct inode *yaffs_iget(struct s #define yaffs_SuperToDevice(sb) ((yaffs_dev_t *)sb->u.generic_sbp) #endif +#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 2, 0)) +static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink) +{ + set_nlink(inode, nlink); +} + +static inline void yaffs_dec_link_count(struct inode *inode) +{ + inode_dec_link_count(inode); +} +#else +static inline void yaffs_set_nlink(struct inode *inode, unsigned int nlink) +{ + inode->i_nlink = nlink; +} + +static inline void yaffs_dec_link_count(struct inode *inode) +{ + inode->i_nlink--; + mark_inode_dirty(inode) +} +#endif + #define update_dir_time(dir) do {\ (dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \ @@ -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; - inode->i_nlink = yaffs_get_obj_link_count(obj); + yaffs_set_nlink(inode, yaffs_get_obj_link_count(obj)); T(YAFFS_TRACE_OS, (TSTR("yaffs_fill_inode mode %x uid %d gid %d size %d count %d\n"), @@ -1784,10 +1807,9 @@ static int yaffs_unlink(struct inode *di retVal = yaffs_unlinker(obj, dentry->d_name.name); if (retVal == YAFFS_OK) { - dentry->d_inode->i_nlink--; + yaffs_dec_link_count(dentry->d_inode); dir->i_version++; yaffs_gross_unlock(dev); - mark_inode_dirty(dentry->d_inode); update_dir_time(dir); return 0; } @@ -1818,7 +1840,8 @@ static int yaffs_link(struct dentry *old obj); if (link) { - old_dentry->d_inode->i_nlink = yaffs_get_obj_link_count(obj); + yaffs_set_nlink(old_dentry->d_inode, + yaffs_get_obj_link_count(obj)); d_instantiate(dentry, old_dentry->d_inode); atomic_inc(&old_dentry->d_inode->i_count); T(YAFFS_TRACE_OS, @@ -1937,11 +1960,9 @@ static int yaffs_rename(struct inode *ol yaffs_gross_unlock(dev); if (retVal == YAFFS_OK) { - if (target) { - new_dentry->d_inode->i_nlink--; - mark_inode_dirty(new_dentry->d_inode); - } - + if (target) + yaffs_dec_link_count(new_dentry->d_inode); + update_dir_time(old_dir); if(old_dir != new_dir) update_dir_time(new_dir); n' name='id' value='99b2c7638276d88b45839a22a77d94c35a5472a1'/>
path: root/README
blob: 092439f4c25bb6b010e8c8ee189f42fdc0155625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157