summaryrefslogtreecommitdiff
path: root/fs/f2fs/segment.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-06-10 07:13:00 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-06-10 07:13:00 -0400
commit0cb30e3f5e2fdff1c4271330db21cec387d3d85c (patch)
treea0c2d6e11c6f054eddc738c8248103d165f36300 /fs/f2fs/segment.h
parent8518546de40d414e7c5cc2bac2f98fdc1fe206b1 (diff)
parente03ced99c437f4a7992b8fa3d97d598f55453fd0 (diff)
Merge v6.12.33linux-rolling-lts
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/f2fs/segment.h')
-rw-r--r--fs/f2fs/segment.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 51b2b8c5c749..0c004dd5595b 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -562,13 +562,16 @@ static inline bool has_curseg_enough_space(struct f2fs_sb_info *sbi,
unsigned int node_blocks, unsigned int data_blocks,
unsigned int dent_blocks)
{
-
unsigned int segno, left_blocks, blocks;
int i;
/* check current data/node sections in the worst case. */
for (i = CURSEG_HOT_DATA; i < NR_PERSISTENT_LOG; i++) {
segno = CURSEG_I(sbi, i)->segno;
+
+ if (unlikely(segno == NULL_SEGNO))
+ return false;
+
left_blocks = CAP_BLKS_PER_SEC(sbi) -
get_ckpt_valid_blocks(sbi, segno, true);
@@ -579,6 +582,10 @@ static inline bool has_curseg_enough_space(struct f2fs_sb_info *sbi,
/* check current data section for dentry blocks. */
segno = CURSEG_I(sbi, CURSEG_HOT_DATA)->segno;
+
+ if (unlikely(segno == NULL_SEGNO))
+ return false;
+
left_blocks = CAP_BLKS_PER_SEC(sbi) -
get_ckpt_valid_blocks(sbi, segno, true);
if (dent_blocks > left_blocks)