• Darrick J. Wong's avatar
    xfs: allow unwritten extents in the CoW fork · a0c46fae
    Darrick J. Wong authored
    commit 05a630d7 upstream.
    
    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: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    a0c46fae
xfs_bmap.c 185 KB