Commit f54de068 authored by David Sterba's avatar David Sterba

btrfs: use GFP_KERNEL in init_ipath

Now that init_ipath is called either from a safe context or with
memalloc_nofs protection, we can switch to GFP_KERNEL allocations in
init_path and init_data_container.
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent de2491fd
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* Boston, MA 021110-1307, USA. * Boston, MA 021110-1307, USA.
*/ */
#include <linux/vmalloc.h> #include <linux/mm.h>
#include <linux/rbtree.h> #include <linux/rbtree.h>
#include "ctree.h" #include "ctree.h"
#include "disk-io.h" #include "disk-io.h"
...@@ -2305,7 +2305,7 @@ struct btrfs_data_container *init_data_container(u32 total_bytes) ...@@ -2305,7 +2305,7 @@ struct btrfs_data_container *init_data_container(u32 total_bytes)
size_t alloc_bytes; size_t alloc_bytes;
alloc_bytes = max_t(size_t, total_bytes, sizeof(*data)); alloc_bytes = max_t(size_t, total_bytes, sizeof(*data));
data = vmalloc(alloc_bytes); data = kvmalloc(alloc_bytes, GFP_KERNEL);
if (!data) if (!data)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -2339,9 +2339,9 @@ struct inode_fs_paths *init_ipath(s32 total_bytes, struct btrfs_root *fs_root, ...@@ -2339,9 +2339,9 @@ struct inode_fs_paths *init_ipath(s32 total_bytes, struct btrfs_root *fs_root,
if (IS_ERR(fspath)) if (IS_ERR(fspath))
return (void *)fspath; return (void *)fspath;
ifp = kmalloc(sizeof(*ifp), GFP_NOFS); ifp = kmalloc(sizeof(*ifp), GFP_KERNEL);
if (!ifp) { if (!ifp) {
vfree(fspath); kvfree(fspath);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
...@@ -2356,6 +2356,6 @@ void free_ipath(struct inode_fs_paths *ipath) ...@@ -2356,6 +2356,6 @@ void free_ipath(struct inode_fs_paths *ipath)
{ {
if (!ipath) if (!ipath)
return; return;
vfree(ipath->fspath); kvfree(ipath->fspath);
kfree(ipath); kfree(ipath);
} }
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <linux/bit_spinlock.h> #include <linux/bit_spinlock.h>
#include <linux/security.h> #include <linux/security.h>
#include <linux/xattr.h> #include <linux/xattr.h>
#include <linux/vmalloc.h> #include <linux/mm.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/uuid.h> #include <linux/uuid.h>
...@@ -4588,7 +4588,7 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_fs_info *fs_info, ...@@ -4588,7 +4588,7 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_fs_info *fs_info,
out: out:
btrfs_free_path(path); btrfs_free_path(path);
vfree(inodes); kvfree(inodes);
kfree(loi); kfree(loi);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment