• Filipe Manana's avatar
    btrfs: avoid start and commit empty transaction when starting qgroup rescan · 6705b48a
    Filipe Manana authored
    When starting a qgroup rescan, we try to join a running transaction, with
    btrfs_join_transaction(), and then commit the transaction. However using
    btrfs_join_transaction() will result in creating a new transaction in case
    there isn't any running or if there's an existing one already committing.
    This is pointless as we only need to attach to an existing one that is
    not committing and in case there's an existing one committing, wait for
    its commit to complete. Creating and committing an empty transaction is
    wasteful, pointless IO and unnecessary rotation of the backup roots.
    
    So use btrfs_attach_transaction_barrier() instead, to avoid creating and
    committing empty transactions.
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    6705b48a
qgroup.c 116 KB