Details
-
Improvement
-
Resolution: Fixed
-
Major
-
None
-
9223372036854775807
Description
The ext4 superblock has an "s_kbytes_written" field that is supposed to contain the total number of bytes written to the block device since the filesystem was formatted. The in-memory counter that tracks the current number of writes written to the block device is exposed to userspace via /sys/fs/{ldiskfs,ext4}/<device>/session_kbytes_written, and this is added to s_kbytes_written to generate the "lifetime" writes and shown at .../lifetime_kbytes_written. This would be useful for tracking the total lifetime writes on flash OST and MDT devices, assuming they are not reformatted during usage (which should be rare). The in-memory block device writes counter is written to disk via ext4_update_super().
Unfortunately, upstream ext4 after commit v3.5-rc5-19-g4d47603d9703 no longer writes out the superblock on any regular basis. The superblock is only written at unmount/remount time, in case ext4_error() is hit, or if the filesystem is resized or frozen, which means that the s_kbytes_written counter may frequently be inaccurate due to missing updates if the filesystem is not unmounted cleanly each time (e.g. due to crash/reboot/STONITH).
Having a periodic write of the superblock (e.g. once per hour, or other tunable interval) would not add any measurable overhead to the system, but ensure that the s_kbytes_written counter is kept relatively well updated, so at most an hour worth of writes would be lost in case of a crash and remount.
Attachments
Issue Links
- is related to
-
LU-16982 Crash lustre after umount -d -f /mnt/lustre-mds4
- Resolved