summaryrefslogtreecommitdiff
path: root/fs/btrfs/zoned.h
diff options
context:
space:
mode:
authorNaohiro Aota <naohiro.aota@wdc.com>2022-05-03 17:48:50 -0700
committerDavid Sterba <dsterba@suse.com>2022-05-16 17:17:32 +0200
commit1bfd476754a2d63f899ef9c3e253b17766b8fb73 (patch)
tree524eb7511c8709caf291088f41837a28a96e2bf7 /fs/btrfs/zoned.h
parentcf4f03c3be4a2a08be5d3a40d25ef577be2db061 (diff)
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 <johannes.thumshirn@wdc.com> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/zoned.h')
-rw-r--r--fs/btrfs/zoned.h6
1 files changed, 6 insertions, 0 deletions
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