diff options
Diffstat (limited to 'fs/ufs/namei.c')
-rw-r--r-- | fs/ufs/namei.c | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index 2958cde7d3d6..8d5f98a01c74 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c | |||
@@ -43,18 +43,6 @@ | |||
43 | #define UFSD(x) | 43 | #define UFSD(x) |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | static inline void ufs_inc_count(struct inode *inode) | ||
47 | { | ||
48 | inode->i_nlink++; | ||
49 | mark_inode_dirty(inode); | ||
50 | } | ||
51 | |||
52 | static inline void ufs_dec_count(struct inode *inode) | ||
53 | { | ||
54 | inode->i_nlink--; | ||
55 | mark_inode_dirty(inode); | ||
56 | } | ||
57 | |||
58 | static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) | 46 | static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) |
59 | { | 47 | { |
60 | int err = ufs_add_link(dentry, inode); | 48 | int err = ufs_add_link(dentry, inode); |
@@ -62,7 +50,7 @@ static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) | |||
62 | d_instantiate(dentry, inode); | 50 | d_instantiate(dentry, inode); |
63 | return 0; | 51 | return 0; |
64 | } | 52 | } |
65 | ufs_dec_count(inode); | 53 | inode_dec_link_count(inode); |
66 | iput(inode); | 54 | iput(inode); |
67 | return err; | 55 | return err; |
68 | } | 56 | } |
@@ -173,7 +161,7 @@ out: | |||
173 | return err; | 161 | return err; |
174 | 162 | ||
175 | out_fail: | 163 | out_fail: |
176 | ufs_dec_count(inode); | 164 | inode_dec_link_count(inode); |
177 | iput(inode); | 165 | iput(inode); |
178 | goto out; | 166 | goto out; |
179 | } | 167 | } |
@@ -191,7 +179,7 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir, | |||
191 | } | 179 | } |
192 | 180 | ||
193 | inode->i_ctime = CURRENT_TIME_SEC; | 181 | inode->i_ctime = CURRENT_TIME_SEC; |
194 | ufs_inc_count(inode); | 182 | inode_inc_link_count(inode); |
195 | atomic_inc(&inode->i_count); | 183 | atomic_inc(&inode->i_count); |
196 | 184 | ||
197 | error = ufs_add_nondir(dentry, inode); | 185 | error = ufs_add_nondir(dentry, inode); |
@@ -208,7 +196,7 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode) | |||
208 | goto out; | 196 | goto out; |
209 | 197 | ||
210 | lock_kernel(); | 198 | lock_kernel(); |
211 | ufs_inc_count(dir); | 199 | inode_inc_link_count(dir); |
212 | 200 | ||
213 | inode = ufs_new_inode(dir, S_IFDIR|mode); | 201 | inode = ufs_new_inode(dir, S_IFDIR|mode); |
214 | err = PTR_ERR(inode); | 202 | err = PTR_ERR(inode); |
@@ -218,7 +206,7 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode) | |||
218 | inode->i_op = &ufs_dir_inode_operations; | 206 | inode->i_op = &ufs_dir_inode_operations; |
219 | inode->i_fop = &ufs_dir_operations; | 207 | inode->i_fop = &ufs_dir_operations; |
220 | 208 | ||
221 | ufs_inc_count(inode); | 209 | inode_inc_link_count(inode); |
222 | 210 | ||
223 | err = ufs_make_empty(inode, dir); | 211 | err = ufs_make_empty(inode, dir); |
224 | if (err) | 212 | if (err) |
@@ -234,11 +222,11 @@ out: | |||
234 | return err; | 222 | return err; |
235 | 223 | ||
236 | out_fail: | 224 | out_fail: |
237 | ufs_dec_count(inode); | 225 | inode_dec_link_count(inode); |
238 | ufs_dec_count(inode); | 226 | inode_dec_link_count(inode); |
239 | iput (inode); | 227 | iput (inode); |
240 | out_dir: | 228 | out_dir: |
241 | ufs_dec_count(dir); | 229 | inode_dec_link_count(dir); |
242 | unlock_kernel(); | 230 | unlock_kernel(); |
243 | goto out; | 231 | goto out; |
244 | } | 232 | } |
@@ -260,7 +248,7 @@ static int ufs_unlink(struct inode * dir, struct dentry *dentry) | |||
260 | goto out; | 248 | goto out; |
261 | 249 | ||
262 | inode->i_ctime = dir->i_ctime; | 250 | inode->i_ctime = dir->i_ctime; |
263 | ufs_dec_count(inode); | 251 | inode_dec_link_count(inode); |
264 | err = 0; | 252 | err = 0; |
265 | out: | 253 | out: |
266 | unlock_kernel(); | 254 | unlock_kernel(); |
@@ -277,8 +265,8 @@ static int ufs_rmdir (struct inode * dir, struct dentry *dentry) | |||
277 | err = ufs_unlink(dir, dentry); | 265 | err = ufs_unlink(dir, dentry); |
278 | if (!err) { | 266 | if (!err) { |
279 | inode->i_size = 0; | 267 | inode->i_size = 0; |
280 | ufs_dec_count(inode); | 268 | inode_dec_link_count(inode); |
281 | ufs_dec_count(dir); | 269 | inode_dec_link_count(dir); |
282 | } | 270 | } |
283 | } | 271 | } |
284 | unlock_kernel(); | 272 | unlock_kernel(); |
@@ -319,35 +307,35 @@ static int ufs_rename (struct inode * old_dir, struct dentry * old_dentry, | |||
319 | new_de = ufs_find_entry (new_dentry, &new_bh); | 307 | new_de = ufs_find_entry (new_dentry, &new_bh); |
320 | if (!new_de) | 308 | if (!new_de) |
321 | goto out_dir; | 309 | goto out_dir; |
322 | ufs_inc_count(old_inode); | 310 | inode_inc_link_count(old_inode); |
323 | ufs_set_link(new_dir, new_de, new_bh, old_inode); | 311 | ufs_set_link(new_dir, new_de, new_bh, old_inode); |
324 | new_inode->i_ctime = CURRENT_TIME_SEC; | 312 | new_inode->i_ctime = CURRENT_TIME_SEC; |
325 | if (dir_de) | 313 | if (dir_de) |
326 | new_inode->i_nlink--; | 314 | new_inode->i_nlink--; |
327 | ufs_dec_count(new_inode); | 315 | inode_dec_link_count(new_inode); |
328 | } else { | 316 | } else { |
329 | if (dir_de) { | 317 | if (dir_de) { |
330 | err = -EMLINK; | 318 | err = -EMLINK; |
331 | if (new_dir->i_nlink >= UFS_LINK_MAX) | 319 | if (new_dir->i_nlink >= UFS_LINK_MAX) |
332 | goto out_dir; | 320 | goto out_dir; |
333 | } | 321 | } |
334 | ufs_inc_count(old_inode); | 322 | inode_inc_link_count(old_inode); |
335 | err = ufs_add_link(new_dentry, old_inode); | 323 | err = ufs_add_link(new_dentry, old_inode); |
336 | if (err) { | 324 | if (err) { |
337 | ufs_dec_count(old_inode); | 325 | inode_dec_link_count(old_inode); |
338 | goto out_dir; | 326 | goto out_dir; |
339 | } | 327 | } |
340 | if (dir_de) | 328 | if (dir_de) |
341 | ufs_inc_count(new_dir); | 329 | inode_inc_link_count(new_dir); |
342 | } | 330 | } |
343 | 331 | ||
344 | ufs_delete_entry (old_dir, old_de, old_bh); | 332 | ufs_delete_entry (old_dir, old_de, old_bh); |
345 | 333 | ||
346 | ufs_dec_count(old_inode); | 334 | inode_dec_link_count(old_inode); |
347 | 335 | ||
348 | if (dir_de) { | 336 | if (dir_de) { |
349 | ufs_set_link(old_inode, dir_de, dir_bh, new_dir); | 337 | ufs_set_link(old_inode, dir_de, dir_bh, new_dir); |
350 | ufs_dec_count(old_dir); | 338 | inode_dec_link_count(old_dir); |
351 | } | 339 | } |
352 | unlock_kernel(); | 340 | unlock_kernel(); |
353 | return 0; | 341 | return 0; |