From 1bfd476754a2d63f899ef9c3e253b17766b8fb73 Mon Sep 17 00:00:00 2001 From: Naohiro Aota Date: Tue, 3 May 2022 17:48:50 -0700 Subject: btrfs: zoned: introduce btrfs_zoned_bg_is_full Introduce a wrapper to check if all the space in a block group is allocated or not. Reviewed-by: Johannes Thumshirn Signed-off-by: Naohiro Aota Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/zoned.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'fs/btrfs/zoned.h') diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h index de923fc8449d..7178bafda469 100644 --- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h @@ -372,4 +372,10 @@ static inline void btrfs_zoned_data_reloc_unlock(struct btrfs_inode *inode) mutex_unlock(&root->fs_info->zoned_data_reloc_io_lock); } +static inline bool btrfs_zoned_bg_is_full(const struct btrfs_block_group *bg) +{ + ASSERT(btrfs_is_zoned(bg->fs_info)); + return (bg->alloc_offset == bg->zone_capacity); +} + #endif -- cgit v1.2.3