Message ID | 20250320065247.2364883-1-weilongping@oppo.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [f2fs-dev] f2fs-tools: fix incorrect return type of f2fs_max_file_offset | expand |
On 2025/3/20 14:52, LongPing Wei wrote: > 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 Good catch! Seems it will affect several tools including fsck, dump and sload. > > Signed-off-by: Zheng Liang <zhengliang@oppo.com> > Signed-off-by: LongPing Wei <weilongping@oppo.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, > --- > 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))
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))