public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] f2fs: check number of blocks in a current section
@ 2024-02-20 23:22 Jaegeuk Kim
  2024-02-20 23:22 ` [PATCH 2/3] f2fs: prevent an f2fs_gc loop during disable_checkpoint Jaegeuk Kim
  2024-02-20 23:22 ` [PATCH 3/3] f2fs: allow to mount if cap is 100 Jaegeuk Kim
  0 siblings, 2 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2024-02-20 23:22 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim

In cfd66bb715fd ("f2fs: fix deadloop in foreground GC"), we needed to check
the number of blocks in a section instead of the segment.

Fixes: cfd66bb715fd ("f2fs: fix deadloop in foreground GC")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/segment.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 63f278210654..9fe5ec619456 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -560,16 +560,16 @@ static inline bool has_curseg_enough_space(struct f2fs_sb_info *sbi,
 	/* check current node segment */
 	for (i = CURSEG_HOT_NODE; i <= CURSEG_COLD_NODE; i++) {
 		segno = CURSEG_I(sbi, i)->segno;
-		left_blocks = BLKS_PER_SEG(sbi) -
-				get_seg_entry(sbi, segno)->ckpt_valid_blocks;
+		left_blocks = BLKS_PER_SEC(sbi) -
+				get_ckpt_valid_blocks(sbi, segno, true);
 		if (node_blocks > left_blocks)
 			return false;
 	}
 
 	/* check current data segment */
 	segno = CURSEG_I(sbi, CURSEG_HOT_DATA)->segno;
-	left_blocks = BLKS_PER_SEG(sbi) -
-			get_seg_entry(sbi, segno)->ckpt_valid_blocks;
+	left_blocks = BLKS_PER_SEC(sbi) -
+				get_ckpt_valid_blocks(sbi, segno, true);
 	if (dent_blocks > left_blocks)
 		return false;
 	return true;
-- 
2.44.0.rc0.258.g7320e95886-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-20 23:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-20 23:22 [PATCH 1/3] f2fs: check number of blocks in a current section Jaegeuk Kim
2024-02-20 23:22 ` [PATCH 2/3] f2fs: prevent an f2fs_gc loop during disable_checkpoint Jaegeuk Kim
2024-02-20 23:22 ` [PATCH 3/3] f2fs: allow to mount if cap is 100 Jaegeuk Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox