All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH v2 1/3] f2fs: wrap all unusable_blocks_per_sec code in CONFIG_BLK_DEV_ZONED
@ 2025-11-10  8:22 Yongpeng Yang
  2025-11-10  8:22 ` [f2fs-dev] [PATCH v2 2/3] f2fs: add a sysfs entry to show max open zones Yongpeng Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Yongpeng Yang @ 2025-11-10  8:22 UTC (permalink / raw)
  To: Chao Yu, Jaegeuk Kim; +Cc: Yongpeng Yang, linux-f2fs-devel

From: Yongpeng Yang <yangyongpeng@xiaomi.com>

The usage of unusable_blocks_per_sec is already wrapped by
CONFIG_BLK_DEV_ZONED, except for its declaration and the definitions of
CAP_BLKS_PER_SEC and CAP_SEGS_PER_SEC. This patch ensures that all code
related to unusable_blocks_per_sec is properly wrapped under the
CONFIG_BLK_DEV_ZONED option.

Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
---
v2:
- Revert the renaming of unusable_blocks_per_sec.
- Separate the sysfs node addition for max_open_zones into a separate
patch.
- Add more explanation for the case that zoned block device's
max_open_zones == 0.
---
 fs/f2fs/f2fs.h    | 2 +-
 fs/f2fs/segment.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 5b4e9548a231..238ef4bcab6d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1661,6 +1661,7 @@ struct f2fs_sb_info {
 
 #ifdef CONFIG_BLK_DEV_ZONED
 	unsigned int blocks_per_blkz;		/* F2FS blocks per zone */
+	unsigned int unusable_blocks_per_sec;   /* unusable blocks per section */
 	unsigned int max_open_zones;		/* max open zone resources of the zoned device */
 	/* For adjust the priority writing position of data in zone UFS */
 	unsigned int blkzone_alloc_policy;
@@ -1732,7 +1733,6 @@ struct f2fs_sb_info {
 	unsigned int meta_ino_num;		/* meta inode number*/
 	unsigned int log_blocks_per_seg;	/* log2 blocks per segment */
 	unsigned int blocks_per_seg;		/* blocks per segment */
-	unsigned int unusable_blocks_per_sec;	/* unusable blocks per section */
 	unsigned int segs_per_sec;		/* segments per section */
 	unsigned int secs_per_zone;		/* sections per zone */
 	unsigned int total_sections;		/* total section count */
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 1ce2c8abaf48..e9134f66ab1f 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -69,11 +69,16 @@ static inline void sanity_check_seg_type(struct f2fs_sb_info *sbi,
 	((!__is_valid_data_blkaddr(blk_addr)) ?			\
 	NULL_SEGNO : GET_L2R_SEGNO(FREE_I(sbi),			\
 		GET_SEGNO_FROM_SEG0(sbi, blk_addr)))
+#ifdef CONFIG_BLK_DEV_ZONED
 #define CAP_BLKS_PER_SEC(sbi)					\
 	(BLKS_PER_SEC(sbi) - (sbi)->unusable_blocks_per_sec)
 #define CAP_SEGS_PER_SEC(sbi)					\
 	(SEGS_PER_SEC(sbi) -					\
 	BLKS_TO_SEGS(sbi, (sbi)->unusable_blocks_per_sec))
+#else
+#define CAP_BLKS_PER_SEC(sbi) BLKS_PER_SEC(sbi)
+#define CAP_SEGS_PER_SEC(sbi) SEGS_PER_SEC(sbi)
+#endif
 #define GET_START_SEG_FROM_SEC(sbi, segno)			\
 	(rounddown(segno, SEGS_PER_SEC(sbi)))
 #define GET_SEC_FROM_SEG(sbi, segno)				\
-- 
2.43.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-11-24 18:50 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10  8:22 [f2fs-dev] [PATCH v2 1/3] f2fs: wrap all unusable_blocks_per_sec code in CONFIG_BLK_DEV_ZONED Yongpeng Yang
2025-11-10  8:22 ` [f2fs-dev] [PATCH v2 2/3] f2fs: add a sysfs entry to show max open zones Yongpeng Yang
2025-11-10  9:40   ` Chao Yu via Linux-f2fs-devel
2025-11-10  8:22 ` [f2fs-dev] [PATCH v2 3/3] f2fs: fix handling of zoned block devices with max_open_zones == 0 Yongpeng Yang
2025-11-10  9:47   ` Chao Yu via Linux-f2fs-devel
2025-11-12 21:42   ` Jaegeuk Kim via Linux-f2fs-devel
2025-11-14  0:51     ` Chao Yu via Linux-f2fs-devel
2025-11-14  7:37       ` Yongpeng Yang
2025-11-15 11:36         ` Chao Yu via Linux-f2fs-devel
2025-11-16 16:31           ` Yongpeng Yang
2025-11-16 18:10             ` Yongpeng Yang
2025-11-17  2:03             ` Chao Yu via Linux-f2fs-devel
2025-11-10  9:34 ` [f2fs-dev] [PATCH v2 1/3] f2fs: wrap all unusable_blocks_per_sec code in CONFIG_BLK_DEV_ZONED Chao Yu via Linux-f2fs-devel
2025-11-24 18:50 ` patchwork-bot+f2fs--- via Linux-f2fs-devel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.