From e4e8efd11585208e63fc4cb39f238f8a21e57c8e Mon Sep 17 00:00:00 2001 From: Ferry Meng Date: Wed, 7 Jun 2023 15:42:05 +0800 Subject: [PATCH] util-linux : add 'lazytime' vfs-option to mount. add lazytime recognization to mount, which will be wrongly passed to kernel mode now. Signed-off-by: Ferry Meng --- ...libmount-add-support-for-MS_LAZYTIME.patch | 82 +++++++++++++++++++ 0203-mount-fix-lazytime-docs.patch | 25 ++++++ util-linux.spec | 8 +- 3 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 0202-libmount-add-support-for-MS_LAZYTIME.patch create mode 100644 0203-mount-fix-lazytime-docs.patch diff --git a/0202-libmount-add-support-for-MS_LAZYTIME.patch b/0202-libmount-add-support-for-MS_LAZYTIME.patch new file mode 100644 index 0000000..6a1c217 --- /dev/null +++ b/0202-libmount-add-support-for-MS_LAZYTIME.patch @@ -0,0 +1,82 @@ +From 3d74186ff2c40c4c7f29de9d25d83419c96482ae Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 30 Mar 2015 12:43:45 +0200 +Subject: [PATCH 202/203] libmount: add support for MS_LAZYTIME + +Signed-off-by: Karel Zak +--- + libmount/src/libmount.h.in | 3 +++ + libmount/src/optmap.c | 4 ++++ + sys-utils/mount.8 | 27 +++++++++++++++++++++++++++ + 3 files changed, 34 insertions(+) + +diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in +index ad31838..c036cfa 100644 +--- a/libmount/src/libmount.h.in ++++ b/libmount/src/libmount.h.in +@@ -757,6 +757,9 @@ extern int mnt_context_set_syscall_status(struct libmnt_context *cxt, int status + #ifndef MS_STRICTATIME + #define MS_STRICTATIME (1<<24) /* strict atime semantics */ + #endif ++#ifndef MS_LAZYTIME ++#define MS_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */ ++#endif + + /* + * Magic mount flag number. Had to be or-ed to the flag values. +diff --git a/libmount/src/optmap.c b/libmount/src/optmap.c +index 7c0a235..81b76dd 100644 +--- a/libmount/src/optmap.c ++++ b/libmount/src/optmap.c +@@ -112,6 +112,10 @@ static const struct libmnt_optmap linux_flags_map[] = + { "strictatime", MS_STRICTATIME }, /* Strict atime semantics */ + { "nostrictatime", MS_STRICTATIME, MNT_INVERT }, /* kernel default atime */ + #endif ++#ifdef MS_LAZYTIME ++ { "lazytime", MS_LAZYTIME }, /* Update {a,m,c}time on the in-memory inode only */ ++ { "nolazytime", MS_LAZYTIME, MNT_INVERT }, ++#endif + #ifdef MS_PROPAGATION + { "unbindable", MS_UNBINDABLE, MNT_NOHLPS | MNT_NOMTAB }, /* Unbindable */ + { "runbindable", MS_UNBINDABLE | MS_REC, MNT_NOHLPS | MNT_NOMTAB }, +diff --git a/sys-utils/mount.8 b/sys-utils/mount.8 +index 35d782f..85fec54 100644 +--- a/sys-utils/mount.8 ++++ b/sys-utils/mount.8 +@@ -1069,6 +1069,33 @@ system mount options see /proc/mounts. + .B nostrictatime + Use the kernel's default behaviour for inode access time updates. + .TP ++.B lazytime ++Only update times (atime, mtime, ctime) on the in-memory version of the file inode. ++ ++This mount option significantly reduces writes to the inode table for ++workloads that perform frequent random writes to preallocated files. ++As at Linux 3.20, this option is supported only on ext4. ++ ++The on-disk timestamps are updated only when: ++.sp ++.RS ++- the inode needs to be updated for some change unrelated to file timestamps ++.sp ++- the application employs ++.BR fsync (2), ++.BR syncfs (2), ++or ++.BR sync (2) ++.sp ++- an undeleted inode is evicted from memory ++.sp ++- more than 24 hours have passed since the i-node was written to disk. ++.RE ++.sp ++.TP ++.B nolazytime ++Do not use the nolazytime feature. ++.TP + .B suid + Allow set-user-identifier or set-group-identifier bits to take + effect. +-- +2.31.1 + diff --git a/0203-mount-fix-lazytime-docs.patch b/0203-mount-fix-lazytime-docs.patch new file mode 100644 index 0000000..fef590c --- /dev/null +++ b/0203-mount-fix-lazytime-docs.patch @@ -0,0 +1,25 @@ +From cfa951792bde69e566b23bb90cc3788b717c10a3 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 30 Mar 2015 12:52:22 +0200 +Subject: [PATCH 203/203] mount: fix lazytime docs + +Signed-off-by: Karel Zak +--- + sys-utils/mount.8 | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/sys-utils/mount.8 b/sys-utils/mount.8 +index 85fec54..0c05572 100644 +--- a/sys-utils/mount.8 ++++ b/sys-utils/mount.8 +@@ -1074,7 +1074,6 @@ Only update times (atime, mtime, ctime) on the in-memory version of the file ino + + This mount option significantly reduces writes to the inode table for + workloads that perform frequent random writes to preallocated files. +-As at Linux 3.20, this option is supported only on ext4. + + The on-disk timestamps are updated only when: + .sp +-- +2.31.1 + diff --git a/util-linux.spec b/util-linux.spec index d292e5f..9162308 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -2,7 +2,7 @@ Summary: A collection of basic system utilities Name: util-linux Version: 2.23.2 -Release: 65%{?dist}.1 +Release: 66%{?dist} License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain Group: System Environment/Base URL: http://en.wikipedia.org/wiki/Util-linux @@ -496,6 +496,9 @@ Patch200: 0200-chrt-default-to-SCHED_RR-policy.patch # 1883013 - RHEL-7: chrt command does not support the -R option [rhel-7.9.z] Patch201: 0201-chrt-use-SCHED_FLAG_RESET_ON_FORK-for-sched_setattr.patch +# Anolis +Patch202: 0202-libmount-add-support-for-MS_LAZYTIME.patch +Patch203: 0203-mount-fix-lazytime-docs.patch %description The util-linux package contains a large variety of low-level system @@ -1276,6 +1279,9 @@ fi %{_libdir}/pkgconfig/uuid.pc %changelog +* Wed Jun 07 2023 Ferry Meng 2.23.2-66 +- Add lazytime/nolazytime vfs mount option recognization + * Wed Dec 09 2020 Karel Zak 2.23.2-65.el7_9.1 - fix #1905956 - RHEL-7: chrt regression: unwanted 'nice' value reset on sched_setattr() [rhel-7.9.z] - fix #1905954 - RHEL-7: chrt regression: unexpected default scheduler [rhel-7.9.z] -- Gitee