mkfs.f2fs: fix name conflict for BLKDISCARD

The compile time option BLKDISCARD conflicts with ioctl code
for discard. This causes discard to fail with "Info: This
device doesn't support TRIM". Rename compile time option
to WITH_BLKDISCARD.

Signed-off-by: Sankalp Bose <sankalp@tuxera.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
mkfs.f2fs: remove build warning

Should be unsigned int for le32_to_cpu.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
dump.f2fs: support dump_file from image

This patch adds supporting dump_file, which can extract a file from image.

You can simply select [yes|no] when doing dump.f2fs -i [inode number] [img].

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: show inode numbers

fsck.f2fs -d 1 [dev]
 : shows inode informations
fsck.f2fs -d -1 [dev]
 : shows directory tree with inode number

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
f2fs_dentry_hash: avoid casting unsigned char to singed char

This can hurt when calculating hash value, resulting in false alarm.

Signed-off-by: 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>

Conflicts:
	fsck/main.c

Change-Id: I09aa8fdfaf9b07193821766c717abc1e999977f2
fsck.f2fs: clean up codes

Fix wrong coding style.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: handle IS_VALID_BLK_ADDR

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

We don't need to get the return value.

Signed-off-by: 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>

Conflicts:
	fsck/main.c

Change-Id: Ic53b8a2aee1f73d762801c0953c1fa4b5c81fd91
fsck.f2fs: cleanup mount.c

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: give a chance to recover sit entries

This patch skips initial verfication on SIT entries, which checks the number of
valid blocks from its bitmap.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: fix inode block inconsistency

This patch is to fix inode block inconsistency such as iblocks and ilinks.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: add fixing messeages

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: remove dentry if its inode block is corrupted

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: corrupted orphan inode will be removed

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: remove corrupted xattr block

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: handle correctly segment summary entries

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: fix checkpoint

- fix nat entries
- fix sit entries
- fix checkpoint

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck.f2fs: check next block is free or not

If block allocation is made to the next block offset, we should drop that
block.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>