Message ID | a7dd241092b862c9c7c297181dd4f13525af8dbe.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 97c3f272fcaa..dadf0da171bf 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -695,7 +695,8 @@ int btrfs_alloc_folio_array(unsigned int nr_folios, struct folio **folio_array) int btrfs_alloc_page_array(unsigned int nr_pages, struct page **page_array, bool nofail) { - const gfp_t gfp = nofail ? (GFP_NOFS | __GFP_NOFAIL) : GFP_NOFS; + const bool debug = IS_ENABLED(CONFIG_BTRFS_DEBUG); + const gfp_t gfp = GFP_NOFS | ((!debug && nofail) ? __GFP_NOFAIL : 0); unsigned int allocated; for (allocated = 0; allocated < nr_pages;) {
Since all callers of this function is already properly handling the allocation error, and for the worst case we're just going to abort the current transaction, I do no believe we need __GFP_NOFAIL here. So to enable more testing and hopefully to provide a smooth transaction, for CONFIG_BTRFS_DEBUG builds do not use __GFP_NOFAIL flag. Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/extent_io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)