From: Luis Chamberlain <[email protected]> Expand get_device_info() to report the zone size. This is now important give power of 2 zone sizees (PO2) can exist, and so can non power of 2 zones sizes (NPO2), and we should be aware of the differences in terms of support.
This will be used more in subsequent patch. Signed-off-by: Luis Chamberlain <[email protected]> Signed-off-by: Pankaj Raghav <[email protected]> --- include/f2fs_fs.h | 1 + lib/libf2fs.c | 5 +++-- lib/libf2fs_zoned.c | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h index d236437..83c5b33 100644 --- a/include/f2fs_fs.h +++ b/include/f2fs_fs.h @@ -386,6 +386,7 @@ struct device_info { u_int32_t nr_zones; u_int32_t nr_rnd_zones; size_t zone_blocks; + uint64_t zone_size; size_t *zone_cap_blocks; }; diff --git a/lib/libf2fs.c b/lib/libf2fs.c index 420dfda..8fad1d7 100644 --- a/lib/libf2fs.c +++ b/lib/libf2fs.c @@ -1055,8 +1055,9 @@ int get_device_info(int i) MSG(0, "Info: Host-%s zoned block device:\n", (dev->zoned_model == F2FS_ZONED_HA) ? "aware" : "managed"); - MSG(0, " %u zones, %u randomly writeable zones\n", - dev->nr_zones, dev->nr_rnd_zones); + MSG(0, " %u zones, %lu zone size: %u randomly writeable zones\n", + dev->nr_zones, dev->zone_size, + dev->nr_rnd_zones); MSG(0, " %lu blocks per zone\n", dev->zone_blocks); } diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c index 1447181..0acae88 100644 --- a/lib/libf2fs_zoned.c +++ b/lib/libf2fs_zoned.c @@ -189,8 +189,9 @@ int f2fs_get_zone_blocks(int i) if (!sectors) return -1; - dev->zone_blocks = sectors >> (F2FS_BLKSIZE_BITS - 9); - sectors = (sectors << 9) / c.sector_size; + dev->zone_size = sectors << SECTOR_SHIFT; + dev->zone_blocks = sectors >> (F2FS_BLKSIZE_BITS - SECTOR_SHIFT); + sectors = dev->zone_size / c.sector_size; /* * Total number of zones: there may -- 2.25.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
