Message ID | d73d5cf4fe47728f885c8869d84794658ffe9cf4.1720159494.git.wqu@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: remove __GFP_NOFAIL usage for debug builds | expand |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index aa7f8148cd0d..d43a3a9fc650 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2672,9 +2672,13 @@ static struct extent_buffer * __alloc_extent_buffer(struct btrfs_fs_info *fs_info, u64 start, unsigned long len) { + const bool debug = IS_ENABLED(CONFIG_BTRFS_DEBUG); struct extent_buffer *eb = NULL; - eb = kmem_cache_zalloc(extent_buffer_cache, GFP_NOFS|__GFP_NOFAIL); + eb = kmem_cache_zalloc(extent_buffer_cache, GFP_NOFS | + (!debug ? __GFP_NOFAIL : 0)); + if (!eb) + return NULL; eb->start = start; eb->len = len; eb->fs_info = fs_info;
Although extent buffer is a critical infrastructure, I'm not convinced that it really needs to go __GFP_NOFAIL. As an experimental to reduce the __GFP_NOFAIL usage, for CONFIG_BTRFS_DEBUG builds remove the __GFP_NOFAIL flag for alloc_extent_buffer(), so we can test this change enough before pushing it to end users. Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/extent_io.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)