From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796376905; b=p1xpxuN8ASKl5dGjZ5I6WTUZjKla8lds/8IshHb50WxPvCltSu5dG3iV/Q/TwVdyM6FU Bjn3YWLwgwua/OiXmqb8+rS3IutUjOKVIQnvUPR1O9j+uGb0M0JuRAOssslhHRRllhS3t 28GK7HX/RYBE0A0Uv+Mf9gGjkvqwCZkQDfj/q/G/ZYIauzyLkuaRe9c/QqQwcILD0uDYI MH0kiK9pMjNJP/cyxDcqlSYg+jxy6NIXJ4HS8LH3hen/7psc/REvJLLE7KII7YHpTMI7O noNuLMIzUnovvFVgnUP6c1XdYz4j4FLUtIdQknw4OqOiXTFCsAFqQ867V6CC+rWWA8g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796376905; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=jFdmJCw9E9EyS2le8fdYwuJObw7jamEtoWgX/KoYz14=; b=JKOsAOJoXcKmJodqjy6q3igByziiR35vdqescnbi+GvEVB27ug5SKTnoBQansrZbhHQJ gink1sr+hcQCGaWt7Kr/lqAAtWaUo1H+TpkXqQduaTOj5asegVE3YIVJ1HTCl1Uj5fp3b XdS6WyKf3ZlaUvNmoBrFf1pIIJsyAACC8F4t8702emcQZniKzYjrg+hsmRvN2wUAAK03W 5kQ84yTpp1c4NrDHYcCbmJiUjHE9o5Iw5WoiUdiocUoJOu7TqOpiMGt1ikU21W3WJgv1j cqZ3uwajO7hVAl2xZ3YZhHwskWwgESJzI8NhLwWt5IjSGgMxL87KcoPu4bWHfmVDCHA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SdBP8FF1; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4920E606A322 for ; Fri, 4 Dec 2026 09:35:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SdBP8FF1 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E54311F000C2; Fri, 4 Dec 2026 09:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796376905; bh=jFdmJCw9E9EyS2le8fdYwuJObw7jamEtoWgX/KoYz14=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=SdBP8FF1wY6ZKQWRFHUG9FkCFHjVGIE7Dmxof3f4DNM1z4VRSSyj69jgAovc/aXR1 8zR9+e2kbhwOaMwcqcMZ+h3oy28RZ3jXSyeJEB0B+lzjjskJwZzGR6/0HP7pk9tIEM ioo7Qg4YaAmwyNNgKacTgXTrnq+k9djbUkT+1wI4NQIH3+unkCkr2BlQDojheTPDsF jgIVcCjSSqzpW2c9794eQyobYpHaxGdLfg9EVdVJyG/btkubSoExgLMCjq1FW8bk2T AVtW+Llz8l4T9CiEiYquVXFpCj04/5SyE9OF/PJLLuZ4eSddTwOOeeTy0UpD5plztP +F9MaooEb+bCA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 2/2] iomap: don't use struct iomap_iter for simple dio reads Reply-To: sashiko-reviews@lists.linux.dev To: "Christoph Hellwig" Cc: linux-ext4@vger.kernel.org, tytso@mit.edu In-Reply-To: <20261204091101.2533591-3-hch@lst.de> References: <20261204091101.2533591-1-hch@lst.de> <20261204091101.2533591-3-hch@lst.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 09:35:04 +0000 X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] ext4: making ext4_iomap_begin() static breaks CONFIG_EXT4_KUNIT_TESTS builds - [Medium] xfs: xfs_read_simple_begin() returns -ENOTBLK instead of -EAGAIN on NOWAIT - [Low] iomap: iomap_dio_read_simple() comment omits uninitialized iomap contract -- commit 5329ccff0d2b6f54203c2a7e79854425463b11e1 Author: Christoph Hellwig iomap: don't use struct iomap_iter for simple dio reads This commit replaces struct iomap_iter in iomap_dio_read_simple() with a plain struct iomap and a dedicated iomap_simple_begin_fn callback, adding simple-read begin handlers in ext4 and XFS. [ ... ] > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c > index 07a62d8569d31..f987991b48c23 100644 > --- a/fs/ext4/inode.c > +++ b/fs/ext4/inode.c > @@ -4012,8 +4012,7 @@ static int ext4_iomap_alloc(struct inode *inode, st= ruct ext4_map_blocks *map, > return ret; > } > =20 > - > -int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length, > +static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t l= ength, > unsigned flags, struct iomap *iomap, struct iomap *srcmap) > { > int ret; [Severity: Medium] Does making ext4_iomap_begin() static break CONFIG_EXT4_KUNIT_TESTS builds? fs/ext4/inode.c still has EXPORT_SYMBOL_FOR_EXT4_TEST(ext4_iomap_begin), which expands to an extern declaration and conflicts with the static definition. inode_test_iomap_and_atomic_writes() in fs/ext4/inode-test.c also calls ext4_iomap_begin() directly, so removing the prototype from fs/ext4/ext4.h and external linkage breaks compiling and linking ext4-test.o. [ ... ] > diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c > index ad1ce4f99ad88..ba46156128dfa 100644 > --- a/fs/xfs/xfs_file.c > +++ b/fs/xfs/xfs_file.c > @@ -189,6 +189,53 @@ static const struct iomap_dio_ops xfs_dio_read_bounc= e_ops =3D { > .bio_set =3D &iomap_ioend_bioset, > }; > =20 > +static int > +xfs_read_simple_begin( > + struct inode *inode, > + loff_t offset, > + loff_t length, > + unsigned flags, > + struct iomap *iomap) > +{ > + struct xfs_inode *ip =3D XFS_I(inode); > + struct xfs_mount *mp =3D ip->i_mount; > + xfs_fileoff_t offset_fsb =3D XFS_B_TO_FSBT(mp, offset); > + struct xfs_bmbt_irec imap; > + struct xfs_iext_cursor icur; > + > + ASSERT(!(flags & ~(IOMAP_DIRECT | IOMAP_NOWAIT))); > + > + if (xfs_is_shutdown(mp)) > + return -EIO; > + if (xfs_need_iread_extents(&ip->i_df)) > + return -ENOTBLK; [Severity: Medium] Should this return -EAGAIN instead of -ENOTBLK when IOMAP_NOWAIT is set? When extents are not yet loaded on a nonblocking direct read, returning -ENOTBLK falls back to iomap_dio_rw(), where __iomap_dio_rw() allocates struct iomap_dio with GFP_KERNEL before xfs_ilock_for_iomap() fails with -EAGAIN. Returning (flags & IOMAP_NOWAIT) ? -EAGAIN : -ENOTBLK preserves the previous behavior and avoids a potentially sleeping allocation on IOCB_NOWAIT. [ ... ] > diff --git a/include/linux/iomap.h b/include/linux/iomap.h > index 78a1b7603a4f2..6db4f005fdfc4 100644 > --- a/include/linux/iomap.h > +++ b/include/linux/iomap.h > @@ -740,20 +740,20 @@ void iomap_dio_bio_end_io(struct bio *bio); > * The caller can only provide an iomap begin handler, and the iterator > * is never advanced. > */ > +typedef int (*iomap_simple_begin_fn)(struct inode *inode, loff_t pos, > + loff_t length, unsigned flags, struct iomap *iomap); > ssize_t __iomap_dio_read_simple(struct kiocb *iocb, struct iov_iter *ite= r, > - struct iomap_iter *iomi); > + unsigned flags, struct iomap *iomap); > static __always_inline ssize_t iomap_dio_read_simple(struct kiocb *iocb, > - struct iov_iter *iter, iomap_iter_begin_fn begin) > + struct iov_iter *iter, iomap_simple_begin_fn begin) > { > - struct iomap_iter iomi =3D { > - .inode =3D file_inode(iocb->ki_filp), > - .pos =3D iocb->ki_pos, > - .len =3D iov_iter_count(iter), > - .flags =3D IOMAP_DIRECT, > - }; > + struct inode *inode =3D file_inode(iocb->ki_filp); > + size_t count =3D iov_iter_count(iter); > + unsigned flags =3D IOMAP_DIRECT; > + struct iomap iomap; [Severity: Low] Could the comment above iomap_simple_begin_fn document that iomap is uninitialized on entry? The comment still mentions the removed iterator ("and the iterator is never advanced") and does not state that iomap_dio_read_simple() passes an uninitialized stack struct iomap, unlike iomap_iter. A future caller assuming zero-initialization (e.g., omitting iomap->flags = =3D 0) would expose uninitialized stack memory to IOMAP_F_INTEGRITY and IOMAP_F_ANON_WRITE checks in __iomap_dio_read_simple() and iomap_sector(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204091101.2533= 591-2-hch@lst.de?part=3D2