• Filipe Manana's avatar
    btrfs: remove obsolete delayed ref throttling logic when truncating items · a8fdc051
    Filipe Manana authored
    We have this logic encapsulated in btrfs_should_throttle_delayed_refs()
    where we try to estimate if running the current amount of delayed
    references we have will take more than half a second, and if so, the
    caller btrfs_should_throttle_delayed_refs() should do something to
    prevent more and more delayed refs from being accumulated.
    
    This logic was added in commit 0a2b2a84 ("Btrfs: throttle delayed
    refs better") and then further refined in commit a79b7d4b ("Btrfs:
    async delayed refs"). The idea back then was that the caller of
    btrfs_should_throttle_delayed_refs() would release its transaction
    handle (by calling btrfs_end_transaction()) when that function returned
    true, then btrfs_end_transaction() would trigger an async job to run
    delayed references in a workqueue, and later start/join a transaction
    again and do more work.
    
    However we don't run delayed references asynchronously anymore, that
    was removed in commit db2462a6 ("btrfs: don't run delayed refs in
    the end transaction logic"). That makes the logic that tries to estimate
    how long we will take to run our current delayed references, at
    btrfs_should_throttle_delayed_refs(), pointless as we don't take any
    action to run delayed references anymore. We do have other type of
    throttling, which consists of checking the size and reserved space of
    the delayed and global block reserves, as well as if fluhsing delayed
    references for the current transaction was already started, etc - this
    is all done by btrfs_should_end_transaction(), and the only user of
    btrfs_should_throttle_delayed_refs() does periodically call
    btrfs_should_end_transaction().
    
    So remove btrfs_should_throttle_delayed_refs() and the infrastructure
    that keeps track of the average time used for running delayed references,
    as well as adapting btrfs_truncate_inode_items() to call
    btrfs_check_space_for_delayed_refs() instead.
    Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    a8fdc051
extent-tree.c 166 KB