From c4d30967f3020cda9df9ee22af79cd1f2c284244 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 27 Feb 2013 22:51:08 -0500 Subject: 9p: turn fid->dlist into hlist Signed-off-by: Al Viro --- include/net/9p/client.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/9p/client.h b/include/net/9p/client.h index 5ff70f433e87..4c7c01a73911 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h @@ -192,7 +192,7 @@ struct p9_fid { void *rdir; struct list_head flist; - struct list_head dlist; /* list of all fids attached to a dentry */ + struct hlist_node dlist; /* list of all fids attached to a dentry */ }; /** -- cgit v1.2.3 From dd37978c50bc8b354e5c4633f69387f16572fdac Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 1 Mar 2013 19:48:30 -0500 Subject: 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 --- fs/file_table.c | 2 ++ fs/open.c | 3 ++- include/linux/fs.h | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/fs/file_table.c b/fs/file_table.c index aa07d3684a2e..cd4d87a82951 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -176,6 +176,7 @@ struct file *alloc_file(struct path *path, fmode_t mode, return file; file->f_path = *path; + file->f_inode = path->dentry->d_inode; file->f_mapping = path->dentry->d_inode->i_mapping; file->f_mode = mode; file->f_op = fop; @@ -258,6 +259,7 @@ static void __fput(struct file *file) drop_file_write_access(file); file->f_path.dentry = NULL; file->f_path.mnt = NULL; + file->f_inode = NULL; file_free(file); dput(dentry); mntput(mnt); diff --git a/fs/open.c b/fs/open.c index 62f907e3bc36..806d4589559f 100644 --- a/fs/open.c +++ b/fs/open.c @@ -689,7 +689,7 @@ static int do_dentry_open(struct file *f, f->f_mode = FMODE_PATH; path_get(&f->f_path); - inode = file_inode(f); + inode = f->f_inode = f->f_path.dentry->d_inode; if (f->f_mode & FMODE_WRITE) { error = __get_file_write_access(inode, f->f_path.mnt); if (error) @@ -752,6 +752,7 @@ cleanup_file: path_put(&f->f_path); f->f_path.mnt = NULL; f->f_path.dentry = NULL; + f->f_inode = NULL; return error; } diff --git a/include/linux/fs.h b/include/linux/fs.h index 4e686a099465..74a907b8b950 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -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; } /* -- cgit v1.2.3 From dcf787f39162ce32ca325b3e784aba2d2444619a Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 1 Mar 2013 23:51:07 -0500 Subject: constify path_get/path_put and fs_struct.c stuff Signed-off-by: Al Viro --- fs/fs_struct.c | 6 +++--- fs/internal.h | 2 +- fs/namei.c | 4 ++-- include/linux/fs_struct.h | 4 ++-- include/linux/path.h | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/fs/fs_struct.c b/fs/fs_struct.c index fe6ca583bbc0..d8ac61d0c932 100644 --- a/fs/fs_struct.c +++ b/fs/fs_struct.c @@ -10,7 +10,7 @@ * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values. * It can block. */ -void set_fs_root(struct fs_struct *fs, struct path *path) +void set_fs_root(struct fs_struct *fs, const struct path *path) { struct path old_root; @@ -29,7 +29,7 @@ void set_fs_root(struct fs_struct *fs, struct path *path) * Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values. * It can block. */ -void set_fs_pwd(struct fs_struct *fs, struct path *path) +void set_fs_pwd(struct fs_struct *fs, const struct path *path) { struct path old_pwd; @@ -53,7 +53,7 @@ static inline int replace_path(struct path *p, const struct path *old, const str return 1; } -void chroot_fs_refs(struct path *old_root, struct path *new_root) +void chroot_fs_refs(const struct path *old_root, const struct path *new_root) { struct task_struct *g, *p; struct fs_struct *fs; diff --git a/fs/internal.h b/fs/internal.h index 2f6af7f645eb..507141fceb99 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -69,7 +69,7 @@ extern void __mnt_drop_write_file(struct file *); /* * fs_struct.c */ -extern void chroot_fs_refs(struct path *, struct path *); +extern void chroot_fs_refs(const struct path *, const struct path *); /* * file_table.c diff --git a/fs/namei.c b/fs/namei.c index dc984fee5532..961bc1268366 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -451,7 +451,7 @@ int inode_permission(struct inode *inode, int mask) * * Given a path increment the reference count to the dentry and the vfsmount. */ -void path_get(struct path *path) +void path_get(const struct path *path) { mntget(path->mnt); dget(path->dentry); @@ -464,7 +464,7 @@ EXPORT_SYMBOL(path_get); * * Given a path decrement the reference count to the dentry and the vfsmount. */ -void path_put(struct path *path) +void path_put(const struct path *path) { dput(path->dentry); mntput(path->mnt); diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h index d0ae3a84bcfb..729eded4b24f 100644 --- a/include/linux/fs_struct.h +++ b/include/linux/fs_struct.h @@ -17,8 +17,8 @@ struct fs_struct { extern struct kmem_cache *fs_cachep; extern void exit_fs(struct task_struct *); -extern void set_fs_root(struct fs_struct *, struct path *); -extern void set_fs_pwd(struct fs_struct *, struct path *); +extern void set_fs_root(struct fs_struct *, const struct path *); +extern void set_fs_pwd(struct fs_struct *, const struct path *); extern struct fs_struct *copy_fs_struct(struct fs_struct *); extern void free_fs_struct(struct fs_struct *); extern int unshare_fs_struct(void); diff --git a/include/linux/path.h b/include/linux/path.h index edc98dec6266..d1372186f431 100644 --- a/include/linux/path.h +++ b/include/linux/path.h @@ -9,8 +9,8 @@ struct path { struct dentry *dentry; }; -extern void path_get(struct path *); -extern void path_put(struct path *); +extern void path_get(const struct path *); +extern void path_put(const struct path *); static inline int path_equal(const struct path *path1, const struct path *path2) { -- cgit v1.2.3