• Qu Wenruo's avatar
    btrfs: fallocate: Add support to accurate qgroup reserve · 14524a84
    Qu Wenruo authored
    Now fallocate will do accurate qgroup reserve space check, unlike old
    method, which will always reserve the whole length of the range.
    
    With this patch, fallocate will:
    1) Iterate the desired range and mark in data rsv map
       Only range which is going to be allocated will be recorded in data
       rsv map and reserve the space.
       For already allocated range (normal/prealloc extent) they will be
       skipped.
       Also, record the marked range into a new list for later use.
    
    2) If 1) succeeded, do real file extent allocate.
       And at file extent allocation time, corresponding range will be
       removed from the range in data rsv map.
    Signed-off-by: default avatarQu Wenruo <quwenruo@cn.fujitsu.com>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    14524a84
file.c 78.3 KB