2023-12-04 18:04:48

by Jaegeuk Kim

[permalink] [raw]
Subject: [PATCH 1/4] f2fs: allocate new section if it's not new

If fsck can allocate a new zone, it'd be better to use that instead of
allocating a new one.

And, it modifies kernel messages.

Signed-off-by: Jaegeuk Kim <[email protected]>
---
fs/f2fs/segment.c | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 08e2f44a1264..9081c9af977a 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -4949,20 +4949,18 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi,
return ret;
}

- if (is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) {
- /*
- * If there are valid blocks and the write pointer doesn't match
- * with them, we need to report the inconsistency and fill
- * the zone till the end to close the zone. This inconsistency
- * does not cause write error because the zone will not be
- * selected for write operation until it get discarded.
- */
- f2fs_notice(sbi, "Valid blocks are not aligned with write "
+ /*
+ * If there are valid blocks and the write pointer doesn't match
+ * with them, we need to report the inconsistency and fill
+ * the zone till the end to close the zone. This inconsistency
+ * does not cause write error because the zone will not be
+ * 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] wp[0x%x,0x%x]",
GET_SEGNO(sbi, last_valid_block),
GET_BLKOFF_FROM_SEG0(sbi, last_valid_block),
wp_segno, wp_blkoff);
- }

ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH,
zone->start, zone->len, GFP_NOFS);
@@ -5053,15 +5051,18 @@ static int fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type)
f2fs_notice(sbi, "Unaligned curseg[%d] with write pointer: "
"curseg[0x%x,0x%x] wp[0x%x,0x%x]", type, cs->segno,
cs->next_blkoff, wp_segno, wp_blkoff);
- } else {
- f2fs_notice(sbi, "Not successfully unmounted in the previous "
- "mount");
}

- f2fs_notice(sbi, "Assign new section to curseg[%d]: "
- "curseg[0x%x,0x%x]", type, cs->segno, cs->next_blkoff);
+ /* Allocate a new section if it's not new. */
+ if (cs->next_blkoff) {
+ unsigned int old_segno = cs->segno, old_blkoff = cs->next_blkoff;

- f2fs_allocate_new_section(sbi, type, true);
+ f2fs_allocate_new_section(sbi, type, true);
+ f2fs_notice(sbi, "Assign new section to curseg[%d]: "
+ "[0x%x,0x%x] -> [0x%x,0x%x]",
+ type, old_segno, old_blkoff,
+ cs->segno, cs->next_blkoff);
+ }

/* check consistency of the zone curseg pointed to */
if (check_zone_write_pointer(sbi, zbd, &zone))
--
2.43.0.rc2.451.g8631bc7472-goog


2023-12-04 18:53:35

by Daeho Jeong

[permalink] [raw]
Subject: Re: [f2fs-dev] [PATCH 1/4] f2fs: allocate new section if it's not new

LGTM

On Mon, Dec 4, 2023 at 10:06 AM Jaegeuk Kim <[email protected]> wrote:
>
> If fsck can allocate a new zone, it'd be better to use that instead of
> allocating a new one.
>
> And, it modifies kernel messages.
>
> Signed-off-by: Jaegeuk Kim <[email protected]>
> ---
> fs/f2fs/segment.c | 33 +++++++++++++++++----------------
> 1 file changed, 17 insertions(+), 16 deletions(-)
>
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 08e2f44a1264..9081c9af977a 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -4949,20 +4949,18 @@ static int check_zone_write_pointer(struct f2fs_sb_info *sbi,
> return ret;
> }
>
> - if (is_set_ckpt_flags(sbi, CP_UMOUNT_FLAG)) {
> - /*
> - * If there are valid blocks and the write pointer doesn't match
> - * with them, we need to report the inconsistency and fill
> - * the zone till the end to close the zone. This inconsistency
> - * does not cause write error because the zone will not be
> - * selected for write operation until it get discarded.
> - */
> - f2fs_notice(sbi, "Valid blocks are not aligned with write "
> + /*
> + * If there are valid blocks and the write pointer doesn't match
> + * with them, we need to report the inconsistency and fill
> + * the zone till the end to close the zone. This inconsistency
> + * does not cause write error because the zone will not be
> + * 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] wp[0x%x,0x%x]",
> GET_SEGNO(sbi, last_valid_block),
> GET_BLKOFF_FROM_SEG0(sbi, last_valid_block),
> wp_segno, wp_blkoff);
> - }
>
> ret = blkdev_zone_mgmt(fdev->bdev, REQ_OP_ZONE_FINISH,
> zone->start, zone->len, GFP_NOFS);
> @@ -5053,15 +5051,18 @@ static int fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type)
> f2fs_notice(sbi, "Unaligned curseg[%d] with write pointer: "
> "curseg[0x%x,0x%x] wp[0x%x,0x%x]", type, cs->segno,
> cs->next_blkoff, wp_segno, wp_blkoff);
> - } else {
> - f2fs_notice(sbi, "Not successfully unmounted in the previous "
> - "mount");
> }
>
> - f2fs_notice(sbi, "Assign new section to curseg[%d]: "
> - "curseg[0x%x,0x%x]", type, cs->segno, cs->next_blkoff);
> + /* Allocate a new section if it's not new. */
> + if (cs->next_blkoff) {
> + unsigned int old_segno = cs->segno, old_blkoff = cs->next_blkoff;
>
> - f2fs_allocate_new_section(sbi, type, true);
> + f2fs_allocate_new_section(sbi, type, true);
> + f2fs_notice(sbi, "Assign new section to curseg[%d]: "
> + "[0x%x,0x%x] -> [0x%x,0x%x]",
> + type, old_segno, old_blkoff,
> + cs->segno, cs->next_blkoff);
> + }
>
> /* check consistency of the zone curseg pointed to */
> if (check_zone_write_pointer(sbi, zbd, &zone))
> --
> 2.43.0.rc2.451.g8631bc7472-goog
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

2023-12-14 20:51:51

by patchwork-bot+f2fs

[permalink] [raw]
Subject: Re: [f2fs-dev] [PATCH 1/4] f2fs: allocate new section if it's not new

Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

On Mon, 4 Dec 2023 10:04:25 -0800 you wrote:
> If fsck can allocate a new zone, it'd be better to use that instead of
> allocating a new one.
>
> And, it modifies kernel messages.
>
> Signed-off-by: Jaegeuk Kim <[email protected]>
>
> [...]

Here is the summary with links:
- [f2fs-dev,1/4] f2fs: allocate new section if it's not new
https://git.kernel.org/jaegeuk/f2fs/c/15a76c8014f9
- [f2fs-dev,2/4] f2fs: fix write pointers on zoned device after roll forward
https://git.kernel.org/jaegeuk/f2fs/c/9dad4d964291
- [f2fs-dev,3/4] f2fs: check write pointers when checkpoint=disable
https://git.kernel.org/jaegeuk/f2fs/c/aca90eea8a90
- [f2fs-dev,4/4] f2fs: let's finish or reset zones all the time
(no matching commit)

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html