public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* on-disk free blocks B-Tree update
@ 2016-06-17 20:02 Benjamin Wirth
  2016-06-18 13:27 ` Brian Foster
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Wirth @ 2016-06-17 20:02 UTC (permalink / raw)
  To: xfs@oss.sgi.com


[-- Attachment #1.1: Type: text/plain, Size: 715 bytes --]

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?

Is there any way to force the in-memory B-Tree to be flushed to disk?

Thanks for any help,
Ben

Benjamin Wirth | Senior Software Developer
WinMagic Inc.
5600A Cancross Court
Mississauga, ON  |  L5R 3E9 |  Canada


[-- Attachment #1.2: Type: text/html, Size: 3538 bytes --]

[-- Attachment #2: Type: text/plain, Size: 121 bytes --]

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: on-disk free blocks B-Tree update
  2016-06-17 20:02 on-disk free blocks B-Tree update Benjamin Wirth
@ 2016-06-18 13:27 ` Brian Foster
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Foster @ 2016-06-18 13:27 UTC (permalink / raw)
  To: Benjamin Wirth; +Cc: xfs@oss.sgi.com

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@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-18 13:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-17 20:02 on-disk free blocks B-Tree update Benjamin Wirth
2016-06-18 13:27 ` Brian Foster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox