kill free_page_put_link()
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 29 Dec 2015 21:03:53 +0000 (16:03 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 29 Dec 2015 21:03:53 +0000 (16:03 -0500)
all callers are better off with 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 b91c01ebb688fba60ec3cfbf71a7b7330e8a726a..e9de962e518daed223abb885af1367b5c7093bdb 100644 (file)
@@ -282,29 +282,29 @@ static int configfs_getlink(struct dentry *dentry, char * path)
 static const char *configfs_get_link(struct dentry *dentry,
                                     struct inode *inode, void **cookie)
 {
-       unsigned long page;
+       char *page;
        int error;
 
        if (!dentry)
                return ERR_PTR(-ECHILD);
 
-       page = get_zeroed_page(GFP_KERNEL);
+       page = kzalloc(PAGE_SIZE, GFP_KERNEL);
        if (!page)
                return ERR_PTR(-ENOMEM);
 
-       error = configfs_getlink(dentry, (char *)page);
+       error = configfs_getlink(dentry, page);
        if (!error) {
-               return *cookie = (void *)page;
+               return *cookie = page;
        }
 
-       free_page(page);
+       kfree(page);
        return ERR_PTR(error);
 }
 
 const struct inode_operations configfs_symlink_inode_operations = {
        .get_link = configfs_get_link,
        .readlink = generic_readlink,
-       .put_link = free_page_put_link,
+       .put_link = kfree_put_link,
        .setattr = configfs_setattr,
 };
 
index 148e8ef7c5418ec0a66d941664da7e5bdc8c7065..def0a4d082bc182fd07a9589af5675c1131af1de 100644 (file)
@@ -1376,7 +1376,7 @@ static const char *fuse_get_link(struct dentry *dentry,
        if (!dentry)
                return ERR_PTR(-ECHILD);
 
-       link = (char *) __get_free_page(GFP_KERNEL);
+       link = kmalloc(PAGE_SIZE, GFP_KERNEL);
        if (!link)
                return ERR_PTR(-ENOMEM);
 
@@ -1388,7 +1388,7 @@ static const char *fuse_get_link(struct dentry *dentry,
        args.out.args[0].value = link;
        ret = fuse_simple_request(fc, &args);
        if (ret < 0) {
-               free_page((unsigned long) link);
+               kfree(link);
                link = ERR_PTR(ret);
        } else {
                link[ret] = '\0';
@@ -1913,7 +1913,7 @@ static const struct inode_operations fuse_common_inode_operations = {
 static const struct inode_operations fuse_symlink_inode_operations = {
        .setattr        = fuse_setattr,
        .get_link       = fuse_get_link,
-       .put_link       = free_page_put_link,
+       .put_link       = kfree_put_link,
        .readlink       = generic_readlink,
        .getattr        = fuse_getattr,
        .setxattr       = fuse_setxattr,
index ffae8579045df6c88e362afc2f23c3766cd94217..f9efdaeda7b01bce1703957009c76c1feb3580f9 100644 (file)
@@ -116,19 +116,19 @@ static const char *kernfs_iop_get_link(struct dentry *dentry,
                                       struct inode *inode, void **cookie)
 {
        int error = -ENOMEM;
-       unsigned long page;
+       char *page;
 
        if (!dentry)
                return ERR_PTR(-ECHILD);
-       page = get_zeroed_page(GFP_KERNEL);
+       page = kzalloc(PAGE_SIZE, GFP_KERNEL);
        if (!page)
                return ERR_PTR(-ENOMEM);
-       error = kernfs_getlink(dentry, (char *)page);
+       error = kernfs_getlink(dentry, page);
        if (unlikely(error < 0)) {
-               free_page((unsigned long)page);
+               kfree(page);
                return ERR_PTR(error);
        }
-       return *cookie = (char *)page;
+       return *cookie = page;
 }
 
 const struct inode_operations kernfs_symlink_iops = {
@@ -138,7 +138,7 @@ const struct inode_operations kernfs_symlink_iops = {
        .listxattr      = kernfs_iop_listxattr,
        .readlink       = generic_readlink,
        .get_link       = kernfs_iop_get_link,
-       .put_link       = free_page_put_link,
+       .put_link       = kfree_put_link,
        .setattr        = kernfs_iop_setattr,
        .getattr        = kernfs_iop_getattr,
        .permission     = kernfs_iop_permission,
index 8dc37fc4b6df23df9f35cc3b18feb4c887699eee..fec7ab0632dc55443d841dab41d93c83528d983e 100644 (file)
@@ -1025,12 +1025,6 @@ 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 d2fdf09a4407508235f8d40dddbdfba2fd3fb60a..138e206df2fc50b8bd5c13e39f4ca5e170d33f3c 100644 (file)
@@ -2743,7 +2743,6 @@ 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);