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 1C454C77B78 for ; Wed, 26 Apr 2023 07:07:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF12D6B008C; Wed, 26 Apr 2023 03:07:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A78BD6B0092; Wed, 26 Apr 2023 03:07:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 919A86B0093; Wed, 26 Apr 2023 03:07:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7DA1C6B008C for ; Wed, 26 Apr 2023 03:07:51 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 42AA2401AF for ; Wed, 26 Apr 2023 07:07:51 +0000 (UTC) X-FDA: 80722662342.23.66D7457 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id 88520100015 for ; Wed, 26 Apr 2023 07:07:49 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=dNtuA6Zw; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682492869; 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=KllLIBhpd2/zSPvoPZjdMLsSq7v6g33bQSjJxc2+Vu0=; b=oenyhIlt8RLrlB1aT3R7T4+4cFwjxmMnXpymoPCbCIUMs+oAtii67ORVeR5zkNJZnPVo4R G10cH5nSyNrK037CM3waDsplzI+nX1orDARa5eJnkm+gRWejSUAmlg7O1r0+RsRg7xznu+ R/aosJNRzzbIU+icFnOl/QImoZO2800= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=dNtuA6Zw; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682492869; a=rsa-sha256; cv=none; b=1HNoS6xXeP0jS/P+fzqqTGA0aFV+UV2WYw7SqUL8fHOerFTErywMkgJnFuPRsm/H9/lgGf uTqdEf6UWDYBYP8GA75jbLQ91k2WAHE6024S9hp0UynOG/hm+73clP+Qfp1E5SK4H4573t U78qdKYMRXa4bjAlTZK0QE8f/oazWWQ= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 94AD4633B4; Wed, 26 Apr 2023 07:07:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95666C433EF; Wed, 26 Apr 2023 07:07:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682492868; bh=2o6kaGsCFO97KPH7lPad22AOk5j+21G5SxH089QMJIQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dNtuA6Zwr2oC++Hau2Eev6ellEt8Arrfgv2YyDVHEkR2gFZuwQ/Yig3nYyNE3h8FW juPQH+WF6aUh/Cfijao/pYEmv8x5xgELnE8uzJsxMB9lQf6O0DNO47ZqIvwWSEG5UA 3eTP+oL6u2BAG93O++dZpkXCidaUifWDg1UzIg4hPJs7Mx7ZFr9SJf4I68q7ip1PTm qIyO6+94cKoYMEbeoaPxNrXk+qB9Z6jrUNGw2Gu8pXpH0re151vMOLCGEgI55mZxbN jfzt0KZXKVUH/tvji8A8XfmRgjFgUim8D5FS8/pmdHnlsVMTkJ10vT6Net2usqKU6T Yr9mxEp05W9Rg== Date: Wed, 26 Apr 2023 09:07:41 +0200 From: Christian Brauner To: Jeff Layton Cc: Alexander Viro , "Darrick J. Wong" , Hugh Dickins , Andrew Morton , Dave Chinner , Chuck Lever , Jan Kara , Amir Goldstein , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org Subject: Re: [PATCH v2 1/3] fs: add infrastructure for multigrain inode i_m/ctime Message-ID: <20230426-bahnanlagen-ausmusterung-4877cbf40d4c@brauner> References: <20230424151104.175456-1-jlayton@kernel.org> <20230424151104.175456-2-jlayton@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230424151104.175456-2-jlayton@kernel.org> X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 88520100015 X-Stat-Signature: mhbxjdm4sbkmppeo87gpw8xg3tbtho5n X-HE-Tag: 1682492869-457575 X-HE-Meta: U2FsdGVkX1/BzX7qFRTlCOzPuoLEj/3H388dS110/w+szQu4UFuh68k7IKRZHTVWtmEgJeNbke63X8YZRDkdWU+15b0fCsxsqzKUJO1x4tUxtsaqB+b+Y093ADb3PWu+Aaek/KTabx7AHAUrOGLwRhlnsWH0ffJ6HUtm0Fo9GzBm/G+BD0pZS4upzcpLotzeOEy5VIc8KpI7kV2zGGD5g1mRygDvI0jyni8zlun16yEUzjE5+0fN4Z0lH97i0rGMbLAgsUsocE23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== 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: On Mon, Apr 24, 2023 at 11:11:02AM -0400, Jeff Layton wrote: > The VFS always uses coarse-grained timestamp updates for filling out the > ctime and mtime after a change. This has the benefit of allowing > filesystems to optimize away a lot metaupdates, to around once per > jiffy, even when a file is under heavy writes. > > Unfortunately, this has always been an issue when we're exporting via > NFSv3, which relies on timestamps to validate caches. Even with NFSv4, a > lot of exported filesystems don't properly support a change attribute > and are subject to the same problems with timestamp granularity. Other > applications have similar issues (e.g backup applications). > > Switching to always using fine-grained timestamps would improve the > situation for NFS, but that becomes rather expensive, as the underlying > filesystem will have to log a lot more metadata updates. > > What we need is a way to only use fine-grained timestamps when they are > being actively queried: > > Whenever the mtime changes, the ctime must also change since we're > changing the metadata. When a superblock has a s_time_gran >1, we can > use the lowest-order bit of the inode->i_ctime as a flag to indicate > that the value has been queried. Then on the next write, we'll fetch a > fine-grained timestamp instead of the usual coarse-grained one. > > We could enable this for any filesystem that has a s_time_gran >1, but > for now, this patch adds a new SB_MULTIGRAIN_TS flag to allow filesystems > to opt-in to this behavior. Hm, the patch raises the flag in s_flags. Please at least move this to s_iflags as SB_I_MULTIGRAIN and treat this as an internal flag. There's no need to give the impression that this will become a mount option. Also, this looks like it's a filesystem property not a superblock property as the granularity isn't changeable. So shouldn't this be an FS_* flag instead?