cache the value of file_inode() in struct file
Note that this thing does *not* contribute to inode refcount; it's pinned down by dentry. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -769,6 +769,7 @@ struct file {
|
||||
} f_u;
|
||||
struct path f_path;
|
||||
#define f_dentry f_path.dentry
|
||||
struct inode *f_inode; /* cached value */
|
||||
const struct file_operations *f_op;
|
||||
|
||||
/*
|
||||
@@ -2217,7 +2218,7 @@ static inline bool execute_ok(struct inode *inode)
|
||||
|
||||
static inline struct inode *file_inode(struct file *f)
|
||||
{
|
||||
return f->f_path.dentry->d_inode;
|
||||
return f->f_inode;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user