• Eric Whitney's avatar
    ext4: reduce reserved cluster count by number of allocated clusters · b6bf9171
    Eric Whitney authored
    Ext4 does not always reduce the reserved cluster count by the number
    of clusters allocated when mapping a delayed extent.  It sometimes
    adds back one or more clusters after allocation if delalloc blocks
    adjacent to the range allocated by ext4_ext_map_blocks() share the
    clusters newly allocated for that range.  However, this overcounts
    the number of clusters needed to satisfy future mapping requests
    (holding one or more reservations for clusters that have already been
    allocated) and premature ENOSPC and quota failures, etc., result.
    
    Ext4 also does not reduce the reserved cluster count when allocating
    clusters for non-delayed allocated writes that have previously been
    reserved for delayed writes.  This also results in overcounts.
    
    To make it possible to handle reserved cluster accounting for
    fallocated regions in the same manner as used for other non-delayed
    writes, do the reserved cluster accounting for them at the time of
    allocation.  In the current code, this is only done later when a
    delayed extent sharing the fallocated region is finally mapped.
    
    Address comment correcting handling of unsigned long long constant
    from Jan Kara's review of RFC version of this patch.
    Signed-off-by: default avatarEric Whitney <enwlinux@gmail.com>
    Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
    b6bf9171
extents_status.h 7.87 KB