aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChao Yu <chao@kernel.org>2023-05-17 16:26:29 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2023-05-17 18:30:53 -0700
commit0f74f239a1ec5e8c1a0a945caa94d454f535c507 (patch)
tree77cbaa1445405958c1d094da4db0f058e4cb984d
parent75f7c586c31692f5ef4a79a336324fdfacaf71b6 (diff)
downloadf2fs-tools-0f74f239a1ec5e8c1a0a945caa94d454f535c507.tar.gz
f2fs-tools: add noatime for quota file
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 <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fsck/node.c2
-rw-r--r--include/f2fs_fs.h7
-rw-r--r--mkfs/f2fs_format.c2
-rw-r--r--tools/f2fs_io/f2fs_io.h4
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