aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* f2fs-tools: android: release 1.6.1HEADreplicant-6.0-0004-transitionreplicant-6.0-0004-rc6replicant-6.0-0004-rc5-transitionreplicant-6.0-0004-rc5replicant-6.0-0004-rc4replicant-6.0-0004-rc3replicant-6.0-0004-rc2replicant-6.0-0004-rc1replicant-6.0-0004replicant-6.0-0003replicant-6.0-0002replicant-6.0-0001stable/cm-13.0-ZNH5Ycm-13.0luca0204002016-04-041-1/+1
| | | | Change-Id: I21c9632e6201cb2c2b0685ae393e028cd164de30
* f2fs-tools: release 1.6.1Jaegeuk Kim2016-04-042-4/+4
| | | | | | | | | | This version mostly fixes the bugs in fsck.f2fs. Especially, this fixes a segfault bug when executing "fsck.f2fs -a". Note that, some body codes (not interfaces) in libf2fs_format.la and libf2fs.la were changed. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: calculate orphan_blkaddr correctlyJunling Zheng2016-04-041-1/+1
| | | | | | | | | | 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>
* fsck.f2fs: refactor extent info verification flowChao Yu2016-04-043-57/+93
| | | | | | | | | | | | | 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>
* fsck.f2fs: check dirent positionChao Yu2016-04-043-14/+108
| | | | | | | | 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>
* mkfs.f2fs: set segment_count in super block correctlyFan Li2016-04-041-1/+2
| | | | | | | | | | | | | | | | | | | | | 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>
* fsck.f2fs: check nat_entry->ino for all nodesSheng Yong2016-04-041-2/+2
| | | | | | | | | | | 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>
* f2fs-tools: rebase struct f2fs_summary_block with upstreamChao Yu2016-04-044-58/+77
| | | | | | | | | | | | 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>
* fsck.f2fs: fix incorrect block_addr of node/metaJunling Zheng2016-04-041-1/+8
| | | | | | | | | | 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>
* fsck.f2fs: calculate the total size correctlyJunling Zheng2016-04-041-1/+2
| | | | | | | | 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>
* fsck.f2fs: check valid values for dot dentriesLiu Xue2016-04-042-1/+79
| | | | | | | | | | 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>
* f2fs-tools: redefine MAX_SIT_BITMAP_SIZEJunling Zheng2016-04-041-1/+3
| | | | | | | | | | | | | | 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>
* libf2fs: limit the total size up to 16TJunling Zheng2016-04-041-0/+5
| | | | | | | | | 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>
* fsck.f2fs: fix corrupted nat entry [0]Sheng Yong2016-04-041-1/+12
| | | | | | | | | | 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>
* fsck.f2fs: remove corrupted nid entry from indirect/double-indirect nodeSheng Yong2016-04-041-6/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* fsck.f2fs: check /proc/mounts first to detect readonlyJaegeuk Kim2016-04-041-8/+8
| | | | | | | | Once f2fs_stop_checkpoint makes f2fs as readonly, only /proc/mounts shows RDONLY whereas /etc/mtab does not. Change-Id: I389cc1589147fcf4da8822de32cd3313d881e65f Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: show encrypted filenames matched with kernelJaegeuk Kim2016-04-041-9/+32
| | | | | | This patch follows the kernel's encrypted name resolution. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: check ino of an inodeSheng Yong2016-04-041-0/+5
| | | | | | | | | 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>
* fsck.f2fs: check ino of an used nat entrySheng Yong2016-04-041-0/+5
| | | | | | | | | 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>
* f2fs-tools: fix endianness of on-disk check_sum in summary_footerSheng Yong2016-04-041-1/+1
| | | | | Signed-off-by: Sheng Yong <shengyong1@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: avoid fix ssa in some caseYunlei He2016-04-041-9/+25
| | | | | | | | | | 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>
* mkfs.f2fs: reset dnode with zerosJaegeuk Kim2016-04-041-2/+1
| | | | | | This patch fixes resetting dnode blocks recursively. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: nullify raw_super pointerJaegeuk Kim2016-04-041-0/+1
| | | | | | Otherwise it will cause double free. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs-utils: Fix Android host utilsstable/cm-13.0-ZNH2KBstable/cm-13.0-ZNH2KSteve Kondik2016-01-212-3/+16
| | | | | | | * __ANDROID__ isn't defined for host utils. * Additionally, use the old behavior as the fallback. Change-Id: Ic0247358fb19595a70f9dd455914bd8f3f9710e2
* Slight ifndef changeGreg Wallace2016-01-191-2/+2
| | | | Change-Id: I9426f0f020c530d8c5e38a55530d8cc2bbc490ec
* Fix readonly for androidGreg Wallace2016-01-191-1/+22
| | | | | | | | | The hasmntopt() function doesn't exist in android, so it needs to be defined if we are building for android. Also, MNTOPT_RO isn't defined on android (and maybe others), so we need to manually specify if if it isn't already defined. Change-Id: I55330e37cebc087e138cdf6a0cbbe61df59f55fa
* fsck.f2fs: return 0 for no error was reportedJaegeuk Kim2016-01-191-3/+9
| | | | | | | When skipping fsck, return 0 with message. Change-Id: I4010836e9045c1b0a230ab18d8dcf15988676db2 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: assign checkpoint pointer correctlyJaegeuk Kim2016-01-191-1/+1
| | | | | | | This patch fixes a bug that cp pointer is not assigned correctly. Change-Id: I6e3eb65e262e02e4da5b0c5228e38ee8508ac50c Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: swap checkpoint crc to CPU endianSheng Yong2016-01-191-2/+2
| | | | | | Change-Id: I98231273412780504b83633ae47c4e8e12dc611d Signed-off-by: Sheng Yong <shengyong1@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs-tools: avoid failure and warnings for android buildJaegeuk Kim2016-01-194-10/+17
| | | | | | | | 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>
* mkfs.f2fs: introduce zone align for main areaYunlei He2016-01-191-10/+10
| | | | | | | | | | This patch calculate main area begin from a new zone, avoid misalign if segments per zone is not 1. Change-Id: Ibda5849c9465fe811aaca6d217e8b7f2971e1c5a Signed-off-by: Yunlei He <heyunlei@huawei.com> Signed-off-by: Shuoran Liu <liushuoran@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: fix double free invalid checkpointSheng Yong2016-01-191-6/+5
| | | | | | | | 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>
* man: modify mkfs.f2fs man pageJaegeuk Kim2016-01-191-1/+3
| | | | | | | | This patch adds missing [sectors] option in mkfs.f2fs, and removes meaningless version. Change-Id: Ib8726f8cb5ea7b22bc0517003e66fcf5ae74ebbf Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* man: add missing man pagesJaegeuk Kim2016-01-195-2/+214
| | | | | | | This patch adds missing man pages. Change-Id: Ifc7690fc95ad013975e6a785aeaf3d6165f8f688 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* Update android versionGreg Wallace2016-01-191-1/+1
| | | | Change-Id: I0a7885bf4b6093760d6d3bd648a8480f5e578201
* f2fs-tools: release 1.6.0Jaegeuk Kim2016-01-191-2/+2
| | | | | | | This version introduces defrag.f2fs newly, and some major bug fixes too. Change-Id: I3e5a918d97b95bd9e16e22b3ccaae9d90c55f5aa Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: fix check error when calloc sum_compact failureLiu Xue2016-01-191-1/+1
| | | | | | | | | We should check sum_compact value when deal with sum_compact calloc failure. Change-Id: Ia141de5bd6bc5a5d3075c7f1f2548fe378c4aa50 Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: fix losing journal entriesJaegeuk Kim2016-01-191-1/+4
| | | | | | | | | | | 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>
* defrag.f2fs: fix missing SSA updatesJaegeuk Kim2016-01-191-3/+6
| | | | | | | | | | | 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>
* defrag.f2fs: enhance allocation speedJaegeuk Kim2016-01-192-5/+7
| | | | | | | This patch improves the allocation speed. Change-Id: I524e5f12e1c2937997374316462a84a159b2e1d8 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* libf2fs: fix incorrect type define of declarationChao Yu2016-01-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | 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. Change-Id: I8c29735e4db1dce05ebc1b96f9ded87c55d02c63 Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* defrag.f2fs: return error if there is no spaceJaegeuk Kim2016-01-191-10/+18
| | | | | | | 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>
* defrag.f2fs: eliminate unexpected journal entriesJaegeuk Kim2016-01-193-0/+10
| | | | | | | | | | 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>
* defrag.f2fs: fix not to allocate current segmentJaegeuk Kim2016-01-191-3/+3
| | | | | | | | 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>
* lib: use u8/u32/u64 for bit operationsJaegeuk Kim2016-01-193-22/+15
| | | | | | | This cleans up the bit operations. Change-Id: Ie2b303cc6eddc4ef5315f8f55616dbe182664ddc Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* lib: fix test_bit_le functionsJaegeuk Kim2016-01-194-26/+21
| | | | | | | This patch fixes test_bit_le functions for dentry bit operations. Change-Id: I3f8c03e54e3f6b068ccaa9d498d984340065f90d Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: remove extent_cache entry for parent directoryJaegeuk Kim2016-01-191-2/+2
| | | | | | | | Currently, directory should not have any extent cache entry. Otherwise, fsck.f2fs will trigger a false-alarmed report. Change-Id: I716e290308eb5f0ea4b59f1a262d20a8fd303a0e Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: fix storing volume label correctly in utf16Jaegeuk Kim2016-01-194-13/+186
| | | | | | | | | 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>
* fsck.f2fs: deal with realloc size and realloc failureLiu Xue2016-01-191-0/+3
| | | | | | | | | 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>
* Revert "fsck.f2fs: deal with realloc failure"Jaegeuk Kim2016-01-191-4/+1
| | | | | | This reverts commit 43095ca4c293249affc29a975c151c92d24b13b5. Change-Id: I8397a81035f71526d32913fce812bfebf9e1af44