On 2011-07-28, at 1:51 PM, Jan Kara wrote: > On Thu 28-07-11 10:44:30, Andreas Dilger wrote: >> Jan, does this specifically relate to the free blocks or free inodes >> count? My preference would actually be to have dumpe2fs print the >> correct values. I guess that means reading all of the group descriptors >> and adding up the free block/inode counts like the kernel does. > > Yes, the number of free blocks and inodes are the main offenders, > although there are other fields like s_wtime, or s_kbytes_written that are > updated only during umount. > >> I'm not against this patch in principle, since any operation on a mounted >> filesystem is inherently racy, but as it stands now the information >> printed by dumpe2fs can be completely useless. > > Well, but OTOH in some cases it might be desirable to actually see the > real numbers stored and since dumpe2fs is mainly for debugging purposes I'd > rather have it's output as close to what's on disk as possible. If people > are interested in amount of free blocks / inodes, they should use statfs(2) > after all. So I'd be reluctant to add some computations like you > suggest... What dumpe2fs might do is sync the filesystem (and do statfs()) > to force most of the information to disk when it sees the filesystem is > mounted. I can update my patch to do this when people think it's desirable. It would be nice if there was a simple way to update the superblock with this data. Calling sync() wouldn't be an unreasonable time to update the superblock, or even just doing it once an hour automatically from the kernel, or at the next time the filesystem is modified. In particular, it makes sense to update s_kbytes_written periodically instead of just at unmount time, or in some cases it may never updated if the filesystem is never unmounted cleanly. Cheers, Andreas -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html