Skip to contentSkip to conversation

f2fs: skip checkpoint if having a dirty segment but no prefree at BG_GC -> FG_GC

PATCH In review Weichao Guo 3 participants 9 messages Feb 24, 2017 – Mar 1, 2017 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: skip checkpoint if having a dirty segment but no prefree at BG_GC -> FG_GC

When turning to FG_GC from BG_GC, we need to write checkpoint in 2 cases:
* a) BG_GC have made some progress, e.g.: some prefree segments.
* b) There is no victim and no prefree segment.

For case a), previously, we also check if there is a dirty segment for infering blocks moving in last BG_GC. But dirty segments do not always indicate that, BG_GC may just start and do not move any blocks at all. Futhermore, skipping checkpoint if there are some dirty segments but no prefree segments is OK.

---
 fs/f2fs/gc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +6 -1
index 6c996e3..30d206a 100644
@@ -958,7 +958,12 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
 		 * enough free sections, we should flush dent/node blocks and do
 		 * garbage collections.
 		 */
-		ret = write_checkpoint(sbi, &cpc);
+		if (prefree_segments(sbi))
+			ret = write_checkpoint(sbi, &cpc);
+		else if (!__get_victim(sbi, &segno, gc_type) {
+			segno = NULL_SEGNO;
+			ret = write_checkpoint(sbi, &cpc);
+		}
 		if (ret)
 			goto stop;
 	} else if (gc_type == BG_GC && !background) {
Signature · 6 lines
2.10.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
maintainer
#1 lore raw

Hi Weichao,

Quoted 3 lines · Weichao Guo

When turning to FG_GC from BG_GC, we need to write checkpoint in 2 cases:
* a) BG_GC have made some progress, e.g.: some prefree segments.
* b) There is no victim and no prefree segment.

You missed
* c) has_not_enough_free_secs() introduced by 6e17bfbc75a5cb ("f2fs: fix to overcome inline_data floods")

And, Yunlong pointed that we can't find a case to avoid write_checkpoint() mostly due to c) condition.

Thanks,

Quoted 34 lines

For case a), previously, we also check if there is a dirty segment for infering blocks moving in last BG_GC. But dirty segments do not always indicate that, BG_GC may just start and do not move any blocks at all. Futhermore, skipping checkpoint if there are some dirty segments but no prefree segments is OK.

---
 fs/f2fs/gc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +6 -1
index 6c996e3..30d206a 100644
@@ -958,7 +958,12 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
 		 * enough free sections, we should flush dent/node blocks and do
 		 * garbage collections.
 		 */
-		ret = write_checkpoint(sbi, &cpc);
+		if (prefree_segments(sbi))
+			ret = write_checkpoint(sbi, &cpc);
+		else if (!__get_victim(sbi, &segno, gc_type) {
+			segno = NULL_SEGNO;
+			ret = write_checkpoint(sbi, &cpc);
+		}
 		if (ret)
 			goto stop;
 	} else if (gc_type == BG_GC && !background) {
Signature · 1 line
2.10.1

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot

author
#2 lore raw

Hi Jaegeuk,

I regard no enough free sections as a precondition when talking about BG_GC -> FG_GC. I mean that for both case a) and b) I mentioned has no enough free sections implicitly.

Quoted 10 lines · Jaegeuk Kim

Hi Weichao,

Quoted 3 lines · Weichao Guo

When turning to FG_GC from BG_GC, we need to write checkpoint in 2 cases:
* a) BG_GC have made some progress, e.g.: some prefree segments.
* b) There is no victim and no prefree segment.

You missed
* c) has_not_enough_free_secs() introduced by 6e17bfbc75a5cb ("f2fs: fix to overcome inline_data floods")

As we have enabled SSR for warm node(5b6c6be2d8 ("f2fs: use SSR for warm node as well")), I think inline data floods should not be a problem in most cases.

Quoted 3 lines

And, Yunlong pointed that we can't find a case to avoid write_checkpoint() mostly due to c) condition.

As inline data floods is an extreme case, and there is little possibility caused panic for inline data floods now, there should be lots of chance to skip checkpoint. I mean that we can make some accurate inline data floods checking before writing checkpoint.

Quoted 31 lines

Thanks,

Quoted 28 lines

For case a), previously, we also check if there is a dirty segment for infering blocks moving in last BG_GC. But dirty segments do not always indicate that, BG_GC may just start and do not move any blocks at all. Futhermore, skipping checkpoint if there are some dirty segments but no prefree segments is OK.

---
 fs/f2fs/gc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +5 -1
index 6c996e3..30d206a 100644
@@ -958,7 +958,12 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
 		 * enough free sections, we should flush dent/node blocks and do
 		 * garbage collections.
 		 */
-		ret = write_checkpoint(sbi, &cpc);
+		if (prefree_segments(sbi))
+			ret = write_checkpoint(sbi, &cpc);
+		else if (!__get_victim(sbi, &segno, gc_type) {
+			segno = NULL_SEGNO;
+			ret = write_checkpoint(sbi, &cpc);
Quoted 9 lines
Quoted 6 lines
fs/f2fs/gc.c +1 -0
+		}
 		if (ret)
 			goto stop;
 	} else if (gc_type == BG_GC && !background) {
Signature · 1 line
2.10.1

.

Thanks,
Weichao

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot

maintainer
#3 lore raw
Quoted 17 lines · guoweichao

Hi Jaegeuk,

I regard no enough free sections as a precondition when talking about BG_GC -> FG_GC. I mean that for both case a) and b) I mentioned has no enough free sections implicitly.

Quoted 10 lines · Jaegeuk Kim

Hi Weichao,

Quoted 3 lines · Weichao Guo

When turning to FG_GC from BG_GC, we need to write checkpoint in 2 cases:
* a) BG_GC have made some progress, e.g.: some prefree segments.
* b) There is no victim and no prefree segment.

You missed
* c) has_not_enough_free_secs() introduced by 6e17bfbc75a5cb ("f2fs: fix to overcome inline_data floods")

Quoted 8 lines

As we have enabled SSR for warm node(5b6c6be2d8 ("f2fs: use SSR for warm node as well")), I think inline data floods should not be a problem in most cases.

Quoted 3 lines

And, Yunlong pointed that we can't find a case to avoid write_checkpoint() mostly due to c) condition.

As inline data floods is an extreme case, and there is little possibility caused panic for inline data floods now, there should be lots of chance to skip checkpoint. I mean that we can make some accurate inline data floods checking before writing checkpoint.

For now, the safest way is our first option. So, I decided to start with doing checkpoint due to previous inline_data flooding issue even though it's an extreme case under SSR.

Anyway, I agree that we need to find a way to detect when to avoid checkpoint.

Thanks,

Quoted 41 lines
Quoted 31 lines

Thanks,

Quoted 28 lines

For case a), previously, we also check if there is a dirty segment for infering blocks moving in last BG_GC. But dirty segments do not always indicate that, BG_GC may just start and do not move any blocks at all. Futhermore, skipping checkpoint if there are some dirty segments but no prefree segments is OK.

---
 fs/f2fs/gc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +5 -1
index 6c996e3..30d206a 100644
@@ -958,7 +958,12 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
 		 * enough free sections, we should flush dent/node blocks and do
 		 * garbage collections.
 		 */
-		ret = write_checkpoint(sbi, &cpc);
+		if (prefree_segments(sbi))
+			ret = write_checkpoint(sbi, &cpc);
+		else if (!__get_victim(sbi, &segno, gc_type) {
+			segno = NULL_SEGNO;
+			ret = write_checkpoint(sbi, &cpc);
Quoted 9 lines
Quoted 6 lines
fs/f2fs/gc.c +1 -0
+		}
 		if (ret)
 			goto stop;
 	} else if (gc_type == BG_GC && !background) {
Signature · 1 line
2.10.1

.

Quoted 2 lines

Thanks,
Weichao

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot

#4 lore raw
Quoted 27 lines · Jaegeuk Kim
Quoted 17 lines · guoweichao

Hi Jaegeuk,

I regard no enough free sections as a precondition when talking about BG_GC -> FG_GC. I mean that for both case a) and b) I mentioned has no enough free sections implicitly.

Quoted 10 lines · Jaegeuk Kim

Hi Weichao,

Quoted 3 lines · Weichao Guo

When turning to FG_GC from BG_GC, we need to write checkpoint in 2 cases:
* a) BG_GC have made some progress, e.g.: some prefree segments.
* b) There is no victim and no prefree segment.

You missed
* c) has_not_enough_free_secs() introduced by 6e17bfbc75a5cb ("f2fs: fix to overcome inline_data floods")

Quoted 8 lines

As we have enabled SSR for warm node(5b6c6be2d8 ("f2fs: use SSR for warm node as well")), I think inline data floods should not be a problem in most cases.

Quoted 3 lines

And, Yunlong pointed that we can't find a case to avoid write_checkpoint() mostly due to c) condition.

As inline data floods is an extreme case, and there is little possibility caused panic for inline data floods now, there should be lots of chance to skip checkpoint. I mean that we can make some accurate inline data floods checking before writing checkpoint.

Quoted 5 lines

For now, the safest way is our first option. So, I decided to start with doing checkpoint due to previous inline_data flooding issue even though it's an extreme case under SSR.

Anyway, I agree that we need to find a way to detect when to avoid checkpoint.

Hi all,

I proposed a approach before, can you please check that one?

https://www.mail-archive.com/[email protected]/msg03632.html

Thanks,

Quoted 44 lines

Thanks,

Quoted 41 lines
Quoted 40 lines

Thanks,

Quoted 34 lines

For case a), previously, we also check if there is a dirty segment for infering blocks moving in last BG_GC. But dirty segments do not always indicate that, BG_GC may just start and do not move any blocks at all. Futhermore, skipping checkpoint if there are some dirty segments but no prefree segments is OK.

---
 fs/f2fs/gc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +6 -1
index 6c996e3..30d206a 100644
@@ -958,7 +958,12 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
 		 * enough free sections, we should flush dent/node blocks and do
 		 * garbage collections.
 		 */
-		ret = write_checkpoint(sbi, &cpc);
+		if (prefree_segments(sbi))
+			ret = write_checkpoint(sbi, &cpc);
+		else if (!__get_victim(sbi, &segno, gc_type) {
+			segno = NULL_SEGNO;
+			ret = write_checkpoint(sbi, &cpc);
+		}
 		if (ret)
 			goto stop;
 	} else if (gc_type == BG_GC && !background) {
Signature · 1 line
2.10.1

.

Quoted 5 lines
Quoted 2 lines

Thanks,
Weichao

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot

maintainer
#5 lore raw
Quoted 32 lines · Chao Yu
Quoted 31 lines · Jaegeuk Kim
Quoted 17 lines · guoweichao

Hi Jaegeuk,

I regard no enough free sections as a precondition when talking about BG_GC -> FG_GC. I mean that for both case a) and b) I mentioned has no enough free sections implicitly.

Quoted 10 lines · Jaegeuk Kim

Hi Weichao,

Quoted 3 lines · Weichao Guo

When turning to FG_GC from BG_GC, we need to write checkpoint in 2 cases:
* a) BG_GC have made some progress, e.g.: some prefree segments.
* b) There is no victim and no prefree segment.

You missed
* c) has_not_enough_free_secs() introduced by 6e17bfbc75a5cb ("f2fs: fix to overcome inline_data floods")

Quoted 8 lines

As we have enabled SSR for warm node(5b6c6be2d8 ("f2fs: use SSR for warm node as well")), I think inline data floods should not be a problem in most cases.

Quoted 3 lines

And, Yunlong pointed that we can't find a case to avoid write_checkpoint() mostly due to c) condition.

As inline data floods is an extreme case, and there is little possibility caused panic for inline data floods now, there should be lots of chance to skip checkpoint. I mean that we can make some accurate inline data floods checking before writing checkpoint.

For now, the safest way is our first option. So, I decided to start with doing checkpoint due to previous inline_data flooding issue even though it's an extreme case under SSR.

Quoted 7 lines
Quoted 1 line

Anyway, I agree that we need to find a way to detect when to avoid checkpoint.

Hi all,

I proposed a approach before, can you please check that one?

https://www.mail-archive.com/[email protected]/msg03632.html

Oh, right, let's take a look at this. ;)

Thanks,

Quoted 52 lines

Thanks,

Quoted 49 lines

Thanks,

Quoted 41 lines
Quoted 31 lines

Thanks,

Quoted 28 lines

For case a), previously, we also check if there is a dirty segment for infering blocks moving in last BG_GC. But dirty segments do not always indicate that, BG_GC may just start and do not move any blocks at all. Futhermore, skipping checkpoint if there are some dirty segments but no prefree segments is OK.

---
 fs/f2fs/gc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +5 -1
index 6c996e3..30d206a 100644
@@ -958,7 +958,12 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
 		 * enough free sections, we should flush dent/node blocks and do
 		 * garbage collections.
 		 */
-		ret = write_checkpoint(sbi, &cpc);
+		if (prefree_segments(sbi))
+			ret = write_checkpoint(sbi, &cpc);
+		else if (!__get_victim(sbi, &segno, gc_type) {
+			segno = NULL_SEGNO;
+			ret = write_checkpoint(sbi, &cpc);
Quoted 9 lines
Quoted 6 lines
fs/f2fs/gc.c +1 -0
+		}
 		if (ret)
 			goto stop;
 	} else if (gc_type == BG_GC && !background) {
Signature · 1 line
2.10.1

.

Quoted 2 lines

Thanks,
Weichao

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot

maintainer
#6 lore raw
Quoted 35 lines · Jaegeuk Kim
Quoted 34 lines · Chao Yu
Quoted 32 lines · Jaegeuk Kim
Quoted 17 lines · guoweichao

Hi Jaegeuk,

I regard no enough free sections as a precondition when talking about BG_GC -> FG_GC. I mean that for both case a) and b) I mentioned has no enough free sections implicitly.

Quoted 10 lines · Jaegeuk Kim

Hi Weichao,

Quoted 3 lines · Weichao Guo

When turning to FG_GC from BG_GC, we need to write checkpoint in 2 cases:
* a) BG_GC have made some progress, e.g.: some prefree segments.
* b) There is no victim and no prefree segment.

You missed
* c) has_not_enough_free_secs() introduced by 6e17bfbc75a5cb ("f2fs: fix to overcome inline_data floods")

Quoted 8 lines

As we have enabled SSR for warm node(5b6c6be2d8 ("f2fs: use SSR for warm node as well")), I think inline data floods should not be a problem in most cases.

Quoted 3 lines

And, Yunlong pointed that we can't find a case to avoid write_checkpoint() mostly due to c) condition.

As inline data floods is an extreme case, and there is little possibility caused panic for inline data floods now, there should be lots of chance to skip checkpoint. I mean that we can make some accurate inline data floods checking before writing checkpoint.

For now, the safest way is our first option. So, I decided to start with doing checkpoint due to previous inline_data flooding issue even though it's an extreme case under SSR.

Anyway, I agree that we need to find a way to detect when to avoid checkpoint.

Quoted 7 lines
Quoted 5 lines

Hi all,

I proposed a approach before, can you please check that one?

https://www.mail-archive.com/[email protected]/msg03632.html

Oh, right, let's take a look at this. ;)

Hmm, I just read this patch again, and realized it doesn't quite address the current issue. This patch flushes inline_data inodes in background, which does not guarantee this worst case. The key idea would be how to measure the space we can do SSR and use it in has_not_enough_free_secs().

Thanks,

Quoted 56 lines

Thanks,

Quoted 52 lines

Thanks,

Quoted 49 lines

Thanks,

Quoted 41 lines
Quoted 31 lines

Thanks,

Quoted 28 lines

For case a), previously, we also check if there is a dirty segment for infering blocks moving in last BG_GC. But dirty segments do not always indicate that, BG_GC may just start and do not move any blocks at all. Futhermore, skipping checkpoint if there are some dirty segments but no prefree segments is OK.

---
 fs/f2fs/gc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +5 -1
index 6c996e3..30d206a 100644
@@ -958,7 +958,12 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
 		 * enough free sections, we should flush dent/node blocks and do
 		 * garbage collections.
 		 */
-		ret = write_checkpoint(sbi, &cpc);
+		if (prefree_segments(sbi))
+			ret = write_checkpoint(sbi, &cpc);
+		else if (!__get_victim(sbi, &segno, gc_type) {
+			segno = NULL_SEGNO;
+			ret = write_checkpoint(sbi, &cpc);
Quoted 9 lines
Quoted 6 lines
fs/f2fs/gc.c +1 -0
+		}
 		if (ret)
 			goto stop;
 	} else if (gc_type == BG_GC && !background) {
Signature · 1 line
2.10.1

.

Quoted 2 lines

Thanks,
Weichao

.

Quoted 7 lines

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot

#7 lore raw
Quoted 40 lines · Jaegeuk Kim
Quoted 39 lines · Jaegeuk Kim
Quoted 38 lines · Chao Yu
Quoted 27 lines · Jaegeuk Kim
Quoted 17 lines · guoweichao

Hi Jaegeuk,

I regard no enough free sections as a precondition when talking about BG_GC -> FG_GC. I mean that for both case a) and b) I mentioned has no enough free sections implicitly.

Quoted 10 lines · Jaegeuk Kim

Hi Weichao,

Quoted 3 lines · Weichao Guo

When turning to FG_GC from BG_GC, we need to write checkpoint in 2 cases:
* a) BG_GC have made some progress, e.g.: some prefree segments.
* b) There is no victim and no prefree segment.

You missed
* c) has_not_enough_free_secs() introduced by 6e17bfbc75a5cb ("f2fs: fix to overcome inline_data floods")

Quoted 8 lines

As we have enabled SSR for warm node(5b6c6be2d8 ("f2fs: use SSR for warm node as well")), I think inline data floods should not be a problem in most cases.

Quoted 3 lines

And, Yunlong pointed that we can't find a case to avoid write_checkpoint() mostly due to c) condition.

As inline data floods is an extreme case, and there is little possibility caused panic for inline data floods now, there should be lots of chance to skip checkpoint. I mean that we can make some accurate inline data floods checking before writing checkpoint.

Quoted 5 lines

For now, the safest way is our first option. So, I decided to start with doing checkpoint due to previous inline_data flooding issue even though it's an extreme case under SSR.

Anyway, I agree that we need to find a way to detect when to avoid checkpoint.

Hi all,

I proposed a approach before, can you please check that one?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

https://www.mail-archive.com/[email protected]/msg03632.html

Oh, right, let's take a look at this. ;)

Hmm, I just read this patch again, and realized it doesn't quite address the current issue. This patch flushes inline_data inodes in background, which does not guarantee this worst case. The key idea would be how to measure the space

Hmm.. Maybe we can cover worst case by moving judgment condition and flushing operation into f2fs_balance_fs.

Quoted 1 line

we can do SSR and use it in has_not_enough_free_secs().

We need to stat usage of slack free space accurately both for data/node, right?

Thanks,

Quoted 67 lines

Thanks,

Quoted 56 lines

Thanks,

Quoted 52 lines

Thanks,

Quoted 49 lines

Thanks,

Quoted 41 lines
Quoted 31 lines

Thanks,

Quoted 28 lines

For case a), previously, we also check if there is a dirty segment for infering blocks moving in last BG_GC. But dirty segments do not always indicate that, BG_GC may just start and do not move any blocks at all. Futhermore, skipping checkpoint if there are some dirty segments but no prefree segments is OK.

---
 fs/f2fs/gc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +5 -1
index 6c996e3..30d206a 100644
@@ -958,7 +958,12 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
 		 * enough free sections, we should flush dent/node blocks and do
 		 * garbage collections.
 		 */
-		ret = write_checkpoint(sbi, &cpc);
+		if (prefree_segments(sbi))
+			ret = write_checkpoint(sbi, &cpc);
+		else if (!__get_victim(sbi, &segno, gc_type) {
+			segno = NULL_SEGNO;
+			ret = write_checkpoint(sbi, &cpc);
Quoted 9 lines
Quoted 6 lines
fs/f2fs/gc.c +1 -0
+		}
 		if (ret)
 			goto stop;
 	} else if (gc_type == BG_GC && !background) {
Signature · 1 line
2.10.1

.

Quoted 2 lines

Thanks,
Weichao

.

Quoted 7 lines

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Quoted 2 lines

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot

maintainer
#8 lore raw
Quoted 49 lines · Chao Yu
Quoted 40 lines · Jaegeuk Kim
Quoted 39 lines · Jaegeuk Kim
Quoted 38 lines · Chao Yu
Quoted 27 lines · Jaegeuk Kim
Quoted 17 lines · guoweichao

Hi Jaegeuk,

I regard no enough free sections as a precondition when talking about BG_GC -> FG_GC. I mean that for both case a) and b) I mentioned has no enough free sections implicitly.

Quoted 10 lines · Jaegeuk Kim

Hi Weichao,

Quoted 3 lines · Weichao Guo

When turning to FG_GC from BG_GC, we need to write checkpoint in 2 cases:
* a) BG_GC have made some progress, e.g.: some prefree segments.
* b) There is no victim and no prefree segment.

You missed
* c) has_not_enough_free_secs() introduced by 6e17bfbc75a5cb ("f2fs: fix to overcome inline_data floods")

Quoted 8 lines

As we have enabled SSR for warm node(5b6c6be2d8 ("f2fs: use SSR for warm node as well")), I think inline data floods should not be a problem in most cases.

Quoted 3 lines

And, Yunlong pointed that we can't find a case to avoid write_checkpoint() mostly due to c) condition.

As inline data floods is an extreme case, and there is little possibility caused panic for inline data floods now, there should be lots of chance to skip checkpoint. I mean that we can make some accurate inline data floods checking before writing checkpoint.

Quoted 5 lines

For now, the safest way is our first option. So, I decided to start with doing checkpoint due to previous inline_data flooding issue even though it's an extreme case under SSR.

Anyway, I agree that we need to find a way to detect when to avoid checkpoint.

Hi all,

I proposed a approach before, can you please check that one?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

https://www.mail-archive.com/[email protected]/msg03632.html

Oh, right, let's take a look at this. ;)

Hmm, I just read this patch again, and realized it doesn't quite address the current issue. This patch flushes inline_data inodes in background, which does not guarantee this worst case. The key idea would be how to measure the space

Quoted 6 lines

Hmm.. Maybe we can cover worst case by moving judgment condition and flushing operation into f2fs_balance_fs.

Quoted 1 line

we can do SSR and use it in has_not_enough_free_secs().

We need to stat usage of slack free space accurately both for data/node, right?

Yup.
Thanks,

Quoted 72 lines

Thanks,

Quoted 69 lines

Thanks,

Quoted 56 lines

Thanks,

Quoted 52 lines

Thanks,

Quoted 49 lines

Thanks,

Quoted 41 lines
Quoted 31 lines

Thanks,

Quoted 28 lines

For case a), previously, we also check if there is a dirty segment for infering blocks moving in last BG_GC. But dirty segments do not always indicate that, BG_GC may just start and do not move any blocks at all. Futhermore, skipping checkpoint if there are some dirty segments but no prefree segments is OK.

---
 fs/f2fs/gc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +5 -1
index 6c996e3..30d206a 100644
@@ -958,7 +958,12 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, bool background)
 		 * enough free sections, we should flush dent/node blocks and do
 		 * garbage collections.
 		 */
-		ret = write_checkpoint(sbi, &cpc);
+		if (prefree_segments(sbi))
+			ret = write_checkpoint(sbi, &cpc);
+		else if (!__get_victim(sbi, &segno, gc_type) {
+			segno = NULL_SEGNO;
+			ret = write_checkpoint(sbi, &cpc);
Quoted 9 lines
Quoted 6 lines
fs/f2fs/gc.c +1 -0
+		}
 		if (ret)
 			goto stop;
 	} else if (gc_type == BG_GC && !background) {
Signature · 1 line
2.10.1

.

Quoted 2 lines

Thanks,
Weichao

.

Quoted 7 lines

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot