new helper: free_page_put_link()
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 7 May 2015 15:19:14 +0000 (11:19 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 11 May 2015 12:13:13 +0000 (08:13 -0400)
similar to kfree_put_link()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/configfs/symlink.c
fs/fuse/dir.c
fs/kernfs/symlink.c
fs/libfs.c
include/linux/fs.h

index bc464c26e00eb1c6ee4b92ea2ee37d2938edd7cf..ec5c8325b503d1a1602863769ae43c067d13a047 100644 (file)
@@ -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,
 };
 
index 9e704c1243922847b6ec8b631bcfd2ebcf915cb7..5e2e08712d3ba614a46687d5688fc2f01cd835be 100644 (file)
@@ -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);
@@ -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,
index f6aa2e5a76b4021ad8489de7b984a108158d555b..db272528ab5bb01c192b5502650f29e0784663ce 100644 (file)
@@ -126,11 +126,6 @@ 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,
@@ -138,7 +133,7 @@ const struct inode_operations kernfs_symlink_iops = {
        .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,
index 01c337b0fec8b235a7b93bcaa7bb191afdf1de07..65e1feca8b982c55bff37e5a85529f8cb0d4121e 100644 (file)
@@ -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.
index f21e3328f9915346d05a835c0b1ab5f10872b71e..8f738512c8746961b12edb46fb7060bc365b5b73 100644 (file)
@@ -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);