fsck, lib: support inline xattr

This patch adjusts the modification to handle inline xattrs.

Change-Id: Ie6043192100491d0ffc821df40b998d7aa6691ac
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
f2fs-tools: discard is default but not set in config

flash devices support discard therefore discard is default but not set
in config

Change-Id: I26e114e0697a91d068c0180194c61ad48b97a961
Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fsck: skip to check block addresses in device files

The device files use i_addr or i_nid fields for their rdev numbers.
So, fsck should skip to check block addresses inside of them.

Change-Id: I85a344e5e7d801ca846ff96f69a59c7e36dd2d60
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fsck: fix to handle file types correctly

The file type is based on the number, not bit operations.

Change-Id: I173d43a24fdc30313038fd4e157084b150d24241
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
libf2fs: avoid warning of implicit declaration

This patch adds extern declaration.

Change-Id: Ic1474e7e89c57c62040ff99d46572961cf3e95e3
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fsck: fix checking orphan inodes

This patch fixes bugs in the orphan inode procedure.

Change-Id: If28f5080279521e2e9d805aaae46a25219c701ba
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
mkfs: add two file extensions for android

This patch adds two file extensions, jpeg and video, to identify cold files
in android systems.

Change-Id: Iaba8a41e27b25bac33abbe9d87cd99202ab44992
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
f2fs-tools: release 1.2.0

This version includes:
- initial fsck and dump tools
- libraries for f2fs
- bug fixes
- etc

Change-Id: I2c4dafa62ae667843a0e2143d37bbf84775e4105
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fsck: fix orphan node blocks

Previously, fsck handles only the orphan inode block excpet its indirect node
blocks.
This causes false-alarm, unreachable nat entries [xxx].
This patch fixes to cover indirect node blocks in an orphan inode.

Change-Id: I66cb00e8e7539dc07cc0e2018662dec985729506
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
mkfs: remove stale node blocks

If the device does not support discard, we should write zero blocks
to avoid roll-forward recovery.

Change-Id: Ib54e3544ecbcb5f9cf1f79875a30237fd54b852a
Reported-and-tested-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Update version on mkfs

Change-Id: Id2204ac86db6b52c327830657d80aabfdd3b8a33
f2fs-tools: add inline data check

Add inline data check

Change-Id: I88d948b2b2567d7d3b1b0d4e088d40a611b9c755
Signed-off-by: Weihong Xu <weihong.xu@intel.com>
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fibmap: fix wrong block count

This is an obvious bug fix patch.

Change-Id: Ib604a9b27f72b40e2bb3c3fcc001623f031e3abe
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
mkfs: completely abstract the dev IO during format

This change allows for f2fs_format to work on a non-standard device (e.g.
sparse-memory backed file).
Removes direct access to config.fd from within f2fs_format.c.

Now, f2fs_format_device() can be made to work against any device by
providing
 f2fs_finalize_device()
 f2fs_trim_device()
and the lib2fs.c functions
  ASCIIToUNICODE
  dev_write
  f2fs_cal_crc32
  f2fs_set_bit
  log_base_2

This will allow Android's fastboot to use f2fs against a libsparse.

Change-Id: Ic4653fae0a422f0bb2b4d1b7101a04785709007c
Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fix typo around CONFIG_64BIT usage

Would do 64 BITS_PER_LONG when CONFIG_64BIT was NOT defined,
causing BITS_PER_LONG to be wrong on 32bit systems.

Change-Id: Iae32521f8686a07e7f17bc656a5f6ddf5ca853f5
Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
mkfs: write the cp page 2 of the checkpoint pack 2 during format

Currently mkfs followed by fsck will fail with

  [f2fs_crc_valid: 351] CRC validation failed: cal_crc = 4076150800 blk_crc = 0 buff_size = 0x0

This is because the validatie_checkpoint() tries to read and checksum the
cp page 2, and it is invoked on both cp packs.
But format only writes the page 1 of the 2nd checkpoint pack.

Change-Id: I7903a04a5282d862955f97ce4fd665e2149f93d5
Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
f2fs-tools: add f2fstat to print f2fs's status in sec

This tool prints /sys/kernel/debug/f2fs/status in sec so that we
can monitor variation of f2fs status.

Change-Id: I23a2ce2497e85927e7727a32d522468ce00dac28
Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Allow to build latest changes with android

Change-Id: I4c71eae82d7e97082881494311528fce6d77c9ca
f2fs-tools: move fsck/fibmap.f2fs to tools/

Let's move miscellaneous utilities into tools directory.

-- Modified to allow android compiling.

Change-Id: Ic8bc61faab2318ca5478ab9eeeb86e733be6b6fa
Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fibmap.f2fs: add bdev information

This patch shows devname and start_lba based on zero sector.
fibmap reports related lba, sometimes we want to know absolute lba of
file to compare with blktrace.

Change-Id: Iba3cc99664339727d0a7c593c2f36117151bce44
Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>