[PATCH v2 0/4] Use global rsv stealing for evict and clean things up
From: Josef Bacik <josef@toxicpanda.com>
Date: 2021-11-08 15:21:37
v1->v2: - Reworked the stealing logic to be inside of the priority metadata loop, since that's the part we care about. - Renamed the helper to see if we can steal to can_steal. - Added Nikolay's reviewed-by's.
--- Original email ---
Hello, While trying to remove direct access of fs_info->extent_root I noticed we were passing root into btrfs_reserve_metadata_bytes() for the sole purpose of stealing from the global reserve if we were doing orphan cleanup. This isn't really necessary anymore, but I needed to clean up a few things 1) We have global reserve stealing logic in the flushing code now that does the proper ordering already. We just hadn't converted evict to this yet, so I've done that. 2) Since we already do the global reserve stealing as a part of the reservation process we don't need the extra check to steal from the global reserve if we fail to make our reservation during orphan cleanup. 3) Since we no longer need this logic we don't need the orphan_cleanup_state bit in the root so we can remove that. 4) Finally with all of this removed we don't have a need for root in btrfs_reserve_metadata_bytes(), so change it to fs_info and change it's main callers as well. With that we've got more consistent global reserve stealing handling in evict, and I've cleaned up the reservation path so I no longer have to worry about a couple of places where we were doing btrfs_reserve_metadata_bytes(root->extent_root). Thanks, Josef Bacik (4): btrfs: make BTRFS_RESERVE_FLUSH_EVICT use the global rsv stealing code btrfs: remove global rsv stealing logic for orphan cleanup btrfs: get rid of root->orphan_cleanup_state btrfs: change root to fs_info for btrfs_reserve_metadata_bytes fs/btrfs/block-group.c | 2 +- fs/btrfs/block-rsv.c | 12 +++++++----- fs/btrfs/block-rsv.h | 4 ++-- fs/btrfs/ctree.h | 9 ++------- fs/btrfs/delalloc-space.c | 2 +- fs/btrfs/delayed-inode.c | 2 +- fs/btrfs/delayed-ref.c | 4 ++-- fs/btrfs/disk-io.c | 1 - fs/btrfs/inode.c | 21 ++++++++------------- fs/btrfs/props.c | 5 +++-- fs/btrfs/relocation.c | 17 +++++++++-------- fs/btrfs/root-tree.c | 2 +- fs/btrfs/space-info.c | 35 +++++++++++++++++++++++------------ fs/btrfs/space-info.h | 2 +- fs/btrfs/transaction.c | 4 ++-- 15 files changed, 63 insertions(+), 59 deletions(-) -- 2.26.3