Chao Yu [Sat, 27 May 2023 00:01:25 +0000 (08:01 +0800)]
f2fs-tools: fix to le32 type variable correctly
Fix below incorrect use:
- compare cpu and le32 type variable:
if (get_sb(feature) & cpu_to_le32(F2FS_FEATURE_RO))
- compare le32 type vairable:
if (c.feature & cpu_to_le32(F2FS_FEATURE_EXTRA_ATTR))
- miss get_sb(feature)
(cpu_to_le32(F2FS_FEATURE_RO) ? 1 : 0)
- update le32 type variable
sb->feature |= cpu_to_le32(F2FS_FEATURE_ENCRYPT);
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 26 May 2023 23:54:23 +0000 (07:54 +0800)]
mkfs.f2fs: refactor format flow for cleanup
During formatting device, node/data block and filesystem metatdata related
to same inode were updated in separated functions, e.g. for root inode:
- f2fs_write_root_inode() updates root inode's block
- f2fs_write_check_point_pack updates its nat/sit journal, summary block
Result in:
- there are some redundant codes in between f2fs_write_check_point_pack()
and functions in f2fs_create_root_dir().
- readability is bad due to filesystem meta and data/node updates in
separated places.
- bad scalability if we want to add more default inode.
So that, this patch introduces below functions:
- update_sit_journal
- update_nat_jounral
- update_summary_entry
Then use them to update inode related metadata into cache in below
functions:
- f2fs_write_root_inode
- f2fs_add_default_dentry_root
- f2fs_write_qf_inode
- f2fs_write_default_quota
- f2fs_write_lpf_inode
- f2fs_write_lpf_inode
Finally, f2fs_write_check_point_pack() can write back cached metadata
into CP area directly.
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 26 May 2023 23:54:22 +0000 (07:54 +0800)]
mkfs.f2fs: cleanup w/ alloc_next_free_block()
Introduce alloc_next_free_block() to wrap below openned codes:
blkaddr = get_sb(main_blkaddr) +
c.cur_seg[curseg_type] * c.blks_per_seg +
c.curseg_offset[curseg_type];
Meanwhile add curseg_offset field in f2fs_configuration to record
last blkaddr in each log.
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
zangyangyang1 [Tue, 23 May 2023 12:27:20 +0000 (20:27 +0800)]
f2fs_io: Fix integer multiplication overflow error in fiemap
When using fiemap to obtain the block address of files
larger than 2GB ((
2147483647+1) bytes), an integer
multiplication overflow error will occur.
This issue is caused by the following code:
start = atoi(argv[1]) * F2FS_BLKSIZE;
length = atoi(argv[2]) * F2FS_BLKSIZE;
Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Wed, 17 May 2023 08:26:30 +0000 (16:26 +0800)]
mkfs.f2fs: remove unneeded nat initialization in f2fs_update_nat_root()
- remove unneeded nat initialization for root/quota inode due to
it has been initialized in nat journal.
- name f2fs_update_nat_root() to f2fs_update_nat_default().
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Wed, 17 May 2023 08:26:29 +0000 (16:26 +0800)]
f2fs-tools: add noatime for quota file
Disk quota file is controlled by filesystem quota subsystem, access time
of quota file is almost random, and should be meanless to user, so let's
add noatime to quota file.
Meanwhile, set quota file w/ F2FS_IMMUTABLE_FL instead of FS_IMMUTABLE_FL,
since F2FS_IMMUTABLE_FL is on-disk flag, however FS_IMMUTABLE_FL is in-memory
one.
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 12 May 2023 10:03:54 +0000 (18:03 +0800)]
fsck.f2fs: lookup and relink root inode
As Stephanos reported in mailing list:
Info: checkpoint state = 1 : unmount
[ASSERT] (sanity_check_nid: 362) --> nid[0x3] ino is 0
The root cause is root inode's nat entry is corrupted, this patch
add logic to search root inode from all node blocks, try to relink
root inode's nat to target node block.
Before:
Info: checkpoint state = 185 : trimmed nat_bits compacted_summary unmount
[lookup_nat_in_journal:3085] ==> Found nid [0x3] in nat cache
[ASSERT] (sanity_check_nat: 404) --> nid->blk_addr is 0x0. [0x3]
Info: root inode is corrupted, search and relink it
Info: possible root inode blkaddr: 0x5a00
[lookup_nat_in_journal:3085] ==> Found nid [0x3] in nat cache
[ASSERT] (sanity_check_nat: 404) --> nid->blk_addr is 0x0. [0x3]
[FSCK] Max image size: 94 MB, Free space: 12194 MB
[FSCK] Unreachable nat entries [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking [Fail]
[FSCK] Hard link checking for regular file [Ok..] [0x0]
[FSCK] valid_block_count matching with CP [Fail] [0x2, 0x0]
[FSCK] valid_node_count matching with CP (de lookup) [Fail] [0x1, 0x0]
[FSCK] valid_node_count matching with CP (nat lookup) [Fail] [0x1, 0x0]
[FSCK] valid_inode_count matched with CP [Fail] [0x1, 0x0]
[FSCK] free segment_count matched with CP [Ok..] [0x17cd]
[FSCK] next block offset is free [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs [Fail]
Do you want to fix this partition? [Y/N] Y
After:
Info: checkpoint state = 185 : trimmed nat_bits compacted_summary unmount
[lookup_nat_in_journal:3085] ==> Found nid [0x3] in nat cache
[ASSERT] (sanity_check_nat: 404) --> nid->blk_addr is 0x0. [0x3]
Info: root inode is corrupted, search and relink it
Info: possible root inode blkaddr: 0x5a00
[FIX] (fsck_chk_root_inode: 730) --> Relink root inode, blkaddr: 0x5a00
update nat(nid:3) blkaddr [0x5a00] in journal
[fsck_chk_dentry_blk:1978] [ 1] Dentry Block [0x6000] Done : dentries:0 in 214 slots (len:255)
[fsck_chk_inode_blk:1244] Directory Inode: 0x3 [] depth: 1 has 0 files
[FSCK] Max image size: 94 MB, Free space: 12194 MB
[FSCK] Unreachable nat entries [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking [Ok..]
[FSCK] Hard link checking for regular file [Ok..] [0x0]
[FSCK] valid_block_count matching with CP [Ok..] [0x2]
[FSCK] valid_node_count matching with CP (de lookup) [Ok..] [0x1]
[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [0x1]
[FSCK] valid_inode_count matched with CP [Ok..] [0x1]
[FSCK] free segment_count matched with CP [Ok..] [0x17cd]
[FSCK] next block offset is free [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs [Fail]
Info: flush_journal_entries() n_nats: 1, n_sits: 6
Info: Duplicate valid checkpoint to mirror position 512 -> 1024
[write_nat_bits:1737] Writing NAT bits pages, at offset 0x000003ff
Info: Write valid nat_bits in checkpoint
Info: write_checkpoint() cur_cp:1
[write_nat_bits:1737] Writing NAT bits pages, at offset 0x000003ff
Info: Write valid nat_bits in checkpoint
Info: fix_checkpoint() cur_cp:1
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 12 May 2023 10:03:53 +0000 (18:03 +0800)]
fsck.f2fs: add more debug info in fsck_verify()
In order to track details of stat info and repair flow.
[FSCK] valid_block_count matching with CP [Fail] [0x2, 0x0]
[FSCK] valid_node_count matching with CP (de lookup) [Fail] [0x1, 0x0]
[FSCK] valid_node_count matching with CP (nat lookup) [Fail] [0x1, 0x0]
[FSCK] valid_inode_count matched with CP [Fail] [0x1, 0x0]
Info: flush_journal_entries() n_nats: 1, n_sits: 6
Info: write_checkpoint() cur_cp:1
Info: fix_checkpoint() cur_cp:1
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 12 May 2023 10:03:52 +0000 (18:03 +0800)]
fsck.f2fs: use f2fs_is_valid_blkaddr()
use f2fs_is_valid_blkaddr() instead of IS_VALID_BLK_ADDR() to
check validity of data/node's block address.
use is_valid_data_blkaddr() in sanity_check_nid() to check NULL_ADDR
as NEW_ADDR, and print the value in error path explicitly.
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 12 May 2023 10:03:51 +0000 (18:03 +0800)]
fsck.f2fs: wrap openned codes into fsck_sanity_check_nid()
read_all_xattrs() is the only user of fsck_sanity_check_nid(), wrap
openned codes of read_all_xattrs() into fsck_sanity_check_nid().
Then fsck_sanity_check_nid() can be reused later.
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yangtao Li [Sat, 6 May 2023 11:45:36 +0000 (19:45 +0800)]
f2fs_io: support move_range command
This patch supports a new sub-command 'move_range' in f2fs_io
to move a range of data blocks from source file to destination
file via F2FS_IOC_MOVE_RANGE ioctl.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 5 May 2023 10:02:05 +0000 (18:02 +0800)]
f2fs-tools: use f2fs_init_inode() to clean up codes
No logic changes.
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 5 May 2023 10:02:04 +0000 (18:02 +0800)]
f2fs-tools: print more raw sb info
Output is as below:
magic [0xf2f52010 :
4076150800]
major_ver [0x 1 : 1]
minor_ver [0x 10 : 16]
log_sectorsize [0x 9 : 9]
log_sectors_per_block [0x 3 : 3]
log_blocksize [0x c : 12]
log_blocks_per_seg [0x 9 : 9]
segs_per_sec [0x 1 : 1]
secs_per_zone [0x 1 : 1]
checksum_offset [0x 0 : 0]
block_count [0x 300000 : 3145728]
section_count [0x 17d3 : 6099]
segment_count [0x 17ff : 6143]
segment_count_ckpt [0x 2 : 2]
segment_count_sit [0x 2 : 2]
segment_count_nat [0x 1c : 28]
segment_count_ssa [0x c : 12]
segment_count_main [0x 17d3 : 6099]
segment0_blkaddr [0x 200 : 512]
cp_blkaddr [0x 200 : 512]
sit_blkaddr [0x 600 : 1536]
nat_blkaddr [0x a00 : 2560]
ssa_blkaddr [0x 4200 : 16896]
main_blkaddr [0x 5a00 : 23040]
root_ino [0x 3 : 3]
node_ino [0x 1 : 1]
meta_ino [0x 2 : 2]
uuid [
f16856a6-8781-422b-adce-
d51c0632c94e]
volum_name []
extension_count [0x 24 : 36]
cold file extentsions
[mp wm og jp ]
[avi m4v m4p mkv ]
[mov webm wav m4a ]
[3gp opus flac gif ]
[png svg webp jar ]
[deb iso gz xz ]
[zst pdf pyc ttc ]
[ttf exe apk cnt ]
[exo odex vdex so ]
hot_ext_count [0x 4 : 4]
hot file extentsions
[db vmdk vdi qcow2 ]
cp_payload [0x 0 : 0]
version [Linux version 6.3.0+ (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #143 SMP PREEMPT_DYNAMIC Thu May 4 09:50:08 HKT 2023]
init_version [Linux version 6.3.0+ (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #143 SMP PREEMPT_DYNAMIC Thu May 4 09:50:08 HKT 2023]
feature [0x 21f8 : 8696]
encryption_level [0x 0 : 0]
encrypt_pw_salt [
00000000-0000-0000-0000-
000000000000]
qf_ino[USRQUOTA] [0x 4 : 4]
qf_ino[GRPQUOTA] [0x 5 : 5]
qf_ino[PRJQUOTA] [0x 6 : 6]
s_encoding [0x 0 : 0]
crc [0x 0 : 0]
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 5 May 2023 10:02:03 +0000 (18:02 +0800)]
f2fs-tools: add DISP_u8() macro
Introduce DISP_u8(), and use DISP_u16() and DISP_u8() to print below fields:
- i_compress_algorithm
- i_log_cluster_size
- i_compress_flag
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 5 May 2023 10:02:02 +0000 (18:02 +0800)]
f2fs-tools: fix typo in f2fs_inode structure
:%s/i_compress_algrithm/i_compress_algorithm/g
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 5 May 2023 10:02:01 +0000 (18:02 +0800)]
f2fs-tools: rename i_padding to i_compress_flag
Commit
b28f047b28c5 ("f2fs: compress: support chksum") renames i_padding
to i_compress_flag in struct f2fs_inode, adjust f2fs-tools' codes as well.
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 5 May 2023 10:02:00 +0000 (18:02 +0800)]
f2fs-tools: add packed attribute for struct f2fs_super_block
Otherwise, it may trigger static assert below when the structure
updates.
static_assert(sizeof(struct f2fs_super_block) == 3072, "")
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 5 May 2023 16:18:30 +0000 (09:18 -0700)]
f2fs-tools: allocate memory to handle label
Let's avoid memory alignment of sb->volume_name.
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yangtao Li [Fri, 14 Apr 2023 08:47:28 +0000 (16:47 +0800)]
f2fs_io: support precache_extents command
This patch supports a new sub-command 'precache_extents' in f2fs_io
to trigger precache extents via F2FS_IOC_PRECACHE_EXTENTS ioctl.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 14 Apr 2023 03:51:46 +0000 (11:51 +0800)]
f2fs_io: support checkpoint command
This patch supports a new sub-command 'checkpoint' in f2fs_io to
trigger filesystem checkpoint via F2FS_IOC_WRITE_CHECKPOINT ioctl.
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yonggil Song [Tue, 4 Apr 2023 06:21:03 +0000 (15:21 +0900)]
mkfs.f2fs: Introduce configurable reserved sections
Overview
========
This option allows zoned block device users to configure GC reserved and
overprovision area manually according to their demands on performance of
sustained write latency and WAF.
Problem
=======
The overprovision segments that mkfs generates are mostly occupied by GC
reserved. This degrades WAF performance.
Experiment
==========
The following experiment evaluated the application of configurable reserved.
The experimental environment is as follows.
System info
- 4.2Ghz, 8 core CPU
- 64GiB Memory
Device info
- a conventional null_blk with 448MiB capacity(meta area) and
- a sequential null_blk with 953 zones of 64MiB
Format
- as-is (find out ovp ratio): mkfs.f2fs <conv null_blk> -c <seq null_blk> -m
Info: Overprovision ratio = 3.700%
Info: Overprovision segments = 1152 (GC reserved = 1088)
- config rsvd: mkfs.f2fs <conv null_blk> -c <seq null_blk> -m -Z 8 -o 2.965
Info: Overprovision ratio = 2.965%
Info: Overprovision segments = 1152 (GC reserved = 256)
Mount
- mount <conv null_blk> <mount point>
Fio script
- fio --rw=randwrite --bs=4k --ba=4k --filesize=58630m --norandommap --overwrite=1 --name=job1 --filename=<mount point>/sustain --time_based --runtime=2h
WAF calculation
- (IOs on conv. null_blk + IOs on seq. null_blk) / random write IOs
Conclusion
==========
In the experiment, it can be shown that reducing the reserved segments
decreases WAF to 10% (from 222 to 23) although it triggers checkpoint more
frequently during gc. With direct IO, the WAF of as-is gets much higher.
In other words, a user can configure more reserved segments for lower GC
latency or allocate less reserved segments for lower WAF on the same number
of OP segments.
Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 11 Apr 2023 17:11:16 +0000 (10:11 -0700)]
f2fs-tools: upgrade version 1.16.0
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Juhyung Park [Tue, 4 Apr 2023 05:54:46 +0000 (14:54 +0900)]
fsck.f2fs: fix sanity check logic for cp_payload
cp_payload is set differently [1] when extended node bitmap feature is
enabled. Commit
b79c3ba4ea9d broke fsck on f2fs file systems created on
2+ TB device with extended node bitmap feature enabled.
As the sanity check is for checking overflows, fix this to assume the max
possible cp_payload size under the extended node bitmap.
Link: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/tree/mkfs/f2fs_format.c?h=v1.15.0#n372
Fixes:
b79c3ba4ea9d ("fsck.f2fs: sanity check cp_payload before reading checkpoint")
Reported-by: Alexander Koskovich <akoskovich@pm.me>
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 27 Mar 2023 18:42:49 +0000 (11:42 -0700)]
mkfs.f2fs: remove indentation
Show info w/o it.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 20 Mar 2023 23:59:31 +0000 (16:59 -0700)]
fsck.f2fs: don't call report_zone on normal partition
Report_zone is not supported on normal partition.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 2 Mar 2023 19:45:09 +0000 (11:45 -0800)]
f2fs-tools: relax zone size of power of 2
Let's relax this for Android support.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 8 Feb 2023 19:24:41 +0000 (11:24 -0800)]
mkfs.f2fs: trim all the devices except the first one
We need to check the first disk only, and trim the other disks.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 10 Feb 2023 21:02:23 +0000 (13:02 -0800)]
f2fs-tools: fix # of total segments
TOTAL_SEGS should include metadata segments and main segments.
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 7 Feb 2023 02:22:03 +0000 (18:22 -0800)]
f2fs_io: support AES_256_HCTR2
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Khem Raj [Thu, 22 Dec 2022 02:28:29 +0000 (18:28 -0800)]
f2fs_io: Fix out of tree builds
Relative path does not work when searching for include files
when srcdir != builddir
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 2 Feb 2023 07:56:25 +0000 (15:56 +0800)]
fsck.f2fs: relocate chksum verification step during f2fs_do_mount()
Keep sanity_check_raw_super flow in fsck.f2fs being consistent w/
sanity_check_raw_super() in f2fs kernel module, otherwise, it outputs
different error information when mounting/fscking the same image which
contains corrupted superblock.
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 20 Dec 2022 18:49:45 +0000 (10:49 -0800)]
f2fs-tools: Remove deprecated f2fstat
Let's remove this.
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 24 Nov 2022 00:34:49 +0000 (16:34 -0800)]
Remove sg_write_buffer
Remove the sg_write_buffer source code and build rules now that the
sg3_utils project has been imported.
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Mon, 14 Nov 2022 14:17:00 +0000 (22:17 +0800)]
fsck.f2fs: avoid uncessary recalculation
There is no need to recalculate ADDRS_PER_INODE and ADDRS_PER_BLOCK,
especially in a for loop.
Signed-off-by: Sheng Yong <shengyong@oppo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 10 Nov 2022 14:07:22 +0000 (22:07 +0800)]
fsck.f2fs: fix potential overflow of copying i_name
If i_namelen is corrupted, there may be an overflow when doing memcpy.
Signed-off-by: Sheng Yong <shengyong@oppo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 10 Nov 2022 14:07:21 +0000 (22:07 +0800)]
fsck.f2fs: add parentheses for SB_MASK
Signed-off-by: Sheng Yong <shengyong@oppo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 10 Nov 2022 14:07:20 +0000 (22:07 +0800)]
dump.f2fs: remove unavailable option -g
Option "-g" for dump.f2fs is unavailable and not used in dump.f2fs.
Signed-off-by: Sheng Yong <shengyong@oppo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Juhyung Park [Sun, 6 Nov 2022 12:19:23 +0000 (21:19 +0900)]
f2fs-tools: define HAVE_CLOCK_GETTIME properly
HAVE_CLOCK_GETTIME wasn't defined during autoconf, leading to
messages like "Done: 0.000000 secs" on Linux distros.
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Daeho Jeong [Mon, 19 Sep 2022 16:15:02 +0000 (09:15 -0700)]
f2fs-tools: support F2FS_IOC_START_ATOMIC_REPLACE
Added options in f2fs_io write command to support
F2FS_IOC_START_ATOMIC_REPLACE.
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 10 Oct 2022 21:02:22 +0000 (14:02 -0700)]
f2fs-tools: give less overprovisioning space
As f2fs becomes more resilient for GCs, let's give the marginal overprovision
space back to user.
Fix an issue where reserved_space > ovp_space, reported by Shinichiro.
Signed-off-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 30 Sep 2022 15:51:13 +0000 (08:51 -0700)]
f2fs-tools: set host-aware zoned device similar to host-managed one
It'd be good to generate zone-aware sequential writes to both of HA and HM
zoned devices.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 3 Oct 2022 20:55:07 +0000 (13:55 -0700)]
fsck.f2fs: fix missing to assign c.zoned_model
We need to set the c.zoned_model appropriately for further usages.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 6 Oct 2022 15:17:27 +0000 (23:17 +0800)]
fsck.f2fs: trigger repairing if filesystem has inconsistent errors
In auto/preen mode, let's trigger repairing if filesystem has
inconsistent errors.
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 6 Oct 2022 15:17:26 +0000 (23:17 +0800)]
fsck.f2fs: trigger repairing if filesystem was forced to stop
In auto/preen mode, let's trigger repairing if filesystem was forced
to stop.
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 6 Oct 2022 15:16:57 +0000 (23:16 +0800)]
fsck.f2fs: export valid image size
Change to calculate and export max image size with valid blocks
used of image rather than last used block of image.
[FSCK] Max image size: xx MB, Free space: xx MB
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 6 Oct 2022 15:16:56 +0000 (23:16 +0800)]
mkfs.f2fs: update allocation policy for ro feature
Update allocation policy for ro feature:
- hot_data: allocating blocks by LBA ascending order
- hot_node: allocating blocks by LBA descending order
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 6 Oct 2022 15:16:06 +0000 (23:16 +0800)]
fsck.f2fs: fix __end_block_addr()
The calculation is wrong, fix it.
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Robin Lee [Fri, 9 Sep 2022 08:05:51 +0000 (08:05 +0000)]
Always use sparse/sparse.h when building for Android
Change-Id: Ic903ce09c93de75d6deb700a5a283638a912a25b
Test: fastboot erase userdata
Jaegeuk Kim [Mon, 29 Aug 2022 18:03:35 +0000 (11:03 -0700)]
f2fs-tools: fix build error on lz4-1.9.4
LZ4_STREAMSIZE_U64 is undefined in new lz4 lib.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Fri, 26 Aug 2022 22:45:34 +0000 (15:45 -0700)]
Fix format strings in log messages
Make the argument list match the format string. Use PRIu64 for uint64_t
and %zu for size_t.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Weichao Guo [Wed, 31 Aug 2022 08:38:26 +0000 (16:38 +0800)]
fsck.f2fs: use elapsed_time in checkpoint for period check
We now use walltime for monthly period check. However the walltime is:
* unstable(timestamp register reset) and settable(modified by user)
* unreasonable(e.g: device power-off for one month, no data changed)
When the walltime changes to the past before one month or the future
after one month, the period check in next fsck will fail to skip or
start a full scan. So, let's use the elapsed_time in checkpoint as
current time for period check.
Signed-off-by: Weichao Guo <guoweichao@oppo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Eric Biggers [Tue, 16 Aug 2022 04:48:32 +0000 (21:48 -0700)]
mkfs.f2fs: catch total_zones=0 instead of crashing
Cleanly report an error instead of dividing by 0 (causing a floating
point exception) in the following case:
truncate -s 16M img && mkfs.f2fs img
Note that this is a minimal fix; it appears that overly-small images
still cause various integer overflows in f2fs_prepare_super_block().
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 8 Aug 2022 22:18:18 +0000 (15:18 -0700)]
f2fs-tools: use F2FS_BLKSIZE instead of PAGE_*_SIZE
We don't need to check the running kernel configuration.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Wed, 27 Jul 2022 15:09:25 +0000 (23:09 +0800)]
f2fs_io: support triggering filesystem GC via ioctl
Support 'gc' sub command to trigger filesystem GC via ioctl in f2fs.
Signed-off-by: Chao Yu <chao.yu@oppo.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Nick Hainke [Mon, 4 Jul 2022 09:29:19 +0000 (11:29 +0200)]
configure.ac: fix cross compilation
AC_CHECK_LIB seems to not work correctly with OpenWrt. Add possibility
to disable lz4 and lzo2 manually.
Fixes errors in the form of:
Package f2fsck is missing dependencies for the following libraries:
liblz4.so.1
liblzo2.so.2
Signed-off-by: Nick Hainke <vincent@systemli.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Nick Hainke [Sun, 3 Jul 2022 08:48:37 +0000 (10:48 +0200)]
configure.ac: fix AC_ARG_WITH
In the new version the configuration no longer respects the
--without/--with blkid/selinux parameters. Add the tests for
"with_blkid" and "with_selinux" back to configure.ac as described
in the manual.
Link: https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/External-Software.html
Fixes:
c48335416a09 ("configure.ac: Enable cross-compilation")
Signed-off-by: Nick Hainke <vincent@systemli.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 23 Jun 2022 18:12:08 +0000 (11:12 -0700)]
Use F2FS_BLKSIZE as the size of struct f2fs_summary_block
Since the size of struct f2fs_summary_block equals F2FS_BLKSIZE, use
F2FS_BLKSIZE instead of PAGE_CACHE_SIZE as the size of struct
f2fs_summary_block.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 23 Jun 2022 18:12:07 +0000 (11:12 -0700)]
Use F2FS_BLKSIZE for dev_read_block() buffers
Use F2FS_BLKSIZE instead of PAGE_SIZE for dev_read_block() buffers since
dev_read_block() reads F2FS_BLKSIZE bytes.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 23 Jun 2022 18:12:06 +0000 (11:12 -0700)]
Improve compile-time type checking for f2fs_report_zone()
Change the type of the third argument of f2fs_report_zone() from void *
into struct blk_zone * to enable type checking.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 23 Jun 2022 18:12:05 +0000 (11:12 -0700)]
Fix f2fs_report_zone()
The definition of struct blk_zone_report is as follows:
struct blk_zone_report {
__u64 sector;
__u32 nr_zones;
__u32 flags;
struct blk_zone zones[0];
};
Since f2fs_report_zone() allocates the above data structure with
malloc() and since f2fs_report_zone() only initializes the sector and
nr_zones members, the flags member is not initialized. Modify
f2fs_report_zone() such that 0 is passed as flags to the
BLKREPORTZONE ioctl instead of a random value. This has been
discovered by reading the source code.
Cc: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fixes:
6d7c7b785feb ("libf2fs_zoned: Introduce f2fs_report_zone() helper function")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 23 Jun 2022 18:12:04 +0000 (11:12 -0700)]
Fix the struct f2fs_dentry_block definition
Fix the struct f2fs_dentry_block definition on systems for which
PAGE_SIZE != 4096. This patch does not change the struct f2fs_dentry_block
definition if PAGE_SIZE == 4096.
Cc: Peter Collingbourne <pcc@google.com>
Reported-by: Peter Collingbourne <pcc@google.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Reviewed-by: Peter Collingbourne <pcc@google.com>
Tested-by: Peter Collingbourne <pcc@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
liuchao12 [Mon, 20 Jun 2022 11:56:28 +0000 (19:56 +0800)]
resize.f2fs: add option to manually specify new overprovision
Make.f2fs supports manually specifying overprovision, and we expect
resize.f2fs to support it as well.
This change add a new '-o' option to manually specify overprovision,
and fix to check free space before grow. Otherwise, after grow,
kernel may report below error message when we mount the image if -o
parameter is specified during resize:
F2FS-fs (loop0): invalid crc_offset: 0
F2FS-fs (loop0): Wrong valid_user_blocks: 16404, user_block_count: 13312
F2FS-fs (loop0): Failed to get valid F2FS checkpoint
mount(2) system call failed: Structure needs cleaning.
Signed-off-by: liuchao12 <liuchao12@xiaomi.com>
Signed-off-by: qixiaoyu1 <qixiaoyu1@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 21 Jun 2022 20:02:54 +0000 (13:02 -0700)]
fsck.f2fs: drop compression bit if inline_data is set
The kernel enforced not to have compression and inline_data bits
together, but old kernel created files with them. Let's disable
compression in that case.
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Ben Chang [Mon, 20 Jun 2022 03:53:01 +0000 (11:53 +0800)]
f2fs-tools: fix cannot get bdev information
Some device like android phone doesn't show the dev number path in
/dev/block/, for example:
$ ls /dev/block/
bootdevice dm-6 loop24 loop43 ram13 sda5 sdd4 sde24 sde43 sde62 sdf1
by-name dm-7 loop25 loop44 ram14 sda6 sdd5 sde25 sde44 sde63 sdf10
dm-0 dm-8 loop26 loop45 ram15 sda7 sdd6 sde26 sde45 sde64 sdf11
dm-1 dm-9 loop27 loop46 ram2 sda8 sdd7 sde27 sde46 sde65 sdf12
dm-10 loop0 loop28 loop47 ram3 sda9 sde sde28 sde47 sde66 sdf13
dm-11 loop1 loop29 loop48 ram4 sdb sde1 sde29 sde48 sde67 sdf14
dm-12 loop10 loop3 loop49 ram5 sdb1 sde10 sde3 sde49 sde68 sdf15
dm-13 loop11 loop30 loop5 ram6 sdb2 sde11 sde30 sde5 sde69 sdf16
dm-14 loop12 loop31 loop50 ram7 sdb3 sde12 sde31 sde50 sde7 sdf17
dm-15 loop13 loop32 loop51 ram8 sdb4 sde13 sde32 sde51 sde70 sdf18
dm-16 loop14 loop33 loop6 ram9 sdb5 sde14 sde33 sde52 sde71 sdf19
dm-17 loop15 loop34 loop7 sda sdc sde15 sde34 sde53 sde72 sdf2
dm-18 loop16 loop35 loop8 sda1 sdc1 sde16 sde35 sde54 sde73 sdf3
dm-19 loop17 loop36 loop9 sda10 sdc2 sde17 sde36 sde55 sde74 sdf4
dm-2 loop18 loop37 mapper sda11 sdc3 sde18 sde37 sde56 sde75 sdf5
dm-20 loop19 loop38 platform sda12 sdc4 sde19 sde38 sde57 sde76 sdf6
dm-21 loop2 loop39 ram0 sda13 sdc5 sde2 sde39 sde58 sde77 sdf7
dm-3 loop20 loop4 ram1 sda14 sdd sde20 sde4 sde59 sde78 sdf8
dm-4 loop21 loop40 ram10 sda2 sdd1 sde21 sde40 sde6 sde8 sdf9
dm-5 loop22 loop41 ram11 sda3 sdd2 sde22 sde41 sde60 sde9 vold
dm-53 loop23 loop42 ram12 sda4 sdd3 sde23 sde42 sde61 sdf zram0
this will cause stat_bdev cannot show bdev information.
But most of devices (include android) show dev number path in /sys/dev/block, for example:
$ ls /sys/dev/block
1:0 254:1 254:6 259:21 259:38 259:54 7:104 7:24 7:368 8:11 8:4 8:70 8:87
1:1 254:10 254:7 259:22 259:39 259:55 7:112 7:240 7:376 8:12 8:48 8:71 8:88
1:10 254:11 254:8 259:23 259:4 259:56 7:120 7:248 7:384 8:13 8:49 8:72 8:89
1:11 254:12 254:9 259:24 259:40 259:57 7:128 7:256 7:392 8:14 8:5 8:73 8:9
1:12 254:13 259:0 259:25 259:41 259:58 7:136 7:264 7:40 8:16 8:50 8:74 8:90
1:13 254:14 259:1 259:26 259:42 259:59 7:144 7:272 7:400 8:17 8:51 8:75 8:91
1:14 254:15 259:10 259:27 259:43 259:6 7:152 7:280 7:408 8:18 8:52 8:76 8:92
1:15 254:16 259:11 259:28 259:44 259:60 7:16 7:288 7:48 8:19 8:53 8:77 8:93
1:2 254:17 259:12 259:29 259:45 259:61 7:160 7:296 7:56 8:2 8:54 8:78 8:94
1:3 254:18 259:13 259:3 259:46 259:62 7:168 7:304 7:64 8:20 8:55 8:79 8:95
1:4 254:19 259:14 259:30 259:47 259:63 7:176 7:312 7:72 8:21 8:6 8:8
1:5 254:2 259:15 259:31 259:48 259:64 7:184 7:32 7:8 8:3 8:64 8:80
1:6 254:20 259:16 259:32 259:49 259:65 7:192 7:320 7:80 8:32 8:65 8:81
1:7 254:21 259:17 259:33 259:5 259:66 7:200 7:328 7:88 8:33 8:66 8:82
1:8 254:3 259:18 259:34 259:50 259:7 7:208 7:336 7:96 8:34 8:67 8:83
1:9 254:4 259:19 259:35 259:51 259:8 7:216 7:344 8:0 8:35 8:68 8:84
253:0 254:5 259:2 259:36 259:52 259:9 7:224 7:352 8:1 8:36 8:69 8:85
254:0 254:53 259:20 259:37 259:53 7:0 7:232 7:360 8:10 8:37 8:7 8:86
so change the access path from /dev/block to /sys/dev/block
(same method of libudev)
Before:
$./f2fs.fibmap testfile_4k
----------------file info-------------------
testfile_4k :
--------------------------------------------
dev [254:53]
ino [0x 3dda : 15834]
mode [0x 81b6 : 33206]
nlink [0x 1 : 1]
uid [0x 0 : 0]
gid [0x 0 : 0]
size [0x 40000 : 262144]
blksize [0x 1000 : 4096]
blocks [0x 200 : 512]
--------------------------------------------
file_pos start_blk end_blk blks
0 2256926 2256987 62
253952 2150337 2150338 2
Patched:
$./f2fs.fibmap testfile_4k
----------------bdev info-------------------
devname = 254:53
start_lba = 0
----------------file info-------------------
testfile_4k :
--------------------------------------------
dev [254:53]
ino [0x 3dda : 15834]
mode [0x 81b6 : 33206]
nlink [0x 1 : 1]
uid [0x 0 : 0]
gid [0x 0 : 0]
size [0x 40000 : 262144]
blksize [0x 1000 : 4096]
blocks [0x 200 : 512]
--------------------------------------------
file_pos start_blk end_blk blks
0 2256926 2256987 62
253952 2150337 2150338 2
Signed-off-by: Ben Chang <ben.chang@sonicsky.net>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sat, 28 May 2022 08:32:16 +0000 (01:32 -0700)]
f2fs_io: add dsync option for write
This adds a write option having O_DIRECT | O_DSYNC.
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Dylan Chang [Thu, 16 Jun 2022 03:58:06 +0000 (11:58 +0800)]
tools: fix file too large causing overflow
fibmap: Fix file too large causing file_pos overflow
fibmap show file_pos with incorrectly value when passing a large file.
Before:
----------------file info-------------------
/data/media/0/data1 :
--------------------------------------------
dev [254:18]
ino [0x 4db1 : 19889]
mode [0x 81b0 : 33200]
nlink [0x 1 : 1]
uid [0x 280e : 10254]
gid [0x 3ff : 1023]
size [0x1b3dca314 :
7312548628]
blksize [0x 1000 : 4096]
blocks [0x da2530 :
14296368]
--------------------------------------------
file_pos start_blk end_blk blks
0 3197602 3198463 862
3530752 3197509 3197509 1
3534848 3197557 3197578 22
3624960 3198464 3396701 198238
815607808 3396703 3632480 235778
1781354496 3632482 3652095 19614
1861693440 3396702 3396702 1
1861697536 3632481 3632481 1
1861701632 1514948 1514948 1
1861705728 1518774 1518774 1
1861709824 2543104 2543125 22
...
1862111232 2457813 2457813 1
1862115328 3652096 3878168 226073
-
1506856960 3878170 4133725 255556
-
460099584 1510048 1510052 5
Patched:
----------------file info-------------------
/data/media/0/data1 :
--------------------------------------------
dev [254:18]
ino [0x 4db1 : 19889]
mode [0x 81b0 : 33200]
nlink [0x 1 : 1]
uid [0x 280e : 10254]
gid [0x 3ff : 1023]
size [0x1b3dca314 :
7312548628]
blksize [0x 1000 : 4096]
blocks [0x da2530 :
14296368]
--------------------------------------------
file_pos start_blk end_blk blks
0 3197602 3198463 862
3530752 3197509 3197509 1
3534848 3197557 3197578 22
3624960 3198464 3396701 198238
815607808 3396703 3632480 235778
1781354496 3632482 3652095 19614
1861693440 3396702 3396702 1
1861697536 3632481 3632481 1
1861701632 1514948 1514948 1
1861705728 1518774 1518774 1
1861709824 2543104 2543125 22
...
1862111232 2457813 2457813 1
1862115328 3652096 3878168 226073
2788110336 3878170 4133725 255556
3834867712 1510048 1510052 5
Signed-off-by: Dylan Chang <dylan.chang@oneplus.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yufen Yu [Tue, 7 Jun 2022 03:40:43 +0000 (11:40 +0800)]
dump.f2fs: add -I nid to dump inode by scan full disk
Usage:
dump.f2fs -I [inode nid] /dev/sda
This feature can be useful for some bugs caused by system crash.
We not only need dump current valid node page, but alse the history
data in disk, which can give some clues for status change of the inode.
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Reviewed-by: Chao Yu <chao@kernel.org>
[Jaegeuk Kim: fix build error]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sat, 28 May 2022 08:13:33 +0000 (01:13 -0700)]
android_config: add time headers
This allows f2fs_io report latency.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 26 May 2022 00:12:43 +0000 (17:12 -0700)]
Check fallthrough in mount.h for Mac
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/os/base.h:128:23: error: missing ')' after 'do'
^~~~~~~~~~~
external/f2fs-tools/include/f2fs_fs.h:81:24: note: expanded from macro 'fallthrough'
~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/os/base.h:128:22: note: to match this '('
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 25 May 2022 23:30:00 +0000 (16:30 -0700)]
avoid unnecessary function
libf2fs.c:883:12: warning: unused function 'is_power_of_2' [-Wunused-function]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Martin Stjernholm [Wed, 25 May 2022 22:47:37 +0000 (23:47 +0100)]
Fix dependencies on linux/blkzoned.h when using Bionic.
This reverts commit
adcec10b4dee ("Support zoned device if libc exists).
Signed-off-by: Martin Stjernholm <mast@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Jaegeuk Kim [Wed, 25 May 2022 21:04:26 +0000 (14:04 -0700)]
Remove unnecessary config.h
Instead, we should use <config.h> generated by configure.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 25 May 2022 22:23:10 +0000 (15:23 -0700)]
libzone: remove duplicate header
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 25 May 2022 17:33:05 +0000 (10:33 -0700)]
Support zoned device if libc exists
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 25 May 2022 04:50:25 +0000 (21:50 -0700)]
mkfs.f2fs: fix typo
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 25 May 2022 01:04:19 +0000 (18:04 -0700)]
mkfs.f2fs: split unused parameter
external/f2fs-tools/mkfs/f2fs_format_utils.c:51:28: error: unused parameter 'i' [-Werror,-Wunused-parameter]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 23 May 2022 20:30:37 +0000 (13:30 -0700)]
f2fs-tools: do not use SG_IO in Android
Android security team does not allow to use SG_IO.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sun, 22 May 2022 05:34:29 +0000 (22:34 -0700)]
f2fs-tools: move android_config before defining them
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 20 May 2022 00:13:22 +0000 (17:13 -0700)]
f2fscrypt: adjust config file first
We need to get the definitions first.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 19 May 2022 21:16:17 +0000 (14:16 -0700)]
android_config: add missing uuid library
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 13 May 2022 17:10:29 +0000 (10:10 -0700)]
f2fs-tools: upgrade version 1.15.0
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 13 May 2022 17:50:31 +0000 (10:50 -0700)]
f2fs-tools: build silently
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 13 May 2022 16:53:12 +0000 (09:53 -0700)]
fsck.f2fs: fix broken file_map output
The new fsck progress should not be used for file_map.
Reported-by: Michael Benedict <michaelbenedicttjahya@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 26 Apr 2022 23:55:51 +0000 (16:55 -0700)]
f2fs-tools: show segment/section layout correctly
This patch fixes wrong segment/section print-outs.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 22 Apr 2022 21:01:31 +0000 (14:01 -0700)]
f2fs-tools: use android config only if there's no config.h
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Tue, 26 Apr 2022 15:26:46 +0000 (23:26 +0800)]
dump.f2fs: compress: fix dstlen of LZ4_compress_fast_extState()
Compressed cluster content includes compress cluster header, so
calculation of dstlen parameter in LZ4_compress_fast_extState()
should consider this design, otherwise compressed data may overflow
destination buffer during compression.
Signed-off-by: Chao Yu <chao.yu@oppo.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 22 Apr 2022 21:07:17 +0000 (14:07 -0700)]
mkfs.f2fs: check uuid library
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 22 Apr 2022 20:31:53 +0000 (13:31 -0700)]
f2fs-tools: use fsync() in Android
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 23 Dec 2020 18:13:59 +0000 (10:13 -0800)]
f2fs-tools: support zoned device in Android
This requires to change Android.bp in AOSP.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Change-Id: I28a4a701513cb2420cdf0e0e2aa3f60e712f2fcb
Jaegeuk Kim [Fri, 22 Apr 2022 18:59:40 +0000 (11:59 -0700)]
android_config.h: add missing liblz4
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 22 Apr 2022 18:57:14 +0000 (11:57 -0700)]
libf2fs_io: add unused mactor to avoid build failure
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 21 Apr 2022 22:18:36 +0000 (15:18 -0700)]
ci: Enable -Wall, -Wextra and -Werror
Make the Github continuous integration checks more strict.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 21 Apr 2022 22:18:35 +0000 (15:18 -0700)]
Fix PowerPC format string warnings
__SANE_USERSPACE_TYPES__ must be defined before <linux/types.h> is
included. Hence this patch that moves the definition of that macro into
the source files that need it.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bart Van Assche [Thu, 21 Apr 2022 22:18:33 +0000 (15:18 -0700)]
Suppress a compiler warning about integer truncation
This patch prevents that older compilers report the following warning:
f2fs_format.c: In function ‘f2fs_prepare_super_block’:
../include/f2fs_fs.h:350:26: error: conversion from ‘unsigned int’ to ‘__uint16_t’ {aka ‘short unsigned int’} changes value from ‘
4076150800’ to ‘8208’ [-Werror=overflow]
350 | #define F2FS_SUPER_MAGIC 0xF2F52010 /* F2FS Magic Number */
| ^~~~~~~~~~
../include/f2fs_fs.h:574:49: note: in expansion of macro ‘cpu_to_le16’
574 | #define set_sb_le16(member, val) (sb->member = cpu_to_le16(val))
| ^~~~~~~~~~~
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 21 Apr 2022 22:18:32 +0000 (15:18 -0700)]
Annotate switch/case fallthrough
Just like in the Linux kernel source code, annotate switch/case
fallthrough.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 21 Apr 2022 22:18:29 +0000 (15:18 -0700)]
Change #ifdef _WIN32 checks into #ifdef HAVE_.*
It is recommended to test a HAVE_* macro instead of directly testing the
host type in source code. Hence this patch.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 21 Apr 2022 22:18:31 +0000 (15:18 -0700)]
tools/f2fs_io: Fix the type of 'ret'
Make it possible to check whether the return value of ioctl() is negative.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 21 Apr 2022 22:18:30 +0000 (15:18 -0700)]
fsck/segment.c: Remove dead code
Since 'remained_blkentries' is unsigned, the assert statement that
verifies whether that variable is positive will never fail. Hence
remove that assert statement.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 21 Apr 2022 22:18:28 +0000 (15:18 -0700)]
fsck/main.c: Suppress a compiler warning
Suppress the following compiler warning:
main.c:37:14: warning: unused function 'absolute_path' [-Wunused-function]
static char *absolute_path(const char *file)
^
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Bart Van Assche [Thu, 21 Apr 2022 22:18:27 +0000 (15:18 -0700)]
tools/f2fscrypt.c: Fix build without uuid/uuid.h header file
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>