From: David Howells <dhowells@redhat.com>
To: hch@infradead.org, viro@ftp.linux.org.uk, torvalds@osdl.org,
akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
dhowells@redhat.com
Subject: [PATCH 04/30] IGET: Mark iget() and read_inode() as being obsolete
Date: Mon, 01 Oct 2007 14:09:42 +0100 [thread overview]
Message-ID: <20071001130942.29339.21757.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <20071001130921.29339.72876.stgit@warthog.procyon.org.uk>
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;
}
Signed-off-by: David Howells <dhowells@redhat.com>
---
Documentation/filesystems/Exporting | 5 -----
Documentation/filesystems/Locking | 3 ---
Documentation/filesystems/vfs.txt | 16 +++++-----------
fs/inode.c | 16 ++++++++++++++++
include/linux/fs.h | 16 +++-------------
5 files changed, 24 insertions(+), 32 deletions(-)
diff --git a/Documentation/filesystems/Exporting b/Documentation/filesystems/Exporting
index 31047e0..22ce3b2 100644
--- a/Documentation/filesystems/Exporting
+++ b/Documentation/filesystems/Exporting
@@ -144,11 +144,6 @@ filesystem:
decode_fh passes two datums through find_exported_dentry. One that
should be used to identify the target object, and one that can be
used to identify the object's parent, should that be necessary.
- The default get_dentry function assumes that the datum contains an
- inode number and a generation number, and it attempts to get the
- inode using "iget" and check it's validity by matching the
- generation number. A filesystem should only depend on the default
- if iget can safely be used this way.
If decode_fh and/or encode_fh are left as NULL, then default
implementations are used. These defaults are suitable for ext2 and
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index f0f8258..d155893 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -90,7 +90,6 @@ of the locking scheme for directory operations.
prototypes:
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 *);
@@ -114,7 +113,6 @@ locking rules:
BKL s_lock s_umount
alloc_inode: no no no
destroy_inode: no
-read_inode: no (see below)
dirty_inode: no (must not sleep)
write_inode: no
put_inode: no
@@ -133,7 +131,6 @@ show_options: no (vfsmount->sem)
quota_read: no no no (see below)
quota_write: no no no (see below)
-->read_inode() is not a method - it's a callback used in iget().
->remount_fs() will have the s_umount lock if it's already mounted.
When called from get_sb_single, it does NOT have the s_umount lock.
->quota_read() and ->quota_write() functions are both guaranteed to
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 045f3e0..63c7e91 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -242,14 +242,8 @@ or bottom half).
->alloc_inode was defined and simply undoes anything done by
->alloc_inode.
- read_inode: this method is called to read a specific inode from the
- mounted filesystem. The i_ino member in the struct inode is
- initialized by the VFS to indicate which inode to read. Other
- members are filled in by this method.
-
- You can set this to NULL and use iget5_locked() instead of iget()
- to read inodes. This is necessary for filesystems for which the
- inode number is not sufficient to identify an 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.
@@ -308,9 +302,9 @@ or bottom half).
quota_write: called by the VFS to write to filesystem quota file.
-The read_inode() method is responsible for filling in the "i_op"
-field. This is a pointer to a "struct inode_operations" which
-describes the methods that can be performed on individual inodes.
+Whoever sets up the inode is responsible for filling in the "i_op" field. This
+is a pointer to a "struct inode_operations" which describes the methods that
+can be performed on individual inodes.
The Inode Object
diff --git a/fs/inode.c b/fs/inode.c
index 29f5068..f78db20 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1427,3 +1427,19 @@ 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 c24d433..dfa07d2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1181,7 +1181,7 @@ struct super_operations {
struct inode *(*alloc_inode)(struct super_block *sb);
void (*destroy_inode)(struct inode *);
- void (*read_inode) (struct inode *);
+ void (*read_inode) (struct inode *) __deprecated;
void (*dirty_inode) (struct inode *);
int (*write_inode) (struct inode *, int);
@@ -1618,18 +1618,8 @@ 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 *);
-static inline 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;
-}
-
+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 *);
next prev parent reply other threads:[~2007-10-01 13:09 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-01 13:09 [PATCH 00/30] Remove iget() and read_inode() David Howells
2007-10-01 13:09 ` [PATCH 01/30] IGET: Introduce a function to register iget failure David Howells
2007-10-01 13:09 ` [PATCH 02/30] IGET: Use iget_failed() in AFS David Howells
2007-10-01 13:09 ` [PATCH 03/30] IGET: Use iget_failed() in GFS2 David Howells
2007-10-01 13:09 ` David Howells [this message]
2007-10-01 13:09 ` [PATCH 05/30] IGET: Stop AFFS from using iget() and read_inode() David Howells
2007-10-01 13:09 ` [PATCH 06/30] IGET: Stop autofs " David Howells
2007-10-01 13:09 ` [PATCH 07/30] IGET: Stop BEFS " David Howells
2007-10-01 17:39 ` Zach Brown
2007-10-01 17:44 ` Linus Torvalds
2007-10-01 18:06 ` Christoph Hellwig
2007-10-01 18:18 ` Zach Brown
2007-10-01 18:19 ` Linus Torvalds
2007-10-02 12:32 ` David Howells
2007-10-02 13:02 ` Dave Kleikamp
2007-10-02 13:24 ` David Howells
2007-10-02 14:16 ` Dave Kleikamp
2007-10-01 13:10 ` [PATCH 08/30] IGET: Stop BFS " David Howells
2007-10-01 13:10 ` [PATCH 09/30] IGET: Stop CIFS " David Howells
2007-10-01 13:10 ` [PATCH 10/30] IGET: Stop EFS " David Howells
2007-10-01 13:10 ` [PATCH 11/30] IGET: Stop EXT2 " David Howells
2007-10-02 10:06 ` Jan Kara
2007-10-02 12:58 ` David Howells
2007-10-01 13:10 ` [PATCH 12/30] IGET: Stop EXT3 " David Howells
2007-10-02 10:24 ` Jan Kara
2007-10-02 10:28 ` Jan Kara
2007-10-02 13:16 ` David Howells
2007-10-01 13:10 ` [PATCH 13/30] IGET: Stop EXT4 " David Howells
2007-10-02 12:26 ` Jan Kara
2007-10-02 13:37 ` David Howells
2007-10-01 13:10 ` [PATCH 14/30] IGET: Stop FAT " David Howells
2007-10-01 13:10 ` [PATCH 15/30] IGET: Stop FreeVXFS " David Howells
2007-10-01 13:10 ` [PATCH 16/30] IGET: Stop FUSE " David Howells
2007-10-01 13:10 ` [PATCH 17/30] IGET: Stop HFSPLUS " David Howells
2007-10-01 13:10 ` [PATCH 18/30] IGET: Stop ISOFS from using read_inode() David Howells
2007-10-01 13:10 ` [PATCH 19/30] IGET: Stop JFFS2 from using iget() and read_inode() David Howells
2007-10-01 13:11 ` [PATCH 20/30] IGET: Stop JFS " David Howells
2007-10-01 18:44 ` Dave Kleikamp
2007-10-01 13:11 ` [PATCH 21/30] IGET: Stop the MINIX filesystem " David Howells
2007-10-01 13:11 ` [PATCH 22/30] IGET: Stop PROCFS " David Howells
2007-10-01 13:11 ` [PATCH 23/30] IGET: Stop QNX4 " David Howells
2007-10-01 13:11 ` [PATCH 24/30] IGET: Stop ROMFS " David Howells
2007-10-01 13:11 ` [PATCH 25/30] IGET: Stop the SYSV filesystem " David Howells
2007-10-01 13:11 ` [PATCH 26/30] IGET: Stop UFS " David Howells
2007-10-01 13:11 ` [PATCH 27/30] IGET: Stop OPENPROMFS " David Howells
2007-10-01 13:11 ` [PATCH 28/30] IGET: Stop HOSTFS " David Howells
2007-10-01 13:11 ` [PATCH 29/30] IGET: Stop HPPFS " David Howells
2007-10-01 13:11 ` [PATCH 30/30] IGET: Remove iget() and the read_inode() super op as being obsolete David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071001130942.29339.21757.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=akpm@osdl.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=viro@ftp.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).