• Qu Wenruo's avatar
    btrfs: qgroup: allow quick inherit if snapshot is created and added to the same parent · b20fe56c
    Qu Wenruo authored
    Currently "btrfs subvolume snapshot -i <qgroupid>" would always mark the
    qgroup inconsistent.
    
    This can be annoying if the fs has a lot of snapshots, and needs qgroup
    to get the accounting for the amount of bytes it can free for each
    snapshot.
    
    Although we have the new simple quote as a solution, there is also a
    case where we can skip the full scan, if all the following conditions
    are met:
    
    - The source subvolume belongs to a higher level parent qgroup
    - The parent qgroup already owns all its bytes exclusively
    - The new snapshot is also added to the same parent qgroup
    
    In that case, we only need to add nodesize to the parent qgroup and
    avoid a full rescan.
    
    This patch would add the extra quick accounting update for such inherit.
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    b20fe56c
qgroup.c 128 KB