[PATCH v2 06/13] f2fs: fix address info has been truncated

From: Wu Bo
Date: Tue Sep 10 2024 - 23:44:18 EST


If there is no data inline, the address table should not be truncate,
in case there may be reserved address info.

Signed-off-by: Wu Bo <bo.wu@xxxxxxxx>
---
fs/f2fs/inline.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 30b18053e784..a542956d618a 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -224,7 +224,8 @@ int f2fs_clear_inline_tail(struct inode *inode, bool force)
if (IS_ERR(ipage))
return PTR_ERR(ipage);

- f2fs_truncate_inline_inode(inode, ipage, 0);
+ if (f2fs_exist_data(inode))
+ f2fs_truncate_inline_inode(inode, ipage, 0);
clear_page_private_inline(ipage);

if (force || end_index >= COMPACT_ADDRS_PER_INODE)
--
2.35.3