Message ID | 20181121190313.24575-4-josef@toxicpanda.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Enospc cleanups and fixes | expand |
On 21.11.18 г. 21:03 ч., Josef Bacik wrote: > We've done this forever because of the voodoo around knowing how much > space we have. However we have better ways of doing this now, and on > normal file systems we'll easily have a global reserve of 512MiB, and > since metadata chunks are usually 1GiB that means we'll allocate > metadata chunks more readily. Instead use the actual used amount when > determining if we need to allocate a chunk or not. This explanation could use more concrete wording currently it's way too "hand wavy"/vague. > > Signed-off-by: Josef Bacik <josef@toxicpanda.com> > --- > fs/btrfs/extent-tree.c | 9 --------- > 1 file changed, 9 deletions(-) > > diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c > index 7a30fbc05e5e..a91b3183dcae 100644 > --- a/fs/btrfs/extent-tree.c > +++ b/fs/btrfs/extent-tree.c > @@ -4388,21 +4388,12 @@ static inline u64 calc_global_rsv_need_space(struct btrfs_block_rsv *global) > static int should_alloc_chunk(struct btrfs_fs_info *fs_info, > struct btrfs_space_info *sinfo, int force) > { > - struct btrfs_block_rsv *global_rsv = &fs_info->global_block_rsv; > u64 bytes_used = btrfs_space_info_used(sinfo, false); > u64 thresh; > > if (force == CHUNK_ALLOC_FORCE) > return 1; > > - /* > - * We need to take into account the global rsv because for all intents > - * and purposes it's used space. Don't worry about locking the > - * global_rsv, it doesn't change except when the transaction commits. > - */ > - if (sinfo->flags & BTRFS_BLOCK_GROUP_METADATA) > - bytes_used += calc_global_rsv_need_space(global_rsv); > - > /* > * in limited mode, we want to have some free space up to > * about 1% of the FS size. >
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 7a30fbc05e5e..a91b3183dcae 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4388,21 +4388,12 @@ static inline u64 calc_global_rsv_need_space(struct btrfs_block_rsv *global) static int should_alloc_chunk(struct btrfs_fs_info *fs_info, struct btrfs_space_info *sinfo, int force) { - struct btrfs_block_rsv *global_rsv = &fs_info->global_block_rsv; u64 bytes_used = btrfs_space_info_used(sinfo, false); u64 thresh; if (force == CHUNK_ALLOC_FORCE) return 1; - /* - * We need to take into account the global rsv because for all intents - * and purposes it's used space. Don't worry about locking the - * global_rsv, it doesn't change except when the transaction commits. - */ - if (sinfo->flags & BTRFS_BLOCK_GROUP_METADATA) - bytes_used += calc_global_rsv_need_space(global_rsv); - /* * in limited mode, we want to have some free space up to * about 1% of the FS size.
We've done this forever because of the voodoo around knowing how much space we have. However we have better ways of doing this now, and on normal file systems we'll easily have a global reserve of 512MiB, and since metadata chunks are usually 1GiB that means we'll allocate metadata chunks more readily. Instead use the actual used amount when determining if we need to allocate a chunk or not. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/extent-tree.c | 9 --------- 1 file changed, 9 deletions(-)