diff mbox series

[02/10] btrfs: move btrfs_check_device_zone_type into volumes.c

Message ID a156cf2430eeaf93a748882f49ca9dd1cf7d51d4.1663196746.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs: clean up zoned device helpers | expand

Commit Message

Josef Bacik Sept. 14, 2022, 11:07 p.m. UTC
Now that this is only used in volumes.c move it out of zoned.h locally
to volumes.c.  This is in order to avoid having a helper that uses
functions not defined in zoned.h.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/volumes.c | 19 +++++++++++++++++++
 fs/btrfs/zoned.h   | 19 -------------------
 2 files changed, 19 insertions(+), 19 deletions(-)

Comments

Johannes Thumshirn Sept. 15, 2022, 1:55 p.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index ea76458d7c70..29652323ef9b 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2583,6 +2583,25 @@  static int btrfs_finish_sprout(struct btrfs_trans_handle *trans)
 	return ret;
 }
 
+static inline bool btrfs_check_device_zone_type(const struct btrfs_fs_info *fs_info,
+						struct block_device *bdev)
+{
+	if (btrfs_is_zoned(fs_info)) {
+		/*
+		 * We can allow a regular device on a zoned filesystem, because
+		 * we will emulate the zoned capabilities.
+		 */
+		if (!bdev_is_zoned(bdev))
+			return true;
+
+		return fs_info->zone_size ==
+			(bdev_zone_sectors(bdev) << SECTOR_SHIFT);
+	}
+
+	/* Do not allow Host Manged zoned device */
+	return bdev_zoned_model(bdev) != BLK_ZONED_HM;
+}
+
 struct block_device *btrfs_open_device_for_adding(struct btrfs_fs_info *fs_info,
 						  const char *device_path)
 {
diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h
index 094f3e44c53c..20d7f35406d4 100644
--- a/fs/btrfs/zoned.h
+++ b/fs/btrfs/zoned.h
@@ -311,25 +311,6 @@  static inline void btrfs_dev_clear_zone_empty(struct btrfs_device *device, u64 p
 	btrfs_dev_set_empty_zone_bit(device, pos, false);
 }
 
-static inline bool btrfs_check_device_zone_type(const struct btrfs_fs_info *fs_info,
-						struct block_device *bdev)
-{
-	if (btrfs_is_zoned(fs_info)) {
-		/*
-		 * We can allow a regular device on a zoned filesystem, because
-		 * we will emulate the zoned capabilities.
-		 */
-		if (!bdev_is_zoned(bdev))
-			return true;
-
-		return fs_info->zone_size ==
-			(bdev_zone_sectors(bdev) << SECTOR_SHIFT);
-	}
-
-	/* Do not allow Host Manged zoned device */
-	return bdev_zoned_model(bdev) != BLK_ZONED_HM;
-}
-
 static inline bool btrfs_check_super_location(struct btrfs_device *device, u64 pos)
 {
 	/*