]> git.karo-electronics.de Git - karo-tx-linux.git/commit
xfs: allow unwritten extents in the CoW fork
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 2 Feb 2017 23:14:01 +0000 (15:14 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 2 Feb 2017 23:14:01 +0000 (15:14 -0800)
commit05a630d76bd3f39baf0eecfa305bed2820796dee
tree9c48c702ed196b44ab897c69ac6abbfa3b99fd92
parentde14c5f541e78c59006bee56f6c5c2ef1ca07272
xfs: allow unwritten extents in the CoW fork

In the data fork, we only allow extents to perform the following state
transitions:

delay -> real <-> unwritten

There's no way to move directly from a delalloc reservation to an
/unwritten/ allocated extent.  However, for the CoW fork we want to be
able to do the following to each extent:

delalloc -> unwritten -> written -> remapped to data fork

This will help us to avoid a race in the speculative CoW preallocation
code between a first thread that is allocating a CoW extent and a second
thread that is remapping part of a file after a write.  In order to do
this, however, we need two things: first, we have to be able to
transition from da to unwritten, and second the function that converts
between real and unwritten has to be made aware of the cow fork.  Do
both of those things.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_bmap.c