Fan Li [Wed, 16 Mar 2016 02:25:36 +0000 (10:25 +0800)]
mkfs.f2fs: set segment_count in super block correctly
Now f2fs will check statistics recorded in super block in
sanity_check_area_boundary() during mount. If the number of segments
per zone is greater than 1, and the disk space isn't aligned with zone,
mount will fail due to following condition:
main_blkaddr + (segment_count_main << log_blocks_per_seg) !=
segment0_blkaddr + (segment_count << log_blocks_per_seg)
This is because when the length of main area isn't aligned with zone,
mkfs doesn't add those excess segments to segment_count_main, but adds
them to segment_count.
Here align segment_count with zone size as well as segment_count_main
to prevent such problem.
Signed-off-by: Fan Li <fanofcode.li@samsung.com>
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Mon, 22 Feb 2016 17:01:15 +0000 (17:01 +0000)]
fsck.f2fs: check nat_entry->ino for all nodes
Commit
843f5b9388c4652a ("fsck.f2fs: check ino of an inode") checks
nat_entry->ino for inode. However, the checking is irrelevant to node
type, and if ino of other kinds of nodes gets corrupted, fsck.f2fs
cannot detect it. This patch fixes the commit.
Fixes:
843f5b9388c4652a ("fsck.f2fs: check ino of an inode")
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 11 Mar 2016 08:43:54 +0000 (16:43 +0800)]
f2fs-tools: rebase struct f2fs_summary_block with upstream
Struct f2fs_summary_block has been changed in upstream commits:
- commit
8f1dbbbbdfe9 ("f2fs: introduce lifetime write IO statistics")
- commit
dfc08a12e49a ("f2fs: introduce f2fs_journal struct to wrap journal info")
This patch does the sync work for f2fs_summary_block structure between
f2fs-utils and f2fs kernel module.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Junling Zheng [Thu, 3 Mar 2016 02:32:31 +0000 (10:32 +0800)]
fsck.f2fs: fix incorrect block_addr of node/meta
Fix incorrect block_addr of node or meta inode into 0x1 during
build_nat_area_bitmap().
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
Signed-off-by: Liu Xue <liuxueliu.liu@huawei.com>
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Junling Zheng [Sat, 27 Feb 2016 02:43:08 +0000 (10:43 +0800)]
fsck.f2fs: calculate the total size correctly
Correctly calculate the total FS size in init_sb_info(), for sector
size may not be 512 bytes.
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Liu Xue [Fri, 26 Feb 2016 06:42:13 +0000 (06:42 +0000)]
fsck.f2fs: check valid values for dot dentries
Check valid values for '.' and '..', such as ino, hash_code, and the
number of dot or dotdot in the directory.
Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com>
Signed-off-by: Yong Sheng <shengyong1@huawei.com>
Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Junling Zheng [Tue, 23 Feb 2016 13:43:42 +0000 (21:43 +0800)]
f2fs-tools: redefine MAX_SIT_BITMAP_SIZE
During mkfs, segment_count_sit is calculated using ALIGN and
SEG_ALIGN, which are both upward. Then, in some extreme scenarios,
such as 16TB, sit_ver_bitmap_bytesize got from segment_count_sit
will exceed MAX_SIT_BITMAP_SIZE, which is calculated in a downward
method.
Unify the two calculating methods and redefine MAX_SIT_BITMAP_SIZE
to prevent sit_ver_bitmap_bytesize overflowing.
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Junling Zheng [Tue, 23 Feb 2016 13:43:41 +0000 (21:43 +0800)]
libf2fs: limit the total size up to 16T
F2FS can support 16T bytes at most. Limit the config.total_sectors
so that most parameters calculated according to it in sb/cp can be
limited correctly too.
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Tue, 23 Feb 2016 11:45:32 +0000 (19:45 +0800)]
fsck.f2fs: fix corrupted nat entry [0]
The first nat entry must be null. If it is corrupted, we set its bit in
nat_area_bitmap, without increasing valid_nat_entry_cnt, fsck_verify will
nullify it at last.
Reported-by: Cheng Yinchao <chengyinchao@huawei.com>
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Fri, 19 Feb 2016 17:14:58 +0000 (17:14 +0000)]
fsck.f2fs: remove corrupted nid entry from indirect/double-indirect node
For indirect/double-indirect node, if the blk_addr in its nat entry is
corrupted, fsck could figure this out and nullify the nat entry. However,
the indirect/double-indirect node still keeps the corrupted nid. As a
result, fsck reports valid blkaddr but fixes nothing each time during
scanning all nodes, like:
=============================
[ASSERT] (sanity_check_nid: 356) --> blkaddres is not valid. [0x0]
delete in.nid[i] = 0;
[ASSERT] (sanity_check_nid: 356) --> blkaddres is not valid. [0x0]
delete in.nid[i] = 0;
[FSCK] Unreachable nat entries [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking [Ok..]
[FSCK] Hard link checking for regular file [Ok..] [0x0]
[FSCK] valid_block_count matching with CP [Ok..] [0xa51b]
[FSCK] valid_node_count matcing with CP (de lookup) [Ok..] [0x98]
[FSCK] valid_node_count matcing with CP (nat lookup) [Ok..] [0x98]
[FSCK] valid_inode_count matched with CP [Ok..] [0x7b]
[FSCK] free segment_count matched with CP [Ok..] [0x1a]
[FSCK] next block offset is free [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs [Fail]
=============================
So let's clean it.
Reported-by: Chen Yinchao <chengyinchao@huawei.com>
Signed-off-by: Liu Xue <liuxueliu.liu@huawei.com>
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 19 Feb 2016 01:37:14 +0000 (17:37 -0800)]
fsck.f2fs: check /proc/mounts first to detect readonly
Once f2fs_stop_checkpoint makes f2fs as readonly, only /proc/mounts shows
RDONLY whereas /etc/mtab does not.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 10 Feb 2016 21:20:25 +0000 (13:20 -0800)]
fsck.f2fs: show encrypted filenames matched with kernel
This patch follows the kernel's encrypted name resolution.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Sat, 30 Jan 2016 09:16:39 +0000 (09:16 +0000)]
fsck.f2fs: check ino of an inode
If the node is an inode, its ino in the nat entry should be equal to the
ino in its node footer. Otherwise, we drop the file.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Sat, 30 Jan 2016 09:16:38 +0000 (09:16 +0000)]
fsck.f2fs: check ino of an used nat entry
If a nid is valid, the ino in its nat entry should record its parent nid.
However if the ino is zero, we should drop the node.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Sat, 30 Jan 2016 09:16:37 +0000 (09:16 +0000)]
f2fs-tools: fix endianness of on-disk check_sum in summary_footer
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlei He [Sat, 30 Jan 2016 02:26:29 +0000 (10:26 +0800)]
fsck.f2fs: avoid fix ssa in some case
In some case, we need confirm node or data blkaddr is ok at first,
and then fix the conflict in ssa block. If the node blkaddr happen to
locate in data type segment caused by something error, may be we 'd
better ignore it, and it's same with data blkaddr.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sat, 23 Jan 2016 14:29:36 +0000 (22:29 +0800)]
mkfs.f2fs: reset dnode with zeros
This patch fixes resetting dnode blocks recursively.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 21 Jan 2016 01:13:14 +0000 (09:13 +0800)]
fsck.f2fs: nullify raw_super pointer
Otherwise it will cause double free.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 15 Jan 2016 04:44:13 +0000 (20:44 -0800)]
fsck.f2fs: return 0 for no error was reported
When skipping fsck, return 0 with message.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 15 Jan 2016 04:36:20 +0000 (20:36 -0800)]
fsck.f2fs: assign checkpoint pointer correctly
This patch fixes a bug that cp pointer is not assigned correctly.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Thu, 14 Jan 2016 09:13:04 +0000 (09:13 +0000)]
fsck.f2fs: swap checkpoint crc to CPU endian
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 13 Jan 2016 19:51:33 +0000 (11:51 -0800)]
f2fs-tools: avoid failure and warnings for android build
This patch fixes to resolve build failure and warnings when compiling it
under AOSP.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlei He [Fri, 8 Jan 2016 02:25:29 +0000 (10:25 +0800)]
mkfs.f2fs: introduce zone align for main area
This patch calculate main area begin from a new zone,
avoid misalign if segments per zone is not 1.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Shuoran Liu <liushuoran@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Mon, 28 Dec 2015 11:33:22 +0000 (11:33 +0000)]
fsck.f2fs: fix double free invalid checkpoint
The invalid checkpoin is freed in validate_checkpoint().
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 23 Dec 2015 00:14:36 +0000 (16:14 -0800)]
man: modify mkfs.f2fs man page
This patch adds missing [sectors] option in mkfs.f2fs, and removes
meaningless version.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 22 Dec 2015 23:55:34 +0000 (15:55 -0800)]
man: add missing man pages
This patch adds missing man pages.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 21 Dec 2015 17:57:10 +0000 (09:57 -0800)]
f2fs-tools: release 1.6.0
This version introduces defrag.f2fs newly, and some major bug fixes too.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Liu Xue [Mon, 21 Dec 2015 07:44:41 +0000 (07:44 +0000)]
mkfs.f2fs: fix check error when calloc sum_compact failure
We should check sum_compact value when deal with sum_compact
calloc failure.
Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sun, 20 Dec 2015 07:17:11 +0000 (23:17 -0800)]
fsck.f2fs: fix losing journal entries
If fsck.f2fs reports a bug, move_curseg_info tries to change the current
segment info.
When it changes the new summary block, it overwrites the existing journal
entries.
This patch fixes it not to overwrite journal entry space.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sat, 19 Dec 2015 01:49:29 +0000 (17:49 -0800)]
defrag.f2fs: fix missing SSA updates
Previously SSA is updated if it is not included in current segment info.
But, defrag.f2fs doesn't handle current segment info during the process, and
instead lastly update the whole current segment info at a time.
So, we need to update summary entries all the time.
Otherwise, we can lose the SSA entry.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 17 Dec 2015 23:37:24 +0000 (15:37 -0800)]
defrag.f2fs: enhance allocation speed
This patch improves the allocation speed.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Fri, 18 Dec 2015 07:57:10 +0000 (15:57 +0800)]
libf2fs: fix incorrect type define of declaration
When compiling f2fs toolset in 32-bits machine, following error was
reported:
libf2fs.c:342:5: error: conflicting types for 'find_next_bit_le'
../include/f2fs_fs.h:864:22: note: previous declaration of 'find_next_bit_le' was here
libf2fs.c:348:5: error: conflicting types for 'find_next_zero_bit_le'
../include/f2fs_fs.h:865:22: note: previous declaration of 'find_next_zero_bit_le' was here
This is because our type of return value(u64 in define) and (unsigned long
in declaration) of find_next_{,zero_}bit_le were not same in non-64-bits
machine:
extern unsigned long find_next_bit_le(const u8 *, u64, u64);
u64 find_next_bit_le(const u8 *addr, u64 size, u64 offset)
Fix it.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 17 Dec 2015 02:31:38 +0000 (18:31 -0800)]
defrag.f2fs: return error if there is no space
This patch checks whether there is a space or not to allocate new blocks.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 17 Dec 2015 01:43:34 +0000 (17:43 -0800)]
defrag.f2fs: eliminate unexpected journal entries
When moving data or node blocks, it changes current segment information
dynamtically. Meanwhile, its journal entry space is recovered by old
stale data.
This patch makes sure that its journal space is zeroed out.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 16 Dec 2015 02:13:08 +0000 (18:13 -0800)]
defrag.f2fs: fix not to allocate current segment
This patch fixes allocating wrong segment which has zero data but is registered
as a current segment.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 15 Dec 2015 19:13:25 +0000 (11:13 -0800)]
lib: use u8/u32/u64 for bit operations
This cleans up the bit operations.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 15 Dec 2015 18:10:15 +0000 (10:10 -0800)]
lib: fix test_bit_le functions
This patch fixes test_bit_le functions for dentry bit operations.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 15 Dec 2015 02:39:00 +0000 (18:39 -0800)]
mkfs.f2fs: remove extent_cache entry for parent directory
Currently, directory should not have any extent cache entry.
Otherwise, fsck.f2fs will trigger a false-alarmed report.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 14 Dec 2015 22:29:41 +0000 (14:29 -0800)]
mkfs.f2fs: fix storing volume label correctly in utf16
This patch fixes to store volume label as utf16 correctly.
Many conversion codes are copied from exfat-tools.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Liu Xue [Mon, 14 Dec 2015 11:31:28 +0000 (11:31 +0000)]
fsck.f2fs: deal with realloc size and realloc failure
Deal with realloc failure to avoid memory leak and memory free,
and assert realloc size to avoid double free for tree_mark.
Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 14 Dec 2015 17:37:30 +0000 (09:37 -0800)]
Revert "fsck.f2fs: deal with realloc failure"
This reverts commit
43095ca4c293249affc29a975c151c92d24b13b5.
Chao Yu [Mon, 14 Dec 2015 10:06:59 +0000 (18:06 +0800)]
mkfs.f2fs: fix to calculate left space of checkpoint page correctly
We reserved one segment for NAT region at least, so when formatting
fs, calculated maximum size of left space in CP page should be:
CHECKSUM_OFFSET - sizeof(struct f2fs_checkpoint) + 1 - 64 (size of
reserved NAT bitmap).
Fix the incorrect calculated size to avoid potential overflow bug here.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 23 Oct 2015 18:45:36 +0000 (11:45 -0700)]
defrag.f2fs: introduce defragmentation tool
This tool tries to move the valid blocks ranging from blkaddr to blkaddr + len
to targeted blkaddr with a direction like expand or shrink.
The option includes:
-d debug level [default:0]
-s start block address [default: main_blkaddr]
-l length [default:512 (2MB)]
-t target block address [default: main_blkaddr + 2MB]
-i set direction as shrink [default: expand]
For example,
# defrag.f2fs -s 0x100 -l 0x10 -t 0x4000 /dev/sdb1
This will move data blocks between 0x100 and 0x110 to the right side of
0x4000 space.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 10 Dec 2015 04:30:41 +0000 (20:30 -0800)]
fsck.f2fs: LFS alloc_type must have free segment after blkoff
This patch checks alloc_type of current segment type.
If it is LFS, the last of segment should have no valid block.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 9 Dec 2015 01:33:23 +0000 (17:33 -0800)]
f2fs-tools: export print_raw_sb_info
This patch exports print_raw_sb_info().
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 9 Dec 2015 01:30:38 +0000 (17:30 -0800)]
mkfs.f2fs: export get_best_overprovision
This patch exports get_best_overprovision() function.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 8 Dec 2015 22:53:21 +0000 (14:53 -0800)]
fsck.f2fs: sanity_check for extent_cache entry
This patch adds to check the stored extent_cache entry is consistent or not.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 9 Dec 2015 19:44:31 +0000 (11:44 -0800)]
libf2fs: enhance the bit operations
This patch modifies the existing bit operations.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 9 Dec 2015 18:30:25 +0000 (10:30 -0800)]
f2fs-tools: add library version info
This patch gives the version info for two libraries.
mkfs/libf2fs_format.la
lib/libf2fs.la
The versioning rule should be:
1. Start with version information of '0:0:0' for each libtool library.
2. Update the version information only immediately before a public release of
your software. More frequent updates are unnecessary, and only guarantee
that the current interface number gets larger faster.
2. If the library source code has changed at all since the last update, then
increment revision (c:r:a) becomes (c:r+1:a).
3. If any interfaces have been added, removed, or changed since the last update,
increment current, and set revision to 0.
4. If any interfaces have been added since the last public release, then
increment age.
5. If any interfaces have been removed or changed since the last public release,
then set age to 0.
quoted from:
http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Kai-Chung Yan [Wed, 9 Dec 2015 18:14:32 +0000 (10:14 -0800)]
mkfs/Makefile.am: add a section to build libf2fs_fmt
libf2fs_fmt is compiled from the same sources of mkfs.f2fs. This library is
required by libf2fs_utils and fastboot from the Android Open Source Project
and we believe the Android SDK maintainers from Debian will greatly benefit
from this change.
Signed-off-by: Kai-Chung Yan <seamlikok@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 7 Dec 2015 23:50:26 +0000 (15:50 -0800)]
mkfs.f2fs: show correct partition size
It needs to consider different sector size when showing the total
size.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sun, 22 Nov 2015 04:02:18 +0000 (20:02 -0800)]
fsck.f2fs: use get_{sb|cp} and set_{sb|cp} macros
We can use get_cp, set_cp, get_sb, and set_sb in fsck.f2fs.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sun, 22 Nov 2015 03:44:29 +0000 (19:44 -0800)]
mkfs.f2fs: export get_{sb|cp} and set_{sb|cp}
This patch exports get_sb, set_sb, get_cp, and set_cp for other tools.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 3 Dec 2015 05:33:21 +0000 (21:33 -0800)]
mkfs.f2fs: discard obsolete blocks to avoid roll-forward recovery
If there are many obsolete blocks written by previous usage, we can recover
wrong blocks with them.
So, mkfs should discard whole wrong information correctly by removing possible
same checkpoint versions.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu [Mon, 30 Nov 2015 10:41:07 +0000 (10:41 +0000)]
mkfs.f2fs: skip extension name that is too long
The length of extension name has a limit of 8 bytes. If an extension
exceeds the limitation, it will not be added to the extension_list.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Sheng Yong [Mon, 30 Nov 2015 10:41:06 +0000 (10:41 +0000)]
mkfs.f2fs: avoid dumplicate extensions
Before copying an user specified extension to extension_list, check if it
is already in the list. User specified extensions are delimitted by token
either ',' or ' '.
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Liu Xue [Tue, 1 Dec 2015 08:34:43 +0000 (08:34 +0000)]
fsck.f2fs: deal with realloc failure
Deal with realloc failure to avoid memory leak and memory free.
Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sun, 22 Nov 2015 02:53:07 +0000 (10:53 +0800)]
fsck.f2fs: support a readonly filesystem
If f2fs is mounted as ro, we can do fsck.f2fs.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sun, 22 Nov 2015 03:13:42 +0000 (11:13 +0800)]
fsck.f2fs: declare static function
This avoids the following warning.
mount.c:783:27: warning: SM_I is static but used in inline function
check_seg_range which is not static.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 5 Nov 2015 18:47:04 +0000 (10:47 -0800)]
f2fs-tools: release 1.5.0
This version includes bug fixes on fsck.f2fs and also support of more precise
overprovision selection and a preen mode.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 23 Oct 2015 21:03:29 +0000 (14:03 -0700)]
fsck.f2fs: support a preen mode
Generic fsck uses -p, preen mode, and fsck.f2fs can support it as -a for now.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 25 Sep 2015 16:31:04 +0000 (09:31 -0700)]
mkfs.f2fs: support <1% overprovision ratio
Big partition size needs uner 1% overprovision space to acquire more space.
section ovp ratio ovp size
For 8TB,
-s1 : 0.07% -> 10GB
-s32 : 0.39% -> 65GB
-s64 : 0.55% -> 92GB
-s128 : 0.78% -> 132GB
For 128GB,
-s1 : 0.55% -> 1.4GB
-s32 : 3.14% -> 8GB
-s64 : 4.45% -> 12GB
-s128 : 6.32% -> 17GB
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 24 Sep 2015 16:45:16 +0000 (09:45 -0700)]
fsck.f2fs: check sit types for node or data only
Previously, check_sit_types didn't handle different numbers of active logs and
SSR cases. But, it didn't cause any problem since fixing sit types is harmless.
Nevertheless, we still don't need to change them all.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 23 Sep 2015 22:20:49 +0000 (15:20 -0700)]
man: fix missing description for overprovision ratio
This patch updates mkfs.f2fs man page to indicate the automatic ovp
calculation.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 23 Sep 2015 21:59:30 +0000 (14:59 -0700)]
mkfs.f2fs: fix wrong ovp space calculation on large section
If a section consists of multiple segments, we should change the equation
to apply it on reserved space.
On 128GB,
option overprovision area reserved area
-o5 -s128 9094 6144
-o5 -s64 6179 3072
-o5 -s1 3309 48
-o1 -s128 27009 26624
-o1 -s64 13831 13312
-o1 -s1 858 208
-s1 858 208
-s64 * 13831 13312
-s128 * 27009 26624
: * should be wrong.
After patch,
-s1 (ovp:1%) 858 208
-s64 (ovp:4%) 6172 3712
-s128 (ovp:6%) 8721 5120
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 11 Aug 2015 00:58:40 +0000 (17:58 -0700)]
mkfs.f2fs: don't need to limit MIN_VOLUME SIZE
The minimum volume size is determined while preparing superblock.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 10 Aug 2015 22:45:10 +0000 (15:45 -0700)]
mkfs.f2fs: set overprovision size more precisely
This patch introduces to set the default overprovision space according to the
partition size in order to provide more space.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 10 Aug 2015 17:57:23 +0000 (10:57 -0700)]
mkfs.f2fs: fix wrong documentation
The -s should be the number of segments per a section.
Reported-by: Marc Lehmann <schmorp@schmorp.de>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Yunlei He [Thu, 16 Jul 2015 02:10:36 +0000 (10:10 +0800)]
fsck.f2fs: add segment type in sit_dump
Add segment type information in sit_dump:
[sit_dump: 48] SIT[0x12905] : 0x 1 : 0
[sit_dump: 48] SIT[0x12906] : 0x 1 : 5
[sit_dump: 48] SIT[0x12907] : 0x 7 : 4
[sit_dump: 48] SIT[0x12908] : 0x 1 : 3
The last column output message on behalf of segment type like
CURSEG_XXX_TYPE.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 2 Jul 2015 01:37:48 +0000 (18:37 -0700)]
fsck.f2fs: drop extent_info to avoid potential wrong access
This patch avoids wrong extent information modified by fixing block addresses.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 2 Jul 2015 01:19:53 +0000 (18:19 -0700)]
fsck.f2fs: select to update the latest valid summary
If two dnode blocks indicate one block address, it needs to keep the latest
valid address selectively.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 28 Apr 2015 21:27:18 +0000 (14:27 -0700)]
fsck.f2fs: add hash conversion for encrypted dentries
If dentry is encrypted, we should convert its hash value.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 29 Apr 2015 00:51:26 +0000 (17:51 -0700)]
fsck.f2fs: avoid build warning
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 24 Apr 2015 01:40:52 +0000 (18:40 -0700)]
dump.f2fs: show i_advise field in inode
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 23 Apr 2015 23:42:29 +0000 (16:42 -0700)]
fsck.f2fs: show superblock features and encryption info
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Wed, 22 Apr 2015 03:03:40 +0000 (20:03 -0700)]
mkfs.f2fs: set encryption feature
This patch add to support encryption feature.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 10 Apr 2015 17:36:06 +0000 (10:36 -0700)]
fsck.f2fs: show ckeckpoint version info
This patch shows the valid checkpoint version number.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 3 Apr 2015 17:49:34 +0000 (10:49 -0700)]
Revert "mkfs.f2fs: 512 UTF-16 characters for label"
The mkfs.f2fs gets 512 characters, which will be recorded as UTF-16 characters.
This reverts commit
fb5eef1d7e4060d9c5a913514c49b260c29d3ed2.
Jaegeuk Kim [Wed, 1 Apr 2015 02:37:40 +0000 (19:37 -0700)]
fsck.f2fs: fix orphan inode's link count
This patch fixes orphan inode's link count as 0.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 30 Mar 2015 20:09:16 +0000 (13:09 -0700)]
fsck.f2fs: fix missing dentries
If a directory has no dot and dotdot dentries, fsck.f2fs sets inline_dots for
the inode so that f2fs module can handle that properly.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 30 Mar 2015 19:57:10 +0000 (12:57 -0700)]
fsck.f2fs: clean up child information
This patch adds a child_info data structure to clean up dirty parameters.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Mon, 30 Mar 2015 19:09:36 +0000 (12:09 -0700)]
fsck.f2fs: fix missing i_links
If a child is a directory, we should increase parent's i_links.
Previously, it counts direct dentry blocks excluding indirect blocks.
This patch fixes to count child_cnt correctly in order to get precise i_links.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 27 Mar 2015 21:40:37 +0000 (14:40 -0700)]
fsck.f2fs: count child directories correctly for i_links
If some of children including directories are corrupted, we should not include
them into i_links of their parent.
This patch fixes that.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 27 Mar 2015 20:32:17 +0000 (13:32 -0700)]
fsck.f2fs: fix corrupted dentries
This patch fixes corrupted dentries such as name_len == 0.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 27 Mar 2015 04:49:43 +0000 (21:49 -0700)]
fsck.f2fs: fix summary block
Previously, if data and node summary was corrupted, the block was deallocated.
But, this patch fixes their summary first, so that we can keep their blocks.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 27 Mar 2015 04:27:56 +0000 (21:27 -0700)]
fsck.f2fs: return summary block pointer and types
This patch adds to return summry_block pointer to callers, which will be used
when fixing them.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 26 Mar 2015 20:41:22 +0000 (13:41 -0700)]
fsck.f2fs: preserve orphan blocks
If fsck.f2fs found some orphan blocks, previously fsck.f2fs drops them and
fixes checkpoint, resulting in false alarm on corruption.
This patch preserves orphan blocks to avoid such the alarms.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 26 Mar 2015 02:26:25 +0000 (19:26 -0700)]
fsck.f2fs: skip block count fix when i_links is fixed
If i_links is wrong, we should not check block count, since it doesn't count
correctly which results in changing the block count to 1.
This patch fixes that.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 26 Mar 2015 01:26:44 +0000 (18:26 -0700)]
fsck.f2fs: fix inodes having wrong i_links
This patch fixes inodes which have wrong i_links.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 26 Mar 2015 00:43:57 +0000 (17:43 -0700)]
fsck.f2fs: check file types
If the file type is mismatched, we should drop that inode.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 26 Mar 2015 00:19:13 +0000 (17:19 -0700)]
fsck.f2fs: remove inconsistent named directories
Each inode has its filename inside inode block.
For directory, the name should be matched all the time.
In other cases, it shouldn't, since there is able to be linked to other file
names.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 26 Mar 2015 00:15:58 +0000 (17:15 -0700)]
fsck.f2fs: reduce redundant message
This assert message is unnecessary to be shown, since caller shows the reason
already.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 24 Mar 2015 07:20:15 +0000 (00:20 -0700)]
mkfs.f2fs: 512 UTF-16 characters for label
We can use 512 UTF-16 characters for label.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Tue, 24 Mar 2015 07:10:15 +0000 (00:10 -0700)]
mkfs.f2fs: add quite mode, -q
This patch add a quite mode as -q.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Sat, 21 Mar 2015 00:07:48 +0000 (17:07 -0700)]
fsck.f2fs: show total sectors consumed by filesystem
This patch shows the information about the number of total sectors composing
filesystem.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 20 Mar 2015 23:57:47 +0000 (16:57 -0700)]
fsck.f2fs: show cp_state for fsck.f2fs
This patch adds to show cp_state during fsck.f2fs.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Fri, 20 Mar 2015 23:41:59 +0000 (16:41 -0700)]
mkfs.f2fs: show bytes for total_sectors
This patch shows correct information about total_sectors.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Gustavo Zacarias [Tue, 10 Mar 2015 18:53:17 +0000 (15:53 -0300)]
configure: add check for fallocate
We need to check for fallocate() rather than just linux/falloc.h +
FALLOC_FL_PUNCH_HOLE since in uClibc we've got both but still not
fallocate() itself since it's only implemented in newer unreleased
versions.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Anthony G. Basile [Sat, 7 Mar 2015 16:16:54 +0000 (11:16 -0500)]
f2fs-tools: fix build system to make distcheck correctly
The current build system fails to `make distcheck` correctly
for two reasons: 1) Some header files are not listed in the
source files for fsck.f2fs and mkfs.f2fs, and so don't make it
into the dist tarball. 2) By setting a default prefix in
configure.ac, the mock install doesn't add the correct prefix
and instead tries to install directly to the file system.
This patch corrects those problems and also adds an autogen.sh
script for convenience.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Jaegeuk Kim [Thu, 5 Mar 2015 04:33:57 +0000 (20:33 -0800)]
f2fs-tools: release 1.4.1
This version includes mostly bug fixes.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>