Skip to content

Commit

Permalink
switch ->put_link() from dentry to inode
Browse files Browse the repository at this point in the history
only one instance looks at that argument at all; that sole
exception wants inode rather than dentry.

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed May 11, 2015
1 parent bda0be7 commit 5f2c417
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Documentation/filesystems/Locking
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ prototypes:
struct inode *, struct dentry *, unsigned int);
int (*readlink) (struct dentry *, char __user *,int);
const char *(*follow_link) (struct dentry *, void **);
void (*put_link) (struct dentry *, void *);
void (*put_link) (struct inode *, void *);
void (*truncate) (struct inode *);
int (*permission) (struct inode *, int, unsigned int);
int (*get_acl)(struct inode *, int);
Expand Down
2 changes: 1 addition & 1 deletion Documentation/filesystems/vfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ struct inode_operations {
struct inode *, struct dentry *, unsigned int);
int (*readlink) (struct dentry *, char __user *,int);
const char *(*follow_link) (struct dentry *, void **);
void (*put_link) (struct dentry *, void *);
void (*put_link) (struct inode *, void *);
int (*permission) (struct inode *, int);
int (*get_acl)(struct inode *, int);
int (*setattr) (struct dentry *, struct iattr *);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/lustre/lustre/llite/symlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static const char *ll_follow_link(struct dentry *dentry, void **cookie)
return symname;
}

static void ll_put_link(struct dentry *dentry, void *cookie)
static void ll_put_link(struct inode *unused, void *cookie)
{
ptlrpc_req_finished(cookie);
}
Expand Down
2 changes: 1 addition & 1 deletion fs/configfs/symlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ static const char *configfs_follow_link(struct dentry *dentry, void **cookie)
return ERR_PTR(error);
}

static void configfs_put_link(struct dentry *dentry, void *cookie)
static void configfs_put_link(struct inode *unused, void *cookie)
{
free_page((unsigned long)cookie);
}
Expand Down
2 changes: 1 addition & 1 deletion fs/f2fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ static const char *f2fs_follow_link(struct dentry *dentry, void **cookie)
const char *link = page_follow_link_light(dentry, cookie);
if (!IS_ERR(link) && !*link) {
/* this is broken symlink case */
page_put_link(dentry, *cookie);
page_put_link(NULL, *cookie);
link = ERR_PTR(-ENOENT);
}
return link;
Expand Down
2 changes: 1 addition & 1 deletion fs/fuse/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ static const char *fuse_follow_link(struct dentry *dentry, void **cookie)
return link;
}

static void fuse_put_link(struct dentry *dentry, void *cookie)
static void fuse_put_link(struct inode *unused, void *cookie)
{
free_page((unsigned long) cookie);
}
Expand Down
2 changes: 1 addition & 1 deletion fs/hostfs/hostfs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ static const char *hostfs_follow_link(struct dentry *dentry, void **cookie)
return *cookie = link;
}

static void hostfs_put_link(struct dentry *dentry, void *cookie)
static void hostfs_put_link(struct inode *unused, void *cookie)
{
__putname(cookie);
}
Expand Down
8 changes: 4 additions & 4 deletions fs/hppfs/hppfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,12 @@ static const char *hppfs_follow_link(struct dentry *dentry, void **cookie)
return d_inode(proc_dentry)->i_op->follow_link(proc_dentry, cookie);
}

static void hppfs_put_link(struct dentry *dentry, void *cookie)
static void hppfs_put_link(struct inode *inode, void *cookie)
{
struct dentry *proc_dentry = HPPFS_I(d_inode(dentry))->proc_dentry;
struct inode *proc_inode = d_inode(HPPFS_I(inode)->proc_dentry);

if (d_inode(proc_dentry)->i_op->put_link)
d_inode(proc_dentry)->i_op->put_link(proc_dentry, cookie);
if (proc_inode->i_op->put_link)
proc_inode->i_op->put_link(proc_inode, cookie);
}

static const struct inode_operations hppfs_dir_iops = {
Expand Down
2 changes: 1 addition & 1 deletion fs/kernfs/symlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static const char *kernfs_iop_follow_link(struct dentry *dentry, void **cookie)
return *cookie = (char *)page;
}

static void kernfs_iop_put_link(struct dentry *dentry, void *cookie)
static void kernfs_iop_put_link(struct inode *unused, void *cookie)
{
free_page((unsigned long)cookie);
}
Expand Down
2 changes: 1 addition & 1 deletion fs/libfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ int noop_fsync(struct file *file, loff_t start, loff_t end, int datasync)
}
EXPORT_SYMBOL(noop_fsync);

void kfree_put_link(struct dentry *dentry, void *cookie)
void kfree_put_link(struct inode *unused, void *cookie)
{
kfree(cookie);
}
Expand Down
13 changes: 7 additions & 6 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ static inline void put_link(struct nameidata *nd)
struct saved *last = nd->stack + --nd->depth;
struct inode *inode = last->inode;
if (last->cookie && inode->i_op->put_link)
inode->i_op->put_link(last->link.dentry, last->cookie);
inode->i_op->put_link(inode, last->cookie);
path_put(&last->link);
}

Expand Down Expand Up @@ -4444,17 +4444,18 @@ EXPORT_SYMBOL(readlink_copy);
int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen)
{
void *cookie;
const char *link = dentry->d_inode->i_link;
struct inode *inode = d_inode(dentry);
const char *link = inode->i_link;
int res;

if (!link) {
link = dentry->d_inode->i_op->follow_link(dentry, &cookie);
link = inode->i_op->follow_link(dentry, &cookie);
if (IS_ERR(link))
return PTR_ERR(link);
}
res = readlink_copy(buffer, buflen, link);
if (dentry->d_inode->i_op->put_link)
dentry->d_inode->i_op->put_link(dentry, cookie);
if (inode->i_op->put_link)
inode->i_op->put_link(inode, cookie);
return res;
}
EXPORT_SYMBOL(generic_readlink);
Expand Down Expand Up @@ -4496,7 +4497,7 @@ const char *page_follow_link_light(struct dentry *dentry, void **cookie)
}
EXPORT_SYMBOL(page_follow_link_light);

void page_put_link(struct dentry *dentry, void *cookie)
void page_put_link(struct inode *unused, void *cookie)
{
struct page *page = cookie;
kunmap(page);
Expand Down
4 changes: 2 additions & 2 deletions fs/overlayfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static const char *ovl_follow_link(struct dentry *dentry, void **cookie)
return ret;
}

static void ovl_put_link(struct dentry *dentry, void *c)
static void ovl_put_link(struct inode *unused, void *c)
{
struct inode *realinode;
struct ovl_link_data *data = c;
Expand All @@ -183,7 +183,7 @@ static void ovl_put_link(struct dentry *dentry, void *c)
return;

realinode = data->realdentry->d_inode;
realinode->i_op->put_link(data->realdentry, data->cookie);
realinode->i_op->put_link(realinode, data->cookie);
kfree(data);
}

Expand Down
2 changes: 1 addition & 1 deletion fs/proc/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ static const char *proc_follow_link(struct dentry *dentry, void **cookie)
return pde->data;
}

static void proc_put_link(struct dentry *dentry, void *p)
static void proc_put_link(struct inode *unused, void *p)
{
unuse_pde(p);
}
Expand Down
6 changes: 3 additions & 3 deletions include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,7 @@ struct inode_operations {
struct posix_acl * (*get_acl)(struct inode *, int);

int (*readlink) (struct dentry *, char __user *,int);
void (*put_link) (struct dentry *, void *);
void (*put_link) (struct inode *, void *);

int (*create) (struct inode *,struct dentry *, umode_t, bool);
int (*link) (struct dentry *,struct inode *,struct dentry *);
Expand Down Expand Up @@ -2706,12 +2706,12 @@ extern const struct file_operations generic_ro_fops;
extern int readlink_copy(char __user *, int, const char *);
extern int page_readlink(struct dentry *, char __user *, int);
extern const char *page_follow_link_light(struct dentry *, void **);
extern void page_put_link(struct dentry *, void *);
extern void page_put_link(struct inode *, void *);
extern int __page_symlink(struct inode *inode, const char *symname, int len,
int nofs);
extern int page_symlink(struct inode *inode, const char *symname, int len);
extern const struct inode_operations page_symlink_inode_operations;
extern void kfree_put_link(struct dentry *, void *);
extern void kfree_put_link(struct inode *, void *);
extern int generic_readlink(struct dentry *, char __user *, int);
extern void generic_fillattr(struct inode *, struct kstat *);
int vfs_getattr_nosec(struct path *path, struct kstat *stat);
Expand Down
2 changes: 1 addition & 1 deletion mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -2486,7 +2486,7 @@ static const char *shmem_follow_link(struct dentry *dentry, void **cookie)
return kmap(page);
}

static void shmem_put_link(struct dentry *dentry, void *cookie)
static void shmem_put_link(struct inode *unused, void *cookie)
{
struct page *page = cookie;
kunmap(page);
Expand Down

0 comments on commit 5f2c417

Please sign in to comment.