An error occurs when the file length exceeds 4 GiB.
For example:
touch test.img
truncate -s 10G test.img
mkfs.f2fs test.img
mkdir mnt
mount -t f2fs -o loop test.img mnt
dd if=/dev/zero of=mnt/testfile bs=1G count=5
sync
umount mnt
fsck.f2fs -M test.img

/testfile 1319936-1320447[ASSERT] (dump_data_blk: 285) blkaddr == NULL_ADDR

Signed-off-by: Zheng Liang <zhengli...@oppo.com>
Signed-off-by: LongPing Wei <weilongp...@oppo.com>
---
 include/f2fs_fs.h | 2 +-
 lib/libf2fs.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index bb40adc..f206994 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -1610,7 +1610,7 @@ extern int utf8_to_utf16(char *, const char *, size_t, 
size_t);
 extern int utf16_to_utf8(char *, const char *, size_t, size_t);
 extern int log_base_2(uint32_t);
 extern unsigned int addrs_per_page(struct f2fs_inode *, bool);
-extern unsigned int f2fs_max_file_offset(struct f2fs_inode *);
+extern u64 f2fs_max_file_offset(struct f2fs_inode *);
 extern __u32 f2fs_inode_chksum(struct f2fs_node *);
 extern __u32 f2fs_checkpoint_chksum(struct f2fs_checkpoint *);
 extern int write_inode(struct f2fs_node *, u64, enum rw_hint);
diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index ecd22d4..d2579d7 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -527,7 +527,7 @@ unsigned int addrs_per_page(struct f2fs_inode *i, bool 
is_inode)
        return ALIGN_DOWN(addrs, 1 << i->i_log_cluster_size);
 }
 
-unsigned int f2fs_max_file_offset(struct f2fs_inode *i)
+u64 f2fs_max_file_offset(struct f2fs_inode *i)
 {
        if (!LINUX_S_ISREG(le16_to_cpu(i->i_mode)) ||
                        !(le32_to_cpu(i->i_flags) & F2FS_COMPR_FL))
-- 
2.34.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to