mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] f2fs: opt in to multigrain timestamps
@ 2026-10-12 15:46 Jeff Layton
  2026-10-14 12:09 ` Chao Yu
  2026-10-14 15:50 ` [f2fs-dev] " patchwork-bot+f2fs
  0 siblings, 2 replies; 3+ messages in thread
From: Jeff Layton @ 2026-10-12 15:46 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu
  Cc: linux-f2fs-devel, linux-fsdevel, linux-kernel, Jeff Layton

Set FS_MGTIME on f2fs_fs_type.

f2fs meets the multigrain requirements:
- ctime updates use inode_set_ctime_current()
- f2fs_getattr() calls generic_fillattr()
- f2fs_setattr() calls setattr_copy()
- s_time_gran is 1ns

Exception: with CONFIG_F2FS_FS_POSIX_ACL, f2fs_setattr() uses a local
__setattr_copy() that sets timestamps directly, bypassing
setattr_copy_mgtime(). Make it call setattr_copy() with ATTR_MODE
cleared, then do the f2fs mode/ACL handling as before. ACL builds now
also honor ATTR_CTIME_SET via inode_set_ctime_deleg(), as non-ACL
builds already do.

Assisted-by: LLM
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/f2fs/file.c  | 14 +++++---------
 fs/f2fs/super.c |  2 +-
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index edc352569e87..71211244f42f 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1100,17 +1100,13 @@ static void __setattr_copy(struct mnt_idmap *idmap,
 			   struct inode *inode, const struct iattr *attr)
 {
 	unsigned int ia_valid = attr->ia_valid;
+	struct iattr sattr = *attr;
 
-	i_uid_update(idmap, attr, inode);
-	i_gid_update(idmap, attr, inode);
-	if (ia_valid & ATTR_ATIME)
-		inode_set_atime_to_ts(inode, attr->ia_atime);
-	if (ia_valid & ATTR_MTIME)
-		inode_set_mtime_to_ts(inode, attr->ia_mtime);
-	if (ia_valid & ATTR_CTIME)
-		inode_set_ctime_to_ts(inode, attr->ia_ctime);
+	sattr.ia_valid &= ~ATTR_MODE;
+
+	setattr_copy(idmap, inode, &sattr);
 	if (ia_valid & ATTR_MODE) {
-		umode_t mode = attr->ia_mode;
+		umode_t mode = sattr.ia_mode;
 
 		if (!in_group_or_capable(idmap, inode, i_gid_into_vfsgid(idmap, inode)))
 			mode &= ~S_ISGID;
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 1314b6ccced9..535666bfa50c 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -5699,7 +5699,7 @@ static struct file_system_type f2fs_fs_type = {
 	.name		= "f2fs",
 	.init_fs_context = f2fs_init_fs_context,
 	.kill_sb	= kill_f2fs_super,
-	.fs_flags	= FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
+	.fs_flags	= FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME,
 };
 MODULE_ALIAS_FS("f2fs");
 

---
base-commit: d5b6dc381db93ff2d1888f7d99c06e0bd85f4083
change-id: 20260815-mgtime-f2fs-aa4a20da1c1b

Best regards,
-- 
Jeff Layton <jlayton@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] f2fs: opt in to multigrain timestamps
  2026-10-12 15:46 [PATCH] f2fs: opt in to multigrain timestamps Jeff Layton
@ 2026-10-14 12:09 ` Chao Yu
  2026-10-14 15:50 ` [f2fs-dev] " patchwork-bot+f2fs
  1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2026-10-14 12:09 UTC (permalink / raw)
  To: Jeff Layton, Jaegeuk Kim
  Cc: chao, linux-f2fs-devel, linux-fsdevel, linux-kernel

On 10/12/26 23:46, Jeff Layton wrote:
> Set FS_MGTIME on f2fs_fs_type.
> 
> f2fs meets the multigrain requirements:
> - ctime updates use inode_set_ctime_current()
> - f2fs_getattr() calls generic_fillattr()
> - f2fs_setattr() calls setattr_copy()
> - s_time_gran is 1ns
> 
> Exception: with CONFIG_F2FS_FS_POSIX_ACL, f2fs_setattr() uses a local
> __setattr_copy() that sets timestamps directly, bypassing
> setattr_copy_mgtime(). Make it call setattr_copy() with ATTR_MODE
> cleared, then do the f2fs mode/ACL handling as before. ACL builds now
> also honor ATTR_CTIME_SET via inode_set_ctime_deleg(), as non-ACL
> builds already do.
> 
> Assisted-by: LLM
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: opt in to multigrain timestamps
  2026-10-12 15:46 [PATCH] f2fs: opt in to multigrain timestamps Jeff Layton
  2026-10-14 12:09 ` Chao Yu
@ 2026-10-14 15:50 ` patchwork-bot+f2fs
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+f2fs @ 2026-10-14 15:50 UTC (permalink / raw)
  To: Jeff Layton; +Cc: jaegeuk, chao, linux-fsdevel, linux-kernel, linux-f2fs-devel

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Mon, 12 Oct 2026 11:46:10 -0400 you wrote:
> Set FS_MGTIME on f2fs_fs_type.
> 
> f2fs meets the multigrain requirements:
> - ctime updates use inode_set_ctime_current()
> - f2fs_getattr() calls generic_fillattr()
> - f2fs_setattr() calls setattr_copy()
> - s_time_gran is 1ns
> 
> [...]

Here is the summary with links:
  - [f2fs-dev] f2fs: opt in to multigrain timestamps
    https://git.kernel.org/jaegeuk/f2fs/c/714c68e85ba3

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-14 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-12 15:46 [PATCH] f2fs: opt in to multigrain timestamps Jeff Layton
2026-10-14 12:09 ` Chao Yu
2026-10-14 15:50 ` [f2fs-dev] " patchwork-bot+f2fs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®