• Dongsheng Yang's avatar
    btrfs: qgroup: do a reservation in a higher level. · e2d1f923
    Dongsheng Yang authored
    There are two problems in qgroup:
    
    a). The PAGE_CACHE is 4K, even when we are writing a data of 1K,
    qgroup will reserve a 4K size. It will cause the last 3K in a qgroup
    is not available to user.
    
    b). When user is writing a inline data, qgroup will not reserve it,
    it means this is a window we can exceed the limit of a qgroup.
    
    The main idea of this patch is reserving the data size of write_bytes
    rather than the reserve_bytes. It means qgroup will not care about
    the data size btrfs will reserve for user, but only care about the
    data size user is going to write. Then reserve it when user want to
    write and release it in transaction committed.
    
    In this way, qgroup can be released from the complex procedure in
    btrfs and only do the reserve when user want to write and account
    when the data is written in commit_transaction().
    Signed-off-by: default avatarDongsheng Yang <yangds.fnst@cn.fujitsu.com>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    e2d1f923
ctree.h 136 KB