Skip to content

Commit 63e727e

Browse files
committed
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: David Sterba <dsterba@suse.com>
1 parent 3ec8362 commit 63e727e

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎fs/btrfs/ioctl.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,16 +1277,15 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
12771277
* context
12781278
*/
12791279
if (!file) {
1280-
ra = kzalloc(sizeof(*ra), GFP_NOFS);
1280+
ra = kzalloc(sizeof(*ra), GFP_KERNEL);
12811281
if (!ra)
12821282
return -ENOMEM;
12831283
file_ra_state_init(ra, inode->i_mapping);
12841284
} else {
12851285
ra = &file->f_ra;
12861286
}
12871287

1288-
pages = kmalloc_array(max_cluster, sizeof(struct page *),
1289-
GFP_NOFS);
1288+
pages = kmalloc_array(max_cluster, sizeof(struct page *), GFP_KERNEL);
12901289
if (!pages) {
12911290
ret = -ENOMEM;
12921291
goto out_ra;

0 commit comments

Comments
 (0)