On 18/1/21 10:15 pm, Naohiro Aota wrote:
On Fri, Jan 15, 2021 at 05:07:26PM -0500, Josef Bacik wrote:
On 1/15/21 1:53 AM, Naohiro Aota wrote:
From: Johannes Thumshirn <johannes.thumsh...@wdc.com>

Run zoned btrfs mode on non-zoned devices. This is done by "slicing
up" the block-device into static sized chunks and fake a conventional zone
on each of them. The emulated zone size is determined from the size of
device extent.

This is mainly aimed at testing parts of the zoned mode, i.e. the zoned
chunk allocator, on regular block devices.

Signed-off-by: Johannes Thumshirn <johannes.thumsh...@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.a...@wdc.com>
---
 fs/btrfs/zoned.c | 149 +++++++++++++++++++++++++++++++++++++++++++----
 fs/btrfs/zoned.h |  14 +++--
 2 files changed, 147 insertions(+), 16 deletions(-)

diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 684dad749a8c..13b240e5db4e 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -119,6 +119,37 @@ static inline u32 sb_zone_number(int shift, int mirror)
     return 0;
 }
+/*
+ * Emulate blkdev_report_zones() for a non-zoned device. It slice up
+ * the block device into static sized chunks and fake a conventional zone
+ * on each of them.
+ */
+static int emulate_report_zones(struct btrfs_device *device, u64 pos,
+                struct blk_zone *zones, unsigned int nr_zones)
+{
+    const sector_t zone_sectors =
+        device->fs_info->zone_size >> SECTOR_SHIFT;
+    sector_t bdev_size = device->bdev->bd_part->nr_sects;

This needs to be changed to bdev_nr_sectors(), it fails to compile on misc-next.  This patch also fails to apply to misc-next as well. Thanks,

Josef

Oh, I'll rebase on the latest misc-next and fix them all in v13. Thanks.


Patch 12 was conflicting in zone.c which was due to line number changes,
and again I was stuck with the patch 19 due to conflicts. I will wait for v13.

Thanks, Anand

Reply via email to