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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43FD8C04FE1 for ; Wed, 9 Aug 2023 22:07:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbjHIWHk (ORCPT ); Wed, 9 Aug 2023 18:07:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjHIWHj (ORCPT ); Wed, 9 Aug 2023 18:07:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59164A3; Wed, 9 Aug 2023 15:07:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CBEB664B0C; Wed, 9 Aug 2023 22:07:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8A1FC433C8; Wed, 9 Aug 2023 22:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691618857; bh=Sbngo3UIZo2TJfFo7ktsW7U9FXdWGIk5Lt7H9K5XFM8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=jLUEcluJ8QWu44nwg8FvEto5mxdSD6jhT4hkYGZFSvOuTab/uQF0xUgz8zLDtJscq f+HBUBgdFJj3+Y2ejcBWfM2DahqOuHFBxu+LY+Hv0Ofoq0ohoPPQ6mfudIqZwl+oWN pLNza58hUz5pcfryyZpEKO+0VcHneBut5CYMVVo+IlIVXRYDByI99w4/3LNaQTR8ZH 5Tcm+fOwhAMw+LBYRd9XcCm1AD2BTsoO11JuCHNeGAZ3X/S7nnQe6dSMtz75w2+y5t 1AyLcsRC7pto0A+XhqMGGaQoyj7sZyZ0q03rK2TphlgLtVEfD926pjyggGNcgTjePk OQw0IGY/USDEA== Message-ID: Subject: Re: [PATCH v7 05/13] fat: make fat_update_time get its own timestamp From: Jeff Layton To: OGAWA Hirofumi , Frank Sorenson Cc: Jan Kara , Alexander Viro , Christian Brauner , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , David Howells , Marc Dionne , Chris Mason , Josef Bacik , David Sterba , Xiubo Li , Ilya Dryomov , Jan Harkes , coda@cs.cmu.edu, Tyler Hicks , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Namjae Jeon , Sungjong Seo , Jan Kara , Theodore Ts'o , Andreas Dilger , Jaegeuk Kim , Miklos Szeredi , Bob Peterson , Andreas Gruenbacher , Greg Kroah-Hartman , Tejun Heo , Trond Myklebust , Anna Schumaker , Konstantin Komarov , Mark Fasheh , Joel Becker , Joseph Qi , Mike Marshall , Martin Brandenburg , Luis Chamberlain , Kees Cook , Iurii Zaikin , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Sergey Senozhatsky , Richard Weinberger , Hans de Goede , Hugh Dickins , Andrew Morton , Amir Goldstein , "Darrick J. Wong" , Benjamin Coddington , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, v9fs@lists.linux.dev, linux-afs@lists.infradead.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, codalist@telemann.coda.cs.cmu.edu, ecryptfs@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@lists.linux.dev, devel@lists.orangefs.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-mtd@lists.infradead.org, linux-mm@kvack.org, linux-unionfs@vger.kernel.org, linux-xfs@vger.kernel.org Date: Wed, 09 Aug 2023 18:07:29 -0400 In-Reply-To: <87a5v06kij.fsf@mail.parknet.co.jp> References: <20230807-mgctime-v7-0-d1dec143a704@kernel.org> <20230807-mgctime-v7-5-d1dec143a704@kernel.org> <87msz08vc7.fsf@mail.parknet.co.jp> <52bead1d6a33fec89944b96e2ec20d1ea8747a9a.camel@kernel.org> <878rak8hia.fsf@mail.parknet.co.jp> <20230809150041.452w7gucjmvjnvbg@quack3> <87v8do6y8q.fsf@mail.parknet.co.jp> <2cb998ff14ace352a9dd553e82cfa0aa92ec09ce.camel@kernel.org> <87leek6rh1.fsf@mail.parknet.co.jp> <87h6p86p9z.fsf@mail.parknet.co.jp> <87a5v06kij.fsf@mail.parknet.co.jp> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, 2023-08-10 at 05:14 +0900, OGAWA Hirofumi wrote: > Jeff Layton writes: >=20 > > When you say it "doesn't work the same", what do you mean, specifically= ? > > I had to make some allowances for the fact that FAT is substantially > > different in its timestamp handling, and I tried to preserve existing > > behavior as best I could. >=20 > Ah, ok. I was misreading some. >=20 > inode_update_timestamps() checks IS_I_VERSION() now, not S_VERSION. So, > if adding the check of IS_I_VERSION() and (S_MTIME|S_CTIME|S_VERSION) to > FAT? >=20 > With it, IS_I_VERSION() would be false on FAT, and I'm fine. >=20 > I.e. something like >=20 > if ((flags & (S_VERSION|S_CTIME|S_MTIME)) && IS_I_VERSION(inode) > && inode_maybe_inc_iversion(inode, false)) > dirty_flags |=3D I_DIRTY_SYNC; >=20 > Thanks. If you do that then the i_version counter would never be incremented. But...I think I see what you're getting at. Most filesystems that support the i_version counter have an on-disk field for it. FAT obviously has no such thing. I suspect the i_version bits in fat_update_time were added by mistake. FAT doesn't set SB_I_VERSION so there's no need to do anything to the i_version field at all. Also, given that the mtime and ctime are always kept in sync on FAT, we're probably fine to have it look something like this: --------------------8<------------------ int fat_update_time(struct inode *inode, int flags)=20 {=20 int dirty_flags =3D 0; if (inode->i_ino =3D=3D MSDOS_ROOT_INO)=20 return 0; fat_truncate_time(inode, NULL, flags); if (inode->i_sb->s_flags & SB_LAZYTIME) dirty_flags |=3D I_DIRTY_TIME; else dirty_flags |=3D I_DIRTY_SYNC; __mark_inode_dirty(inode, dirty_flags); return 0; }=20 --------------------8<------------------ ...and we should probably do that in a separate patch in advance of the update_time rework, since it's really a different change. If you're in agreement, then I'll plan to respin the series with this fixed and resend. Thanks for being patient! --=20 Jeff Layton