History log of /external/f2fs-tools/fsck/main.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f070415c0bededac9ca300e4cac1560bbbd9d44f 04-Feb-2017 Jaegeuk Kim <jaegeuk@google.com> f2fs-tools: merge -next changes

Changes include:
mkfs.f2fs: drop initial spaces for feature string
f2fs-tools: avoid build warnings
(origin/dev, dev) mkfs.f2fs: avoid wrong discard of dnode
f2fs-tools: fix the wrong message when errno is EBUSY
f2fs-tools: support to set and recognize CP_TRIMMED_FLAG
fsck.f2fs: sanity check segno and blk_off when building curseg array
fsck.f2fs: sanity check cp_payload before reading checkpoint
fsck.f2fs: sanity check blk_off for summary block entries
mkfs.f2fs: fix wrong segment assignment
f2fs-tools: sanity check segment count
fsck.f2fs: fix cur_valid_map buffer overflow
Fix mkfs out of tree builds
mkfs.f2fs: use noheap by default
libf2fs: avoid overwrite the c.start_sector by non-root device
...

Change-Id: I27adc30ff4439e5b3f7a290d81a3a783bf916d4a
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
88753dbcf385c8f3c0a4a1c43159bfb2e5144b18 21-Jan-2017 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: show parse errors neatly

This patch is just to clean up.

Cc: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
ed031d6b24edf78908a9ccd42f45cc33ec935028 21-Jan-2017 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: support -p without argument

This patch allows fsck run -p without argument. So we could use -p as
-p, -p 0, -p 1. '-p' and '-p 0' have the same meaning as '-a'. '-p 1'
check more meta data than '-a'.

Reported-by: KARBOWSKI Piotr <piotr.karbowski@gmail.com>
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
de7e07e011004a0264e27d7134ee32cbcd9695ec 02-Nov-2016 Jaegeuk Kim <jaegeuk@kernel.org> f2fs-tools: support multiple devices

This patch adds an option to specify multiple devices for an f2fs instance.

Up to 7 devices in addition to the default device can be added.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
5e056bef1798844e640e3ae118c06949c70dd8e6 07-Nov-2016 Yunlei He <heyunlei@huawei.com> resize.f2fs: modify condition for resize

it better to decide resize or not by sector num.

Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
390fe587b1b843270bbf7f1e35ac08c8a48d03a1 14-Oct-2016 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: support restore lost files into ./lost_found/

This patch adds to support restoring lost files into ./lost_found/.

For example,

# fsck.f2fs /dev/sdXX

...
NID[0x87d7] is unreachable
NID[0x87d8] is unreachable
NID[0x87d9] is unreachable
[FSCK] Unreachable nat entries [Fail] [0x4988]
[FSCK] SIT valid block bitmap checking [Fail]
[FSCK] Hard link checking for regular file [Ok..] [0x0]
[FSCK] valid_block_count matching with CP [Fail] [0x2]
[FSCK] valid_node_count matcing with CP (de lookup) [Fail] [0x1]
[FSCK] valid_node_count matcing with CP (nat lookup) [Ok..] [0x4989]
[FSCK] valid_inode_count matched with CP [Fail] [0x1]
[FSCK] free segment_count matched with CP [Ok..] [0x1f7]
[FSCK] next block offset is free [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs [Fail]

Do you want to restore lost files into ./lost_found/? [Y/N] y

Then, you can restore unreachable files from ./lost_found/ in its best effort.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
bdc1a0ac8bd99298f56c5506c244148db7b64876 12-Oct-2016 Jaegeuk Kim <jaegeuk@kernel.org> f2fs-tools: clean up and avoid build warning

This patch is to clean up and avoid warnings when compiling aosp.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
c499346871b95583d36d164f0689a43f88245965 12-Oct-2016 Jaegeuk Kim <jaegeuk@kernel.org> f2fs: avoid AOSP build failure

SCSI-related operations are not permitted to AOSP biuld.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
3ffc5a8f3ea0a70e247d1b1b222ad27f20716bdd 17-Sep-2016 Jaegeuk Kim <jaegeuk@kernel.org> f2fs-tools: use shorter config variable name

This patch has no functional change.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
4f105bbaba07a90f2bed1e87dbe961c4252366e4 04-Jun-2016 Yunlei He <heyunlei@huawei.com> fsck.f2fs: modify sit dump && add nat dump

modify sit dump && add nat dump like this:

dump_sit:

segment_type(0:HD, 1:WD, 2:CD, 3:HN, 4:WN, 5:CN)

segno: 13 vblocks:512 seg_type:2 sit_pack:2

ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

dump_nat:

nid: 3 ino: 3 offset: 0 blkaddr: 2076417 pack:2
nid: 1042 ino: 1042 offset: 0 blkaddr: 2087156 pack:2
nid:57076 ino:57076 offset: 0 blkaddr: 2071232 pack:2
nid:57118 ino:57118 offset: 0 blkaddr: 2071233 pack:2
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
603f8f9d3628e8b81fea301e5f543a9f0b0d902d 10-Dec-2015 Jaegeuk Kim <jaegeuk@kernel.org> sload.f2fs: support loading files into partition directly

This patch implements loading files into the existing partition.
For example,
# sload.f2fs -f ./ /dev/sdb1

Then, all the directories and files will be loaded into /dev/sdb1.
By default, newly files should have inline_data and inline_xattr, if possible.

Signed-off-by: Hou Pengyang <houpengyang@huawei.com>
Signed-off-by: Liu Shuoran <liushuoran@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
d3be08825e9f5ebe8e9bf9da9a9b77cefd9b525d 09-Dec-2015 Jaegeuk Kim <jaegeuk@kernel.org> resize.f2fs: support to expand partition size

Now user can expand existing partition with resize.f2fs.
Currently, it doesn't support shrink an image.

For example,
# resize.f2fs -t [# of sectors] [image]

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
bea9d60888e01552e3c3357b0338ca0836b018cd 14-Mar-2016 Sheng Yong <shengyong1@huawei.com> fsck.f2fs: set fix_on if error is detected

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
6e225697bda9459ffb62d0bcccc545193cc9ecdf 14-Mar-2016 Sheng Yong <shengyong1@huawei.com> fsck.f2fs: introduce -p option to check meta

This patch introduces a new option '-p' to do more checks on NAT/SIT areas.
'-p' has 2 levels: level 1 has the same sematics as '-a'; level 2 checks
NAT/SIT counters to see if they matches the status in SB and CP.

A new function, fsck_chk_meta, is called by '-p 1' to implement these
comparsion. If errors are detected, fix_on is set, which means fsck will
do a 'fsck -f' immediately.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
2a802319c3c45a527dc706173e9831ace5410ee7 16-Mar-2016 Chao Yu <chao2.yu@samsung.com> fsck.f2fs: refactor extent info verification flow

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>
/external/f2fs-tools/fsck/main.c
bbc4176aa7fbf5889156cf4117213c680fade87a 15-Jan-2016 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: return 0 for no error was reported

When skipping fsck, return 0 with message.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
2c1ebe237acb9b1e8093f9aecd0c92b53583877b 23-Oct-2015 Jaegeuk Kim <jaegeuk@kernel.org> 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>
/external/f2fs-tools/fsck/main.c
c605c5eb4c20d4617cfda397e602f7232a28d45f 08-Dec-2015 Jaegeuk Kim <jaegeuk@kernel.org> 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>
/external/f2fs-tools/fsck/main.c
67de42f76ac67a941cacb689cbd2e0d750ad67a9 22-Nov-2015 Jaegeuk Kim <jaegeuk@kernel.org> 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>
/external/f2fs-tools/fsck/main.c
5489249c23e00b775286d6f6d6df38b8614a30e9 23-Oct-2015 Jaegeuk Kim <jaegeuk@kernel.org> 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>
/external/f2fs-tools/fsck/main.c
56b89303683a6b4deb7af965a1cc1e442954f753 30-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> 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>
/external/f2fs-tools/fsck/main.c
e358413d4c18ba5cfe19346d747c995937cf19d6 30-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> 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>
/external/f2fs-tools/fsck/main.c
7d253ac582e041412ee4af83e1841f1f016aba52 26-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> 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>
/external/f2fs-tools/fsck/main.c
7ba9eec293b70f7e7204512a59e58205bbb1cecc 21-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> 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>
/external/f2fs-tools/fsck/main.c
b57708aecf07a7caa8fcce02f65735a11e987154 15-Jan-2015 Jaegeuk Kim <jaegeuk@kernel.org> dump.f2fs: show checkpoint flag

This patch is to show the checkpoint flag.
With this flag, we can guess the last status of the partition.
And, this can be used by xfstests.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
9c6617d06dbdf8266838569b8169b0f9471704f4 13-Dec-2014 Jaegeuk Kim <jaegeuk@kernel.org> dump.f2fs: dump owner of data given block address

This patch introduces a feature to dump owner information of given block
address.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
cfeb015e887db6edbd13ad41597d82f1e565fc33 04-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> f2fs: rearrange options to remove redundant check

This patch summarizes the usage of options.

-a : auto_fix, fix corruption, only if f2fs reported some potential errors
-f : force, fix corruption entire partition
None : prompt, if fsck.f2fs detets any corruption

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
7eb6c5a03b78d8673030e89ce15345d69d5e5777 03-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: add auto_fix feature

This patch adds an auto_fix feature which fixes inconsistency of f2fs images.

E.g.,

With this option, -a, fsck.f2fs tries to fix inconsistency only if its valid
checkpoint has CP_FSCK_FLAG, written by previous bug_on cases.

So, normally it does fix nothing, so that there is no performance regression.
But, if a sort of corruption was reported by the f2fs module, this tries to
fix potential corrupted partition.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
5cd7001f5dfaf1c7f275826c44dcf203d49f4cce 28-Aug-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: handle error cases

Do sanity check first and then update metadata.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
6f4106c12bb2faa6cd9922ae3a03b400bdf49fde 27-Aug-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: retry to fix corrupted image

This patch adds a facility to retry conducting fsck.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
0575dd1c56ef731662687fa5b7817335b14c69ee 13-Jun-2014 Jaegeuk Kim <jaegeuk@kernel.org> libf2fs, fsck, mkfs: call f2fs_finalize_device before exit

The fsck tool should call f2fs_finalize_device before exit to close the device
file.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/external/f2fs-tools/fsck/main.c
a68ee58a5d1485be637bcc4e4fbddc5da727fc62 14-May-2014 JP Abgrall <jpa@google.com> Cleanup various build warnings (signed vs unsigned, unused vars,...)

* removed unused includes.
* removed unused parameters.
* Fixed a bunch of warnings around:
int i;
if (i < some_uint) ...
and
u32 x;
...
if (x < 0) return error;
* Protect BLKDISCARD usage if it is not available.

Change-Id: Iede035b1beb2df01c961589a69aff47a5258ecd2
Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
/external/f2fs-tools/fsck/main.c
2c877a862d6d22ff5324e90b726c7d6a26febfb7 02-Aug-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> libf2fs: check more conditions on mounted filesystem

In the case of lazy umount, "umount -l", some processes are able to use the
file system even if its mountpoint was disconnected.
At this moment, we should not allow mkfs.f2fs.
This patch adds this condition check.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
/external/f2fs-tools/fsck/main.c
57baa23a3279a4b9e9df0ab92ee20a2c79b839d8 30-Jul-2013 Changman Lee <cm224.lee@samsung.com> f2fs-tools: add option to display directory tree

This option shows directory tree of f2fs.

Usage: fsck.f2fs -t /dev/sdx

`-- p0
|-- f4
`-- d6
|-- f5e
|-- cb6
|-- fdb
|-- fe8
`-- l9a

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
/external/f2fs-tools/fsck/main.c
932f9845f6d6ab79815d80a1eb03b1b3509a4463 30-Jul-2013 Changman Lee <cm224.lee@samsung.com> f2fs-tools: use either hex or decimal options

This patch supports both hex and decimal when using nid as option.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
/external/f2fs-tools/fsck/main.c
8843554c8c43e713e2ce4e36ac3c06f9eca94b09 18-Jul-2013 Changman Lee <cm224.lee@samsung.com> dump: dump inode information from blkaddr

This patch is to dump inode which blkaddr belongs in.
Usage:
dump.f2fs /dev/sdx -b blk_addr (in 4KB)

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
/external/f2fs-tools/fsck/main.c
7f35b548d4b0e3c8577ad7a09433e589a0ab3f2a 04-Jul-2013 Changman Lee <cm224.lee@samsung.com> f2fs-tools: add fsck.f2fs and dump.f2fs

fsck.f2fs checks file system consistency, but does not repair a broken
file system yet.
dump.f2fs shows the information of a specific inode and makes dump file
of SSA and SIT.
f2fs checks file system consistency as follows:
o When data about used area and its metadata are identical,
f2fs is considered consistent. To verify such consistency, we use
three bitmaps: nat_area_bitmap, sit_area_bitmap, and main_area_bitmap.
First, each bit in nat_area_bitmap corresponds to a nid in NAT.
Second, each bit in sit_area_bitmap corresponds to a valid block in a
segment. This bitmap is same to the total valid_map of f2fs_sit_entries
in SIT.
Last, each bit in main_area_bitmap corresponds to a block in main area
except meta area.
After a consistency check of each block, we set or clear the
corresponding bit of each bitmap.
From the root node, we start consistency check. The verified
information varies according to block type.
1. NODE
- Read information of node block from NAT
- Check if block address is allocated using node info.
- Check if the type of f2fs_summary related to nid in SSA is NODE.
- Update the corresponding bit in nat_area_bitmap.
- Update the corresponding bit in sit_area_bitmap.
- Set the corresponding bit in main_area_bitmap to 1.
- Then, read node block. According to its attribute, explore
inode/direct node/indirect node/double indirect node
recursively.
- If it is an inode block, we also check its xattr and hard link.
2. DATA
- Check if the type of f2fs_summary related to nid in SSA is DATA.
- Set the corresponding bits of sit_area_bitmap and
main_area_bitmap to visited
- If it is a dentry block, traverse each dentries that may be
regular
file or directory. At this time, it will check inode block again.
Finally, we verify whether
- every nat_area_bitmap is visited
- any unreachable hard link exists
- values of sit_area_bitmap and main_area_bitmap are identical
- total_valid_block_count/node_count/inode_count are correct

Usage:
o fsck.f2fs
# fsck.f2fs /dev/sdx
options:
-d debug level [default:0]
o dump.f2fs
# dump.f2fs -i [ino] /dev/sdx
# dump.f2fs -s 0~-1 /dev/sdx (SIT dump)
# dump.f2fs -a 0~-1 /dev/sdx (SSA dump)
options:
-d debug level [default:0]
-i inode no (hex)
-s [SIT dump segno from #1~#2 (decimal), for all 0~-1]
-a [SSA dump segno from #1~#2 (decimal), for all 0~-1]

Note: To use dump.f2fs, please run make install or ln -s fsck.f2fs
dump.f2fs

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Byoung Geun Kim <bgbg.kim@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
/external/f2fs-tools/fsck/main.c