Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

Al Viro dd37978c 5e608671

+6 -2
+2
fs/file_table.c
··· 176 176 return file; 177 177 178 178 file->f_path = *path; 179 + file->f_inode = path->dentry->d_inode; 179 180 file->f_mapping = path->dentry->d_inode->i_mapping; 180 181 file->f_mode = mode; 181 182 file->f_op = fop; ··· 259 258 drop_file_write_access(file); 260 259 file->f_path.dentry = NULL; 261 260 file->f_path.mnt = NULL; 261 + file->f_inode = NULL; 262 262 file_free(file); 263 263 dput(dentry); 264 264 mntput(mnt);
+2 -1
fs/open.c
··· 689 689 f->f_mode = FMODE_PATH; 690 690 691 691 path_get(&f->f_path); 692 - inode = file_inode(f); 692 + inode = f->f_inode = f->f_path.dentry->d_inode; 693 693 if (f->f_mode & FMODE_WRITE) { 694 694 error = __get_file_write_access(inode, f->f_path.mnt); 695 695 if (error) ··· 752 752 path_put(&f->f_path); 753 753 f->f_path.mnt = NULL; 754 754 f->f_path.dentry = NULL; 755 + f->f_inode = NULL; 755 756 return error; 756 757 } 757 758
+2 -1
include/linux/fs.h
··· 769 769 } f_u; 770 770 struct path f_path; 771 771 #define f_dentry f_path.dentry 772 + struct inode *f_inode; /* cached value */ 772 773 const struct file_operations *f_op; 773 774 774 775 /* ··· 2218 2217 2219 2218 static inline struct inode *file_inode(struct file *f) 2220 2219 { 2221 - return f->f_path.dentry->d_inode; 2220 + return f->f_inode; 2222 2221 } 2223 2222 2224 2223 /*