diff mbox series

[v2,1/7] btrfs-progs: remove function btrfs_check_allocatable_zones()

Message ID 8358b7a43c479769bf32c1ccac24284442ceb567.1683093416.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: fix -Wmissing-prototypes warnings and enable that warning option | expand

Commit Message

Qu Wenruo May 3, 2023, 6:03 a.m. UTC
This function is introduced by commit b031fe84fda8 ("btrfs-progs: zoned:
implement zoned chunk allocator") but it never got called since then.

Furthermore in the kernel zoned code, there is no such function from the
very beginning, and everything is handled by
btrfs_find_allocatable_zones().

Thus we can safely remove the function.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 kernel-shared/zoned.c | 58 -------------------------------------------
 1 file changed, 58 deletions(-)

Comments

Anand Jain May 4, 2023, 8:46 a.m. UTC | #1
On 03/05/2023 14:03, Qu Wenruo wrote:
> This function is introduced by commit b031fe84fda8 ("btrfs-progs: zoned:
> implement zoned chunk allocator") but it never got called since then.
> 
> Furthermore in the kernel zoned code, there is no such function from the
> very beginning, and everything is handled by
> btrfs_find_allocatable_zones().
> 
> Thus we can safely remove the function.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Anand Jain <anand.jain@oracle.com>
diff mbox series

Patch

diff --git a/kernel-shared/zoned.c b/kernel-shared/zoned.c
index 7d2e68d08bcc..16abb042f5b0 100644
--- a/kernel-shared/zoned.c
+++ b/kernel-shared/zoned.c
@@ -596,64 +596,6 @@  size_t btrfs_sb_io(int fd, void *buf, off_t offset, int rw)
 	return ret_sz;
 }
 
-/*
- * Check if spcecifeid region is suitable for allocation
- *
- * @device:	the device to allocate a region
- * @pos:	the position of the region
- * @num_bytes:	the size of the region
- *
- * In non-ZONED device, anywhere is suitable for allocation. In ZONED
- * device, check if:
- * 1) the region is not on non-empty sequential zones,
- * 2) all zones in the region have the same zone type,
- * 3) it does not contain super block location
- */
-bool btrfs_check_allocatable_zones(struct btrfs_device *device, u64 pos,
-				   u64 num_bytes)
-{
-	struct btrfs_zoned_device_info *zinfo = device->zone_info;
-	u64 nzones, begin, end;
-	u64 sb_pos;
-	bool is_sequential;
-	int shift;
-	int i;
-
-	if (!zinfo || zinfo->model == ZONED_NONE)
-		return true;
-
-	nzones = num_bytes / zinfo->zone_size;
-	begin = pos / zinfo->zone_size;
-	end = begin + nzones;
-
-	ASSERT(IS_ALIGNED(pos, zinfo->zone_size));
-	ASSERT(IS_ALIGNED(num_bytes, zinfo->zone_size));
-
-	if (end > zinfo->nr_zones)
-		return false;
-
-	shift = ilog2(zinfo->zone_size);
-	for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) {
-		sb_pos = sb_zone_number(shift, i);
-		if (!(end < sb_pos || sb_pos + 1 < begin))
-			return false;
-	}
-
-	is_sequential = btrfs_dev_is_sequential(device, pos);
-
-	while (num_bytes) {
-		if (is_sequential && !btrfs_dev_is_empty_zone(device, pos))
-			return false;
-		if (is_sequential != btrfs_dev_is_sequential(device, pos))
-			return false;
-
-		pos += zinfo->zone_size;
-		num_bytes -= zinfo->zone_size;
-	}
-
-	return true;
-}
-
 /**
  * btrfs_find_allocatable_zones - find allocatable zones within a given region
  *