History

vfs: add support for a lazytime mount option

Add a new mount option which enables a new "lazytime" mode. This mode causes atime, mtime, and ctime updates to only be made to the in-memory version of the inode. The on-disk times will only get updated when (a) if the inode needs to be updated for some non-time related change, (b) if userspace calls fsync(), syncfs() or sync(), or (c) just before an undeleted inode is evicted from memory. This is OK according to POSIX because there are no guarantees after a crash unless userspace explicitly requests via a fsync(2) call. For workloads which feature a large number of random write to a preallocated file, the lazytime mount option significantly reduces writes to the inode table. The repeated 4k writes to a single block will result in undesirable stress on flash devices and SMR disk drives. Even on conventional HDD's, the repeated writes to the inode table block will trigger Adjacent Track Interference (ATI) remediation latencies, which very negatively impact long tail latencies --- which is a very big deal for web serving tiers (for example). Google-Bug-Id: 18297052

Theodore Ts'o committed 11 years ago

Commit 0ae45f61 parent e36f01413 files · +186 −35Browse files

Showing the changes to include/uapi/linux (1 of 13 files). Show all

Unified · Split

include/uapi/linux/fs.h+3−1
@@ -90,6 +90,7 @@ struct inodes_stat_t { · 89 unmodified lines
9090 #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
9191 #define MS_I_VERSION (1<<23) /* Update inode I_version field */
9292 #define MS_STRICTATIME (1<<24) /* Always perform atime updates */
93+#define MS_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */
9394
9495 /* These sb flags are internal to the kernel */
9596 #define MS_NOSEC (1<<28)
@@ -100,7 +101,8 @@ struct inodes_stat_t { · 4 unmodified lines
100101 /*
101102 * Superblock flags that can be altered by MS_REMOUNT
102103 */
103−#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION)
104+#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|\
105+ MS_LAZYTIME)
104106
105107 /*
106108 * Old magic mount flag and mask