aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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
* mkfs.f2fs: fix to calculate left space of checkpoint page correctlyChao Yu2016-01-191-1/+1
| | | | | | | | | | | | | 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. Change-Id: Ieecd6399a2a519496f9e37c687e99047a7233bf4 Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* Android add f2fs defragGreg Wallace2016-01-191-1/+2
| | | | Change-Id: I9a6be181dd7e80279335d3d0db00842b891952c6
* defrag.f2fs: introduce defragmentation toolJaegeuk Kim2016-01-198-9/+538
| | | | | | | | | | | | | | | | | | | | | 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>
* fsck.f2fs: LFS alloc_type must have free segment after blkoffJaegeuk Kim2016-01-194-1/+131
| | | | | | | | 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>
* f2fs-tools: export print_raw_sb_infoJaegeuk Kim2016-01-192-4/+4
| | | | | | | This patch exports print_raw_sb_info(). Change-Id: I4f5017916059de36bc9f5a2bf907101602e385a9 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: export get_best_overprovisionJaegeuk Kim2016-01-192-29/+29
| | | | | | | This patch exports get_best_overprovision() function. Change-Id: I33978afd864f29d343ea547bdacda8696112a661 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: sanity_check for extent_cache entryJaegeuk Kim2016-01-193-24/+82
| | | | | | | 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>
* libf2fs: enhance the bit operationsJaegeuk Kim2016-01-193-66/+73
| | | | | | | This patch modifies the existing bit operations. Change-Id: Ib6c9ba77d5426b31ee31e0d811d45a85ac89cc57 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* f2fs-tools: add library version infoJaegeuk Kim2016-01-193-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Change-Id: I2226ec841157adeb65bceda06eb2e4bcafce66a4 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs/Makefile.am: add a section to build libf2fs_fmtKai-Chung Yan2016-01-191-0/+6
| | | | | | | | | | | 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. Change-Id: Ia376939b7476e6dadd9cd2fad2f867d66e9102e0 Signed-off-by: Kai-Chung Yan <seamlikok@gmail.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: show correct partition sizeJaegeuk Kim2016-01-192-7/+3
| | | | | | | | It needs to consider different sector size when showing the total size. Change-Id: I1eaea7df37dd1d6a26e8cda9033f816a040db789 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: use get_{sb|cp} and set_{sb|cp} macrosJaegeuk Kim2016-01-192-131/+116
| | | | | | | 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>
* mkfs.f2fs: export get_{sb|cp} and set_{sb|cp}Jaegeuk Kim2016-01-192-85/+83
| | | | | | | This patch exports get_sb, set_sb, get_cp, and set_cp for other tools. Change-Id: I15cb51e0d58023f61ab336f1f6995a3e9034d3e6 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: discard obsolete blocks to avoid roll-forward recoveryJaegeuk Kim2016-01-191-6/+28
| | | | | | | | | | 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. Change-Id: Ic7a4d88e985e93056a225a586396a75f8dee2a69 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* mkfs.f2fs: skip extension name that is too longChao Yu2016-01-191-0/+5
| | | | | | | | | | 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. Change-Id: I67765b42ff81a0e33b10aae9efa640f772187e9d 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>
* mkfs.f2fs: avoid dumplicate extensionsSheng Yong2016-01-191-3/+17
| | | | | | | | | | 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 ' '. Change-Id: I107542643f79f96dde19c1d3a9d375a771392acf Signed-off-by: Sheng Yong <shengyong1@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: deal with realloc failureLiu Xue2016-01-191-1/+4
| | | | | | | | 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>
* fsck.f2fs: support a readonly filesystemJaegeuk Kim2016-01-195-17/+35
| | | | | | | If f2fs is mounted as ro, we can do fsck.f2fs. Change-Id: If20a055242824fd94110bcde12988ddc019a4011 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
* fsck.f2fs: declare static functionJaegeuk Kim2016-01-191-1/+1
| | | | | | | | | | 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>
* mkfs.f2fs: Disable clangstable/cm-13.0-ZNH0ELuK13372016-01-101-0/+1
| | | | | | | Otherwise it segfaults while formatting ext sd as internal storage: http://pastebin.com/2JAFr8uv Change-Id: Icd241b7f64c996f83b55a4010d470f039aa4cc3d
* f2fs-tools: Cleanup build targetsMichael Bestas2015-12-121-18/+0
| | | | | | * Remove host targets, they are provided by system/extras/f2fs_utils Change-Id: Ib66405df0411dbd481b3bd220f9854648c8f1339
* f2fs-tools: Update version in Android.mkMichael Bestas2015-12-041-1/+1
| | | | Change-Id: Id3b15a90f75bb9426ba250ed8459d3cc9710ff09
* f2fs-tools: release 1.5.0Jaegeuk Kim2015-11-121-2/+2
| | | | | | | | This version includes bug fixes on fsck.f2fs and also support of more precise overprovision selection and a preen mode. Change-Id: I32bccbd3b3f8f1a2b6fb2bdac1d7c64a766d83ca Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>