Commit Graph

966 Commits

Author SHA1 Message Date
tongkai0808fh
af1c3576a8
修改mkfs/BUILD.gn,消除蓝区include_dirs告警
Signed-off-by: tongkai0808fh <tongkai5@huawei.com>
2024-05-28 08:27:49 +00:00
tongkai0808fh
960ed9ac7b
修改mkfs/BUILD.gn,外部部件依赖external_deps改成public_external_deps
Signed-off-by: tongkai0808fh <tongkai5@huawei.com>
2024-05-27 11:23:15 +00:00
tongkai0808fh
58b79de074
update fsck/BUILD.gn.
Signed-off-by: tongkai0808fh <tongkai5@huawei.com>
2024-05-27 07:48:11 +00:00
tongkai0808fh
377379d690 格式化gn文件
Signed-off-by: tongkai0808fh <tongkai5@huawei.com>
2024-05-27 14:24:20 +08:00
tongkai0808fh
36a5458a68
update bundle.json,删去header字段
Signed-off-by: tongkai0808fh <tongkai5@huawei.com>
2024-05-27 06:17:37 +00:00
tongkai0808fh
ef11282bca
修改f2fs-tools部件的mkfs接口依赖,消除蓝区ci看板告警
Signed-off-by: tongkai0808fh <tongkai5@huawei.com>
2024-05-27 05:54:57 +00:00
tongkai0808fh
fff71bfadf
修改f2fs-tools的fsck接口依赖,清除蓝区ci看板告警
Signed-off-by: tongkai0808fh <tongkai5@huawei.com>
2024-05-27 05:51:10 +00:00
openharmony_ci
7e11b4c4d0
!42 README.OpenSource文件与黄区文件修改同步
Merge pull request !42 from 覃权/master
2024-05-15 10:05:28 +00:00
qinquan5
3f4f913b57 update config.h f2fs version to 1.15.0
Signed-off-by: qinquan5 <qinquan5@huawei.com>
2024-05-15 11:59:33 +08:00
qinquan5
8629bf9550 README.OpenSource修改同步
Signed-off-by: qinquan5 <qinquan5@huawei.com>
2024-05-13 17:00:30 +08:00
openharmony_ci
a7e97206a7
!41 f2fs-tools upgrade version 1.16.0
Merge pull request !41 from shenshensun/f2fs_tools_v1.16
2024-04-16 10:32:11 +00:00
Jaegeuk Kim
6943d0196f f2fs-tools: upgrade version 1.16.0
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-04-15 11:31:47 +08:00
Juhyung Park
7a64f18f69 fsck.f2fs: fix sanity check logic for cp_payload
cp_payload is set differently [1] when extended node bitmap feature is
enabled. Commit b79c3ba4ea 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 [1]
Fixes: b79c3ba4ea ("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>
2024-04-15 11:31:47 +08:00
Jaegeuk Kim
7835032f2c mkfs.f2fs: remove indentation
Show info w/o it.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-04-15 11:31:46 +08:00
Jaegeuk Kim
540bec88ab 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>
2024-04-15 11:31:46 +08:00
Jaegeuk Kim
53055e6db1 f2fs-tools: relax zone size of power of 2
Let's relax this for Android support.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-04-15 11:31:46 +08:00
Jaegeuk Kim
ca912d6446 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>
2024-04-15 11:31:46 +08:00
Jaegeuk Kim
6d50a75823 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>
2024-04-15 11:31:46 +08:00
Jaegeuk Kim
79410835d2 f2fs_io: support AES_256_HCTR2
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-04-15 11:31:46 +08:00
Khem Raj
e118fca18c 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>
2024-04-15 11:31:46 +08:00
Chao Yu
4207f53215 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>
2024-04-15 11:31:46 +08:00
Jaegeuk Kim
7026a73750 f2fs-tools: Remove deprecated f2fstat
Let's remove this.

Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-04-15 11:31:46 +08:00
Bart Van Assche
f3344cf6db 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>
2024-04-15 11:31:46 +08:00
Sheng Yong
c027dc1905 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>
2024-04-15 11:31:46 +08:00
Sheng Yong
792c0b4a71 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>
2024-04-15 11:31:46 +08:00
Sheng Yong
e9217c4777 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>
2024-04-15 11:31:46 +08:00
Sheng Yong
eed09be1c4 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>
2024-04-15 11:31:46 +08:00
Juhyung Park
8247209800 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>
2024-04-15 11:31:46 +08:00
Daeho Jeong
4c2d71c5b6 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>
2024-04-15 11:31:46 +08:00
Jaegeuk Kim
76a88baa90 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>
2024-04-15 11:31:46 +08:00
Jaegeuk Kim
2f3589348f 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>
2024-04-15 11:31:46 +08:00
Jaegeuk Kim
9d92496013 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>
2024-04-15 11:31:46 +08:00
Chao Yu
b98aab471a 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>
2024-04-15 11:31:46 +08:00
Chao Yu
d2ab813581 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>
2024-04-15 11:31:46 +08:00
Chao Yu
04b067cbb9 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>
2024-04-15 11:31:46 +08:00
Chao Yu
0bed51f3ad 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>
2024-04-15 11:31:46 +08:00
Chao Yu
3a80a7e962 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>
2024-04-15 11:31:46 +08:00
Robin Lee
a42e1108e1 Always use sparse/sparse.h when building for Android
Change-Id: Ic903ce09c93de75d6deb700a5a283638a912a25b
Test: fastboot erase userdata
2024-04-15 11:31:46 +08:00
Jaegeuk Kim
f250440b04 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>
2024-04-15 11:31:46 +08:00
Bart Van Assche
e864d270dd 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>
2024-04-15 11:31:46 +08:00
Weichao Guo
398c037d13 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>
2024-04-15 11:31:46 +08:00
Eric Biggers
25ab476727 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>
2024-04-15 11:31:46 +08:00
Jaegeuk Kim
cd0f88bc6e 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>
2024-04-15 11:31:46 +08:00
Chao Yu
aaf8c8720b 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>
2024-04-15 11:31:46 +08:00
Nick Hainke
434d856c8c 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>
2024-04-15 11:31:46 +08:00
Nick Hainke
a2a6ec2494 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>
2024-04-15 11:31:46 +08:00
Bart Van Assche
3b2251bbfc 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>
2024-04-15 11:31:46 +08:00
Bart Van Assche
4a727688e1 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>
2024-04-15 11:31:46 +08:00
Bart Van Assche
cdd66bafeb 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>
2024-04-15 11:31:46 +08:00
Bart Van Assche
a491213a0d 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: 6d7c7b785f ("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>
2024-04-15 11:31:46 +08:00