Skip to content

Commit 581251e

Browse files
Yongpeng YangJaegeuk Kim
authored andcommitted
f2fs: wrap all unusable_blocks_per_sec code in CONFIG_BLK_DEV_ZONED
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> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 24fd7f0 commit 581251e

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

fs/f2fs/f2fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,7 @@ struct f2fs_sb_info {
16691669

16701670
#ifdef CONFIG_BLK_DEV_ZONED
16711671
unsigned int blocks_per_blkz; /* F2FS blocks per zone */
1672+
unsigned int unusable_blocks_per_sec; /* unusable blocks per section */
16721673
unsigned int max_open_zones; /* max open zone resources of the zoned device */
16731674
/* For adjust the priority writing position of data in zone UFS */
16741675
unsigned int blkzone_alloc_policy;
@@ -1741,7 +1742,6 @@ struct f2fs_sb_info {
17411742
unsigned int meta_ino_num; /* meta inode number*/
17421743
unsigned int log_blocks_per_seg; /* log2 blocks per segment */
17431744
unsigned int blocks_per_seg; /* blocks per segment */
1744-
unsigned int unusable_blocks_per_sec; /* unusable blocks per section */
17451745
unsigned int segs_per_sec; /* segments per section */
17461746
unsigned int secs_per_zone; /* sections per zone */
17471747
unsigned int total_sections; /* total section count */

fs/f2fs/segment.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,16 @@ static inline void sanity_check_seg_type(struct f2fs_sb_info *sbi,
6969
((!__is_valid_data_blkaddr(blk_addr)) ? \
7070
NULL_SEGNO : GET_L2R_SEGNO(FREE_I(sbi), \
7171
GET_SEGNO_FROM_SEG0(sbi, blk_addr)))
72+
#ifdef CONFIG_BLK_DEV_ZONED
7273
#define CAP_BLKS_PER_SEC(sbi) \
7374
(BLKS_PER_SEC(sbi) - (sbi)->unusable_blocks_per_sec)
7475
#define CAP_SEGS_PER_SEC(sbi) \
7576
(SEGS_PER_SEC(sbi) - \
7677
BLKS_TO_SEGS(sbi, (sbi)->unusable_blocks_per_sec))
78+
#else
79+
#define CAP_BLKS_PER_SEC(sbi) BLKS_PER_SEC(sbi)
80+
#define CAP_SEGS_PER_SEC(sbi) SEGS_PER_SEC(sbi)
81+
#endif
7782
#define GET_START_SEG_FROM_SEC(sbi, segno) \
7883
(rounddown(segno, SEGS_PER_SEC(sbi)))
7984
#define GET_SEC_FROM_SEG(sbi, segno) \

0 commit comments

Comments
 (0)