[dhowells-fs:netfs-next 33/36] fs/netfs/write_issue.c:795:9: warning: assignment to 'struct netfs_writeback *' from 'int' makes pointer from integer without a cast

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git netfs-next
head:   8f0e78ba82ccca8613b01c5f0215f8ce7c7c5cf3
commit: e09967cf018fd9ee7f1324d6ccea2d0a5f6b0f46 [33/36] netfs: Rework writeback to use a separate list of regions to be unlocked
config: riscv-randconfig-001-20260826 (https://download.01.org/0day-ci/archive/20260826/[email protected]/config)
compiler: riscv64-linux-gcc (GCC) 10.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260826/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   fs/netfs/write_issue.c: In function 'netfs_writeback_folio':
   fs/netfs/write_issue.c:795:11: error: implicit declaration of function 'mempool_alloc'; did you mean 'mm_alloc'? [-Werror=implicit-function-declaration]
     795 |   wback = mempool_alloc(&netfs_writeback_pool, wreq->gfp);
         |           ^~~~~~~~~~~~~
         |           mm_alloc
>> fs/netfs/write_issue.c:795:9: warning: assignment to 'struct netfs_writeback *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     795 |   wback = mempool_alloc(&netfs_writeback_pool, wreq->gfp);
         |         ^
   cc1: some warnings being treated as errors


vim +795 fs/netfs/write_issue.c

   681	
   682	/*
   683	 * Queue a folio for writeback.
   684	 */
   685	static void netfs_writeback_folio(struct netfs_io_request *wreq,
   686					  struct writeback_control *wbc,
   687					  struct folio *folio,
   688					  struct netfs_wb_params *params)
   689	{
   690		struct netfs_writeback *wback;
   691		struct netfs_group *fgroup; /* TODO: Use this with ceph */
   692		struct netfs_folio *finfo;
   693		size_t fsize = folio_size(folio), fend = fsize, foff = 0;
   694		uoff_t fpos = folio_pos(folio), i_size;
   695	
   696		_enter("%x", params->notes);
   697	
   698		/* netfs_perform_write() may shift i_size around the folio or from out
   699		 * of the folio to beyond it, but cannot move i_size into or through
   700		 * the folio since we have it locked.
   701		 *
   702		 * Truncate could in theory move i_size into or before the folio, but
   703		 * it should take steps to prevent writeback from happening
   704		 * concurrently and should wait for any in-progress writebacks before
   705		 * proceeding.
   706		 */
   707		i_size = i_size_read(wreq->inode);
   708	
   709		params->fpos = fpos;
   710		if (fpos >= i_size) {
   711			/* mmap beyond eof. */
   712			_debug("beyond eof");
   713			folio_start_writeback(folio);
   714			folio_unlock(folio);
   715			netfs_folio_written_back(folio, wreq);
   716			netfs_put_group_many(wreq->group, wreq->nr_group_rel);
   717			wreq->nr_group_rel = 0;
   718			return;
   719		}
   720	
   721		if (fpos + fsize > wreq->i_size)
   722			wreq->i_size = i_size;
   723	
   724		fgroup = netfs_folio_group(folio);
   725		finfo = netfs_folio_info(folio);
   726		if (finfo) {
   727			foff = finfo->dirty_offset;
   728			fend = foff + finfo->dirty_len;
   729			params->notes |= NOTE_STREAMW;
   730		}
   731	
   732		if (fend > i_size - fpos) {
   733			fend = i_size - fpos;
   734			if (!(params->notes & NOTE_STREAMW))
   735				folio_zero_segment(folio, fend, fsize);
   736		}
   737	
   738		/* Account for cache and crypto alignments. */
   739		params->inner_off = round_down(foff, params->inner_align);
   740		params->inner_end = round_up  (fend, params->inner_align);
   741		params->outer_off = round_down(foff, params->outer_align);
   742		params->outer_end = round_up  (fend, params->outer_align);
   743	
   744		_debug("folio %zx %zx %zx", foff, fend - foff, fsize);
   745	
   746		/* Deal with discontinuities in the stream of dirty pages.  These can
   747		 * arise from a number of sources:
   748		 *
   749		 * (1) Intervening non-dirty pages from random-access writes, multiple
   750		 *     flushers writing back different parts simultaneously and manual
   751		 *     syncing.
   752		 *
   753		 * (2) Partially-written pages from write-streaming.
   754		 *
   755		 * (3) Pages that belong to a different write-back group (eg.  Ceph
   756		 *     snapshots).
   757		 *
   758		 * (4) Actually-clean pages that were marked for write to the cache
   759		 *     when they were read.  Note that these appear as a special
   760		 *     write-back group.
   761		 */
   762		if (fgroup == NETFS_FOLIO_COPY_TO_CACHE) {
   763			if (!(params->notes & NOTE_CACHE_AVAIL)) {
   764				trace_netfs_folio(folio, netfs_folio_trace_cancel_copy);
   765				goto cancel_folio;
   766			}
   767			params->notes |= NOTE_CACHE_COPY;
   768			trace_netfs_folio(folio, netfs_folio_trace_store_copy);
   769		} else if (fgroup != wreq->group) {
   770			/* We can't write this page to the server yet. */
   771			kdebug("wrong group");
   772			goto skip_folio;
   773		} else if (!(params->notes & (NOTE_UPLOAD_AVAIL | NOTE_CACHE_AVAIL))) {
   774			trace_netfs_folio(folio, netfs_folio_trace_cancel_store);
   775			goto cancel_folio_discard;
   776		} else {
   777			if (params->notes & NOTE_UPLOAD_STARTED) {
   778				params->notes |= NOTE_UPLOAD;
   779				trace_netfs_folio(folio, netfs_folio_trace_store_plus);
   780			} else {
   781				params->notes |= NOTE_UPLOAD | NOTE_UPLOAD_STARTED;
   782				trace_netfs_folio(folio, netfs_folio_trace_store);
   783			}
   784			if ((params->notes & NOTE_CACHE_AVAIL) &&
   785			    !(params->notes & NOTE_STREAMW))
   786				params->notes |= NOTE_CACHE_COPY;
   787		}
   788	
   789		folio_start_writeback(folio);
   790		folio_unlock(folio);
   791	
   792		/* Keep track of what we will need to unlock. */
   793		wback = wreq->writebacks_tail;
   794		if (!wback || fpos != wback->start + wback->len || wback->len > LONG_MAX) {
 > 795			wback = mempool_alloc(&netfs_writeback_pool, wreq->gfp);
   796			wback->next = NULL;
   797			wback->start = fpos;
   798			wback->len = fsize;
   799	
   800			if (wreq->writebacks)
   801				/* Order write of next after last write of len in old tail. */
   802				smp_store_release(&wreq->writebacks_tail->next, wback);
   803			else
   804				wreq->writebacks = wback;
   805			wreq->writebacks_tail = wback;
   806		} else {
   807			/* Order update of len after setting pointer. */
   808			smp_store_release(&wback->len, wback->len + fsize);
   809		}
   810	
   811		/* Flush any streams not being used for this folio. */
   812		for (int s = 0; s < NR_IO_STREAMS; s++) {
   813			struct netfs_io_stream *stream = &wreq->io_streams[s];
   814	
   815			if (!stream->active || !(params->notes & stream->applicable)) {
   816				if (stream->buffering) {
   817					params->notes |= NOTE_FLUSH_ANYWAY;
   818					netfs_writeback_flush(wreq, stream, params);
   819				}
   820				atomic64_set_release(&stream->issued_to, fpos + params->outer_end);
   821			}
   822		}
   823	
   824		/* Initiate or extend the dispatch of each selected stream.  At this
   825		 * point we may need to copy the data to a bounce buffer and push the
   826		 * bounce bits instead.
   827		 */
   828		// TODO: Do bouncing if selected.
   829		netfs_writeback_add_folio_to_stream(wreq, params, folio);
   830	
   831	out:
   832		_leave(" = %x", params->notes);
   833		return;
   834	
   835	skip_folio:
   836		folio_redirty_for_writepage(wbc, folio);
   837		folio_unlock(folio);
   838		goto out;
   839	cancel_folio_discard:
   840		netfs_put_group(fgroup);
   841	cancel_folio:
   842		folio_detach_private(folio);
   843		kfree(finfo);
   844		folio_unlock(folio);
   845		folio_cancel_dirty(folio);
   846		goto out;
   847	}
   848	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.