All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Yunsheng Lin <linyunsheng@huawei.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [linyunsheng:page_bulk_alloc_opt_v2 1/1] fs/btrfs/extent_io.c:631:37: error: use of undeclared identifier 'pages'
Date: Mon, 24 Feb 2025 00:29:17 +0800	[thread overview]
Message-ID: <202502240053.pJMTGvUm-lkp@intel.com> (raw)

tree:   https://github.com/gestionlin/linux.git page_bulk_alloc_opt_v2
head:   10c5db9fc7b189b222074598ce5bc9c1d8cd0ea8
commit: 10c5db9fc7b189b222074598ce5bc9c1d8cd0ea8 [1/1] mm: alloc_pages_bulk: remove assumption of populating only NULL elements
config: x86_64-buildonly-randconfig-001-20250223 (https://download.01.org/0day-ci/archive/20250224/202502240053.pJMTGvUm-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250224/202502240053.pJMTGvUm-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502240053.pJMTGvUm-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from fs/btrfs/extent_io.c:5:
   In file included from include/linux/bio.h:10:
   In file included from include/linux/blk_types.h:10:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:8:
   In file included from include/linux/cacheflush.h:5:
   In file included from arch/x86/include/asm/cacheflush.h:5:
   In file included from include/linux/mm.h:2224:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> fs/btrfs/extent_io.c:631:37: error: use of undeclared identifier 'pages'
     631 |         for (allocated = 0, ret = 0; ret < pages; ret++) {
         |                                            ^
>> fs/btrfs/extent_io.c:633:4: error: use of undeclared identifier 'rqstp'
     633 |                         rqstp->rq_pages[allocated] = rqstp->rq_pages[ret];
         |                         ^
   fs/btrfs/extent_io.c:633:33: error: use of undeclared identifier 'rqstp'
     633 |                         rqstp->rq_pages[allocated] = rqstp->rq_pages[ret];
         |                                                      ^
   fs/btrfs/extent_io.c:635:5: error: use of undeclared identifier 'rqstp'
     635 |                                 rqstp->rq_pages[ret] = NULL;
         |                                 ^
   3 warnings and 4 errors generated.


vim +/pages +631 fs/btrfs/extent_io.c

   609	
   610	/*
   611	 * Populate every free slot in a provided array with pages, using GFP_NOFS.
   612	 *
   613	 * @nr_pages:   number of pages to allocate
   614	 * @page_array: the array to fill with pages; any existing non-null entries in
   615	 *		the array will be skipped
   616	 * @nofail:	whether using __GFP_NOFAIL flag
   617	 *
   618	 * Return: 0        if all pages were able to be allocated;
   619	 *         -ENOMEM  otherwise, the partially allocated pages would be freed and
   620	 *                  the array slots zeroed
   621	 */
   622	int btrfs_alloc_page_array(unsigned int nr_pages, struct page **page_array,
   623				   bool nofail)
   624	{
   625		const gfp_t gfp = nofail ? (GFP_NOFS | __GFP_NOFAIL) : GFP_NOFS;
   626		unsigned int allocated, ret;
   627	
   628		/* Defragment page_array so pages can be bulk allocated into remaining
   629		 * NULL elements sequentially.
   630		 */
 > 631		for (allocated = 0, ret = 0; ret < pages; ret++) {
   632			if (page_array[ret]) {
 > 633				rqstp->rq_pages[allocated] = rqstp->rq_pages[ret];
   634				if (ret != allocated)
   635					rqstp->rq_pages[ret] = NULL;
   636	
   637				allocated++;
   638			}
   639		}
   640	
   641		while (allocated < nr_pages) {
   642			ret = alloc_pages_bulk(gfp, nr_pages - allocated,
   643					       page_array + allocated);
   644			allocated += ret;
   645			if (unlikely(!ret)) {
   646				/* No progress, fail and do cleanup. */
   647				for (int i = 0; i < allocated; i++) {
   648					__free_page(page_array[i]);
   649					page_array[i] = NULL;
   650				}
   651				return -ENOMEM;
   652			}
   653		}
   654		return 0;
   655	}
   656	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2025-02-23 16:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202502240053.pJMTGvUm-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=linyunsheng@huawei.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.