Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

btrfs: rename the extra_gfp parameter of btrfs_alloc_page_array()

There is only one caller utilizing the @extra_gfp parameter,
alloc_eb_folio_array(). And in that case the extra_gfp is only assigned
to __GFP_NOFAIL.

Rename the @extra_gfp parameter to @nofail to indicate that.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Qu Wenruo and committed by
David Sterba
0fbf6cbd fea91134

+16 -16
+10 -10
fs/btrfs/extent_io.c
··· 696 696 } 697 697 698 698 /* 699 - * Populate every free slot in a provided array with pages. 699 + * Populate every free slot in a provided array with pages, using GFP_NOFS. 700 700 * 701 701 * @nr_pages: number of pages to allocate 702 702 * @page_array: the array to fill with pages; any existing non-null entries in 703 - * the array will be skipped 704 - * @extra_gfp: the extra GFP flags for the allocation. 703 + * the array will be skipped 704 + * @nofail: whether using __GFP_NOFAIL flag 705 705 * 706 706 * Return: 0 if all pages were able to be allocated; 707 707 * -ENOMEM otherwise, the partially allocated pages would be freed and 708 708 * the array slots zeroed 709 709 */ 710 710 int btrfs_alloc_page_array(unsigned int nr_pages, struct page **page_array, 711 - gfp_t extra_gfp) 711 + bool nofail) 712 712 { 713 - const gfp_t gfp = GFP_NOFS | extra_gfp; 713 + const gfp_t gfp = nofail ? (GFP_NOFS | __GFP_NOFAIL) : GFP_NOFS; 714 714 unsigned int allocated; 715 715 716 716 for (allocated = 0; allocated < nr_pages;) { ··· 734 734 * 735 735 * For now, the folios populated are always in order 0 (aka, single page). 736 736 */ 737 - static int alloc_eb_folio_array(struct extent_buffer *eb, gfp_t extra_gfp) 737 + static int alloc_eb_folio_array(struct extent_buffer *eb, bool nofail) 738 738 { 739 739 struct page *page_array[INLINE_EXTENT_BUFFER_PAGES] = { 0 }; 740 740 int num_pages = num_extent_pages(eb); 741 741 int ret; 742 742 743 - ret = btrfs_alloc_page_array(num_pages, page_array, extra_gfp); 743 + ret = btrfs_alloc_page_array(num_pages, page_array, nofail); 744 744 if (ret < 0) 745 745 return ret; 746 746 ··· 2722 2722 */ 2723 2723 set_bit(EXTENT_BUFFER_UNMAPPED, &new->bflags); 2724 2724 2725 - ret = alloc_eb_folio_array(new, 0); 2725 + ret = alloc_eb_folio_array(new, false); 2726 2726 if (ret) { 2727 2727 btrfs_release_extent_buffer(new); 2728 2728 return NULL; ··· 2755 2755 if (!eb) 2756 2756 return NULL; 2757 2757 2758 - ret = alloc_eb_folio_array(eb, 0); 2758 + ret = alloc_eb_folio_array(eb, false); 2759 2759 if (ret) 2760 2760 goto err; 2761 2761 ··· 3121 3121 3122 3122 reallocate: 3123 3123 /* Allocate all pages first. */ 3124 - ret = alloc_eb_folio_array(eb, __GFP_NOFAIL); 3124 + ret = alloc_eb_folio_array(eb, true); 3125 3125 if (ret < 0) { 3126 3126 btrfs_free_subpage(prealloc); 3127 3127 goto out;
+1 -1
fs/btrfs/extent_io.h
··· 364 364 struct extent_buffer *buf); 365 365 366 366 int btrfs_alloc_page_array(unsigned int nr_pages, struct page **page_array, 367 - gfp_t extra_gfp); 367 + bool nofail); 368 368 int btrfs_alloc_folio_array(unsigned int nr_folios, struct folio **folio_array); 369 369 370 370 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
+1 -1
fs/btrfs/inode.c
··· 9128 9128 pages = kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS); 9129 9129 if (!pages) 9130 9130 return -ENOMEM; 9131 - ret = btrfs_alloc_page_array(nr_pages, pages, 0); 9131 + ret = btrfs_alloc_page_array(nr_pages, pages, false); 9132 9132 if (ret) { 9133 9133 ret = -ENOMEM; 9134 9134 goto out;
+3 -3
fs/btrfs/raid56.c
··· 1051 1051 { 1052 1052 int ret; 1053 1053 1054 - ret = btrfs_alloc_page_array(rbio->nr_pages, rbio->stripe_pages, 0); 1054 + ret = btrfs_alloc_page_array(rbio->nr_pages, rbio->stripe_pages, false); 1055 1055 if (ret < 0) 1056 1056 return ret; 1057 1057 /* Mapping all sectors */ ··· 1066 1066 int ret; 1067 1067 1068 1068 ret = btrfs_alloc_page_array(rbio->nr_pages - data_pages, 1069 - rbio->stripe_pages + data_pages, 0); 1069 + rbio->stripe_pages + data_pages, false); 1070 1070 if (ret < 0) 1071 1071 return ret; 1072 1072 ··· 1640 1640 const int data_pages = rbio->nr_data * rbio->stripe_npages; 1641 1641 int ret; 1642 1642 1643 - ret = btrfs_alloc_page_array(data_pages, rbio->stripe_pages, 0); 1643 + ret = btrfs_alloc_page_array(data_pages, rbio->stripe_pages, false); 1644 1644 if (ret < 0) 1645 1645 return ret; 1646 1646
+1 -1
fs/btrfs/scrub.c
··· 261 261 atomic_set(&stripe->pending_io, 0); 262 262 spin_lock_init(&stripe->write_error_lock); 263 263 264 - ret = btrfs_alloc_page_array(SCRUB_STRIPE_PAGES, stripe->pages, 0); 264 + ret = btrfs_alloc_page_array(SCRUB_STRIPE_PAGES, stripe->pages, false); 265 265 if (ret < 0) 266 266 goto error; 267 267