Skip to contentSkip to conversation

Return valid segment type in 4 head logging

PATCH In review Surbhi Palande 2 participants 3 messages Aug 7, 2019 – Aug 8, 2019 1 message not in the archive F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Return valid segment type in 4 head logging

The valid type of current segments in a 4 head logging scheme are:

CURSEG_HOT_DATA, CURSEG_COLD_DATA
CURSEG_HOT_NODE, CURSEG_HOT_NODE.

When a direct node page is not explicitly marked cold, return CURSEG_HOT_NODE as it's segment type. CURSEG_WARM_NODE is not a valid segment type in a 4 head logging scheme.

---
 fs/f2fs/segment.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +2 -2
index a661ac32e829..b904b5d7b4df 100644
@@ -3006,8 +3006,8 @@ static int __get_segment_type_4(struct f2fs_io_info *fio)
 		else
 			return CURSEG_COLD_DATA;
 	} else {
-		if (IS_DNODE(fio->page) && is_cold_node(fio->page))
-			return CURSEG_WARM_NODE;
+		if (IS_DNODE(fio->page) && !is_cold_node(fio->page))
+			return CURSEG_HOT_NODE;
 		else
 			return CURSEG_COLD_NODE;
 	}
Signature · 8 lines
2.20.1



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#1 lore raw
Quoted 4 lines · Surbhi Palande

The valid type of current segments in a 4 head logging scheme are:

CURSEG_HOT_DATA, CURSEG_COLD_DATA
CURSEG_HOT_NODE, CURSEG_HOT_NODE.

I didn't see a very strong reason to force to use HOT/COLD keyword in datas type, WARM and COLD can also separate different temperature of datas, right?

Quoted 5 lines

When a direct node page is not explicitly marked cold, return CURSEG_HOT_NODE as it's segment type. CURSEG_WARM_NODE is not a valid segment type in a 4 head logging scheme.

AFAIK, by default, recovery will traverse and replay all regular's dnode in linklist of warm node segment, in order to keep recovery mechanism valid, we keep the rule of allocating warm segment for cold node (regular's dnode).

Certainly, you can change to use HOT_NODE to store cold node, however we should adjust need_do_checkpoint() as below to trigger checkpoint for every fsync, sadly it will cause obvious performance regression, we can't afford it.

else if (F2FS_OPTION(sbi).active_logs != 6)

	cp_reason = CP_SPEC_LOG_NUM;

Thanks,

Quoted 12 lines
---
 fs/f2fs/segment.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +0 -0
index a661ac32e829..b904b5d7b4df 100644

fs/f2fs/segment.c static int __get_segment_type_4(struct f2fs_io_info *fio) · line 3013

Quoted 10 lines
fs/f2fs/segment.c +2 -2
@@ -3006,8 +3006,8 @@ static int __get_segment_type_4(struct f2fs_io_info *fio)
 		else
 			return CURSEG_COLD_DATA;
 	} else {
-		if (IS_DNODE(fio->page) && is_cold_node(fio->page))
-			return CURSEG_WARM_NODE;
+		if (IS_DNODE(fio->page) && !is_cold_node(fio->page))
+			return CURSEG_HOT_NODE;
 		else
 			return CURSEG_COLD_NODE;
 	}

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

A message that is not in the archive (sent off-list or not yet received): CAMBkX3eyb9qNMeoRyNsVg5W=BkChe9Ac2YvW5a7cji8AWvrN=w@mail.gmail.com

#3 lore raw
Quoted 38 lines · Surbhi Palande

On Wed, Aug 7, 2019 at 6:33 PM Chao Yu <[email protected] <mailto:[email protected]>> wrote:

On 2019/8/8 4:54, Surbhi Palande wrote:
> The valid type of current segments in a 4 head logging scheme are:
>
> CURSEG_HOT_DATA, CURSEG_COLD_DATA
> CURSEG_HOT_NODE, CURSEG_HOT_NODE.

I didn't see a very strong reason to force to use HOT/COLD keyword in datas type, WARM and COLD can also separate different temperature of datas, right?

>
> When a direct node page is not explicitly marked cold, > return CURSEG_HOT_NODE as it's segment type. > CURSEG_WARM_NODE is not a valid segment type in a > 4 head logging scheme.

AFAIK, by default, recovery will traverse and replay all regular's dnode in linklist of warm node segment, in order to keep recovery mechanism valid, we keep the rule of allocating warm segment for cold node (regular's dnode).

OK! Got it. Thanks!

Certainly, you can change to use HOT_NODE to store cold node, however we should adjust need_do_checkpoint() as below to trigger checkpoint for every fsync, sadly it will cause obvious performance regression, we can't afford it.

Quoted 6 lines

else if (F2FS_OPTION(sbi).active_logs != 6)
        cp_reason = CP_SPEC_LOG_NUM;

I did not see any support in mkfs or mount for creating 4 or 2 active logs. Am I missing anything?

FYI

Quoted from Documentation/filesystems/f2fs.txt

active_logs=%u Support configuring the number of active logs. In the
current design, f2fs supports only 2, 4, and 6 logs. Default number is 6.

Quoted 25 lines

Best Regards,
Surbhi.

    Thanks,

    >
    > Signed-off-by: Surbhi Palande <[email protected] <mailto:[email protected]>>
    > ---
    >  fs/f2fs/segment.c | 4 ++--
    >  1 file changed, 2 insertions(+), 2 deletions(-)
    >
    > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
    > index a661ac32e829..b904b5d7b4df 100644
    > --- a/fs/f2fs/segment.c
    > +++ b/fs/f2fs/segment.c
    > @@ -3006,8 +3006,8 @@ static int __get_segment_type_4(struct f2fs_io_info
    *fio)
    >               else
    >                       return CURSEG_COLD_DATA;
    >       } else {
Quoted 9 lines
    > -             if (IS_DNODE(fio->page) && is_cold_node(fio->page))
    > -                     return CURSEG_WARM_NODE;
    > +             if (IS_DNODE(fio->page) && !is_cold_node(fio->page))
    > +                     return CURSEG_HOT_NODE;
    >               else
    >                       return CURSEG_COLD_NODE;
    >       }
    >

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel