Disk quota file is controlled by filesystem quota subsystem, access time
of quota file is almost random, and should be meanless to user, so let's
add noatime to quota file.

Meanwhile, set quota file w/ F2FS_IMMUTABLE_FL instead of FS_IMMUTABLE_FL,
since F2FS_IMMUTABLE_FL is on-disk flag, however FS_IMMUTABLE_FL is in-memory
one.

Signed-off-by: Chao Yu <c...@kernel.org>
---
 fsck/node.c             | 2 +-
 include/f2fs_fs.h       | 7 ++++++-
 mkfs/f2fs_format.c      | 2 +-
 tools/f2fs_io/f2fs_io.h | 4 ++++
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/fsck/node.c b/fsck/node.c
index 9ce8a72..4dc7890 100644
--- a/fsck/node.c
+++ b/fsck/node.c
@@ -62,7 +62,7 @@ int f2fs_rebuild_qf_inode(struct f2fs_sb_info *sbi, int qtype)
 
        raw_node->i.i_size = cpu_to_le64(1024 * 6);
        raw_node->i.i_blocks = cpu_to_le64(1);
-       raw_node->i.i_flags = FS_IMMUTABLE_FL;
+       raw_node->i.i_flags = F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL;
 
        if (is_set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG))
                cp_ver |= (cur_cp_crc(ckpt) << 32);
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 936a5d8..8475645 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -750,7 +750,12 @@ enum {
 #define QUOTA_DATA(i)          (2)
 #define QUOTA_INO(sb,t)        (le32_to_cpu((sb)->qf_ino[t]))
 
-#define FS_IMMUTABLE_FL                0x00000010 /* Immutable file */
+/*
+ * On-disk inode flags (f2fs_inode::i_flags)
+ */
+#define F2FS_IMMUTABLE_FL              0x00000010 /* Immutable file */
+#define F2FS_NOATIME_FL                        0x00000080 /* do not update 
atime */
+
 
 #define F2FS_ENC_UTF8_12_1     1
 #define F2FS_ENC_STRICT_MODE_FL        (1 << 0)
diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index ef5d9a6..df6bde2 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -1364,7 +1364,7 @@ static int f2fs_write_qf_inode(int qtype, int offset)
 
        raw_node->i.i_size = cpu_to_le64(1024 * 6);
        raw_node->i.i_blocks = cpu_to_le64(1 + QUOTA_DATA(qtype));
-       raw_node->i.i_flags = FS_IMMUTABLE_FL;
+       raw_node->i.i_flags = F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL;
 
        raw_node->footer.next_blkaddr = cpu_to_le32(
                        get_sb(main_blkaddr) +
diff --git a/tools/f2fs_io/f2fs_io.h b/tools/f2fs_io/f2fs_io.h
index 58be8f8..b4aa9cf 100644
--- a/tools/f2fs_io/f2fs_io.h
+++ b/tools/f2fs_io/f2fs_io.h
@@ -167,6 +167,10 @@ struct fscrypt_get_policy_ex_arg {
 #define F2FS_IOC_FSGETXATTR            FS_IOC_FSGETXATTR
 #define F2FS_IOC_FSSETXATTR            FS_IOC_FSSETXATTR
 
+#ifndef FS_IMMUTABLE_FL
+#define FS_IMMUTABLE_FL                        0x00000010 /* Immutable file */
+#endif
+
 #ifndef FS_ENCRYPT_FL
 #define FS_ENCRYPT_FL                  0x00000800 /* Encrypted file */
 #endif
-- 
2.40.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to