periodic lifetime_write_kbytes updates?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was looking at the /sys/fs/ext4/*/lifetime_write_kbytes counters on
my home server and wondering about how accurate they are.  That is most
interesting in the case of flash devices, to get a good idea of the
lifetime writes vs. actual rated drive writes per day.

It looks like s_kbytes_written is only updated on clean unmount
via ext4_commit_super->ext4_update_super() and in a few error handling
codepaths.  This means any in-memory updates are typically lost if the
server crashes or loses power (which is typical for long-running servers,
rather than a clean shutdown).

It would be useful to periodically update the superblock with the current
value, maybe once an hour if the value has changed more than some small
margin (to take into account the *previous* update).  The superblock used
to be written frequently via ->write_super(), but this has not been the
case since commit v3.5-rc5-19-g4d47603d9703.

Any thoughts/objections to a periodic task calling ext4_update_super()
every hour if there have been any noticeable writes since the last time
it was called?  This could potentially be more clever so that it only
writes if the disk is not asleep, and do the writes the next time it wakes,
but I'm not sure how easy/hard that is to detect at the filesystem level.

Cheers, Andreas

PS: there is *also* a function resize.c::ext4_update_super() for added
confusion, but that does something completely different...




Attachment: signature.asc
Description: Message signed with OpenPGP


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux