• Qu Wenruo's avatar
    btrfs: qgroup: Use independent and accurate per inode qgroup rsv · ff6bc37e
    Qu Wenruo authored
    Unlike reservation calculation used in inode rsv for metadata, qgroup
    doesn't really need to care about things like csum size or extent usage
    for the whole tree COW.
    
    Qgroups care more about net change of the extent usage.
    That's to say, if we're going to insert one file extent, it will mostly
    find its place in COWed tree block, leaving no change in extent usage.
    Or causing a leaf split, resulting in one new net extent and increasing
    qgroup number by nodesize.
    Or in an even more rare case, increase the tree level, increasing qgroup
    number by 2 * nodesize.
    
    So here instead of using the complicated calculation for extent
    allocator, which cares more about accuracy and no error, qgroup doesn't
    need that over-estimated reservation.
    
    This patch will maintain 2 new members in btrfs_block_rsv structure for
    qgroup, using much smaller calculation for qgroup rsv, reducing false
    EDQUOT.
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    ff6bc37e
extent-tree.c 303 KB