aboutsummaryrefslogtreecommitdiffstats
path: root/fs/freevxfs/vxfs_inode.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-02-07 03:15:39 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:28 -0500
commitd0b079483dd4cf6373f0ff234d5fdaef80c9588f (patch)
tree8f222250ca750d370238b07111ec4f7ddc989a9c /fs/freevxfs/vxfs_inode.c
parent17f95a7b4416a2c61e35f51b29eaaf1818fb5d7d (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>
Diffstat (limited to 'fs/freevxfs/vxfs_inode.c')
-rw-r--r--fs/freevxfs/vxfs_inode.c45
1 files changed, 29 insertions, 16 deletions
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 */
134static struct vxfs_inode_info * 134static 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
162fail: 162fail:
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:
178struct vxfs_inode_info * 178struct vxfs_inode_info *
179vxfs_stiget(struct super_block *sbp, ino_t ino) 179vxfs_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 */
292void 296struct inode *
293vxfs_read_inode(struct inode *ip) 297vxfs_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/**