From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ADE6C83F22 for ; Tue, 15 Jul 2025 16:20:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF2476B0098; Tue, 15 Jul 2025 12:20:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA1866B009A; Tue, 15 Jul 2025 12:20:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B91116B009B; Tue, 15 Jul 2025 12:20:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A18176B009A for ; Tue, 15 Jul 2025 12:20:24 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 67017140513 for ; Tue, 15 Jul 2025 16:20:24 +0000 (UTC) X-FDA: 83667011568.26.46104F7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 8BE8FA0007 for ; Tue, 15 Jul 2025 16:20:22 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ijaztzpF; spf=pass (imf25.hostedemail.com: domain of bfoster@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bfoster@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752596422; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RNt1gYF8rhzNdcRcfNFkSyvS8xhryuLLwlnJ0xbg9tE=; b=rA/JU0sc7P1FUtTzjQibNTwHvNwiHxYwL4gk4mbP6CCZhU3cpjXDAsWGbNywSMxDU8lpQZ vtRIPYzFKERLV2QH5A+4tgMKiQ/1Nb6YxyVdcFAG9g+k8A+EEzdq47sFGLKuKxn+EsDSJL BXDDo2u2LThxBXUHpVLLNpzXPwKYgCg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752596422; a=rsa-sha256; cv=none; b=Nv75FvnUFcryg6rlJnqMTVSzl8W93pTWH/9HX85HJvNTgdOf/R/nSEYvqD4JZmm592Fxzq YIR5lYFdPacH0OTb+e9gRHdK/DP03+8eW1bYr4i4DXtJTxExT+2nC3EjqNgxUx03nWPeBa yT+cKiJ7DexEDAmRCsKJncshgZRqWZ0= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ijaztzpF; spf=pass (imf25.hostedemail.com: domain of bfoster@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bfoster@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1752596421; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RNt1gYF8rhzNdcRcfNFkSyvS8xhryuLLwlnJ0xbg9tE=; b=ijaztzpFHMNfs23K1+RZfEya9HRx1Bdfty9LI+XM1MYZp7v9fILDCafnfY35zXvgiTnI9Z GLjg0yiROMcgnZzWC/deSM/IuYwO+fu/HK0kPPgmh6v1P5iyfrf26sd6S7AjcGAsRHQoLZ NPpJg2FpXQ0Nq87upKdmBKxVb36xTL8= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-423-WBM6xo3aNsmHwaQKp9Ur1A-1; Tue, 15 Jul 2025 12:16:48 -0400 X-MC-Unique: WBM6xo3aNsmHwaQKp9Ur1A-1 X-Mimecast-MFC-AGG-ID: WBM6xo3aNsmHwaQKp9Ur1A_1752596206 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B0B9E18002EC; Tue, 15 Jul 2025 16:16:46 +0000 (UTC) Received: from bfoster (unknown [10.22.64.43]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 344B1197702F; Tue, 15 Jul 2025 16:16:45 +0000 (UTC) Date: Tue, 15 Jul 2025 12:20:26 -0400 From: Brian Foster To: "Darrick J. Wong" Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, hch@infradead.org, willy@infradead.org Subject: Re: [PATCH v3 7/7] xfs: error tag to force zeroing on debug kernels Message-ID: References: <20250714204122.349582-1-bfoster@redhat.com> <20250714204122.349582-8-bfoster@redhat.com> <20250715052444.GP2672049@frogsfrogsfrogs> <20250715143041.GN2672029@frogsfrogsfrogs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250715143041.GN2672029@frogsfrogsfrogs> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 8BE8FA0007 X-Stat-Signature: 57sz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KbI2qaScg7b2S2NnuF8B9cyqR2UeUQhGOYzdQLklVGfnTTRbZtHkz9sQy63VptKCegnCYjdCu9JiQApeICVL9vtWKuC4xqCZoRQORNPoeHsFiNR3BWd61MytSisqqJ+h97KeUx2M+sDEWzL8GlKk5s/z3evkFiM0Rh2YFf+ajkfAmOYlZGXLwliPWpOEgIJh0BmGTyJXj3PXN9KqAmPB+1dblGfWJoEtFkqa/KBP876ph25Q/eSP1yjOIpI3hagb/Xr/S5dr6Euv0MEbSWeerSBMiYDk9/1gbzOjRtR8zg3lKQ1acW6cUNCCPFodQlFtAFxztZg3sLr1ZRi1M0yqj+di7jKE3zjwHj5e3/SOrW/G6TCvTe1RW8ldppPqY+E2qPMCc0y0Y7drFEXiZWQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Jul 15, 2025 at 07:30:41AM -0700, Darrick J. Wong wrote: > On Tue, Jul 15, 2025 at 08:39:03AM -0400, Brian Foster wrote: > > On Mon, Jul 14, 2025 at 10:24:44PM -0700, Darrick J. Wong wrote: > > > On Mon, Jul 14, 2025 at 04:41:22PM -0400, Brian Foster wrote: > > > > iomap_zero_range() has to cover various corner cases that are > > > > difficult to test on production kernels because it is used in fairly > > > > limited use cases. For example, it is currently only used by XFS and > > > > mostly only in partial block zeroing cases. > > > > > > > > While it's possible to test most of these functional cases, we can > > > > provide more robust test coverage by co-opting fallocate zero range > > > > to invoke zeroing of the entire range instead of the more efficient > > > > block punch/allocate sequence. Add an errortag to occasionally > > > > invoke forced zeroing. > > > > > > > > Signed-off-by: Brian Foster > > > > Reviewed-by: Christoph Hellwig > > > > --- > > > > fs/xfs/libxfs/xfs_errortag.h | 4 +++- > > > > fs/xfs/xfs_error.c | 3 +++ > > > > fs/xfs/xfs_file.c | 26 ++++++++++++++++++++------ > > > > 3 files changed, 26 insertions(+), 7 deletions(-) > > > > > > ... > > > > diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c > > > > index 0b41b18debf3..c865f9555b77 100644 > > > > --- a/fs/xfs/xfs_file.c > > > > +++ b/fs/xfs/xfs_file.c > > > > @@ -27,6 +27,8 @@ > > > > #include "xfs_file.h" > > > > #include "xfs_aops.h" > > > > #include "xfs_zone_alloc.h" > > > > +#include "xfs_error.h" > > > > +#include "xfs_errortag.h" > > > > > > > > #include > > > > #include > > > > @@ -1269,13 +1271,25 @@ xfs_falloc_zero_range( > > > > if (error) > > > > return error; > > > > > > > > - error = xfs_free_file_space(XFS_I(inode), offset, len, ac); > > > > - if (error) > > > > - return error; > > > > + /* > > > > + * Zero range implements a full zeroing mechanism but is only used in > > > > + * limited situations. It is more efficient to allocate unwritten > > > > + * extents than to perform zeroing here, so use an errortag to randomly > > > > + * force zeroing on DEBUG kernels for added test coverage. > > > > + */ > > > > + if (XFS_TEST_ERROR(false, XFS_I(inode)->i_mount, > > > > + XFS_ERRTAG_FORCE_ZERO_RANGE)) { > > > > + error = xfs_zero_range(XFS_I(inode), offset, len, ac, NULL); > > > > > > Isn't this basically the ultra slow version fallback version of > > > FALLOC_FL_WRITE_ZEROES ? > > > > > > > ~/linux$ git grep FALLOC_FL_WRITE_ZEROES > > ~/linux$ > > > > IIRC write zeroes is intended to expose fast hardware (physical) zeroing > > (i.e. zeroed written extents)..? If so, I suppose you could consider > > this a fallback of sorts. I'm not sure what write zeroes is expected to > > do in the unwritten extent case, whereas iomap zero range is happy to > > skip those mappings unless they're already dirty in pagecache. > > Sorry, forgot that they weren't wiring anything up in xfs so it never > showed up here: > https://lore.kernel.org/linux-fsdevel/20250619111806.3546162-1-yi.zhang@huaweicloud.com/ > > Basically they want to avoid the unwritten extent conversion overhead by > providing a way to preallocate written zeroed extents and sending magic > commands to hardware that unmaps LBAs in such a way that rereads return > zero. > Ack.. I'd seen that before, but hadn't looked too closely and wasn't sure what the status was. > > Regardless, the purpose of this patch is not to add support for physical > > zeroing, but rather to increase test coverage for the additional code on > > debug kernels because the production use case tends to be more limited. > > This could easily be moved/applied to write zeroes if it makes sense in > > the future and test infra grows support for it. > > On second look, I don't think the new fallocate flag allows for > letting the kernel do pagecache zeroing + flush. Admittedly that would > be beside the point (and userspaces already do that anyway). > Ok. Thanks for the reviews. Brian > Anyway enough mumbling from me, > Reviewed-by: "Darrick J. Wong" > > --D > > > Brian > > > > > --D > > > > > > > + } else { > > > > + error = xfs_free_file_space(XFS_I(inode), offset, len, ac); > > > > + if (error) > > > > + return error; > > > > > > > > - len = round_up(offset + len, blksize) - round_down(offset, blksize); > > > > - offset = round_down(offset, blksize); > > > > - error = xfs_alloc_file_space(XFS_I(inode), offset, len); > > > > + len = round_up(offset + len, blksize) - > > > > + round_down(offset, blksize); > > > > + offset = round_down(offset, blksize); > > > > + error = xfs_alloc_file_space(XFS_I(inode), offset, len); > > > > + } > > > > if (error) > > > > return error; > > > > return xfs_falloc_setsize(file, new_size); > > > > -- > > > > 2.50.0 > > > > > > > > > > > > > > > >