Commit 63e727ec authored by David Sterba's avatar David Sterba

btrfs: use GFP_KERNEL in btrfs_defrag_file

We can safely use GFP_KERNEL, the function is called from two contexts:

- ioctl handler, called directly, no locks taken
- cleaner thread, running all queued defrag work, outside of any locks
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 3ec83621
...@@ -1277,7 +1277,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file, ...@@ -1277,7 +1277,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
* context * context
*/ */
if (!file) { if (!file) {
ra = kzalloc(sizeof(*ra), GFP_NOFS); ra = kzalloc(sizeof(*ra), GFP_KERNEL);
if (!ra) if (!ra)
return -ENOMEM; return -ENOMEM;
file_ra_state_init(ra, inode->i_mapping); file_ra_state_init(ra, inode->i_mapping);
...@@ -1285,8 +1285,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file, ...@@ -1285,8 +1285,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
ra = &file->f_ra; ra = &file->f_ra;
} }
pages = kmalloc_array(max_cluster, sizeof(struct page *), pages = kmalloc_array(max_cluster, sizeof(struct page *), GFP_KERNEL);
GFP_NOFS);
if (!pages) { if (!pages) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_ra; goto out_ra;
......
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