Message ID | 20240223205535.307307-3-jaegeuk@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [f2fs-dev,1/5] f2fs: check number of blocks in a current section | expand |
On 2024/2/24 4:55, Jaegeuk Kim wrote: > No functional change, but add some more logs. > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Reviewed-by: Chao Yu <chao@kernel.org> Thanks,
On Fri, Feb 23, 2024 at 12:56 PM Jaegeuk Kim <jaegeuk@kernel.org> wrote: > > No functional change, but add some more logs. > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> > --- > fs/f2fs/segment.c | 34 ++++++++++++++++++++++++---------- > fs/f2fs/super.c | 1 + > 2 files changed, 25 insertions(+), 10 deletions(-) > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index d4f228e6f771..6d586ae8b55f 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -4912,6 +4912,16 @@ static int sanity_check_curseg(struct f2fs_sb_info *sbi) > } > > #ifdef CONFIG_BLK_DEV_ZONED > +const char *f2fs_zone_status[BLK_ZONE_COND_OFFLINE + 1] = { > + [BLK_ZONE_COND_NOT_WP] = "NOT_WP", > + [BLK_ZONE_COND_EMPTY] = "EMPTY", > + [BLK_ZONE_COND_IMP_OPEN] = "IMPLICITE_OPEN", > + [BLK_ZONE_COND_EXP_OPEN] = "EXPLICITE_OPEN", > + [BLK_ZONE_COND_CLOSED] = "CLOSED", > + [BLK_ZONE_COND_READONLY] = "READONLY", > + [BLK_ZONE_COND_FULL] = "FULL", > + [BLK_ZONE_COND_OFFLINE] = "OFFLINE", > +}; > > static int check_zone_write_pointer(struct f2fs_sb_info *sbi, > struct f2fs_dev_info *fdev, > @@ -4928,18 +4938,22 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, > zone_block = fdev->start_blk + (zone->start >> log_sectors_per_block); > zone_segno = GET_SEGNO(sbi, zone_block); > > + /* > + * Get # of valid block of the zone. > + */ > + valid_block_cnt = get_valid_blocks(sbi, zone_segno, true); > + > /* > * Skip check of zones cursegs point to, since > * fix_curseg_write_pointer() checks them. > */ > if (zone_segno >= MAIN_SEGS(sbi) || How about this not to use a wrong segno value for get_valid_blocks() and not to print a wrong segment info? if (zone_segno >= MAIN_SEGS(sbi)) return 0; valid_block_cnt = get_valid_blocks(sbi, zone_segno, true); > - IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) > + IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) { > + f2fs_notice(sbi, "Open zones: valid block[0x%x,0x%x] cond[%s]", > + zone_segno, valid_block_cnt, > + f2fs_zone_status[zone->cond]); > return 0; > - > - /* > - * Get # of valid block of the zone. > - */ > - valid_block_cnt = get_valid_blocks(sbi, zone_segno, true); > + } > > if ((!valid_block_cnt && zone->cond == BLK_ZONE_COND_EMPTY) || > (valid_block_cnt && zone->cond == BLK_ZONE_COND_FULL)) > @@ -4947,8 +4961,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, > > if (!valid_block_cnt) { > f2fs_notice(sbi, "Zone without valid block has non-zero write " > - "pointer. Reset the write pointer: cond[0x%x]", > - zone->cond); > + "pointer. Reset the write pointer: cond[%s]", > + f2fs_zone_status[zone->cond]); > ret = __f2fs_issue_discard_zone(sbi, fdev->bdev, zone_block, > zone->len >> log_sectors_per_block); > if (ret) > @@ -4965,8 +4979,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, > * selected for write operation until it get discarded. > */ > f2fs_notice(sbi, "Valid blocks are not aligned with write " > - "pointer: valid block[0x%x,0x%x] cond[0x%x]", > - zone_segno, valid_block_cnt, zone->cond); > + "pointer: valid block[0x%x,0x%x] cond[%s]", > + zone_segno, valid_block_cnt, f2fs_zone_status[zone->cond]); > > ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH, > zone->start, zone->len, GFP_NOFS); > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index 4d03ce1109ad..fc7f1a9fbbda 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -4674,6 +4674,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) > * check zoned block devices' write pointer consistency. > */ > if (!f2fs_readonly(sb) && f2fs_sb_has_blkzoned(sbi)) { > + f2fs_notice(sbi, "Checking entire write pointers"); > err = f2fs_check_write_pointer(sbi); > if (err) > goto free_meta; > -- > 2.44.0.rc0.258.g7320e95886-goog > > > > _______________________________________________ > Linux-f2fs-devel mailing list > Linux-f2fs-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
No functional change, but add some more logs. Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> --- from v1: - avoid unnecessary log per Daeho's comment fs/f2fs/segment.c | 27 +++++++++++++++++++++------ fs/f2fs/super.c | 1 + 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index d4f228e6f771..31a9e7db19e3 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -4912,6 +4912,16 @@ static int sanity_check_curseg(struct f2fs_sb_info *sbi) } #ifdef CONFIG_BLK_DEV_ZONED +const char *f2fs_zone_status[BLK_ZONE_COND_OFFLINE + 1] = { + [BLK_ZONE_COND_NOT_WP] = "NOT_WP", + [BLK_ZONE_COND_EMPTY] = "EMPTY", + [BLK_ZONE_COND_IMP_OPEN] = "IMPLICITE_OPEN", + [BLK_ZONE_COND_EXP_OPEN] = "EXPLICITE_OPEN", + [BLK_ZONE_COND_CLOSED] = "CLOSED", + [BLK_ZONE_COND_READONLY] = "READONLY", + [BLK_ZONE_COND_FULL] = "FULL", + [BLK_ZONE_COND_OFFLINE] = "OFFLINE", +}; static int check_zone_write_pointer(struct f2fs_sb_info *sbi, struct f2fs_dev_info *fdev, @@ -4932,14 +4942,19 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, * Skip check of zones cursegs point to, since * fix_curseg_write_pointer() checks them. */ - if (zone_segno >= MAIN_SEGS(sbi) || - IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) + if (zone_segno >= MAIN_SEGS(sbi)) return 0; /* * Get # of valid block of the zone. */ valid_block_cnt = get_valid_blocks(sbi, zone_segno, true); + if (IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) { + f2fs_notice(sbi, "Open zones: valid block[0x%x,0x%x] cond[%s]", + zone_segno, valid_block_cnt, + f2fs_zone_status[zone->cond]); + return 0; + } if ((!valid_block_cnt && zone->cond == BLK_ZONE_COND_EMPTY) || (valid_block_cnt && zone->cond == BLK_ZONE_COND_FULL)) @@ -4947,8 +4962,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, if (!valid_block_cnt) { f2fs_notice(sbi, "Zone without valid block has non-zero write " - "pointer. Reset the write pointer: cond[0x%x]", - zone->cond); + "pointer. Reset the write pointer: cond[%s]", + f2fs_zone_status[zone->cond]); ret = __f2fs_issue_discard_zone(sbi, fdev->bdev, zone_block, zone->len >> log_sectors_per_block); if (ret) @@ -4965,8 +4980,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, * selected for write operation until it get discarded. */ f2fs_notice(sbi, "Valid blocks are not aligned with write " - "pointer: valid block[0x%x,0x%x] cond[0x%x]", - zone_segno, valid_block_cnt, zone->cond); + "pointer: valid block[0x%x,0x%x] cond[%s]", + zone_segno, valid_block_cnt, f2fs_zone_status[zone->cond]); ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH, zone->start, zone->len, GFP_NOFS); diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 4d03ce1109ad..fc7f1a9fbbda 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4674,6 +4674,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) * check zoned block devices' write pointer consistency. */ if (!f2fs_readonly(sb) && f2fs_sb_has_blkzoned(sbi)) { + f2fs_notice(sbi, "Checking entire write pointers"); err = f2fs_check_write_pointer(sbi); if (err) goto free_meta;
On 2024/2/27 6:52, Jaegeuk Kim wrote: > No functional change, but add some more logs. > > Reviewed-by: Chao Yu <chao@kernel.org> v2 looks fine to me. Thanks,
On 02/23, Jaegeuk Kim wrote: > No functional change, but add some more logs. > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> > --- > fs/f2fs/segment.c | 34 ++++++++++++++++++++++++---------- > fs/f2fs/super.c | 1 + > 2 files changed, 25 insertions(+), 10 deletions(-) > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index d4f228e6f771..6d586ae8b55f 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -4912,6 +4912,16 @@ static int sanity_check_curseg(struct f2fs_sb_info *sbi) > } > > #ifdef CONFIG_BLK_DEV_ZONED > +const char *f2fs_zone_status[BLK_ZONE_COND_OFFLINE + 1] = { Added static. > + [BLK_ZONE_COND_NOT_WP] = "NOT_WP", > + [BLK_ZONE_COND_EMPTY] = "EMPTY", > + [BLK_ZONE_COND_IMP_OPEN] = "IMPLICITE_OPEN", > + [BLK_ZONE_COND_EXP_OPEN] = "EXPLICITE_OPEN", > + [BLK_ZONE_COND_CLOSED] = "CLOSED", > + [BLK_ZONE_COND_READONLY] = "READONLY", > + [BLK_ZONE_COND_FULL] = "FULL", > + [BLK_ZONE_COND_OFFLINE] = "OFFLINE", > +}; > > static int check_zone_write_pointer(struct f2fs_sb_info *sbi, > struct f2fs_dev_info *fdev, > @@ -4928,18 +4938,22 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, > zone_block = fdev->start_blk + (zone->start >> log_sectors_per_block); > zone_segno = GET_SEGNO(sbi, zone_block); > > + /* > + * Get # of valid block of the zone. > + */ > + valid_block_cnt = get_valid_blocks(sbi, zone_segno, true); > + > /* > * Skip check of zones cursegs point to, since > * fix_curseg_write_pointer() checks them. > */ > if (zone_segno >= MAIN_SEGS(sbi) || > - IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) > + IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) { > + f2fs_notice(sbi, "Open zones: valid block[0x%x,0x%x] cond[%s]", > + zone_segno, valid_block_cnt, > + f2fs_zone_status[zone->cond]); > return 0; > - > - /* > - * Get # of valid block of the zone. > - */ > - valid_block_cnt = get_valid_blocks(sbi, zone_segno, true); > + } > > if ((!valid_block_cnt && zone->cond == BLK_ZONE_COND_EMPTY) || > (valid_block_cnt && zone->cond == BLK_ZONE_COND_FULL)) > @@ -4947,8 +4961,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, > > if (!valid_block_cnt) { > f2fs_notice(sbi, "Zone without valid block has non-zero write " > - "pointer. Reset the write pointer: cond[0x%x]", > - zone->cond); > + "pointer. Reset the write pointer: cond[%s]", > + f2fs_zone_status[zone->cond]); > ret = __f2fs_issue_discard_zone(sbi, fdev->bdev, zone_block, > zone->len >> log_sectors_per_block); > if (ret) > @@ -4965,8 +4979,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, > * selected for write operation until it get discarded. > */ > f2fs_notice(sbi, "Valid blocks are not aligned with write " > - "pointer: valid block[0x%x,0x%x] cond[0x%x]", > - zone_segno, valid_block_cnt, zone->cond); > + "pointer: valid block[0x%x,0x%x] cond[%s]", > + zone_segno, valid_block_cnt, f2fs_zone_status[zone->cond]); > > ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH, > zone->start, zone->len, GFP_NOFS); > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index 4d03ce1109ad..fc7f1a9fbbda 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -4674,6 +4674,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) > * check zoned block devices' write pointer consistency. > */ > if (!f2fs_readonly(sb) && f2fs_sb_has_blkzoned(sbi)) { > + f2fs_notice(sbi, "Checking entire write pointers"); > err = f2fs_check_write_pointer(sbi); > if (err) > goto free_meta; > -- > 2.44.0.rc0.258.g7320e95886-goog
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index d4f228e6f771..6d586ae8b55f 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -4912,6 +4912,16 @@ static int sanity_check_curseg(struct f2fs_sb_info *sbi) } #ifdef CONFIG_BLK_DEV_ZONED +const char *f2fs_zone_status[BLK_ZONE_COND_OFFLINE + 1] = { + [BLK_ZONE_COND_NOT_WP] = "NOT_WP", + [BLK_ZONE_COND_EMPTY] = "EMPTY", + [BLK_ZONE_COND_IMP_OPEN] = "IMPLICITE_OPEN", + [BLK_ZONE_COND_EXP_OPEN] = "EXPLICITE_OPEN", + [BLK_ZONE_COND_CLOSED] = "CLOSED", + [BLK_ZONE_COND_READONLY] = "READONLY", + [BLK_ZONE_COND_FULL] = "FULL", + [BLK_ZONE_COND_OFFLINE] = "OFFLINE", +}; static int check_zone_write_pointer(struct f2fs_sb_info *sbi, struct f2fs_dev_info *fdev, @@ -4928,18 +4938,22 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, zone_block = fdev->start_blk + (zone->start >> log_sectors_per_block); zone_segno = GET_SEGNO(sbi, zone_block); + /* + * Get # of valid block of the zone. + */ + valid_block_cnt = get_valid_blocks(sbi, zone_segno, true); + /* * Skip check of zones cursegs point to, since * fix_curseg_write_pointer() checks them. */ if (zone_segno >= MAIN_SEGS(sbi) || - IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) + IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, zone_segno))) { + f2fs_notice(sbi, "Open zones: valid block[0x%x,0x%x] cond[%s]", + zone_segno, valid_block_cnt, + f2fs_zone_status[zone->cond]); return 0; - - /* - * Get # of valid block of the zone. - */ - valid_block_cnt = get_valid_blocks(sbi, zone_segno, true); + } if ((!valid_block_cnt && zone->cond == BLK_ZONE_COND_EMPTY) || (valid_block_cnt && zone->cond == BLK_ZONE_COND_FULL)) @@ -4947,8 +4961,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, if (!valid_block_cnt) { f2fs_notice(sbi, "Zone without valid block has non-zero write " - "pointer. Reset the write pointer: cond[0x%x]", - zone->cond); + "pointer. Reset the write pointer: cond[%s]", + f2fs_zone_status[zone->cond]); ret = __f2fs_issue_discard_zone(sbi, fdev->bdev, zone_block, zone->len >> log_sectors_per_block); if (ret) @@ -4965,8 +4979,8 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi, * selected for write operation until it get discarded. */ f2fs_notice(sbi, "Valid blocks are not aligned with write " - "pointer: valid block[0x%x,0x%x] cond[0x%x]", - zone_segno, valid_block_cnt, zone->cond); + "pointer: valid block[0x%x,0x%x] cond[%s]", + zone_segno, valid_block_cnt, f2fs_zone_status[zone->cond]); ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH, zone->start, zone->len, GFP_NOFS); diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 4d03ce1109ad..fc7f1a9fbbda 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4674,6 +4674,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) * check zoned block devices' write pointer consistency. */ if (!f2fs_readonly(sb) && f2fs_sb_has_blkzoned(sbi)) { + f2fs_notice(sbi, "Checking entire write pointers"); err = f2fs_check_write_pointer(sbi); if (err) goto free_meta;
No functional change, but add some more logs. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> --- fs/f2fs/segment.c | 34 ++++++++++++++++++++++++---------- fs/f2fs/super.c | 1 + 2 files changed, 25 insertions(+), 10 deletions(-)