fsck.f2fs: attempt to identify bad dentries

If a dentry has a bad ino (fsck_chk_nod_blk() fails)
and has a name len of 0, then __chk_dentries() will end up stuck:

....
[__chk_dentries: 663] [  4]-[0x0] name[] len[0x0] ino[0x5f1710dc] type[0xd1]
[ASSERT] (sanity_check_nid: 184)  --> nid is not valid. [0x5f1710dc]
[__chk_dentries: 663] [  4]-[0x0] name[] len[0x0] ino[0x5f1710dc] type[0xd1]
[ASSERT] (sanity_check_nid: 184)  --> nid is not valid. [0x5f1710dc]
[__chk_dentries: 663] [  4]-[0x0] name[] len[0x0] ino[0x5f1710dc] type[0xd1]
[ASSERT] (sanity_check_nid: 184)  --> nid is not valid. [0x5f1710dc]
....

This change tries to identify bad dentries:
 - is the ino a valid NID?
 - is the FILE_TYPE a happy type?

Change-Id: I5fb2f3869c96f2c928baaace148de1af102e558e
Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: fix DATA_EXIST flag for old partition

This should fix the DATA_EXIST before recent inline_data is enabled.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
f2fs: use last_blk for print dentries

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: actually flag the fixed dentries as fixed

This is a followup from 056e4b04fc44a006d5529bafbf87b1d73296c665
Now the blk is marked as fixed so that the callers can write it back.

Change-Id: I99c94bc39e772e0d0baab81bd741ce55416ce0e6
Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: fix SIT entry types

Sometimes, SIT entry type is broken, so we need to rebuild it.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: trigger fsck.f2fs when new change was made

This patch remains user specified triggering information in superblock.
Then, if the information was changed, fsck.f2fs is triggered.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
mkfs.f2fs: give a kernel version for initial format

This is to identify when the format was done.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
mkfs.f2fs: reclaim free space in case of regular file

If we use regular file instead block device, let's reclaim its free
space.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: show orphan inodes when fixing partition

Let's show orphan inode information when fixing partition.
Otherwise, it causes a false alarm.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: remove unneeded return

To show better output.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Merge remote-tracking branch 'upstream/master' into cm-11.0