Skip to content

Commit 9bcaaea

Browse files
committed
btrfs: fix the gfp_mask for the reada_zones radix tree
Commits cc8385b and 7ef70b4 added preallocation for the reada radix trees and also switched them over to GFP_KERNEL for the default gfp mask. Since we're doing radix tree insertions under spinlocks, we need to make sure the mask doesn't allow sleeping. This fix keeps the radix preallocation but switches back to the original gfp_mask. Reported-by: Filipe Manana <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent bce19f9 commit 9bcaaea

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fs/btrfs/disk-io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2693,7 +2693,7 @@ int open_ctree(struct super_block *sb,
26932693
fs_info->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL;
26942694
fs_info->avg_delayed_ref_runtime = NSEC_PER_SEC >> 6; /* div by 64 */
26952695
/* readahead state */
2696-
INIT_RADIX_TREE(&fs_info->reada_tree, GFP_KERNEL);
2696+
INIT_RADIX_TREE(&fs_info->reada_tree, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
26972697
spin_lock_init(&fs_info->reada_lock);
26982698

26992699
fs_info->thread_pool_size = min_t(unsigned long,

fs/btrfs/volumes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static struct btrfs_device *__alloc_device(void)
252252
atomic_set(&dev->reada_in_flight, 0);
253253
atomic_set(&dev->dev_stats_ccnt, 0);
254254
btrfs_device_data_ordered_init(dev);
255-
INIT_RADIX_TREE(&dev->reada_zones, GFP_KERNEL);
255+
INIT_RADIX_TREE(&dev->reada_zones, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
256256
INIT_RADIX_TREE(&dev->reada_extents, GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
257257

258258
return dev;

0 commit comments

Comments
 (0)