Questions about XFS discard and xfs_free_extent() code (newbie)
Dave Chinner
david at fromorbit.com
Thu Dec 26 17:00:18 CST 2013
On Tue, Dec 24, 2013 at 08:21:50PM +0200, Alex Lyakas wrote:
> Hi Dave,
> Reading through the code some more, I see that the extent that is
> freed through xfs_free_extent() can be an XFS metadata extent as
> well.
> For example, xfs_inobt_free_block() frees a block of the AG's
> free-inode btree. Also, xfs_bmbt_free_block() frees a generic btree
> block by putting it onto the cursor's "to-be-freed" list, which will
> be dropped into the free-space btree (by xfs_free_extent) in
> xfs_bmap_finish(). If we discard such metadata block before the
> transaction is committed to the log and we crash, we might not be
> able to properly mount after reboot, is that right?
Yes. The log stores a delta of the transactional changes, and so
requires th eprevious version of the block to be intact for revoery
to take place.
> I mean it's not
> that some file's data block will show 0s to the user instead of
> before-delete data, but some XFS btree node (for example) will be
> wiped in such case. Can this happen?
Yes, it could. That's what I meant by:
[snip]
> > IOWs, issuing the discard before the transaction that frees the
> > extent is on stable storage means we are discarding user data or
^^
> > metadata before we've guaranteed that the extent free transaction
^^^^^^^^
> > is permanent and that means we violate certain guarantees with
> > respect to crash recovery...
The "or metadata" part of the above sentence.
Cheers,
Dave.
--
Dave Chinner
david at fromorbit.com
More information about the xfs
mailing list