| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
Commit 4ea4f1db ("fsck.f2fs: large volume support") added the support
for large volume over about 3TB. The "cp_payload" is added to start_blk,
but not removed from orphan_blkaddr.
Fixes: 4ea4f1db ("fsck.f2fs: large volume support")
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are some issues in original approach:
- memory allocated in i_extent.map will leak
- do not convert fields in i_ext from on-disk format to cpu format
- do not support checking file offset with extent info
This patch refactors the flow for fixing above issues and supporting
file offset check.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
| |
This patch enables fsck.f2fs to detect incorrect position where dirent
locates in an hierarchical hash structure directory.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
This patch follows the kernel's encrypted name resolution.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
Otherwise it will cause double free.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
When skipping fsck, return 0 with message.
Change-Id: I4010836e9045c1b0a230ab18d8dcf15988676db2
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
This patch fixes a bug that cp pointer is not assigned correctly.
Change-Id: I6e3eb65e262e02e4da5b0c5228e38ee8508ac50c
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
| |
Change-Id: I98231273412780504b83633ae47c4e8e12dc611d
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
| |
This patch fixes to resolve build failure and warnings when compiling it
under AOSP.
Change-Id: I26f65615203183ad4d4c54c28fc152042707251b
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
| |
The invalid checkpoin is freed in validate_checkpoint().
Change-Id: I9025683078e7c2c99695d8f098aef9864e215c67
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
|
|
|
| |
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.
Change-Id: I99e118eb0e97985348fef212d0fff6b7a161b3a3
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
|
|
|
| |
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.
Change-Id: Ic94dc3b3b589620d30c7c442ec2b580ce4c76cad
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
This patch improves the allocation speed.
Change-Id: I524e5f12e1c2937997374316462a84a159b2e1d8
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
This patch checks whether there is a space or not to allocate new blocks.
Change-Id: I92bfd159b820d8364d3f081e571cef9fec99d76c
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
|
|
| |
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.
Change-Id: I125b334ed6f0392448ce4b7722cc284c1580b4aa
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
| |
This patch fixes allocating wrong segment which has zero data but is registered
as a current segment.
Change-Id: I863301e1243038420d877b7d7a74160b80810ecb
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
This cleans up the bit operations.
Change-Id: Ie2b303cc6eddc4ef5315f8f55616dbe182664ddc
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
This patch fixes test_bit_le functions for dentry bit operations.
Change-Id: I3f8c03e54e3f6b068ccaa9d498d984340065f90d
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
|
| |
This patch fixes to store volume label as utf16 correctly.
Many conversion codes are copied from exfat-tools.
Change-Id: Iee96b27a5bfc4938f285b4de49d32e01a181d17f
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
|
| |
Deal with realloc failure to avoid memory leak and memory free,
and assert realloc size to avoid double free for tree_mark.
Change-Id: I39fef4d4d03eeb8334f5d4899701a2d1a3852588
Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
| |
This reverts commit 43095ca4c293249affc29a975c151c92d24b13b5.
Change-Id: I8397a81035f71526d32913fce812bfebf9e1af44
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
Change-Id: I7d5e9368d4e597f35483adb16f9ab35daa445a38
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
| |
This patch checks alloc_type of current segment type.
If it is LFS, the last of segment should have no valid block.
Change-Id: I11411e894b92520a576f33dde3790a66500aae5e
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
This patch exports print_raw_sb_info().
Change-Id: I4f5017916059de36bc9f5a2bf907101602e385a9
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
This patch adds to check the stored extent_cache entry is consistent or not.
Change-Id: I3a45b11661a3a9eeebff3d0ebe095c86d3b7896b
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
This patch modifies the existing bit operations.
Change-Id: Ib6c9ba77d5426b31ee31e0d811d45a85ac89cc57
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
We can use get_cp, set_cp, get_sb, and set_sb in fsck.f2fs.
Change-Id: Ibff6a5b7d811064a92ca272e8e95d73cebd1e04a
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
| |
Deal with realloc failure to avoid memory leak and memory free.
Change-Id: Ic0d01c03ef9390e3c9fd05c9bb386fa929698133
Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
If f2fs is mounted as ro, we can do fsck.f2fs.
Change-Id: If20a055242824fd94110bcde12988ddc019a4011
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
|
|
| |
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.
Change-Id: I1321fc29bbfc5b6e1c966d1537a12b0758ac3a50
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
Generic fsck uses -p, preen mode, and fsck.f2fs can support it as -a for now.
Change-Id: Ib3b31d10feb8f778540377424f91fb0e5e690cc0
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
|
| |
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.
Change-Id: I7c3e4d354c9f0091f56011978ad7ffd5553f076c
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
Change-Id: I8c2f2f48579aef10e685df97f43136f46ddbe31f
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
This patch avoids wrong extent information modified by fixing block addresses.
Change-Id: I33fca48aa307dee9cf4829a935f301949bc879c4
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
|
| |
If two dnode blocks indicate one block address, it needs to keep the latest
valid address selectively.
Change-Id: I82574293da9999994da7a3b3fb63798f33dfb8ef
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
If dentry is encrypted, we should convert its hash value.
Change-Id: I70bc0d1f03b7713dd618508710012acc2066e54d
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
| |
Change-Id: If7d05384302cab8bd9aa7edef9342401fda8d830
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
| |
Change-Id: I46beb7def13a866296cfc4cf9f29d0d407ba6ab2
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
| |
Change-Id: I9b7cecff9081d06ecb42c88120149f5623a2b703
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|
|
|
|
|
|
|
| |
This patch shows the valid checkpoint version number.
Change-Id: I78b8a32af9427bbcf37ed21d3aeb83eabf46d6a7
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
|