• Eric Sandeen's avatar
    ext4: don't use quota reservation for speculative metadata · 72b8ab9d
    Eric Sandeen authored
    
    
    Because we can badly over-reserve metadata when we
    calculate worst-case, it complicates things for quota, since
    we must reserve and then claim later, retry on EDQUOT, etc.
    Quota is also a generally smaller pool than fs free blocks,
    so this over-reservation hurts more, and more often.
    
    I'm of the opinion that it's not the worst thing to allow
    metadata to push a user slightly over quota.  This simplifies
    the code and avoids the false quota rejections that result
    from worst-case speculation.
    
    This patch stops the speculative quota-charging for
    worst-case metadata requirements, and just charges quota
    when the blocks are allocated at writeout.  It also is
    able to remove the try-again loop on EDQUOT.
    
    This patch has been tested indirectly by running the xfstests
    suite with a hack to mount & enable quota prior to the test.
    
    I also did a more specific test of fragmenting freespace
    and then doing a large delalloc write under quota; quota
    stopped me at the right amount of file IO, and then the
    writeout generated enough metadata (due to the fragmentation)
    that it put me slightly over quota, as expected.
    
    Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
    Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
    72b8ab9d