diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2006-03-23 06:00:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:15 -0500 |
commit | 4e907c3d45d10dc5162d283d109be425c23aeb69 (patch) | |
tree | 4b9ae84dec9f4bc9f3b77f9e853e37280b064d71 /fs/sysv | |
parent | 78ec7b6917a938910d5ed6049c0e4ee6e6852e4e (diff) |
[PATCH] sysv: switch to inode_inc_count, inode_dec_count
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/sysv')
-rw-r--r-- | fs/sysv/namei.c | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c index 7f0e4b53085e..b8a73f716fbe 100644 --- a/fs/sysv/namei.c +++ b/fs/sysv/namei.c | |||
@@ -16,18 +16,6 @@ | |||
16 | #include <linux/smp_lock.h> | 16 | #include <linux/smp_lock.h> |
17 | #include "sysv.h" | 17 | #include "sysv.h" |
18 | 18 | ||
19 | static inline void inc_count(struct inode *inode) | ||
20 | { | ||
21 | inode->i_nlink++; | ||
22 | mark_inode_dirty(inode); | ||
23 | } | ||
24 | |||
25 | static inline void dec_count(struct inode *inode) | ||
26 | { | ||
27 | inode->i_nlink--; | ||
28 | mark_inode_dirty(inode); | ||
29 | } | ||
30 | |||
31 | static int add_nondir(struct dentry *dentry, struct inode *inode) | 19 | static int add_nondir(struct dentry *dentry, struct inode *inode) |
32 | { | 20 | { |
33 | int err = sysv_add_link(dentry, inode); | 21 | int err = sysv_add_link(dentry, inode); |
@@ -35,7 +23,7 @@ static int add_nondir(struct dentry *dentry, struct inode *inode) | |||
35 | d_instantiate(dentry, inode); | 23 | d_instantiate(dentry, inode); |
36 | return 0; | 24 | return 0; |
37 | } | 25 | } |
38 | dec_count(inode); | 26 | inode_dec_link_count(inode); |
39 | iput(inode); | 27 | iput(inode); |
40 | return err; | 28 | return err; |
41 | } | 29 | } |
@@ -124,7 +112,7 @@ out: | |||
124 | return err; | 112 | return err; |
125 | 113 | ||
126 | out_fail: | 114 | out_fail: |
127 | dec_count(inode); | 115 | inode_dec_link_count(inode); |
128 | iput(inode); | 116 | iput(inode); |
129 | goto out; | 117 | goto out; |
130 | } | 118 | } |
@@ -138,7 +126,7 @@ static int sysv_link(struct dentry * old_dentry, struct inode * dir, | |||
138 | return -EMLINK; | 126 | return -EMLINK; |
139 | 127 | ||
140 | inode->i_ctime = CURRENT_TIME_SEC; | 128 | inode->i_ctime = CURRENT_TIME_SEC; |
141 | inc_count(inode); | 129 | inode_inc_link_count(inode); |
142 | atomic_inc(&inode->i_count); | 130 | atomic_inc(&inode->i_count); |
143 | 131 | ||
144 | return add_nondir(dentry, inode); | 132 | return add_nondir(dentry, inode); |
@@ -151,7 +139,7 @@ static int sysv_mkdir(struct inode * dir, struct dentry *dentry, int mode) | |||
151 | 139 | ||
152 | if (dir->i_nlink >= SYSV_SB(dir->i_sb)->s_link_max) | 140 | if (dir->i_nlink >= SYSV_SB(dir->i_sb)->s_link_max) |
153 | goto out; | 141 | goto out; |
154 | inc_count(dir); | 142 | inode_inc_link_count(dir); |
155 | 143 | ||
156 | inode = sysv_new_inode(dir, S_IFDIR|mode); | 144 | inode = sysv_new_inode(dir, S_IFDIR|mode); |
157 | err = PTR_ERR(inode); | 145 | err = PTR_ERR(inode); |
@@ -160,7 +148,7 @@ static int sysv_mkdir(struct inode * dir, struct dentry *dentry, int mode) | |||
160 | 148 | ||
161 | sysv_set_inode(inode, 0); | 149 | sysv_set_inode(inode, 0); |
162 | 150 | ||
163 | inc_count(inode); | 151 | inode_inc_link_count(inode); |
164 | 152 | ||
165 | err = sysv_make_empty(inode, dir); | 153 | err = sysv_make_empty(inode, dir); |
166 | if (err) | 154 | if (err) |
@@ -175,11 +163,11 @@ out: | |||
175 | return err; | 163 | return err; |
176 | 164 | ||
177 | out_fail: | 165 | out_fail: |
178 | dec_count(inode); | 166 | inode_dec_link_count(inode); |
179 | dec_count(inode); | 167 | inode_dec_link_count(inode); |
180 | iput(inode); | 168 | iput(inode); |
181 | out_dir: | 169 | out_dir: |
182 | dec_count(dir); | 170 | inode_dec_link_count(dir); |
183 | goto out; | 171 | goto out; |
184 | } | 172 | } |
185 | 173 | ||
@@ -199,7 +187,7 @@ static int sysv_unlink(struct inode * dir, struct dentry * dentry) | |||
199 | goto out; | 187 | goto out; |
200 | 188 | ||
201 | inode->i_ctime = dir->i_ctime; | 189 | inode->i_ctime = dir->i_ctime; |
202 | dec_count(inode); | 190 | inode_dec_link_count(inode); |
203 | out: | 191 | out: |
204 | return err; | 192 | return err; |
205 | } | 193 | } |
@@ -213,8 +201,8 @@ static int sysv_rmdir(struct inode * dir, struct dentry * dentry) | |||
213 | err = sysv_unlink(dir, dentry); | 201 | err = sysv_unlink(dir, dentry); |
214 | if (!err) { | 202 | if (!err) { |
215 | inode->i_size = 0; | 203 | inode->i_size = 0; |
216 | dec_count(inode); | 204 | inode_dec_link_count(inode); |
217 | dec_count(dir); | 205 | inode_dec_link_count(dir); |
218 | } | 206 | } |
219 | } | 207 | } |
220 | return err; | 208 | return err; |
@@ -258,34 +246,34 @@ static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, | |||
258 | new_de = sysv_find_entry(new_dentry, &new_page); | 246 | new_de = sysv_find_entry(new_dentry, &new_page); |
259 | if (!new_de) | 247 | if (!new_de) |
260 | goto out_dir; | 248 | goto out_dir; |
261 | inc_count(old_inode); | 249 | inode_inc_link_count(old_inode); |
262 | sysv_set_link(new_de, new_page, old_inode); | 250 | sysv_set_link(new_de, new_page, old_inode); |
263 | new_inode->i_ctime = CURRENT_TIME_SEC; | 251 | new_inode->i_ctime = CURRENT_TIME_SEC; |
264 | if (dir_de) | 252 | if (dir_de) |
265 | new_inode->i_nlink--; | 253 | new_inode->i_nlink--; |
266 | dec_count(new_inode); | 254 | inode_dec_link_count(new_inode); |
267 | } else { | 255 | } else { |
268 | if (dir_de) { | 256 | if (dir_de) { |
269 | err = -EMLINK; | 257 | err = -EMLINK; |
270 | if (new_dir->i_nlink >= SYSV_SB(new_dir->i_sb)->s_link_max) | 258 | if (new_dir->i_nlink >= SYSV_SB(new_dir->i_sb)->s_link_max) |
271 | goto out_dir; | 259 | goto out_dir; |
272 | } | 260 | } |
273 | inc_count(old_inode); | 261 | inode_inc_link_count(old_inode); |
274 | err = sysv_add_link(new_dentry, old_inode); | 262 | err = sysv_add_link(new_dentry, old_inode); |
275 | if (err) { | 263 | if (err) { |
276 | dec_count(old_inode); | 264 | inode_dec_link_count(old_inode); |
277 | goto out_dir; | 265 | goto out_dir; |
278 | } | 266 | } |
279 | if (dir_de) | 267 | if (dir_de) |
280 | inc_count(new_dir); | 268 | inode_inc_link_count(new_dir); |
281 | } | 269 | } |
282 | 270 | ||
283 | sysv_delete_entry(old_de, old_page); | 271 | sysv_delete_entry(old_de, old_page); |
284 | dec_count(old_inode); | 272 | inode_dec_link_count(old_inode); |
285 | 273 | ||
286 | if (dir_de) { | 274 | if (dir_de) { |
287 | sysv_set_link(dir_de, dir_page, new_dir); | 275 | sysv_set_link(dir_de, dir_page, new_dir); |
288 | dec_count(old_dir); | 276 | inode_dec_link_count(old_dir); |
289 | } | 277 | } |
290 | return 0; | 278 | return 0; |
291 | 279 | ||