Since no code uses the HAVE_.*_PROTOTYPE macros, remove the code that
sets these macros.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Run autoupdate v2.71 to fix the following autogen.sh warnings:
configure.ac:33: warning: The macro `AC_CONFIG_HEADER' is obsolete.
configure.ac:33: You should run autoupdate.
./lib/autoconf/status.m4:719: AC_CONFIG_HEADER is expanded from...
configure.ac:33: the top level
configure.ac:49: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:49: You should run autoupdate.
m4/libtool.m4💯 AC_PROG_LIBTOOL is expanded from...
configure.ac:49: the top level
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
f2fs currently only work with zoned storage devices with a zone
size which is a power of 2 (PO2). So check if a non-power of 2
zoned device is found, and if so disallow its use. This prevents
users from incorrectly using these devices.
This is a non-issue today given today's kernel does not allow NPO2
zoned devices to exist as a block device. But NPO2 zoned devices do exist
so proactively put a stop-gap measure in place to prevent it from being
incorrectly used.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
A specific define is needed. Fixes mostly issues with -Wformat.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Added two option to f2fs_io "write" command.
- atomic_commit : atomic write & commit
- atomic_abort : atomic write & abort
Also, added an optional option {delay}, which is in ms unit and optional
only for atomic_commit and atomic_abort.
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
On large SSDs filled with lots of data, fsck.f2fs can be very long to finish.
For instance, on my 1TB SSD filled at 99%, it takes literally 5 minutes to
complete.
Currently, the only way to have some feedback is to enable debug output,
but it is very verbose and doesn't tell the actual progress.
This patch implements a simple progress report in the longest
running part of the check (in fsck_chk_node_blk).
The number of checked node / total valid nodes is printed
every 1000 nodes checked, and the percentage of progress
is also calculated and printed.
Signed-off-by: Antoine Viallon <antoine@lesviallon.fr>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
When we check other corrupted bugs in fsck, we use bug_on. So, if major
bugs are already detected in fsck_verify(), fsck will false alarm that
there are other bugs, even if there are no other bugs. So, let's fix this.
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Even though fsck fixed quota issues, fsck returns failure status and
makes the user code misunderstand like errors are still there.
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
In lower versions than macOS 10.12, they don't support clock_gettime
function. It breaks the build, so we need to fall back to the original
kernel version check algorithm, in that case.
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This adds a check to the is_valid_summary function to prevent a segfault
if the calculated offset is out of bounds. Such an offset can for example
occur as the result of corruption of the underlying hardware.
I encountered this segfault on my own phone's sd card, so this is not
just a theoretical concern.
Signed-off-by: Arpad Müller <arpad.mueller@uni-bonn.de>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Update the usage about option of preen mode.
It's difficult to know about preen mode 2, because there is no
description in usage.
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Given fiemap way to print out extents in the kernel, we can correctly
print the layout of each file in a unit of extent, not block. So, I
changed fiemap print out way like below.
Fiemap: offset = 0 len = 60
logical addr. physical addr. length flags
0 0000000000000000 00000020032df000 0000000000004000 00001008
1 0000000000004000 00000020032e0000 0000000000004000 00001008
2 0000000000008000 00000020032e1000 0000000000004000 00001008
3 000000000000c000 00000020032e2000 0000000000004000 00001008
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* check/fix i_compr_blocks
* check/fix compressed flag in i_flags when compression is not
supported.
Signed-off-by: Robin Hsu <robinhsu@google.com>
[Jaegeuk Kim: minor coding style]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Made "fiemap" command in accordance with user api manual. So, eliminated
NEW_ADDR print out and made it ends in the last extent.
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
If the following process returns an error,
the quota inode, not the quota file, is damaged.
(fsck_chk_quota_node-->fsck_chk_node_blk-->sanity_check_nid)
The fsck does not have a process to rebuild the quota inode.
Because sanity_check_nid is not passed, fsck->nat_area_bitmap
can not be cleared, and then the NAT of quota will be nullify
during fix_nat_entries.
During the next fsck check, the quota inode check fails
because the address of the quota inode changes to 0.
In addition, in fsck_chk_quota_files-->f2fs_filesize_update,
data is written to address 0.
Therefore, when the quota inode is corrupted, we need to rebuild it.
Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
In previous, we did a full scan right after kernel version is changed
and it triggered many unnecessary full scan whenever a newly built
kernel is downloaded. Plus, we are lack of a periodic health check of
on-disk filesystem images. So, I added a monthly periodic check after
a new vesion is updated.
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
In page_symlink, reserve_new_block applies address for data block,
not for inodes. Therefore, is_inode is set to 0.
Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This fixes wrong file offset updates, since we should not do (*ofs)++; for
indirect node blocks.
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
For a volume using a zoned block device without conventional zones
(e.g. a NVMe ZNS drive), a regular block device must be used to store
metadata so that in-place metadata writes can be executed. The zoned
block device cannot contain any metadata blocks requiring in-place
update (e.g. bitmap blocks). When formatting a volume that contains
host managed zoned block devices, make sure that the conventional device
used to store metadata is large enough to avoid write errors.
Signed-off-by: Aravind Ramesh <aravind.ramesh@wdc.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Since the IMMUTABLE flag for compression is now changed
to F2FS_COMPRESS_RELEASED, some 'IMMUTABLE' words should be changed too:
1. sload help page
2. inline comments
Signed-off-by: Robin Hsu <robinhsu@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This patch adds a readonly feature on small partitions by eliminating
on-disk layout for data writes such as provisioning/reserved space and
SSA.
This requires f2fs updates to understand RO feature in superblock.
Tested 4 cases:
sload.f2fs -c -a lz0 -f kernel/fs $DEV
sload.f2fs -c -a lz4 -f kernel/fs $DEV
sload.f2fs -c -r -a lz4 -f kernel/fs $DEV
sload.f2fs -c -L 3 -r -a lz4 -f kernel/fs $DEV
after:
mkfs.f2fs -O ro,compression,extra_attr -f $DEV
fsck.f2fs $DEV
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Although many other filesystems provide a tool for changing volume
label, e.g. e2label for ext filesystem, but f2fs has no way to change
volume label except set it while formatting with mkfs.f2fs.
This introduces f2fslabel, simple tool for changing label of f2fs
volume.
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Current implementation, If define WITH_KERNEL_VERSION
get_kernel_uname_version just return release info, not define
WITH_KERNEL_VERSION, return release and version info.
So remove "!" in get_kernel_uname_version, make logic more clear.
Signed-off-by: lijiazi <lijiazi@xiaomi.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Fix to free node_blk when nid is 0 from dump_node_blk().
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
With invalid node info from fsck_chk_orphan_node(), orphan_blk
and new_blk are not freed. Fix memory leak in the path.
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
In not enough segements error path of f2fs_write_check_point_pack(),
cp_payload is not freed. Fix the error path.
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
In 1126e38 (fsck.f2fs: add --{no-}kernel-check to bypass kernel version diff or
not) the automatic check on a kernel version change was made optional and
disabled by default on non-Android systems. This also disabled the update of
the kernel version stored in the superblock if --kernel-check is not given.
Restore the update in case a full check is forced via -y or -f to properly
reflect the version in the superblock.
Signed-off-by: Michael Lass <bevan@bi-co.net>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This patch add an ioctl to get filename encryption mode.
Signed-off-by: Robin Hsu <robinhsu@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Increase debug level from 0 to 1 in migrate_block.
It seems that doesn't need to display debug message by default.
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
As beroal <me@beroal.in.ua> reported: f2fs image can be corrupted
after below testcase:
1. truncate -s $((256*1024*1024)) img
2. mkfs.f2fs -f img
3. mount -t f2fs -o loop img /mnt
4. xfs_io -f /mnt/file -c "pwrite 0 2M" -c "fsync"
5. umount /mnt
6. resize.f2fs -s -t 262144 img
7. fsck.f2fs img
The root cause is we forgot to copy original sit/nat bitmap to
new checkpoint during rebuild_checkpoint(), fix it.
Reported-and-testd-by: beroal <me@beroal.in.ua>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
beroal reported a mount failure due to broken valid_user_blocks.
[ 6890.647749] F2FS-fs (loop0): Wrong valid_user_blocks: 16040048,
user_block_count: 10016768
From fsck,
segment_count_main [0x 9a95 : 39573]
-> 39573 * 2MB = 78GB as user space
overprov_segment_count [0x 4e29 : 20009]
-> 20009 * 2MB = 40GB as overprovisioned space which user can't see.
But,
[FSCK] valid_block_count matching with CP [Ok..] [0xf4c070]
-> 0xf4c070 = 16040048
valid_block_count [0x f4c070 : 16040048]
-> So, this is correct.
It turns out resize.f2fs gave very large and wrong overprovisioning space
result in shortage of user blocks. The root cause was f2fs_get_usable_segments()
didn't consider resize case which needs segment_count_main from new superblock.
Fixes: f8410857b7 ("f2fs-tools: zns zone-capacity support")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>