f2fs-tools: fix incorrect return type of f2fs_max_file_offset
PATCH 1/1 f2fs-tools: fix incorrect return type of f2fs_max_file_offset
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
--- include/f2fs_fs.h | 2 +- lib/libf2fs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/f2fs_fs.h +1 -1
@@ -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 );
lib/libf2fs.c +1 -1
@@ -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 ))
Signature · 8 lines
2.34.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 12 lines · LongPing Wei
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
Quoted 1 line
/testfile 1319936-1320447[ASSERT] (
dump_data_blk: 285) blkaddr ==NULL_ADDR
Good catch! Seems it will affect several tools including fsck, dump and sload.
Quoted 3 lines
Signed-off-by Zheng Liang <[email protected]>Signed-off-by LongPing Wei <[email protected]>
Thanks,
Quoted 23 lines
--- include/f2fs_fs.h | 2 +- lib/libf2fs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)include/f2fs_fs.h +1
-1@@ -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 );lib/libf2fs.c +0
-0
lib/libf2fs.c unsigned int addrs_per_page(struct f2fs_inode *i, bool is_inode) · line 533
Quoted 8 lines
lib/libf2fs.c +1
-1@@ -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 ))
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel