• Mark Fasheh's avatar
    btrfs: qgroup: account shared subtree during snapshot delete · 82bd101b
    Mark Fasheh authored
    Commit 0ed4792a ('btrfs: qgroup: Switch to new extent-oriented qgroup
    mechanism.') removed our qgroup accounting during
    btrfs_drop_snapshot(). Predictably, this results in qgroup numbers
    going bad shortly after a snapshot is removed.
    
    Fix this by adding a dirty extent record when we encounter extents during
    our shared subtree walk. This effectively restores the functionality we had
    with the original shared subtree walking code in 1152651a (btrfs: qgroup:
    account shared subtrees during snapshot delete).
    
    The idea with the original patch (and this one) is that shared subtrees can
    get skipped during drop_snapshot. The shared subtree walk then allows us a
    chance to visit those extents and add them to the qgroup work for later
    processing. This ultimately makes the accounting for drop snapshot work.
    
    The new qgroup code nicely handles all the other extents during the tree
    walk via the ref dec/inc functions so we don't have to add actions beyond
    what we had originally.
    Signed-off-by: default avatarMark Fasheh <mfasheh@suse.de>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    82bd101b
qgroup.c 65.9 KB