From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5A1C30FC1D; Mon, 23 Feb 2026 16:27:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771864060; cv=none; b=LZFIouZD2SWuOWWzdIgJMvDtIJfQi3DxwtYkZFUk6Wc+YvtBlXtZz6TgOAGy2M7//UkV4SM1FFPWKD38uOamqL0vgGS2/a41hEHm2iozPoibJjUOFaHfSBkJCntd9zP1RuBUv8JfVaUVsqkQSlixYWVbzou5Ufqbz84oLhCSzgk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771864060; c=relaxed/simple; bh=fzmMAPqHr6UY1W4QOVefe5i2Klnyid7y4W4h12ZJ2Lo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TwMW/WX1Lx42fVqraMDhJpwsbkntahoPoXrc8zxcbgzgNc9+pp0I4pKy18NE9bkILaMcUoK8UXbbqD2M1WENro+MVd16b2xYVfWJm0TU6CaWnrvNr1goJHYFd/7/UpBzvoUxI0v9BtHge5Tu0W+ID4DnYmQeKHfyFt1cfmHm43c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZpZHqKCQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZpZHqKCQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B4C0C116C6; Mon, 23 Feb 2026 16:27:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771864060; bh=fzmMAPqHr6UY1W4QOVefe5i2Klnyid7y4W4h12ZJ2Lo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZpZHqKCQVoqovvBwyXxOJHCiEMZrA6Q/JpYJGnJIIc2oQPs06MEKkI2nY/zfzmSWW RUMoIBImCulZAFA1eRig7dOUjjvPSv7vrLnjoa5hpGddB6C8VZjV9DU4c5omi5GA3V kbB0tp1pQ4yEZCNRLtkWc/NrBeyohlbB9FoijXBqBflMlKjQa+/gXYebPitszzgJUv 76a515aLdWGxWI/p9dF+d2BNiOHcnnrwsg1RCAZbpUyI9HB5oyHCU9SRwIoBytvTdg eBnyigzBpUc4z5n0YMet2oqc1k0UhJU4y9u22UoLfJJqBTVOPfxsZ50XKnQE1Okwbx 2Kc+0pi50pInA== Date: Mon, 23 Feb 2026 08:27:39 -0800 From: "Darrick J. Wong" To: Christoph Hellwig Cc: Jens Axboe , Christian Brauner , Carlos Maiolino , "Martin K. Petersen" , Anuj Gupta , Kanchan Joshi , Konstantin Komarov , ntfs3@lists.linux.dev, linux-block@vger.kernel.org, nvdimm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH 12/16] ntfs3: remove copy and pasted iomap code Message-ID: <20260223162739.GC2390353@frogsfrogsfrogs> References: <20260223132021.292832-1-hch@lst.de> <20260223132021.292832-13-hch@lst.de> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260223132021.292832-13-hch@lst.de> On Mon, Feb 23, 2026 at 05:20:12AM -0800, Christoph Hellwig wrote: > ntfs3 copied the iomap code without attribution or talking to the > maintainers, to hook into the bio completion for (unexplained) zeroing. Well they /did/ attribute it... > Fix this by just overriding the bio completion handler in the submit > handler. > > Signed-off-by: Christoph Hellwig > --- > fs/ntfs3/inode.c | 51 +++--------------------------------------------- > 1 file changed, 3 insertions(+), 48 deletions(-) > > diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c > index 7ab4e18f8013..60af9f8e0366 100644 > --- a/fs/ntfs3/inode.c > +++ b/fs/ntfs3/inode.c > @@ -605,63 +605,18 @@ static void ntfs_iomap_read_end_io(struct bio *bio) > bio_put(bio); > } > > -/* > - * Copied from iomap/bio.c. ...extremely poorly, by not recording their reasons for copy-pasting the code. > - */ > -static int ntfs_iomap_bio_read_folio_range(const struct iomap_iter *iter, > - struct iomap_read_folio_ctx *ctx, > - size_t plen) > -{ > - struct folio *folio = ctx->cur_folio; > - const struct iomap *iomap = &iter->iomap; > - loff_t pos = iter->pos; > - size_t poff = offset_in_folio(folio, pos); > - loff_t length = iomap_length(iter); > - sector_t sector; > - struct bio *bio = ctx->read_ctx; > - > - sector = iomap_sector(iomap, pos); > - if (!bio || bio_end_sector(bio) != sector || > - !bio_add_folio(bio, folio, plen, poff)) { > - gfp_t gfp = mapping_gfp_constraint(folio->mapping, GFP_KERNEL); > - gfp_t orig_gfp = gfp; > - unsigned int nr_vecs = DIV_ROUND_UP(length, PAGE_SIZE); > - > - if (bio) > - submit_bio(bio); > - > - if (ctx->rac) /* same as readahead_gfp_mask */ > - gfp |= __GFP_NORETRY | __GFP_NOWARN; > - bio = bio_alloc(iomap->bdev, bio_max_segs(nr_vecs), REQ_OP_READ, > - gfp); > - /* > - * If the bio_alloc fails, try it again for a single page to > - * avoid having to deal with partial page reads. This emulates > - * what do_mpage_read_folio does. > - */ > - if (!bio) > - bio = bio_alloc(iomap->bdev, 1, REQ_OP_READ, orig_gfp); > - if (ctx->rac) > - bio->bi_opf |= REQ_RAHEAD; > - bio->bi_iter.bi_sector = sector; > - bio->bi_end_io = ntfs_iomap_read_end_io; > - bio_add_folio_nofail(bio, folio, plen, poff); > - ctx->read_ctx = bio; > - } > - return 0; > -} Yeah, identical to iomap_bio_read_folio_range except for setting bi_end_io. Don't copy-paste stuff. Reviewed-by: "Darrick J. Wong" --D > - > static void ntfs_iomap_bio_submit_read(const struct iomap_iter *iter, > struct iomap_read_folio_ctx *ctx) > { > struct bio *bio = ctx->read_ctx; > > + bio->bi_end_io = ntfs_iomap_read_end_io; > submit_bio(bio); > } > > static const struct iomap_read_ops ntfs_iomap_bio_read_ops = { > - .read_folio_range = ntfs_iomap_bio_read_folio_range, > - .submit_read = ntfs_iomap_bio_submit_read, > + .read_folio_range = iomap_bio_read_folio_range, > + .submit_read = ntfs_iomap_bio_submit_read, > }; > > static int ntfs_read_folio(struct file *file, struct folio *folio) > -- > 2.47.3 > >