On Fri, Jun 17, 2016 at 08:02:59PM +0000, Benjamin Wirth wrote: > Hello XFS community, > > I have code that parses the free blocks B-Tree from the disk but it seems to me that the on-disk version of the B-Tree is not updated even when sync() is called, so that the disk version of the B-Tree becomes outdated. Is that correct? > > I have debug information from the kernel BIO layer where I see sectors/blocks being flushed out by the sync but the B-Tree on disk still lists those blocks as free. At what time is the on-disk B-Tree updated, only at umount? > Calling sync() will first flush out all cached user data. This, in turn, may result in block allocation transactions, etc. sync() then calls into the fs superblock ->sync_fs() handler, which on XFS forces the log to disk. This means the metadata changes associated with the user data are persistent in the log, but not necessarily written back to disk. This occurs some time later according to the internal state of the fs. > Is there any way to force the in-memory B-Tree to be flushed to disk? > The only thing that comes to mind is to freeze ('fsfreeze -f <mnt>') the fs, which appears to push the AIL. This is really the only way to get a coherent view of the fs on disk while mounted, anyways. I also assume you're using direct I/O, as the underlying disk buffer/page cache is not coherent with XFS I/O. Brian > Thanks for any help, > Ben > > Benjamin Wirth | Senior Software Developer > WinMagic Inc. > 5600A Cancross Court > Mississauga, ON | L5R 3E9 | Canada > > _______________________________________________ > xfs mailing list > xfs@xxxxxxxxxxx > http://oss.sgi.com/mailman/listinfo/xfs _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs