On Thu, Mar 07, 2024 at 08:53:43AM -0500, Phillip Susi wrote: > I have noticed that whenever you suspend to ram or shutdown the system, > runtime pm suspended disks are woken up only to be spun right back down > again. This is because the kernel syncs all filesystems, and they issue > a cache flush. Since the disk is suspended however, there is nothing in > the cache to flush, so this is wasteful. > > Should this be solved in the filesystems, or the block layer? > > I first started trying to fix this in ext4, but now I am thinking this > is more of a generic issue that should be solved in the block layer. I > am thinking that the block layer could keep a dirty flag that is set by > any write request, and cleared by a flush, or when the disk is > suspended. As long as the dirty flag is not set, any flush requests can > just be discarded. Another fix would be making sure that the kernel isues the file system syncs, and waits for them to be completed, *before* we freeze the disk. That way, if there are any dirty pages, they can be flushed to stable store so that if the battery runs down while the laptop is suspended, the user won't see data loss. - Ted