Commit Graph

258 Commits

Author SHA1 Message Date
Jaegeuk Kim
ad3736cca5 mkfs.f2fs: remove IMMUTABLE bit
The immutable bit disallows selinux permission which gives no way to clear it.

Fixes: 8cc4e257ec ("mkfs.f2fs: add device aliasing feature")
Reviewed-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-11-11 17:12:21 +00:00
Yohan Joung
2893f7c6c5 mkfs.f2fs: adjust zone alignment when using convention partition with zoned one
When formatting conventional partition with zoned one, we are already
aligning the starting block address of the next device to the zone size.
Therefore, we do not align the segment0 address to the zone alignment.
This reduces the wasted zone_align_start_offset.

Test result
segment0 blkaddr 389583 -> 119251
Add one additional section to main

Signed-off-by: Yohan Joung <yohan.joung@sk.com>
Reviewed-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-10-29 17:49:32 +00:00
Jaegeuk Kim
bd9d28398d mkfs.f2fs: don't trim on aliased partition
Reviewed-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-10-15 17:08:35 +00:00
Daeho Jeong
8cc4e257ec mkfs.f2fs: add device aliasing feature
We can add a device aliasing file which can map the whole device with an
extent, not using node blocks. This mapped area should be pinned and
normally used for read-only usages. After finished using it, we can
deallocate the whole area and return it back to use it for other files.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-10-11 22:49:52 +00:00
Daeho Jeong
c35fa8cd75 mkfs.f2fs: change -c option description
Current description confuses users like they can add addtional devices
with one -c option using commas(,) at the same time.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-10-11 22:49:52 +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
Daeho Jeong
662e619cfa mkfs.f2fs: use correct endian conversion for writing lpf inode
The conversion between cpu and little endian is incorrect.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-10-11 22:49:52 +00:00
zhangxirui
b9a68f381b f2fs-tools: reduce overprov_segment_count set times
If overprov_segment_count < rsvd_segment_count will
set_cp(overprov_segment_count) twice, reduce it.

Signed-off-by: zhangxirui <xirui.zhang@vivo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-08-15 15:22:43 +00:00
Peter Collingbourne
72f6b7806c mkfs.f2fs: Fix out-of-bounds read in f2fs_prepare_super_block
The path field in c.devices[i] is a pointer and is normally filled
in using strdup. This makes it invalid to copy MAX_PATH_LEN bytes
from it because the string may be shorter than that. Therefore,
fix the code to use strncpy to copy the string instead.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-07-30 16:31:59 +00:00
Chao Yu
250d610d62 f2fs-tools: fix to add missing le32_to_cpu()/cpu_to_le32()
This patch fixes some cases in where we missed to consider
endianness when we access/update inode.i_flags.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-07-25 18:40:28 +00:00
Sheng Yong
5cfe1971ad mkfs.f2fs: align each device to zone size
For multiple device, each device should be aligned to zone size, instead
of aligning the total size.

Signed-off-by: Sheng Yong <shengyong@oppo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-05-09 00:42:09 +00:00
Jaegeuk Kim
5da4e52415 f2fs-tools: give 6 sections for overprovision buffer
This addresses high GC cost at runtime.

Reviewed-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-04-08 18:10:33 +00:00
Chao Yu
d1225a911d mkfs.f2fs: kill heap allocation
No one uses this feature. Let's kill it.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-02-21 09:42:41 -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
Daeho Jeong
96da467d93 f2fs-tools: allocate logs after conventional area for HM zoned devices
Make to allocate logs after conventional area for HM zoned devices to
spare them for file pinning support.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2024-02-07 16:22:14 -08:00
Daniel Rosenberg
444c048c15 f2fs-tools: Fix dqb_curspace to reflect blocksize
The initial sizes for dqblk.dqb_curspace should reflect the block size,
as that's the minimal filesize.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-11-28 10:55:59 -08: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
c404632d82 f2fs-tools: Refactor f2fs_dentry_block struct
This moves access to f2fs_dentry_block's dentry list and filename list
behind a macro, as their locations depend on block size.

Since struct f2fs_dentry_block no longer represents the full block, use
F2FS_BLKSIZE instead of sizeof(struct f2fs_dentry_block)

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-09-07 14:22:04 -07:00
Daniel Rosenberg
ef47782c0a f2fs-tools: Refactor Summary block struct and friends
This splits off access to the summary block's journal and footer into a
macro call, as their location is dependent on block size. Because of
this you should use F2FS_BLKSIZE instead of sizeof(struct summary_block)

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-09-07 14:20:32 -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
Daniel Rosenberg
b1aeb99ec0 f2fs-tools: Refactor Orphan Block struct
This splits off access to the orphan block's footer into a macro call
as its location is dependent on block size. Because of this, you should
use F2FS_BLKSIZE instead of sizeof(struct f2fs_orphan_block)

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-09-07 14:17:00 -07:00
Daniel Rosenberg
30825b3813 f2fs-tools: Define constants in terms of BLKSIZE
This converts the various block size based constants to be defined in
terms of the block size. This makes it possible to change the block size
by changing only F2FS_BLKSIZE_BITS in f2fs_fs.h

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2023-09-07 14:15:58 -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
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
Chao Yu
724ca08836 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>
2023-05-30 16:46:32 -07:00
Chao Yu
e76f933f7c 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>
2023-05-30 16:46:28 -07:00
Chao Yu
70e9ea44f5 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>
2023-05-17 18:32:06 -07:00
Chao Yu
0f74f239a1 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>
2023-05-17 18:30:53 -07:00
Chao Yu
05a4effecf 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>
2023-05-17 18:13:02 -07:00
Chao Yu
ed52acdbd1 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>
2023-05-17 18:13:02 -07:00
Chao Yu
980fb3dfc4 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>
2023-05-17 18:13:02 -07:00
Chao Yu
98b7ba656e 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>
2023-05-17 18:13:02 -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
641be32259 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>
2023-02-15 08:34:57 -08:00
Jaegeuk Kim
9ff70fb214 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>
2022-10-26 13:35:18 -07:00
Jaegeuk Kim
844f821e45 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>
2022-10-20 16:09:16 -07:00
Chao Yu
3486b62aa0 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>
2022-10-10 13:24:56 -07:00
Eric Biggers
9b7a4c5d4f 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>
2022-08-19 16:22:36 -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
efc2bc71b3 mkfs.f2fs: fix typo
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-05-24 21:50:25 -07:00
Jaegeuk Kim
3034a418ff 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>
2022-05-24 18:07:41 -07:00
Jaegeuk Kim
4f216e6b06 f2fs-tools: move android_config before defining them
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-05-21 23:03:38 -07:00
Jaegeuk Kim
eee3969d7d mkfs.f2fs: check uuid library
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-04-26 16:05:35 -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
98f7f56cf3 mkfs/f2fs_format.c: Suppress a compiler warning
Suppress the following compiler warning:

f2fs_format.c:1653:37: warning: adding 'int' to a string does not append to the
      string [-Wstring-plus-int]
                memcpy(dent_blk->filename[3], LPF + F2FS_SLOT_LEN,
                                              ~~~~^~~~~~~~~~~~~~~
f2fs_format.c:1653:37: note: use array indexing to silence this warning
                memcpy(dent_blk->filename[3], LPF + F2FS_SLOT_LEN,
                                                  ^
                                              &   [              ]

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2022-04-22 12:42:51 -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
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