Commit Graph

819 Commits

Author SHA1 Message Date
Bart Van Assche
ef011a49f3 configure.ac: Detect selinux/android.h
The selinux/android.h header file is available in Android but not in the
Android NDK. Hence this patch that detects presence of that header file
at configure time.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-04-22 12:42:50 -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
1790203dee Fix the MinGW build
Fix multiple compiler warnings and build errors reported by the MinGW
cross-compiler.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-04-22 11:43:14 -07:00
Bart Van Assche
ecd27dc7de Use %zu to format size_t
Use %zu to format size_t as required by the POSIX standards.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-04-22 11:43:14 -07:00
Bart Van Assche
24663b6227 Include <stddef.h> instead of defining offsetof()
Prepare for enabling -Wmacro-redefined.

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
cdefef0d07 Move the be32_to_cpu() definition
Move the be32_to_cpu() definition next to the little endian conversion
functions. This patch improves portability since the MinGW ntohl()
function exists in another library than the C library.

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
1612bf99de Remove unnecessary __attribute__((packed)) annotations
Applying the __attribute__((packed)) annotation to members that do not
need it impacts performance negatively on architectures that do not
support efficient unaligned accesses (e.g. ARMv7). Hence minimize the
__attribute__((packed)) annotations.

See also CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS in the Linux kernel.

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
7a5109ff62 f2fs_fs.h: Use standard fixed width integer types
Use uint64_t instead of __u64 in the definitions of the endianness
conversion macros. This patch fixes the following compiler warning:

dir.c: In function ‘f2fs_create’:
dir.c:785:16: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 12 has type ‘long long unsigned int’ [-Wformat=]
  785 |         MSG(1, "Info: Create %s -> %s\n"
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
../include/f2fs_fs.h:252:32: note: in definition of macro ‘MSG’
  252 |                         printf(fmt, ##__VA_ARGS__);                     \
      |                                ^~~

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
e61203c2aa Suppress a compiler warning
Suppress the following compiler warning:

segment.c:698:12: warning: ‘n’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  698 |         if (n < 0)
      |            ^

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
9425b47b89 Verify structure sizes at compile time
Before modifying the __attribute__((packed)) annotations, let the
compiler verify the sizes of on-disk data structures.

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
006bb1305a Change one array member into a flexible array member
Prepare for verifying structure sizes with static_assert().

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
cb4c5d616c ci: Build f2fstools upon push and pull requests
For those who use Github to contribute f2fs-tools patches, let the
github servers build the f2fs-tools source code upon every push and pull
requests. This change does not affect users who do not use Github.

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
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
Bart Van Assche
c48335416a configure.ac: Enable cross-compilation
Stop using PKG_CHECK_MODULES() since that macro is not compatible with
cross-compilation.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-04-22 10:44:45 -07:00
Bart Van Assche
3e97d07348 configure.ac: Sort header file names alphabetically
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-04-22 10:44:34 -07:00
Bart Van Assche
91ba5e5daf configure.ac: Enable the automake -Wall option
This patch fixes the following automake warnings:

/usr/share/automake-1.16/am/ltlibrary.am: warning: 'libf2fs.la': linking libtool libraries using a non-POSIX
/usr/share/automake-1.16/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
lib/Makefile.am:3:   while processing Libtool library 'libf2fs.la'
/usr/share/automake-1.16/am/ltlibrary.am: warning: 'libf2fs_format.la': linking libtool libraries using a non-POSIX
/usr/share/automake-1.16/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
mkfs/Makefile.am:11:   while processing Libtool library 'libf2fs_format.la'

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-04-22 10:43:43 -07:00
Bart Van Assche
ae65a15763 configure.ac: Remove two prototype tests
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>
2022-04-22 10:21:42 -07:00
Bart Van Assche
d24fd5c01c configure.ac: Stop using obsolete macros
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>
2022-04-22 10:19:12 -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
c7757ecdd1 man: update mkfs.f2fs to give the default android option
This gives an information of "-g android".

Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-03-28 20:15:01 -07:00
Rosen Penev
46e1b83398 f2fs-tools: use proper 64bit types for PPC
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>
2022-03-01 21:37:22 -08: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
0d3d26dd26 mkfs.f2fs: set project quota by default for -g android for v4.14+
With this patch, "-g android" enables project quota only by default, if the
kernel is over v4.14. Otherwise, it enables usr/grp/proj all together.

1) -O quota : enables usr/grp
2) -O project_quota -O extra_attr : enabled prj
3) -O quota -O project_quota -O extra_attr : enables usr/grp/proj
4) -g android : enables proj (4.14+), usr/grp/proj (old kernel)
5) -g android -O project_quota -O extra_attr : enables usr/grp/proj

Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-03-01 21:23:02 -08:00
Daeho Jeong
1de1db84d2 f2fs-tools: add atomic write related options to f2fs_io write command
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>
2022-02-02 16:15:55 -08:00
Jaegeuk Kim
85cd72a244 mkfs.f2fs: set required quota types only
This patch modifies enabling quota options in which enables user/group quotas
only if user specifies the "-O quota" especially.

1) -O quota : enables usr/grp
2) -O project_quota -O extra_attr : enabled prj
3) -O quota -O project_quota -O extra_attr : enables usr/grp/proj
4) -g android : enables usr/grp
5) -g android -O project_quota -O extra_attr : enables usr/grp/proj

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-01-13 10:20:12 -08:00
Antoine Viallon
028af9f606 fsck.f2fs: Add progression feedback
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>
2022-01-11 19:04:50 -08:00
Jaegeuk Kim
972d71073a fsck.f2fs: do not assert if i_size is missing i_blocks in symlink
This case is not a bug, so we should fix seamlessly.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2021-11-12 13:26:46 -08:00
Daeho Jeong
f63551b9e4 f2fs-tools: separate other bugs in fsck_verify
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>
2021-10-29 10:36:13 -07:00
Daeho Jeong
ade81b96c9 f2fs-tools: remove false failure alarm when fixing quota
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>
2021-10-29 10:36:13 -07:00
Daeho Jeong
99bc49736b f2fs-tools: fall back to the original version check when clock_gettime is not supported
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>
2021-09-28 13:57:27 -07: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
Arpad Müller
63d5004573 fsck.f2fS: is_valid_summary(): check whether offset is out of bounds
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>
2021-09-03 17:13:25 -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
Jaehoon Chung
1edc138ae7 fsck.f2fs: Update the usage about option of preen mode
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>
2021-08-23 11:42:56 -07:00
Daeho Jeong
49159df049 f2fs-tools: change fiemap print out format
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>
2021-08-23 11:42:56 -07:00
Jaegeuk Kim
8bcb58ec90 f2fs_io: add rename w/ fsync option
e.g., f2fs_io rename source dest 1
      1. open(source)
      2. rename(source, dest)
      3. fsync(source)
      4. close(source)

Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2021-08-23 11:42:56 -07:00
Robin Hsu
9429e865e8 fsck.f2fs: add basic compress related check/fix
* 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>
2021-08-23 11:42:52 -07:00
Daeho Jeong
529967eac0 f2fs-tools: make fiemap command in accordance with uapi
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>
2021-07-22 13:52:15 -07:00
Wang Xiaojun
1228009520 f2fs-tools: rebuild the quota inode if it is corrupted
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>
2021-07-22 10:54:37 -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
Jaegeuk Kim
1bc76585d5 dump.f2fs: minor clean ups
This patch cleans up, pointed by Chao.

Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2021-07-13 16:15:35 -07:00
Wang Xiaojun
69952e3e23 f2fs-tools: fix wrong value of reserve_new_block parameter in page_symlink
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>
2021-07-07 10:46:30 -07:00
Daeho Jeong
76d2a9199f f2fs-tools: add extent cache for each file
This patch adds an extent cache for ro partition.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2021-06-23 09:02:46 -07:00
Jaegeuk Kim
8d464ee16f f2fs-tools: fix wrong file offset
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>
2021-06-23 09:02:00 -07:00
Jaegeuk Kim
acd2518e26 fsck|dump.f2fs: add -M to get file map
This option shows all the file names in the disk.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2021-06-23 09:01:37 -07:00
Jaegeuk Kim
027488ef5d mkfs.f2fs: remove android features for RO
We don't need to enable all android features for RO.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2021-06-23 08:51:30 -07:00
Aravind Ramesh
e01ad31081 f2fs-tools: fix metadata region overlap with zoned block device zones
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>
2021-06-22 08:09:58 -07:00
Robin Hsu
f3b93bf5b8 sload.f2fs: Reword "IMMUTABLE" in strings/comments
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>
2021-06-22 08:09:57 -07:00
Jaegeuk Kim
820b5e3723 sload.f2fs: use F2FS_COMPRESS_RELEASED instead of IMMUTABLE bit
Let's use F2FS_COMPRESS_RELEASED to disallow writes only.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2021-05-26 10:07:46 -07:00