All of lore.kernel.org
 help / color / mirror / Atom feed
* [mcgrof:blk-iobuf-pool-v2 8/13] block/blk-map.c:626:47: sparse: sparse: incorrect type in argument 4 (different base types)
@ 2026-07-02  0:56 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-07-02  0:56 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git blk-iobuf-pool-v2
head:   da75cc2253180af718ba0b7b3684a091b16b14fb
commit: b88f2bfe111b8778c8bba9e0309c653966171bdd [8/13] block: bounce passthrough bios through iobuf pool folios
config: i386-randconfig-063-20260702 (https://download.01.org/0day-ci/archive/20260702/202607020854.oEUwARTt-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260702/202607020854.oEUwARTt-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/202607020854.oEUwARTt-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> block/blk-map.c:626:47: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected unsigned int op @@     got restricted blk_opf_t enum req_op @@
   block/blk-map.c:626:47: sparse:     expected unsigned int op
   block/blk-map.c:626:47: sparse:     got restricted blk_opf_t enum req_op

vim +626 block/blk-map.c

   529	
   530	/**
   531	 * bio_copy_user_iov_iobuf - copy user data using pool-allocated folios
   532	 *
   533	 * Maps user I/O into a bio using higher-order folios from the queue's iobuf
   534	 * pool.  Falls back to page-by-page allocation if pool is exhausted or the
   535	 * request is not aligned.
   536	 *
   537	 * Returns 0 on success (pool or fallback), <0 on hard error.
   538	 */
   539	static int bio_copy_user_iov_iobuf(struct request *rq, struct iov_iter *iter,
   540					   gfp_t gfp_mask)
   541	{
   542		struct request_queue *q = rq->q;
   543		struct bio_iobuf_data *ibd;
   544		struct folio **folios;
   545		unsigned long len = iter->count;
   546		unsigned int folio_size = blk_iobuf_pool_folio_size(q);
   547		unsigned int nr_folios;
   548		struct bio *bio;
   549		unsigned int i;
   550		int ret;
   551	
   552		/* Only handle whole-folio-aligned sizes for now */
   553		if (!IS_ALIGNED(len, folio_size))
   554			return -EREMOTEIO;
   555	
   556		nr_folios = DIV_ROUND_UP(len, folio_size);
   557	
   558		/*
   559		 * Allocate ibd without the bmd.iov[] flexible array: for writes
   560		 * we don't need the original iov after copy_from_iter, and for reads
   561		 * (not yet implemented) we'll revisit.  The separate folios array
   562		 * tracks pool allocations; iov overlap with flex array is avoided.
   563		 */
   564		ibd = kzalloc(sizeof(*ibd), gfp_mask);
   565		if (!ibd)
   566			return -ENOMEM;
   567	
   568		folios = kcalloc(nr_folios, sizeof(*folios), gfp_mask);
   569		if (!folios) {
   570			kfree(ibd);
   571			return -ENOMEM;
   572		}
   573	
   574		for (i = 0; i < nr_folios; i++) {
   575			folios[i] = blk_iobuf_alloc_folio(q,
   576					(gfp_mask | __GFP_NOWARN) & ~__GFP_DIRECT_RECLAIM);
   577			if (!folios[i]) {
   578				/* Pool exhausted; log fallback and bail */
   579				blk_iobuf_inc_fallback(q);
   580				trace_block_iobuf_fallback(q, "pool_exhausted");
   581				ret = -EREMOTEIO;
   582				goto free_folios;
   583			}
   584		}
   585	
   586		bio = blk_rq_map_bio_alloc(rq, nr_folios, gfp_mask);
   587		if (!bio) {
   588			ret = -ENOMEM;
   589			goto free_folios;
   590		}
   591	
   592		for (i = 0; i < nr_folios; i++) {
   593			unsigned int chunk = min_t(unsigned long, len, folio_size);
   594	
   595			if (!bio_add_folio(bio, folios[i], chunk, 0)) {
   596				ret = -EINVAL;
   597				goto put_bio;
   598			}
   599			len -= chunk;
   600		}
   601	
   602		ibd->bmd.is_our_pages   = true;
   603		ibd->bmd.is_null_mapped = false;
   604		ibd->bmd.is_iobuf       = true;
   605		ibd->q         = q;
   606		ibd->folios    = folios;
   607		ibd->nr_folios = nr_folios;
   608	
   609		if (iov_iter_rw(iter) == WRITE) {
   610			ret = bio_copy_from_iter(bio, iter);
   611			if (ret)
   612				goto put_bio;
   613		} else {
   614			zero_fill_bio(bio);
   615			iov_iter_advance(iter, bio->bi_iter.bi_size);
   616		}
   617	
   618		bio->bi_private = ibd;
   619		bio->bi_end_io = NULL;		/* bio_uncopy_user_iobuf called on unmap */
   620	
   621		ret = blk_rq_append_bio(rq, bio);
   622		if (ret)
   623			goto put_bio;
   624	
   625		trace_block_iobuf_bounce_submit(q, bio->bi_iter.bi_size, nr_folios,
 > 626						bio_op(bio));
   627		return 0;
   628	
   629	put_bio:
   630		blk_mq_map_bio_put(bio);
   631	free_folios:
   632		for (i = 0; i < nr_folios; i++)
   633			if (folios[i])
   634				blk_iobuf_free_folio(q, folios[i]);
   635		kfree(folios);
   636		kfree(ibd);
   637		return ret;
   638	}
   639	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-02  0:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02  0:56 [mcgrof:blk-iobuf-pool-v2 8/13] block/blk-map.c:626:47: sparse: sparse: incorrect type in argument 4 (different base types) kernel test robot

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.