Hyojun Kim [Thu, 1 Mar 2018 21:42:44 +0000 (13:42 -0800)]
tools: sg_write_buffer: add sg_write_buffer for FFU
sg_write_buffer sources are added for FFU.
Signed-off-by: Hyojun Kim <hyojun@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Jaegeuk Kim [Tue, 30 Jan 2018 22:35:10 +0000 (14:35 -0800)]
f2fs-tools: release 1.10.0
This release includes:
- build support for Mac/Windows
- sparse support for Android build
- --dry-run for fsck.f2fs
- -q to preserve quota limits
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 25 Jan 2018 06:58:45 +0000 (14:58 +0800)]
f2fs-tools: support inode creation time
This patch supports inode_crtime feature to enable recording inode
creation time in inode layout.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlei He [Mon, 22 Jan 2018 12:03:46 +0000 (20:03 +0800)]
fsck.f2fs: use mem nat info directly
Use mem nat info directly for we built in fsck init.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sat, 20 Jan 2018 21:55:14 +0000 (13:55 -0800)]
fsck.f2fs: show missing checkpoint flags
This patch shows some missing checkpoint flags.
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sat, 20 Jan 2018 21:51:05 +0000 (13:51 -0800)]
fsck.f2fs: allow roll-forward for small checkpoint fix
This allows roll-forward when fsck.f2fs changes checkpoint crc.
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 11 Jan 2018 02:17:21 +0000 (10:17 +0800)]
dump.f2fs: do not write nat bits when dumping info
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 11 Jan 2018 02:17:20 +0000 (10:17 +0800)]
mkfs.f2fs: set seed for random checkpoint_ver
If seed is not set, rand always uses 1 as the default seed.
Signed-off-by: Liu Xue <liuxueliu.liu@huawei.com>
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 11 Jan 2018 02:17:19 +0000 (10:17 +0800)]
fsck.f2fs: show encoded name when unlinking corrupted dentry
For dentry name, we should check if parent directory is encrypted. If it
is, show digest-encoded name instead of cipher text when unlink corrupted
dir entries.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlei He [Thu, 4 Jan 2018 01:51:03 +0000 (09:51 +0800)]
dump.f2fs: Test blkaddr is valid or not in option '-b'
Test blkaddr is valid or not in option '-b'
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlei He [Fri, 29 Dec 2017 02:11:09 +0000 (10:11 +0800)]
fsck.f2fs: Remove unused ckpt_valid_map info
Remove unused ckpt_valid_map info.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 28 Dec 2017 20:33:03 +0000 (12:33 -0800)]
fsck.f2fs: add -y for generic fsck
-y is same as -f, which fixes any corruption all the time.
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Gaoxiang (OS) [Fri, 22 Dec 2017 04:20:58 +0000 (04:20 +0000)]
resize.f2fs: fix max_nat_bitmap_size miscalculatation
For the same reason as "mkfs.f2fs: fix to calculate
left space of checkpoint page correctly",
this patch also fixes miscalculatation in resize.f2fs.
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 28 Dec 2017 02:02:32 +0000 (18:02 -0800)]
fsck.f2fs: avoid wrong IS_VALID_BLK_ADDR
This patch avoids to check next free block offset in current segments, since we
are using IS_VALID_BLK_ADDR during fsck which is able to be valid for a while.
Let's just check this at the end of fsck.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlong Song [Mon, 18 Dec 2017 13:25:27 +0000 (21:25 +0800)]
fsck.f2fs: check and fix i_namelen to avoid double free
This checks i_namelen between inode block and its dentry.
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlong Song [Mon, 18 Dec 2017 11:53:45 +0000 (19:53 +0800)]
fsck.f2fs: check nid range before use to avoid segmentation fault
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Hyojun Kim [Thu, 14 Dec 2017 18:15:47 +0000 (10:15 -0800)]
mkfs.f2fs: Limit pragma pack(1) only for Windows Host
A side-effect was found for #pragma pack(1), which were added for
Windows SDK support. Limiting it with ANDROID_WINDOWS_HOST.
Signed-off-by: Hyojun Kim <hyojun@google.com>
Hyojun Kim [Fri, 1 Dec 2017 23:03:30 +0000 (23:03 +0000)]
mkfs.f2fs: Windows Android SDK support
This patch enables cross compilation for Windows Android SDK
by using ANDROID_WINDOWS_HOST.
Signed-off-by: Hyojun Kim <hyojun@google.com>
Jaegeuk Kim [Thu, 30 Nov 2017 04:34:37 +0000 (20:34 -0800)]
f2fs-tools: enable sparse_file opeartions
This adds reading data from sparse_file.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 30 Nov 2017 01:21:12 +0000 (17:21 -0800)]
sload.f2fs: update build for android
This patch updates sload.f2fs for android build.
- do fsck() after sload() to update quota information.
- return success, if there's no source directory
-C fs_config
-f source directory [path of the source directory]
-p product out directory
: path on fs_config file for uid/gid/mode
-s file_contexts
: selabel file
-t mount point [prefix of target fs path, default:/]
: path stored in selabel/fs_config files
-T timestamp
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 30 Nov 2017 02:49:15 +0000 (18:49 -0800)]
f2fs-tools: allow multiple prog names
This patch allows different prog names like fsck_f2fs, sload_f2fs, etc for
android.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 30 Nov 2017 19:35:48 +0000 (11:35 -0800)]
mkfs.f2fs: match uid/gid/projid between root inode and quota info
This patch fixes mismatched root inode and quota info.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 30 Nov 2017 18:40:12 +0000 (10:40 -0800)]
mkfs.f2fs: show debug message for quota data writes
This patch shows debugging message for quota.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 30 Nov 2017 01:15:18 +0000 (17:15 -0800)]
f2fs-tools: build tools selectively
This patch enables to build tools except mkfs.f2fs selectively.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 24 Nov 2017 09:33:39 +0000 (17:33 +0800)]
libf2fs: propagate error from f2fs_{finalize,fsync}_device
tests/generic/405 of fstest suit expects that mkfs will return error
when it hits EIO, so let's propagate error from
f2fs_{finalize,fsync}_device, then mkfs can be aware of fsync error.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
[Jaegeuk Kim: initialize ret to zero]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 16 Nov 2017 11:50:58 +0000 (19:50 +0800)]
f2fs-tools: adjust feature name
This patch slightly changes showed feature name.
Before:
Info: superblock features = f9 : encrypt extra attribute project quota inode checksum flexible inline xattr quota ino
After:
Info: superblock features = f9 : encrypt extra_attr project_quota inode_checksum flexible_inline_xattr quota_ino
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 16 Nov 2017 11:50:57 +0000 (19:50 +0800)]
f2fs: avoid memory leak in f2fs_write_root_inode
Before exiting f2fs_write_root_inode, we should free in-there allocated
memory.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 16 Nov 2017 11:50:56 +0000 (19:50 +0800)]
fsck.f2fs: fix potential stack overflow issue
In fsck_chk_inode_blk, we will allocate 256 bytes memory in stack before
traversing sub-directory recursively, it's not safe, in order to avoid
potential stack overflow, use malloc instead.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Thu, 16 Nov 2017 11:50:55 +0000 (19:50 +0800)]
dump.f2fs: show extra attr only when feature is enabled
If we don't turn on the feature, don't show related info in dumped data.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 16 Nov 2017 23:47:29 +0000 (15:47 -0800)]
f2fs-tools: define WITH_ANDROID if __ANDROID__ is defined
This matches with __ANDROID__ with WITH_ANDROID.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 14 Nov 2017 18:53:32 +0000 (10:53 -0800)]
f2fs-tools: build binaries in Mac
This patch modifies f2fs-tools to be built in mac.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Anthony G. Basile [Sun, 12 Nov 2017 23:07:54 +0000 (18:07 -0500)]
lib/libf2fs.c: include <sys/sysmacros.h>
The macros `major' and `minor' have been moved from <sys/types.h>
to <sys/sysmacros.h>. We include the latter to avoid deprecated
messages and future proof the code.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Anthony G. Basile [Sun, 12 Nov 2017 22:57:41 +0000 (17:57 -0500)]
fsck/Makefile.am, mkfs/Makefile.am: fix to `make distcheck` correctly
We add noinst_HEADERS to include header files which are needed to build
but which do not need to be installed on the file system, and include_HEADERS
which are header files that should be installed in $(includedir).
This fixes 'make distcheck`.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
[Jaegeuk Kim: remove list.h]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Fri, 3 Nov 2017 04:25:12 +0000 (12:25 +0800)]
dump/fsck: introduce print_xattr_entry
This patch exports read_all_xattrs to allow dump/fsck to get all xattrs,
and introduces print_xattr_entry which tries to parse an xattr entry
accroding to its xattr index.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
[Jaegeuk Kim: fix configure.ac]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 8 Nov 2017 19:20:47 +0000 (11:20 -0800)]
fsck.f2fs: add an option to preserve quota limits
If it detects quota file errors, we can see insane quota limits. In order
to recover that, this patch adds an option to reset them as zeros.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlei He [Fri, 3 Nov 2017 06:29:39 +0000 (14:29 +0800)]
fsck: check inline_dentry i_addr[0] same as inline_data
<4>[ 30.222442s][pid:1,cpu4,init][<
ffffff8008357ffc>] f2fs_evict_inode+0x850/0xa34
<4>[ 30.222442s][pid:1,cpu4,init][<
ffffff8008209ec4>] evict+0xa0/0x168
<4>[ 30.222442s][pid:1,cpu4,init][<
ffffff800820ad34>] iput+0x188/0x220
<4>[ 30.222473s][pid:1,cpu4,init][<
ffffff800836d050>] recover_orphan_inodes+0x2b4/0xa80
<4>[ 30.222473s][pid:1,cpu4,init][<
ffffff80083648b0>] f2fs_fill_super+0xcf4/0x16a0
<4>[ 30.222473s][pid:1,cpu4,init][<
ffffff80081f2478>] mount_bdev+0x198/0x1c8
<4>[ 30.222473s][pid:1,cpu4,init][<
ffffff80083608a8>] f2fs_mount+0x14/0x1c
<4>[ 30.222503s][pid:1,cpu4,init][<
ffffff80081f2f38>] mount_fs+0x3c/0x15c
<4>[ 30.222503s][pid:1,cpu4,init][<
ffffff800820e9f8>] vfs_kern_mount+0x7c/0x16c
<4>[ 30.222503s][pid:1,cpu4,init][<
ffffff8008212548>] do_mount+0x214/0xcf8
<4>[ 30.222503s][pid:1,cpu4,init][<
ffffff800821338c>] SyS_mount+0xa8/0x164
<4>[ 30.222503s][pid:1,cpu4,init][<
ffffff80080831b0>] el0_svc_naked+0x24/0x28
Mount failed with message as blow:
recover_orphan_inode: orphan failed (ino=1265), run fsck to fix
One orphan directory with inline_dentry flag, but i_addr[0] is not zero.
By the way, sit bitmap of i_addr[0] is also invalidate.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 2 Nov 2017 03:56:12 +0000 (11:56 +0800)]
fsck.f2fs: format output message of FIX_MSG
This patch removes an extra '\n' at the end of the string in FIX_MSG.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 2 Nov 2017 03:56:11 +0000 (11:56 +0800)]
f2fs-tools: remove unused list.h
Commit
7d96d138a378 ("fsck.f2fs: remove list.h") has already the usage
of list.h. So let's remove list.h itself.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 2 Nov 2017 03:56:10 +0000 (11:56 +0800)]
fsck.f2fs: introduce sanity_check_inode
f2fs_iget checks if i_mode is valid. If it is not, the file cannot be
accessed as well as deleted. To make sure such files can be removed,
fsck adds the same check, and removes incorrect inode blocks.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 2 Nov 2017 03:56:09 +0000 (11:56 +0800)]
fsck.f2fs: introduce new option --dry-run
With --dry-run enabled, fsck.f2fs will do all checks and "fixes" except
that all fixes will not be written to storage at last.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 2 Nov 2017 03:56:08 +0000 (11:56 +0800)]
dump.f2fs: do not dump encrypted files
If a file is encrypted, its content is cipher text on the storage. So
there is no need to dump an encrypted file.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 2 Nov 2017 03:56:07 +0000 (11:56 +0800)]
dump.f2fs: introduce dump_xattr
This patch introduces dump_xattr to create xattrs for dumped files.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
[Jaegeuk Kim: detect header files]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 2 Nov 2017 03:56:05 +0000 (11:56 +0800)]
fsck.f2fs: do not fix corrupted nat entries in build_nat_area_bitmap
Fixing corrupted data depends on c.fix_on. If it's not set, we should not
force fixing corrupted data. So if nat entries are found invalid when
building nat_area_bitmap, we should just set c.bug_on, and fix it later.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 2 Nov 2017 03:56:04 +0000 (11:56 +0800)]
fsck.f2fs: do not set fix_on directly
Do not set fix_on if it is allowed by user.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 2 Nov 2017 17:41:16 +0000 (10:41 -0700)]
f2fs-tools: fix warnings when building in android
This patch tries to avoid all the warnings.
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Jaegeuk Kim [Fri, 3 Nov 2017 03:12:30 +0000 (20:12 -0700)]
mkfs.f2fs: set .so to cold files
This patch adds .so in cold file extention list.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Hyojun Kim [Mon, 30 Oct 2017 23:21:09 +0000 (23:21 +0000)]
fsck.f2fs: support quota
This patch let fsck to check and fix quota file contents.
Signed-off-by: Hyojun Kim <hyojun@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Hyojun Kim [Mon, 30 Oct 2017 23:10:27 +0000 (23:10 +0000)]
mkfs.f2fs: support quota option in mkfs
This patch let mkfs to handle quota option and create quota files.
Signed-off-by: Hyojun Kim <hyojun@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Hyojun Kim [Mon, 30 Oct 2017 21:26:30 +0000 (21:26 +0000)]
f2fs-tools: f2fs_read() and f2fs_filesize_update() are added
This patch adds f2fs_read() and f2fs_filesize_update(). It also refactors
f2fs_write_block() and renamed as f2fs_write().
Signed-off-by: Hyojun Kim <hyojun@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Hyojun Kim [Mon, 30 Oct 2017 19:12:39 +0000 (12:12 -0700)]
sload.f2fs: fix bugs in f2fs_write_block()
Found and fixed following three bugs in f2fs_write_block() function.
- Write (4096 - offset) bytes for the first block even for small count.
- For overwriting, found blkaddr is not used for writing.
- dn.idirty status can be lost by set_new_dnode().
- missing inode_checksum
Signed-off-by: Hyojun Kim <hyojun@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Chao Yu [Mon, 4 Sep 2017 10:58:29 +0000 (18:58 +0800)]
f2fs-tools: support flexible inline xattr size
This patch makes mkfs to support flexible inline xattr feature, also
this enables fsck to recognize new disk-layout of inode which be of
flexible inline xattr size.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlei He [Tue, 17 Oct 2017 07:03:51 +0000 (15:03 +0800)]
fsck: introduce generic function f2fs_fsync_device
We use f2fs_finalize_device to fsync previous data in
checkpoint area before write last CP pack, in order to avoid
cp corruption in sudden-power-off case. But this function will
close the device, so this patch introduce a function to call
fsync() only.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Liu Xue [Tue, 10 Oct 2017 12:49:35 +0000 (20:49 +0800)]
mkfs.f2fs: fix wrong end blkaddr
The end blkaddr should use main blkaddr and add main area segments.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 21 Sep 2017 23:15:40 +0000 (16:15 -0700)]
f2fs-tools: release 1.9.0
This release includes:
- sparse support
- inode checksum support
- nat_bits option
- encryption management
- noheap allocation by default
- add CP_TRIMMED_FLAG
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlong Song [Sun, 10 Sep 2017 16:20:36 +0000 (00:20 +0800)]
f2fs-tools: move_curseg_info only if check_curseg_offset fails
Current design will lose recovery process when check_curseg_offset is OK.
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlong Song [Sun, 10 Sep 2017 11:15:29 +0000 (19:15 +0800)]
f2fs-tools: fix is_set_ckpt_flags for correct bool value
If flag bit to check is in 0xFFFFFF00, then the return value will be false,
this is not correct, so fix it.
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlong Song [Thu, 7 Sep 2017 13:09:15 +0000 (21:09 +0800)]
f2fs-tools: add cscope files to .gitignore
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 25 Aug 2017 02:33:10 +0000 (19:33 -0700)]
mkfs.f2fs: fix wrong curseg check
We should avoid i==j, otherwise we always assign 0~5 segments.
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlei He [Wed, 23 Aug 2017 04:13:04 +0000 (12:13 +0800)]
fsck.f2fs: write back last cp block in the end
Write back last cp block in the end in case of sudden power off
during fsck process
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 23 Aug 2017 20:33:00 +0000 (13:33 -0700)]
mkfs.f2fs: fix missing cpu_to_le64 for checkpoint version
The error on mips was reported by Stijn as follow.
Commit
8399a29df92d6867d226df362edbf2e0efa527c1 in f2fs-tools
("mkfs.f2fs: give random checkpoint version") causes a bug when mounting
a filesystem created with it on a MIPS64 device running a 4.4(.83)
kernel. The following kernel warning appears several times per second,
for 30 seconds:
[ 23.837262] ------------[ cut here ]------------
[ 23.842039] WARNING: CPU: 0 PID: 935 at fs/f2fs/segment.c:718
update_sit_entry+0x1c0/0x2b0()
[ 23.850507] Modules linked in: pppoe ppp_async l2tp_ppp iptable_nat
[ 24.174064] Call Trace:
[ 24.176527] [<
ffffffff81126e14>] show_stack+0x68/0xb4
[ 24.181595] [<
ffffffff81321fc4>] dump_stack+0x8c/0xc4
[ 24.186660] [<
ffffffff8113d004>] warn_slowpath_common+0xa0/0xd0
[ 24.192597] [<
ffffffff812e0148>] update_sit_entry+0x1c0/0x2b0
[ 24.198353] [<
ffffffff812e0a70>] refresh_sit_entry+0x70/0xf8
[ 24.204022] [<
ffffffff812e251c>] allocate_data_block+0x1f0/0x310
[ 24.210038] [<
ffffffff812e28d8>] do_write_page+0x29c/0x2bc
[ 24.215532] [<
ffffffff812e2a88>] write_data_page+0xa0/0xd8
[ 24.221028] [<
ffffffff812d844c>] do_write_data_page+0xe4/0x384
[ 24.226870] [<
ffffffff812d88f4>] f2fs_write_data_page+0x208/0x464
[ 24.232972] [<
ffffffff812d5184>] __f2fs_writepage+0x1c/0x74
[ 24.238553] [<
ffffffff812d54dc>]
f2fs_write_cache_pages.constprop.7+0x250/0x394
[ 24.245869] [<
ffffffff812d57f4>] f2fs_write_data_pages+0x130/0x1b0
[ 24.252066] [<
ffffffff811a9f80>] __filemap_fdatawrite_range+0xa0/0xd4
[ 24.258515] [<
ffffffff812d2338>] sync_dirty_dir_inodes+0x94/0xd8
[ 24.264530] [<
ffffffff812d2484>] write_checkpoint+0x108/0xb9c
[ 24.270283] [<
ffffffff812cc398>] f2fs_sync_fs+0x68/0xb0
[ 24.275526] [<
ffffffff812c641c>] f2fs_sync_file+0x2e8/0x518
[ 24.281107] [<
ffffffff81213ff4>] do_fsync+0x38/0x70
[ 24.285992] [<
ffffffff812142e8>] SyS_fsync+0x14/0x20
[ 24.290972] [<
ffffffff81103950>] syscall_common+0x34/0x58
[ 24.296372]
[ 24.298096] ---[ end trace
fd3ac44449b218ab ]---
Fix:
8399a29df92d68 ("mkfs.f2fs: give random checkpoint version")
Reported-And-Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Wed, 26 Jul 2017 15:01:35 +0000 (23:01 +0800)]
f2fs-tools: support inode checksum
This patch introduce a new option 'inode_checksum' for enabling inode
checksum functionality in mkfs/fsck/sload.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Piotr Sokołowski [Wed, 26 Jul 2017 17:16:37 +0000 (19:16 +0200)]
f2fs-tools: fix printing block adresses
This patch allows properly printing all addresses in an inode.
It is useful in commands like dump.f2fs.
Signed-off-by: Piotr Sokołowski <piosoko1@student.pg.edu.pl>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Wed, 26 Jul 2017 14:54:18 +0000 (22:54 +0800)]
f2fs-tools: support project quota
This patch introduce a new option 'project_quota' for enabling project
quota functionality during mkfs.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Wed, 26 Jul 2017 14:49:57 +0000 (22:49 +0800)]
f2fs-tools: enhance on-disk inode structure scalability
This patch adds an option 'extra_attr' in mkfs for enabling v2 f2fs
inode format in kernel codes.
Also this patch makes fsck to support recognize v2 inode format,
below is v2 format description:
Original one:
struct f2fs_inode {
...
struct f2fs_extent i_ext;
__le32 i_addr[DEF_ADDRS_PER_INODE];
__le32 i_nid[DEF_NIDS_PER_INODE];
}
Extended one:
struct f2fs_inode {
...
struct f2fs_extent i_ext;
union {
struct {
__le16 i_extra_isize;
__le16 i_padding;
__le32 i_extra_end[0];
};
__le32 i_addr[DEF_ADDRS_PER_INODE];
};
__le32 i_nid[DEF_NIDS_PER_INODE];
}
Once F2FS_EXTRA_ATTR is set, we will steal four bytes in the head of
i_addr field for storing i_extra_isize and i_padding. with i_extra_isize,
we can calculate actual size of reserved space in i_addr, available
attribute fields included in total extra attribute fields for current
inode can be described as below:
+--------------------+
| .i_mode |
| ... |
| .i_ext |
+--------------------+
| .i_extra_isize |-----+
| .i_padding | |
| .i_prjid | |
| .i_atime_extra | |
| .i_ctime_extra | |
| .i_mtime_extra |<----+
| .i_inode_cs |<----- store blkaddr/inline from here
| .i_xattr_cs |
| ... |
+--------------------+
| |
| block address |
| |
+--------------------+
| .i_nid |
+--------------------+
| node_footer |
| (nid, ino, offset) |
+--------------------+
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 21 Jul 2017 20:49:28 +0000 (13:49 -0700)]
f2fs-tools: add atomic_write feature flag
This patch adds atomic_write feature flag.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Sun, 16 Jul 2017 07:12:49 +0000 (15:12 +0800)]
f2fs-tools: spread struct f2fs_dentry_ptr for inline path
Use f2fs_dentry_ptr structure to indicate inline dentry structure as
much as possible, so we can wrap inline dentry with size-fixed fields
to the one with size-changeable fields. With this change, we can
handle size-changeable inline dentry more easily.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yang Jin [Fri, 16 Jun 2017 18:32:58 +0000 (11:32 -0700)]
add sparse support for f2fs
Description:
modify I/O operations to support writing in sparse format
build host executable for making sparse image
Signed-off-by: Yang Jin <yajin@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 6 Jun 2017 01:12:55 +0000 (18:12 -0700)]
mkfs.f2fs: drop initial spaces for feature string
This patch removes initial spaces to detect correct feature string.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 5 Jun 2017 20:44:50 +0000 (13:44 -0700)]
f2fs-tools: avoid build warnings
This patch resolves warnings while building it in android.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 26 May 2017 02:17:44 +0000 (19:17 -0700)]
mkfs.f2fs: avoid wrong discard of dnode
This can drop root inode, which can be caused by previous stale data.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Tiezhu Yang [Wed, 10 May 2017 13:16:46 +0000 (21:16 +0800)]
f2fs-tools: fix the wrong message when errno is EBUSY
If f2fs is unmounted with the -l option, the process can still use the
file system. In this case, the command mkfs.f2fs, fsck.f2fs, dump.f2fs,
defrag.f2fs, resize.f2fs and sload.f2fs failed due to the device is in
use by the system. At the moment f2fs is already not mounted, so it is
wrong to print error message "Error: Not available on mounted device!",
this patch fixes it.
[root@localhost home]# mkfs.f2fs -f /dev/sdb1
[root@localhost home]# mkdir -p /mnt/f2fs_mnt_point
[root@localhost home]# mount -t f2fs /dev/sdb1 /mnt/f2fs_mnt_point/
[root@localhost home]# cd /mnt/f2fs_mnt_point/
[root@localhost f2fs_mnt_point]# umount /dev/sdb1
umount: /mnt/f2fs_mnt_point: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
[root@localhost f2fs_mnt_point]# umount -l /dev/sdb1
[root@localhost f2fs_mnt_point]# umount /dev/sdb1
umount: /dev/sdb1: not mounted
[root@localhost f2fs_mnt_point]# mkfs.f2fs -f /dev/sdb1
F2FS-tools: mkfs.f2fs Ver: 1.8.0 (2017-04-28)
Info: Disable heap-based policy
Info: Debug level = 0
Info: Label =
Info: Trim is enabled
Error: In use by the system!
Error: Not available on mounted device!
[root@localhost f2fs_mnt_point]# fsck.f2fs /dev/sdb1
Error: In use by the system!
Error: Not available on mounted device!
[root@localhost f2fs_mnt_point]# dump.f2fs /dev/sdb1
Error: In use by the system!
Error: Not available on mounted device!
[root@localhost f2fs_mnt_point]# defrag.f2fs /dev/sdb1
Error: In use by the system!
Error: Not available on mounted device!
[root@localhost f2fs_mnt_point]# resize.f2fs /dev/sdb1
Error: In use by the system!
Error: Not available on mounted device!
[root@localhost f2fs_mnt_point]# sload.f2fs /dev/sdb1
Error: In use by the system!
Error: Not available on mounted device!
Signed-off-by: Tiezhu Yang <kernelpatch@126.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 28 Apr 2017 09:16:31 +0000 (17:16 +0800)]
f2fs-tools: support to set and recognize CP_TRIMMED_FLAG
During mkfs, once we have issued discard for all device, we can set
CP_TRIMMED_FLAG in cp pack, this can make kernel module to record
undiscard blocks correctly, it will help to avoid unneeded discard.
Also this patch makes f2fs-tools be with the ability of recognizing
that new flag.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jin Qian [Thu, 27 Apr 2017 22:45:28 +0000 (15:45 -0700)]
fsck.f2fs: sanity check segno and blk_off when building curseg array
segno and blk_off were read from input image without sanity check. This
could lead to buffer overflow when accessing internal arrays like SIT
sentries and seg_entry cur_valid_map.
Signed-off-by: Jin Qian <jinqian@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jin Qian [Thu, 27 Apr 2017 19:12:22 +0000 (12:12 -0700)]
fsck.f2fs: sanity check cp_payload before reading checkpoint
cp_payload is not sanity checked from input image. A invalid size
can cause buffer overflow when reading checkpoint blks into memory.
Signed-off-by: Jin Qian <jinqian@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jin Qian [Thu, 27 Apr 2017 18:29:22 +0000 (11:29 -0700)]
fsck.f2fs: sanity check blk_off for summary block entries
crafted malicious f2fs partition can fill an out of bound blk_off,
which cause overflow when accessing summary block entries.
Signed-off-by: Jin Qian <jinqian@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 26 Apr 2017 00:49:17 +0000 (17:49 -0700)]
mkfs.f2fs: fix wrong segment assignment
We must guarantee that current segments should be different between different
logs.
This should resolve xfstests/generic/015 panic.
Fixes:
8f9327c0c02ee1 ("mkfs.f2fs: use noheap by default")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jin Qian [Tue, 25 Apr 2017 23:25:11 +0000 (16:25 -0700)]
f2fs-tools: sanity check segment count
make sure segment count in super block doesn't exceed F2FS_MAX_SEGMENT.
Signed-off-by: Jin Qian <jinqian@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jin Qian [Tue, 18 Apr 2017 17:58:05 +0000 (10:58 -0700)]
fsck.f2fs: fix cur_valid_map buffer overflow
blk_off is read from image. Attacker can construct an image with big
blk_off that trigger overflow on se->cur_valid_map.
Signed-off-by: Jin Qian <jinqian@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yong, Jonathan [Thu, 30 Mar 2017 08:03:37 +0000 (08:03 +0000)]
Fix mkfs out of tree builds
Libraries are built in builddir, not srcdir, fix Makefile.am
accordingly.
Signed-off-by: Yong, Jonathan <jonathan.yong@intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sat, 25 Mar 2017 00:56:24 +0000 (20:56 -0400)]
mkfs.f2fs: use noheap by default
Let's set noheap by default.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Sat, 18 Mar 2017 08:00:10 +0000 (16:00 +0800)]
libf2fs: avoid overwrite the c.start_sector by non-root device
For multiple devices, the c.start_sector will be overwrite by the non-root devices.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Fri, 17 Mar 2017 14:01:12 +0000 (22:01 +0800)]
sload.f2fs: support sload files into directory includes inline dentry
It seems the new created directory always includes inline dentries,
let sload.f2fs supporting it.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Fri, 17 Mar 2017 14:01:04 +0000 (22:01 +0800)]
sload.f2fs: let dir_buckets/dir_block_index supports dir_level
The dir_level in the filesystem maybe larger than zero,
supports it.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Fri, 17 Mar 2017 13:56:19 +0000 (21:56 +0800)]
fsck.f2fs: check encrypted filename depends FADVISE_ENC_NAME_BIT
An encrypted directory under an unencrypted directory, the filename isn't encrypted.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Fri, 17 Mar 2017 13:55:50 +0000 (21:55 +0800)]
fsck.f2fs: fix bad notice of missing device
The following messages is better than before.
Before,
# fsck.f2fs -d 1
Error: Need argument for -d
Now,
# fsck.f2fs -d 1
Info: Debug level = 1
Error: Device not specified
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Fri, 17 Mar 2017 11:08:21 +0000 (19:08 +0800)]
sload.f2fs: fix missing SSA updates
If sload many larger files to disk, the SSA that doesn't cached will be missed.
Mar 17 12:04:39 localhost kernel: ------------[ cut here ]------------
Mar 17 12:04:39 localhost kernel: kernel BUG at fs/f2fs/gc.c:899!
Mar 17 12:04:39 localhost kernel: invalid opcode: 0000 [#1] SMP
Mar 17 12:04:39 localhost kernel: Modules linked in: f2fs tun bridge stp llc fuse ip_set nfnetlink vmw_vsock_vmci_transport vsock snd_seq_midi snd_seq_midi_event snd_ens1371 gameport snd_ac97_codec coretemp ac97_bus crct10dif_pclmul crc32_pclmul ppdev snd_seq snd_pcm ghash_clmulni_intel intel_rapl_perf vmw_balloon snd_rawmidi joydev snd_timer snd_seq_device snd soundcore parport_pc parport nfit acpi_cpufreq tpm_tis tpm_tis_core shpchp vmw_vmci tpm i2c_piix4 nfsd auth_rpcgss nfs_acl lockd grace sunrpc xfs libcrc32c vmwgfx drm_kms_helper ttm drm e1000 crc32c_intel mptspi scsi_transport_spi serio_raw mptscsih mptbase ata_generic pata_acpi fjes
Mar 17 12:04:39 localhost kernel: CPU: 0 PID: 6427 Comm: f2fs_gc-8:33 Tainted: G W 4.10.0-f2fs+ #25
Mar 17 12:04:39 localhost kernel: Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/02/2015
Mar 17 12:04:39 localhost kernel: task:
ffff94ba7d998000 task.stack:
ffffb6e4c2e50000
Mar 17 12:04:39 localhost kernel: RIP: 0010:do_garbage_collect+0xa39/0xb60 [f2fs]
Mar 17 12:04:39 localhost kernel: RSP: 0018:
ffffb6e4c2e53cc0 EFLAGS:
00010213
Mar 17 12:04:39 localhost kernel: RAX:
ffff94baa0427000 RBX:
0000000000000001 RCX:
0000000000000002
Mar 17 12:04:39 localhost kernel: RDX:
0000000000000000 RSI:
fffff5e2c28109c0 RDI:
fffff5e2c28109c0
Mar 17 12:04:39 localhost kernel: RBP:
ffffb6e4c2e53dc0 R08:
ffff94ba7dfc72f0 R09:
fffff5e2c28109dc
Mar 17 12:04:39 localhost kernel: R10:
0000000000000040 R11:
ffff94ba7dfc7238 R12:
0000000000000418
Mar 17 12:04:39 localhost kernel: R13:
fffff5e2c28109c0 R14:
0000000000000417 R15:
ffff94ba3c021000
Mar 17 12:04:39 localhost kernel: FS:
0000000000000000(0000) GS:
ffff94babb600000(0000) knlGS:
0000000000000000
Mar 17 12:04:39 localhost kernel: CS: 0010 DS: 0000 ES: 0000 CR0:
0000000080050033
Mar 17 12:04:39 localhost kernel: CR2:
00007fc42a0d7000 CR3:
00000000a7e94000 CR4:
00000000001406f0
Mar 17 12:04:39 localhost kernel: Call Trace:
Mar 17 12:04:39 localhost kernel: ? find_next_bit+0xb/0x10
Mar 17 12:04:39 localhost kernel: f2fs_gc+0x111/0x480 [f2fs]
Mar 17 12:04:39 localhost kernel: ? prepare_to_wait_event+0x79/0x160
Mar 17 12:04:39 localhost kernel: gc_thread_func+0x2d0/0x3f0 [f2fs]
Mar 17 12:04:39 localhost kernel: ? __schedule+0x273/0x860
Mar 17 12:04:39 localhost kernel: ? remove_wait_queue+0x70/0x70
Mar 17 12:04:39 localhost kernel: kthread+0x101/0x140
Mar 17 12:04:39 localhost kernel: ? f2fs_gc+0x480/0x480 [f2fs]
Mar 17 12:04:39 localhost kernel: ? kthread_park+0x90/0x90
Mar 17 12:04:39 localhost kernel: ret_from_fork+0x2c/0x40
Mar 17 12:04:39 localhost kernel: Code: 48 8d 84 24 90 00 00 00 48 89 c7 48 89 44 24 28 e8 7d cc ba e6 e9 17 fa ff ff 48 c7 c6 48 3f 84 c0 48 89 c7 e8 59 8d 9d e6 0f 0b <0f> 0b 48 c7 c6 48 3f 84 c0 4c 89 ff e8 46 8d 9d e6 0f 0b 8b b4
Mar 17 12:04:39 localhost kernel: RIP: do_garbage_collect+0xa39/0xb60 [f2fs] RSP:
ffffb6e4c2e53cc0
Mar 17 12:04:39 localhost kernel: ---[ end trace
926d61b064ed1f2d ]---
Fixes:
767a93ea8b ("defrag.f2fs: fix missing SSA updates")
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Wed, 15 Mar 2017 13:28:19 +0000 (21:28 +0800)]
fsck.f2fs: a separate option for showing directory tree
Showing directory tree reuses dbg_lv that if setting "-t",
fsck.f2fs does not show any others.
Users may want much information include the debug info and directory tree.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Wed, 15 Mar 2017 13:16:40 +0000 (21:16 +0800)]
f2fscrypt: add a tool for encryption management in the f2fs filesystem
It's migrated from e4crypt.
Adds an example to the f2fscrypt manpages.
v3, add /tools/f2fscrypt to .gitignore
v2, migrate those micro defines for encrypt to f2fs internal,
drop unless of libsha etc.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Wed, 15 Mar 2017 13:12:10 +0000 (21:12 +0800)]
fsck.f2fs: sanity check of crc_offset from raw checkpoint
The crc_offset towards or beyond the end of block is wrong,
sanity check it.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlei He [Wed, 8 Mar 2017 12:20:54 +0000 (20:20 +0800)]
resize.f2fs: fix a resize fail for sector size mismatch
This patch fix a resize faill for sector size mismatch.
The initial fs comes from an image file, with sector size
512KB, and the block device sector size is equal to block
size.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Sun, 5 Mar 2017 13:05:01 +0000 (21:05 +0800)]
mkfs.f2fs: check overwrite before make filesystem
Mkfs.f2fs doesn't check the overwrite of exist filesystem.
Avoid formatting an exist filesystem by mistake, a notice is important.
The code is modified from xfsprogs.
v3, add the missing update of SYNOPSIS
v2, add the manpages description of -f.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Sun, 5 Mar 2017 13:04:46 +0000 (21:04 +0800)]
mkfs.f2fs: clearfiy the help message and manpages
Add some missing options in manpages, also order those options.
v3, add the missing update of SYNOPSIS
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 9 Feb 2017 02:55:43 +0000 (18:55 -0800)]
mkfs.f2fs: support nat_bits feature
This patch adds nat_bits in the last one ore two 4KB-sized blocks of first
checkpoint segment. So, now a set of checkpoint *segment* consists of:
< checkpoint segment >
----------------------
| cp page #1 | 4KB
----------------------
| compacted data sum | 4KB
----------------------
| node sum #1 | 4KB
----------------------
| node sum #2 | 4KB
----------------------
| node sum #3 | 4KB
----------------------
| cp page #2 | 4KB
----------------------
...
----------------------
| crc|cpver | 8 bytes
----------------------
| full NAT bits | # of NAT segments / 2 * 512 / 8 bytes
----------------------
| empty NAT bits | # of NAT segments / 2 * 512 / 8 bytes
----------------------
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sat, 11 Feb 2017 00:12:33 +0000 (16:12 -0800)]
fsck.f2fs: fix wrong usage out
This fixes wrong messages for error out.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 9 Feb 2017 18:32:19 +0000 (10:32 -0800)]
f2fs-tools: catch up up-to-date checkpoint flag
It needs to use up-to-date ckpt flag.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Tue, 7 Feb 2017 02:43:09 +0000 (10:43 +0800)]
mkfs.f2fs: make sure clean all reset dnodes
memset(raw_node, 0, F2FS_BLKSIZE) sets the next_blkaddr to zero,
so that, only one reset dnode is cleaned always.
Fixes:
ad042d9194f5 "mkfs.f2fs: reset dnode with zeros",
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Mon, 6 Feb 2017 09:58:43 +0000 (17:58 +0800)]
mkfs.f2fs: check the c.overprovision with zero before using it
The using of c.overprovision when it equal zero as,
c.reserved_segments =
(2 * (100 / c.overprovision + 1) + 6)
* c.segs_per_sec;
may cause problem, although it doesn't happen.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Sat, 4 Feb 2017 06:45:59 +0000 (14:45 +0800)]
resize.f2fs: correct checkpoint_ver of new checkpoint
resize.f2fs rebuilds a new checkpoint at the new position. Its
checkpoint_ver should be increased.
Signed-off-by: Shuoran Liu <liushuoran@huawei.com>
Signed-off-by: Weichao Guo <guoweichao@huawei.com>
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sat, 4 Feb 2017 00:00:20 +0000 (16:00 -0800)]
f2fs-tools: release 1.8.0
This release includes:
- enhance fsck.f2fs mostly.
- retrieve lost files from dump.f2fs.
- support zoned device and multiple devices.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kinglong Mee [Tue, 24 Jan 2017 02:42:53 +0000 (10:42 +0800)]
mkfs.f2fs: fix bad assignment of total_sectors for f2fs_configuration
wanted_total_sectors is introduced instead total_sectors,
so that, the initialize is a fault, drop it.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>