aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-02-07 03:15:52 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:29 -0500
commit12debc4248a4a7f1873e47cda2cdd7faca80b099 (patch)
tree1ad80b77d213ea09cb746d6e4d50c4316462a452 /include/linux/fs.h
parent755aedc15900ff7d83dd046f632af9a680b0c28f (diff)
iget: remove iget() and the read_inode() super op as being obsolete
Remove the old iget() call and the read_inode() superblock operation it uses as these are really obsolete, and the use of read_inode() does not produce proper error handling (no distinction between ENOMEM and EIO when marking an inode bad). Furthermore, this removes the temptation to use iget() to find an inode by number in a filesystem from code outside that filesystem. iget_locked() should be used instead. A new function is added in an earlier patch (iget_failed) that is to be called to mark an inode as bad, unlock it and release it should the get routine fail. Mark iget() and read_inode() as being obsolete and remove references to them from the documentation. Typically a filesystem will be modified such that the read_inode function becomes an internal iget function, for example the following: void thingyfs_read_inode(struct inode *inode) { ... } would be changed into something like: struct inode *thingyfs_iget(struct super_block *sp, unsigned long ino) { struct inode *inode; int ret; inode = iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); if (!(inode->i_state & I_NEW)) return inode; ... unlock_new_inode(inode); return inode; error: iget_failed(inode); return ERR_PTR(ret); } and then thingyfs_iget() would be called rather than iget(), for example: ret = -EINVAL; inode = iget(sb, ino); if (!inode || is_bad_inode(inode)) goto error; becomes: inode = thingyfs_iget(sb, ino); if (IS_ERR(inode)) { ret = PTR_ERR(inode); goto error; } Note that is_bad_inode() does not need to be called. The error returned by thingyfs_iget() should render it unnecessary. 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 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h14
1 files changed, 0 insertions, 14 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d202600d36bd..36b7abefacbe 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1241,8 +1241,6 @@ struct super_operations {
1241 struct inode *(*alloc_inode)(struct super_block *sb); 1241 struct inode *(*alloc_inode)(struct super_block *sb);
1242 void (*destroy_inode)(struct inode *); 1242 void (*destroy_inode)(struct inode *);
1243 1243
1244 void (*read_inode) (struct inode *);
1245
1246 void (*dirty_inode) (struct inode *); 1244 void (*dirty_inode) (struct inode *);
1247 int (*write_inode) (struct inode *, int); 1245 int (*write_inode) (struct inode *, int);
1248 void (*put_inode) (struct inode *); 1246 void (*put_inode) (struct inode *);
@@ -1767,18 +1765,6 @@ extern struct inode * iget5_locked(struct super_block *, unsigned long, int (*te
1767extern struct inode * iget_locked(struct super_block *, unsigned long); 1765extern struct inode * iget_locked(struct super_block *, unsigned long);
1768extern void unlock_new_inode(struct inode *); 1766extern void unlock_new_inode(struct inode *);
1769 1767
1770static inline struct inode *iget(struct super_block *sb, unsigned long ino)
1771{
1772 struct inode *inode = iget_locked(sb, ino);
1773
1774 if (inode && (inode->i_state & I_NEW)) {
1775 sb->s_op->read_inode(inode);
1776 unlock_new_inode(inode);
1777 }
1778
1779 return inode;
1780}
1781
1782extern void __iget(struct inode * inode); 1768extern void __iget(struct inode * inode);
1783extern void iget_failed(struct inode *); 1769extern void iget_failed(struct inode *);
1784extern void clear_inode(struct inode *); 1770extern void clear_inode(struct inode *);