Skip to content

Commit

Permalink
new helper: free_page_put_link()
Browse files Browse the repository at this point in the history
similar to kfree_put_link()

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed May 11, 2015
1 parent 5f2c417 commit ecc087f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
7 changes: 1 addition & 6 deletions fs/configfs/symlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,10 @@ static const char *configfs_follow_link(struct dentry *dentry, void **cookie)
return ERR_PTR(error);
}

static void configfs_put_link(struct inode *unused, void *cookie)
{
free_page((unsigned long)cookie);
}

const struct inode_operations configfs_symlink_inode_operations = {
.follow_link = configfs_follow_link,
.readlink = generic_readlink,
.put_link = configfs_put_link,
.put_link = free_page_put_link,
.setattr = configfs_setattr,
};

7 changes: 1 addition & 6 deletions fs/fuse/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1395,11 +1395,6 @@ static const char *fuse_follow_link(struct dentry *dentry, void **cookie)
return link;
}

static void fuse_put_link(struct inode *unused, void *cookie)
{
free_page((unsigned long) cookie);
}

static int fuse_dir_open(struct inode *inode, struct file *file)
{
return fuse_open_common(inode, file, true);
Expand Down Expand Up @@ -1915,7 +1910,7 @@ static const struct inode_operations fuse_common_inode_operations = {
static const struct inode_operations fuse_symlink_inode_operations = {
.setattr = fuse_setattr,
.follow_link = fuse_follow_link,
.put_link = fuse_put_link,
.put_link = free_page_put_link,
.readlink = generic_readlink,
.getattr = fuse_getattr,
.setxattr = fuse_setxattr,
Expand Down
7 changes: 1 addition & 6 deletions fs/kernfs/symlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,14 @@ static const char *kernfs_iop_follow_link(struct dentry *dentry, void **cookie)
return *cookie = (char *)page;
}

static void kernfs_iop_put_link(struct inode *unused, void *cookie)
{
free_page((unsigned long)cookie);
}

const struct inode_operations kernfs_symlink_iops = {
.setxattr = kernfs_iop_setxattr,
.removexattr = kernfs_iop_removexattr,
.getxattr = kernfs_iop_getxattr,
.listxattr = kernfs_iop_listxattr,
.readlink = generic_readlink,
.follow_link = kernfs_iop_follow_link,
.put_link = kernfs_iop_put_link,
.put_link = free_page_put_link,
.setattr = kernfs_iop_setattr,
.getattr = kernfs_iop_getattr,
.permission = kernfs_iop_permission,
Expand Down
6 changes: 6 additions & 0 deletions fs/libfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,12 @@ void kfree_put_link(struct inode *unused, void *cookie)
}
EXPORT_SYMBOL(kfree_put_link);

void free_page_put_link(struct inode *unused, void *cookie)
{
free_page((unsigned long) cookie);
}
EXPORT_SYMBOL(free_page_put_link);

/*
* nop .set_page_dirty method so that people can use .page_mkwrite on
* anon inodes.
Expand Down
1 change: 1 addition & 0 deletions include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2712,6 +2712,7 @@ extern int __page_symlink(struct inode *inode, const char *symname, int len,
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 inode *, void *);
extern void free_page_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

0 comments on commit ecc087f

Please sign in to comment.