Commit Graph

172 Commits

Author SHA1 Message Date
Jaegeuk Kim
83f090d220 f2fs-tools: remove linux/fcntl.h but define the hint directly
It's complicated to address libc and kernel headers.

Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-10-15 15:23:28 +00:00
Daejun Park
5c06793f80 f2fs-tools: add write hint support
This patch enables support for write hints by segment type.

Signed-off-by: Daejun Park <daejun7.park@samsung.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-10-11 22:49:52 +00:00
Jaegeuk Kim
896eff74db fsck.f2fs: don't finish zones if it's not open
Should finish zones if they are open.

Reviewed-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-08-15 15:22:39 +00:00
Chao Yu
d31d5f26ae f2fs-tools: clean up addrs_per_{inode,block}()
Introduce a new help addrs_per_page() to wrap common code
from addrs_per_inode() and addrs_per_block() for cleanup.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-07-25 18:40:28 +00:00
Wu Bo
4f7ac389f4 libf2fs: add BLKFINISHZONE define if not defined
BLKFINISHZONE may not defined in old blkzoned.h, and cause build error.

Signed-off-by: Wu Bo <bo.wu@vivo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-07-25 18:40:28 +00:00
Daniel Rosenberg
a66d49fd26 dump.f2fs: Dump symlinks as symlinks
Previously, dumped symlinks would always create regular files instead.
This allows symlinks to be dumped as symlinks with the -L option.

The i_name field's name may not be the same as the actual name from the
dirent, so we use the dirent name when available.

Currently hardlinks aren't detected, so print a warning if we notice a
nondirectory with a link count over 1.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-07-25 18:40:28 +00:00
Jaegeuk Kim
efcff4bc16 f2fs-tools: deal with permission denial on non-root user
This fixes some android build failures due to the missing permission when
checking the loop device. Until we get a better solution, let's ignore
the error with warnings.

Reviewed-by: Huang Jianan <huangjianan@xiaomi.com>
Reviewed-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-03-06 09:42:08 -08:00
Jaegeuk Kim
e22c886268 mkfs.f2fs: fix sparse_mode case on stat
When we turn on sparse_mode, stat() will be failed, as the file will be
created afterwards. Let's fix.

Fixes: 14197d546b ("f2fs-tools: fix to check loop device")
Reviewed-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-02-13 16:23:05 -08:00
Chao Yu
14197d546b f2fs-tools: fix to check loop device
Otherwise, mkfs/fsck can update backfile of moutned loop device.

1. mkfs.f2fs image
2. mount -o loop image /mnt/f2fs/
3. mkfs.f2fs image -f

Before:
...
Info: format successful

After:
...
	Error: In use by loop device!

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-02-07 16:25:51 -08:00
Daniel Rosenberg
eca9049a07 libf2fs: Fix possible memleak with Sparse Files
If sparse files is set along with multiple devices, we initialize
sparse file data multiple times without freeing the previously allocated
data. This skips the initialization for subsequent devices, as sparse
file mode currently only deals with device 0 anyways.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-01-29 12:14:56 -08:00
Daniel Rosenberg
9f435e3d57 libf2fs: Accept Sparse files with non 4K Blocksize
Since we may not know the block size when initializing sparse files, we
should assume that the sparse file's blocksize is correct.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-01-29 12:14:52 -08:00
Chao Yu
dff4893b49 f2fs-tools: don't call fsync on a clean image
generic/019 50s ... _check_generic_filesystem: filesystem on /dev/vdc is inconsistent
(see /media/fstests/results//generic/019.full for details)

[FSCK] Max image size: 16196 MB, Free space: 188 MB
[FSCK] Unreachable nat entries                        [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking                [Ok..]
[FSCK] Hard link checking for regular file            [Ok..] [0x166]
[FSCK] valid_block_count matching with CP             [Ok..] [0x3ecfe7]
[FSCK] valid_node_count matching with CP (de lookup)  [Ok..] [0x4c79]
[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [0x4c79]
[FSCK] valid_inode_count matched with CP              [Ok..] [0xb46]
[FSCK] free segment_count matched with CP             [Ok..] [0x9d]
[FSCK] next block offset is free                      [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs                           [Ok..]
        Error: Could not conduct fsync!!!

Generic/019 will trigger fsync() on a clean image, but it will fail
due to simulated failure on disk, result in testcase failure.

Let's add c.need_fsync to record dirty status of image, and only trigger
fsync() when there is dirty data in image.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-01-26 00:40:27 -08:00
Daeho Jeong
10dad5ed7c f2fs-tools: support zoned ufs devices
Support zoned ufs devices.
1. implemented out-place updates
2. keep roll forward recovery intact
3. open block device files with O_SYNC to comply with zoned device's
   write rules

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-11-30 12:04:42 -08:00
Maxim Korotkov
00efc38bb9 f2fs-tools: fixed incorrect error handling
Case of failed memory allocation of dev->zone_cap_blocks
doesn't release heap allocated rep
Found by RASU JSC
Fixes: f8410857b7a8(f2fs-tools: zns zone-capacity support)
Signed-off-by: Maxim Korotkov <maskorotkov@rasu.ru>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-11-28 10:55:59 -08:00
zangyangyang1
370d070e02 libf2fs: Fix using uninitialized variables error in get_device_info()
This issue comes from a static code scanning tool.
When c.sparse_mode is 1, stat_buf will not be initialized,
but it will be used next.
If this issue does not require modification, please ignore this commit.

Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-11-17 09:26:56 -08:00
Daeho Jeong
5e7ebf1278 f2fs-tools: initialize user cache valid values
Need to initialize user cache valid values to prevent from providing
false cache entries.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-11-09 15:38:39 -08:00
Daeho Jeong
06a25b021d f2fs-tools: make six open zone check resilient
We need to make sure to finish all the zones except six open zones. In
a case of that the previous mount wasn't successfully unmounted, we have
to change all the current segments.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-10-26 18:37:58 -07:00
Jaegeuk Kim
13e9d9f71f fsck.f2fs: fix cache offset for multiple partitions
The cache offset should have been considered multiple partitions per fd.
Let's fix.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-10-16 16:14:20 -07:00
Jaegeuk Kim
efcb92448d Revert "f2fs-tools: do not support user-space cache"
This reverts commit 2835107ae3.

There's a report that the impact was true.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-10-16 16:14:04 -07:00
Daeho Jeong
2835107ae3 f2fs-tools: do not support user-space cache
We don't have lots of benefits from this, since block devices already
have page caches in the kernel. Moreover, this feature has some
stability issues corrupting metadata. So, we better make this deprecated.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-09-29 15:41:40 -07:00
Daniel Rosenberg
50fd00b168 f2fs-tools: Support different block sizes
This adds support for 4K and 16K block size using the same binary.
mkfs can choose block size via the -b option, with other tools getting
the blocksize from the superblock.

On mount time, we can't rely on block size for the location for the
superblock, since that information is in the superblock. If the first
superblock is corrupt, we will attempt to find the second superblock at
a 4K block offset, and then a 16K block offset if that fails.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-09-07 14:22:25 -07:00
Daniel Rosenberg
32f5a37782 f2fs-tools: Refactor f2fs_node struct and friends
This converts inodes, direct nodes, and indirect nodes over to not being
based on a 4K page size. f2fs_inode's i_nids field should now be
accessed via a macro, as it's location depends on block size.

Access to direct nodes and indirect nodes is unchanged.

The node footer's location is also based on block sized, and accessed
via a macro. With these changes, you should use F2FS_BLKSIZE in place of
sizeof(struct f2fs_node)

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-09-07 14:18:09 -07:00
Waldemar Brodkorb
b15b6cc56a f2fs-tools: convert to lseek() and kill lseek64
This patch replaces lseek64 with lseek() having #define _FILE_OFFSET_BITS 64.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-08-25 10:28:52 -07:00
Chao Yu
c5835f6891 f2fs-tools: fix to call assert() if f2fs_dentry_hash() fails
f2fs_dentry_hash() may return -ENOMEM due to malloc() failure, however
caller won't check validaty of return value, result assign or check
wrong hash value, fix to call assert() for such case.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-06-08 17:23:38 -07:00
Chao Yu
4c1fd35c72 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>
2023-05-30 16:46:32 -07:00
Jaegeuk Kim
f89e5af24e 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>
2023-05-17 18:12:57 -07:00
Yonggil Song
03aa49e495 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>
2023-04-11 10:16:12 -07:00
Jaegeuk Kim
a7df89e5c5 mkfs.f2fs: remove indentation
Show info w/o it.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-04-03 18:21:18 -07:00
Jaegeuk Kim
0ac168e210 f2fs-tools: relax zone size of power of 2
Let's relax this for Android support.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-03-08 11:10:30 -08:00
Chao Yu
465159ffeb 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>
2022-10-10 13:24:56 -07:00
Bart Van Assche
986c1f18ec 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>
2022-09-07 19:08:38 -07:00
Bart Van Assche
5317d184f4 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>
2022-07-21 19:27:23 -07:00
Bart Van Assche
92e2e52609 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>
2022-07-21 19:27:03 -07:00
Jaegeuk Kim
c1144bf472 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>
2022-05-25 17:14:03 -07:00
Jaegeuk Kim
bcb992989d avoid unnecessary function
libf2fs.c:883:12: warning: unused function 'is_power_of_2' [-Wunused-function]

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-05-25 16:30:00 -07:00
Jaegeuk Kim
274abbb77c Remove unnecessary config.h
Instead, we should use <config.h> generated by configure.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-05-25 15:40:30 -07:00
Jaegeuk Kim
8c97ab33fd libzone: remove duplicate header
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-05-25 15:39:06 -07:00
Jaegeuk Kim
dd8d8e54a6 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>
2022-05-23 13:30:37 -07:00
Jaegeuk Kim
3af62be37c f2fs-tools: show segment/section layout correctly
This patch fixes wrong segment/section print-outs.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-04-26 16:55:51 -07:00
Jaegeuk Kim
ea9921f4f5 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
2022-04-26 16:05:34 -07:00
Jaegeuk Kim
0c54cf767f libf2fs_io: add unused mactor to avoid build failure
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-04-22 12:42:52 -07:00
Bart Van Assche
b964b79d49 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>
2022-04-22 12:42:52 -07:00
Bart Van Assche
2e59ab8fa6 configure.ac: Detect the sparse/sparse.h header
The <sparse/sparse.h> header is available in Android but not in the
Android NDK. Hence this patch that only includes the sparse header file
if it is available.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-04-22 11:54:20 -07:00
Bart Van Assche
f3033fbc8a Change the ANDROID_WINDOWS_HOST macro into _WIN32
This makes it easier to build f2fs-tools for Windows.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-04-22 11:43:13 -07:00
Bart Van Assche
87d7a95e31 Switch from the u_int to the uint types
Many format strings use one of the PRI* macros. These macros are compatible
with the uint types but not with the u_int types. Hence this patch
that switches from the u_int to the uint types.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-04-22 11:43:11 -07:00
Luis Chamberlain
6afcf64935 libf2fs: don't allow mkfs / fsck on non power-of-2 zoned devices
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>
2022-04-20 11:08:30 -07:00
Jaegeuk Kim
97ce230ab6 mkfs.f2fs: fix wrong indentation and clean up
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-03-01 21:23:05 -08:00
Jaegeuk Kim
1603a3d1de mkfs.f2fs: wipe other FS magics given -f
This patch fixes the below stale magic info.

$ mkfs.btrfs -f test.img
btrfs-progs v5.10.1
See http://btrfs.wiki.kernel.org for more information.

Label:              (null)
UUID:               941d2db7-3ece-4090-8b22-c4ea548b5dae
Node size:          16384
Sector size:        4096
Filesystem size:    1.00GiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         DUP              51.19MiB
  System:           DUP               8.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata
Runtime features:
Checksum:           crc32c
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1     1.00GiB  test.img

$ hexdump -s 0x10000 -n 128 -C test.img
00010000  81 29 94 0a 00 00 00 00  00 00 00 00 00 00 00 00  |.)..............|
00010010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00010020  94 1d 2d b7 3e ce 40 90  8b 22 c4 ea 54 8b 5d ae  |..-.>.@.."..T.].|
00010030  00 00 01 00 00 00 00 00  01 00 00 00 00 00 00 00  |................|
00010040  5f 42 48 52 66 53 5f 4d  05 00 00 00 00 00 00 00  |_BHRfS_M........|
00010050  00 40 d2 01 00 00 00 00  00 40 50 01 00 00 00 00  |.@.......@P.....|
00010060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00010070  00 00 00 40 00 00 00 00  00 00 02 00 00 00 00 00  |...@............|
00010080

$ mkfs.f2fs -t 0 -f test.img

	F2FS-tools: mkfs.f2fs Ver: 1.14.0 (2020-12-28)

Info: Disable heap-based policy
Info: Debug level = 0
Info: Trim is disabled
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 2097152 (1024 MB)
Info: zone aligned segment0 blkaddr: 512
Info: format version with
  "Linux version 5.10.46-4rodete1-amd64 (glinux-team@google.com) (gcc-10 (Debian 10.2.1-6+build2) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1 SMP Debian 5.10.46-4rodete1 (2021-08-20)"
Info: Overprovision ratio = 6.360%
Info: Overprovision segments = 68 (GC reserved = 39)
Info: format successful

$hexdump -s 0x10000 -n 128 -C test.img
00010000  c2 8a c8 26 00 00 00 00  00 00 00 00 00 00 00 00  |...&............|
00010010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00010020  92 ab 3f c6 b7 82 49 5e  93 23 e8 c9 e9 45 7d ac  |..?...I^.#...E}.|
00010030  00 00 01 00 00 00 00 00  01 00 00 00 00 00 00 00  |................|
00010040  5f 42 48 52 66 53 5f 4d  05 00 00 00 00 00 00 00  |_BHRfS_M........|
00010050  00 40 d2 01 00 00 00 00  00 40 50 01 00 00 00 00  |.@.......@P.....|
00010060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00010070  00 00 00 40 00 00 00 00  00 00 02 00 00 00 00 00  |...@............|
00010080

--- After this patch ---
$ mkfs.f2fs -t 0 -f test.img

	F2FS-tools: mkfs.f2fs Ver: 1.14.0 (2020-12-28)

Info: Disable heap-based policy
Info: Debug level = 0
Info: Trim is disabled
	test.img appears to contain an existing filesystem (btrfs).
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 2097152 (1024 MB)
Info: zone aligned segment0 blkaddr: 512
Info: format version with
  "Linux version 5.10.46-4rodete1-amd64 (glinux-team@google.com) (gcc-10 (Debian 10.2.1-6+build2) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1 SMP Debian 5.10.46-4rodete1 (2021-08-20)"
Info: Overprovision ratio = 6.360%
Info: Overprovision segments = 68 (GC reserved = 39)
Info: format successful

$ hexdump -s 0x10000 -n 128 -C test.img
00010000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00010080

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2021-09-20 16:23:43 -07:00
Jaegeuk Kim
3fd996cc16 Avoid redefined ALIGN_UP
This tries to avoid build warning.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2021-08-23 11:42:56 -07:00
Daeho Jeong
9ee091e819 f2fs-tools: add periodic check in kernel version check
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>
2021-07-19 11:29:12 -07:00