[PATCH 32/32] IGET: Remove iget() and the read_inode() super op as being obsolete [try #2]

David Howells
2007-10-04T16:09:30Z

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 (iget_failed)
that is to be called to mark an inode as bad, unlock it and release it should
the get routine fail.

Signed-off-by: David Howells <dhowells@redhat.com>
---

Documentation/filesystems/porting | 4 ++--
Documentation/filesystems/vfs.txt | 5 -----
fs/inode.c | 16 ----------------
include/linux/fs.h | 4 ----
4 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index 3b0fb22..c20eae9 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -34,8 +34,8 @@ FOO_I(inode) (see in-tree filesystems for examples).

Make them ->alloc_inode and ->destroy_inode in your super_operations.

-Keep in mind that now you need explicit initialization of private data -
-typically in ->read_inode() and after getting an inode from new_inode().
+Keep in mind that now you need explicit initialization of private data
+typically between calling iget_locked() and calling unlocking the inode.

At some point that will become mandatory.

diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 63c7e91..133bc88 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -203,8 +203,6 @@ struct super_operations {
struct inode *(*alloc_inode)(struct super_block *sb);
void (*destroy_inode)(struct inode *);

- void (*read_inode) (struct inode *);
-
void (*dirty_inode) (struct inode *);
int (*write_inode) (struct inode *, int);
void (*put_inode) (struct inode *);
@@ -242,9 +240,6 @@ or bottom half).
->alloc_inode was defined and simply undoes anything done by
->alloc_inode.

- read_inode: deprecated, do not use. Use iget_locked() instead of iget() and
- return a proper error value.
-
dirty_inode: this method is called by the VFS to mark an inode dirty.

write_inode: this method is called when the VFS needs to write an
diff --git a/fs/inode.c b/fs/inode.c
index f78db20..29f5068 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1427,19 +1427,3 @@ void init_special_inode(struct inode *inode, umode_t mode, dev_t rdev)
mode);
}
EXPORT_SYMBOL(init_special_inode);
-
-/*
- * old deprecated inode creator
- */
-struct inode *iget(struct super_block *sb, unsigned long ino)
-{
- struct inode *inode = iget_locked(sb, ino);
-
- if (inode && (inode->i_state & I_NEW)) {
- sb->s_op->read_inode(inode);
- unlock_new_inode(inode);
- }
-
- return inode;
-}
-EXPORT_SYMBOL(iget);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index dfa07d2..42aabc1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1181,8 +1181,6 @@ struct super_operations {
struct inode *(*alloc_inode)(struct super_block *sb);
void (*destroy_inode)(struct inode *);

- void (*read_inode) (struct inode *) __deprecated;
-
void (*dirty_inode) (struct inode *);
int (*write_inode) (struct inode *, int);
void (*put_inode) (struct inode *);
@@ -1618,8 +1616,6 @@ extern struct inode * iget5_locked(struct super_block *, unsigned long, int (*te
extern struct inode * iget_locked(struct super_block *, unsigned long);
extern void unlock_new_inode(struct inode *);

-extern struct inode *iget(struct super_block *sb, unsigned long ino)
- __deprecated;
extern void __iget(struct inode * inode);
extern void iget_failed(struct inode *);
extern void clear_inode(struct inode *);