All of lore.kernel.org
 help / color / mirror / Atom feed
* [mcgrof:blk-iobuf-pool-v2 10/13] fs/iomap/direct-io.c:219:58: sparse: sparse: incorrect type in argument 4 (different base types)
@ 2026-07-02  2:10 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-07-02  2:10 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: 6d1abeffbce3bf1c78052c72b02530c421e2e4e8 [10/13] iomap: bounce aligned DIO writes through iobuf pool folios
config: i386-randconfig-063-20260702 (https://download.01.org/0day-ci/archive/20260702/202607021031.eBJ2hGXW-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/202607021031.eBJ2hGXW-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/202607021031.eBJ2hGXW-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> fs/iomap/direct-io.c:219:58: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected unsigned int op @@     got restricted blk_opf_t enum req_op @@
   fs/iomap/direct-io.c:219:58: sparse:     expected unsigned int op
   fs/iomap/direct-io.c:219:58: sparse:     got restricted blk_opf_t enum req_op

vim +219 fs/iomap/direct-io.c

    95	
    96	/*
    97	 * iomap_dio_write_iobuf - prototype pool-backed aligned DIO write path
    98	 *
    99	 * Constraints: IOMAP_DIO_WRITE only, full-block aligned, pool available,
   100	 * synchronous copy_from_iter (no async copyback needed for writes).
   101	 *
   102	 * Returns bytes consumed on success, 0 if ineligible, <0 on error.
   103	 */
   104	static ssize_t iomap_dio_write_iobuf(const struct iomap_iter *iter,
   105					     struct iomap_dio *dio, loff_t pos,
   106					     unsigned int alignment, blk_opf_t op)
   107	{
   108		struct block_device *bdev = iter->iomap.bdev;
   109		struct iomap_dio_iobuf_ctx *ctx;
   110		struct request_queue *q;
   111		struct iov_iter copy_iter;
   112		struct folio *folio;
   113		struct bio *bio;
   114		unsigned int fsize;
   115		size_t len;
   116		ssize_t ret;
   117	
   118		/* Only writes for now */
   119		if (!(dio->flags & IOMAP_DIO_WRITE))
   120			return 0;
   121	
   122		if (!bdev)
   123			return 0;
   124	
   125		q = bdev_get_queue(bdev);
   126		if (!blk_queue_iobuf_pool_enabled(q))
   127			return 0;
   128	
   129		fsize = blk_iobuf_pool_folio_size(q);
   130		if (!fsize)
   131			return 0;
   132	
   133		/*
   134		 * Never bounce an atomic write: it must be issued as a single bio
   135		 * covering the whole length (see the REQ_ATOMIC check in
   136		 * iomap_dio_bio_iter_one()).  Splitting it into per-folio bios here
   137		 * would silently break hardware atomic semantics.
   138		 */
   139		if (op & REQ_ATOMIC)
   140			return 0;
   141	
   142		/*
   143		 * Integrity (PI) writes need fs_bio_integrity_generate() run on the
   144		 * bio, which the normal path below does; leave them to it rather than
   145		 * replicate the integrity setup in the bounce.
   146		 */
   147		if (iter->iomap.flags & IOMAP_F_INTEGRITY)
   148			return 0;
   149	
   150		/*
   151		 * Bvec-backed iterators (e.g. io_uring registered buffers) are already
   152		 * described as physical ranges; bouncing them only adds a memcpy with
   153		 * no segment benefit.
   154		 */
   155		if (iov_iter_is_bvec(dio->submit.iter))
   156			return 0;
   157	
   158		len = iov_iter_count(dio->submit.iter);
   159	
   160		/* Require at least one full folio, aligned */
   161		if (len < fsize)
   162			return 0;
   163		if (!IS_ALIGNED(pos, fsize))
   164			return 0;
   165	
   166		/*
   167		 * This helper emits a single fsize bio.  Do not turn a larger write
   168		 * into N separately-bounced fsize sub-I/Os -- that fragments one
   169		 * multi-segment bio into N bios and regresses throughput badly.  Let
   170		 * the normal path handle anything bigger than one folio for now.
   171		 */
   172		if (round_down(len, fsize) != fsize)
   173			return 0;
   174	
   175		folio = blk_iobuf_alloc_folio(q, GFP_NOWAIT);
   176		if (!folio) {
   177			blk_iobuf_inc_fallback(q);
   178			trace_block_iobuf_fallback(q, "dio_pool_exhausted");
   179			return 0;
   180		}
   181	
   182		/* Copy user data into the folio */
   183		copy_iter = *dio->submit.iter;
   184		iov_iter_truncate(&copy_iter, fsize);
   185		if (copy_from_iter(folio_address(folio), fsize,
   186				   &copy_iter) != fsize) {
   187			blk_iobuf_free_folio(q, folio);
   188			return -EFAULT;
   189		}
   190	
   191		/* Wrap the bio private to carry both the dio and the folio to free */
   192		ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
   193		if (!ctx) {
   194			blk_iobuf_free_folio(q, folio);
   195			return -ENOMEM;
   196		}
   197		ctx->dio   = dio;
   198		ctx->q     = q;
   199		ctx->folio = folio;
   200	
   201		bio = iomap_dio_alloc_bio(iter, dio, 1, op);
   202		fscrypt_set_bio_crypt_ctx(bio, iter->inode, pos, GFP_KERNEL);
   203		bio->bi_iter.bi_sector = iomap_sector(&iter->iomap, pos);
   204		bio->bi_write_hint = iter->inode->i_write_hint;
   205		bio->bi_ioprio = dio->iocb->ki_ioprio;
   206		bio->bi_private = ctx;
   207		bio->bi_end_io  = iomap_dio_iobuf_bio_end_io;
   208	
   209		if (!bio_add_folio(bio, folio, fsize, 0)) {
   210			kfree(ctx);
   211			blk_iobuf_free_folio(q, folio);
   212			bio_put(bio);
   213			return -EINVAL;
   214		}
   215	
   216		ret = bio->bi_iter.bi_size;
   217		task_io_account_write(ret);
   218	
 > 219		trace_block_iobuf_bounce_submit(q, ret, 1, bio_op(bio));
   220	
   221		iov_iter_advance(dio->submit.iter, fsize);
   222		iomap_dio_submit_bio(iter, dio, bio, pos);
   223		return ret;
   224	}
   225	#endif /* CONFIG_BLK_IOBUF_POOL */
   226	

--
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  2:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02  2:10 [mcgrof:blk-iobuf-pool-v2 10/13] fs/iomap/direct-io.c:219:58: 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.