diff options
author | David Howells <dhowells@redhat.com> | 2008-02-07 03:15:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 11:42:28 -0500 |
commit | d0b079483dd4cf6373f0ff234d5fdaef80c9588f (patch) | |
tree | 8f222250ca750d370238b07111ec4f7ddc989a9c | |
parent | 17f95a7b4416a2c61e35f51b29eaaf1818fb5d7d (diff) |
iget: stop FreeVXFS from using iget() and read_inode()
Stop the FreeVXFS filesystem from using iget() and read_inode(). Replace
vxfs_read_inode() with vxfs_iget(), and call that instead of iget().
vxfs_iget() then uses iget_locked() directly and returns a proper error code
instead of an inode in the event of an error.
vxfs_fill_super() returns any error incurred when getting the root inode
instead of EINVAL.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/freevxfs/vxfs_extern.h | 2 | ||||
-rw-r--r-- | fs/freevxfs/vxfs_inode.c | 45 | ||||
-rw-r--r-- | fs/freevxfs/vxfs_lookup.c | 6 | ||||
-rw-r--r-- | fs/freevxfs/vxfs_super.c | 10 |
4 files changed, 40 insertions, 23 deletions
diff --git a/fs/freevxfs/vxfs_extern.h b/fs/freevxfs/vxfs_extern.h index 91ccee8723f7..2b46064f66b2 100644 --- a/fs/freevxfs/vxfs_extern.h +++ b/fs/freevxfs/vxfs_extern.h | |||
@@ -58,7 +58,7 @@ extern struct inode * vxfs_get_fake_inode(struct super_block *, | |||
58 | extern void vxfs_put_fake_inode(struct inode *); | 58 | extern void vxfs_put_fake_inode(struct inode *); |
59 | extern struct vxfs_inode_info * vxfs_blkiget(struct super_block *, u_long, ino_t); | 59 | extern struct vxfs_inode_info * vxfs_blkiget(struct super_block *, u_long, ino_t); |
60 | extern struct vxfs_inode_info * vxfs_stiget(struct super_block *, ino_t); | 60 | extern struct vxfs_inode_info * vxfs_stiget(struct super_block *, ino_t); |
61 | extern void vxfs_read_inode(struct inode *); | 61 | extern struct inode * vxfs_iget(struct super_block *, ino_t); |
62 | extern void vxfs_clear_inode(struct inode *); | 62 | extern void vxfs_clear_inode(struct inode *); |
63 | 63 | ||
64 | /* vxfs_lookup.c */ | 64 | /* vxfs_lookup.c */ |
diff --git a/fs/freevxfs/vxfs_inode.c b/fs/freevxfs/vxfs_inode.c index d1f7c5b5b3c3..ad88d2364bc2 100644 --- a/fs/freevxfs/vxfs_inode.c +++ b/fs/freevxfs/vxfs_inode.c | |||
@@ -129,7 +129,7 @@ fail: | |||
129 | * Description: | 129 | * Description: |
130 | * Search the for inode number @ino in the filesystem | 130 | * Search the for inode number @ino in the filesystem |
131 | * described by @sbp. Use the specified inode table (@ilistp). | 131 | * described by @sbp. Use the specified inode table (@ilistp). |
132 | * Returns the matching VxFS inode on success, else a NULL pointer. | 132 | * Returns the matching VxFS inode on success, else an error code. |
133 | */ | 133 | */ |
134 | static struct vxfs_inode_info * | 134 | static struct vxfs_inode_info * |
135 | __vxfs_iget(ino_t ino, struct inode *ilistp) | 135 | __vxfs_iget(ino_t ino, struct inode *ilistp) |
@@ -157,12 +157,12 @@ __vxfs_iget(ino_t ino, struct inode *ilistp) | |||
157 | } | 157 | } |
158 | 158 | ||
159 | printk(KERN_WARNING "vxfs: error on page %p\n", pp); | 159 | printk(KERN_WARNING "vxfs: error on page %p\n", pp); |
160 | return NULL; | 160 | return ERR_CAST(pp); |
161 | 161 | ||
162 | fail: | 162 | fail: |
163 | printk(KERN_WARNING "vxfs: unable to read inode %ld\n", (unsigned long)ino); | 163 | printk(KERN_WARNING "vxfs: unable to read inode %ld\n", (unsigned long)ino); |
164 | vxfs_put_page(pp); | 164 | vxfs_put_page(pp); |
165 | return NULL; | 165 | return ERR_PTR(-ENOMEM); |
166 | } | 166 | } |
167 | 167 | ||
168 | /** | 168 | /** |
@@ -178,7 +178,10 @@ fail: | |||
178 | struct vxfs_inode_info * | 178 | struct vxfs_inode_info * |
179 | vxfs_stiget(struct super_block *sbp, ino_t ino) | 179 | vxfs_stiget(struct super_block *sbp, ino_t ino) |
180 | { | 180 | { |
181 | return __vxfs_iget(ino, VXFS_SBI(sbp)->vsi_stilist); | 181 | struct vxfs_inode_info *vip; |
182 | |||
183 | vip = __vxfs_iget(ino, VXFS_SBI(sbp)->vsi_stilist); | ||
184 | return IS_ERR(vip) ? NULL : vip; | ||
182 | } | 185 | } |
183 | 186 | ||
184 | /** | 187 | /** |
@@ -282,23 +285,32 @@ vxfs_put_fake_inode(struct inode *ip) | |||
282 | } | 285 | } |
283 | 286 | ||
284 | /** | 287 | /** |
285 | * vxfs_read_inode - fill in inode information | 288 | * vxfs_iget - get an inode |
286 | * @ip: inode pointer to fill | 289 | * @sbp: the superblock to get the inode for |
290 | * @ino: the number of the inode to get | ||
287 | * | 291 | * |
288 | * Description: | 292 | * Description: |
289 | * vxfs_read_inode reads the disk inode for @ip and fills | 293 | * vxfs_read_inode creates an inode, reads the disk inode for @ino and fills |
290 | * in all relevant fields in @ip. | 294 | * in all relevant fields in the new inode. |
291 | */ | 295 | */ |
292 | void | 296 | struct inode * |
293 | vxfs_read_inode(struct inode *ip) | 297 | vxfs_iget(struct super_block *sbp, ino_t ino) |
294 | { | 298 | { |
295 | struct super_block *sbp = ip->i_sb; | ||
296 | struct vxfs_inode_info *vip; | 299 | struct vxfs_inode_info *vip; |
297 | const struct address_space_operations *aops; | 300 | const struct address_space_operations *aops; |
298 | ino_t ino = ip->i_ino; | 301 | struct inode *ip; |
299 | 302 | ||
300 | if (!(vip = __vxfs_iget(ino, VXFS_SBI(sbp)->vsi_ilist))) | 303 | ip = iget_locked(sbp, ino); |
301 | return; | 304 | if (!ip) |
305 | return ERR_PTR(-ENOMEM); | ||
306 | if (!(ip->i_state & I_NEW)) | ||
307 | return ip; | ||
308 | |||
309 | vip = __vxfs_iget(ino, VXFS_SBI(sbp)->vsi_ilist); | ||
310 | if (IS_ERR(vip)) { | ||
311 | iget_failed(ip); | ||
312 | return ERR_CAST(vip); | ||
313 | } | ||
302 | 314 | ||
303 | vxfs_iinit(ip, vip); | 315 | vxfs_iinit(ip, vip); |
304 | 316 | ||
@@ -323,7 +335,8 @@ vxfs_read_inode(struct inode *ip) | |||
323 | } else | 335 | } else |
324 | init_special_inode(ip, ip->i_mode, old_decode_dev(vip->vii_rdev)); | 336 | init_special_inode(ip, ip->i_mode, old_decode_dev(vip->vii_rdev)); |
325 | 337 | ||
326 | return; | 338 | unlock_new_inode(ip); |
339 | return ip; | ||
327 | } | 340 | } |
328 | 341 | ||
329 | /** | 342 | /** |
diff --git a/fs/freevxfs/vxfs_lookup.c b/fs/freevxfs/vxfs_lookup.c index bf86e5444ea6..aee049cb9f84 100644 --- a/fs/freevxfs/vxfs_lookup.c +++ b/fs/freevxfs/vxfs_lookup.c | |||
@@ -213,10 +213,10 @@ vxfs_lookup(struct inode *dip, struct dentry *dp, struct nameidata *nd) | |||
213 | lock_kernel(); | 213 | lock_kernel(); |
214 | ino = vxfs_inode_by_name(dip, dp); | 214 | ino = vxfs_inode_by_name(dip, dp); |
215 | if (ino) { | 215 | if (ino) { |
216 | ip = iget(dip->i_sb, ino); | 216 | ip = vxfs_iget(dip->i_sb, ino); |
217 | if (!ip) { | 217 | if (IS_ERR(ip)) { |
218 | unlock_kernel(); | 218 | unlock_kernel(); |
219 | return ERR_PTR(-EACCES); | 219 | return ERR_CAST(ip); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | unlock_kernel(); | 222 | unlock_kernel(); |
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index 4f95572d2722..1dacda831577 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c | |||
@@ -60,7 +60,6 @@ static int vxfs_statfs(struct dentry *, struct kstatfs *); | |||
60 | static int vxfs_remount(struct super_block *, int *, char *); | 60 | static int vxfs_remount(struct super_block *, int *, char *); |
61 | 61 | ||
62 | static const struct super_operations vxfs_super_ops = { | 62 | static const struct super_operations vxfs_super_ops = { |
63 | .read_inode = vxfs_read_inode, | ||
64 | .clear_inode = vxfs_clear_inode, | 63 | .clear_inode = vxfs_clear_inode, |
65 | .put_super = vxfs_put_super, | 64 | .put_super = vxfs_put_super, |
66 | .statfs = vxfs_statfs, | 65 | .statfs = vxfs_statfs, |
@@ -153,6 +152,7 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) | |||
153 | struct buffer_head *bp = NULL; | 152 | struct buffer_head *bp = NULL; |
154 | u_long bsize; | 153 | u_long bsize; |
155 | struct inode *root; | 154 | struct inode *root; |
155 | int ret = -EINVAL; | ||
156 | 156 | ||
157 | sbp->s_flags |= MS_RDONLY; | 157 | sbp->s_flags |= MS_RDONLY; |
158 | 158 | ||
@@ -219,7 +219,11 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) | |||
219 | } | 219 | } |
220 | 220 | ||
221 | sbp->s_op = &vxfs_super_ops; | 221 | sbp->s_op = &vxfs_super_ops; |
222 | root = iget(sbp, VXFS_ROOT_INO); | 222 | root = vxfs_iget(sbp, VXFS_ROOT_INO); |
223 | if (IS_ERR(root)) { | ||
224 | ret = PTR_ERR(root); | ||
225 | goto out; | ||
226 | } | ||
223 | sbp->s_root = d_alloc_root(root); | 227 | sbp->s_root = d_alloc_root(root); |
224 | if (!sbp->s_root) { | 228 | if (!sbp->s_root) { |
225 | iput(root); | 229 | iput(root); |
@@ -236,7 +240,7 @@ out_free_ilist: | |||
236 | out: | 240 | out: |
237 | brelse(bp); | 241 | brelse(bp); |
238 | kfree(infp); | 242 | kfree(infp); |
239 | return -EINVAL; | 243 | return ret; |
240 | } | 244 | } |
241 | 245 | ||
242 | /* | 246 | /* |