platform/upstream/f2fs-tools.git
9 years agofsck.f2fs: show superblock features and encryption info
Jaegeuk Kim [Thu, 23 Apr 2015 23:42:29 +0000 (16:42 -0700)]
fsck.f2fs: show superblock features and encryption info

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agomkfs.f2fs: set encryption feature
Jaegeuk Kim [Wed, 22 Apr 2015 03:03:40 +0000 (20:03 -0700)]
mkfs.f2fs: set encryption feature

This patch add to support encryption feature.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: show ckeckpoint version info
Jaegeuk Kim [Fri, 10 Apr 2015 17:36:06 +0000 (10:36 -0700)]
fsck.f2fs: show ckeckpoint version info

This patch shows the valid checkpoint version number.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agoRevert "mkfs.f2fs: 512 UTF-16 characters for label"
Jaegeuk Kim [Fri, 3 Apr 2015 17:49:34 +0000 (10:49 -0700)]
Revert "mkfs.f2fs: 512 UTF-16 characters for label"

The mkfs.f2fs gets 512 characters, which will be recorded as UTF-16 characters.

This reverts commit fb5eef1d7e4060d9c5a913514c49b260c29d3ed2.

9 years agofsck.f2fs: fix orphan inode's link count
Jaegeuk Kim [Wed, 1 Apr 2015 02:37:40 +0000 (19:37 -0700)]
fsck.f2fs: fix orphan inode's link count

This patch fixes orphan inode's link count as 0.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: fix missing dentries
Jaegeuk Kim [Mon, 30 Mar 2015 20:09:16 +0000 (13:09 -0700)]
fsck.f2fs: fix missing dentries

If a directory has no dot and dotdot dentries, fsck.f2fs sets inline_dots for
the inode so that f2fs module can handle that properly.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: clean up child information
Jaegeuk Kim [Mon, 30 Mar 2015 19:57:10 +0000 (12:57 -0700)]
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>
9 years agofsck.f2fs: fix missing i_links
Jaegeuk Kim [Mon, 30 Mar 2015 19:09:36 +0000 (12:09 -0700)]
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>
9 years agofsck.f2fs: count child directories correctly for i_links
Jaegeuk Kim [Fri, 27 Mar 2015 21:40:37 +0000 (14:40 -0700)]
fsck.f2fs: count child directories correctly for i_links

If some of children including directories are corrupted, we should not include
them into i_links of their parent.
This patch fixes that.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: fix corrupted dentries
Jaegeuk Kim [Fri, 27 Mar 2015 20:32:17 +0000 (13:32 -0700)]
fsck.f2fs: fix corrupted dentries

This patch fixes corrupted dentries such as name_len == 0.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: fix summary block
Jaegeuk Kim [Fri, 27 Mar 2015 04:49:43 +0000 (21:49 -0700)]
fsck.f2fs: fix summary block

Previously, if data and node summary was corrupted, the block was deallocated.
But, this patch fixes their summary first, so that we can keep their blocks.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: return summary block pointer and types
Jaegeuk Kim [Fri, 27 Mar 2015 04:27:56 +0000 (21:27 -0700)]
fsck.f2fs: return summary block pointer and types

This patch adds to return summry_block pointer to callers, which will be used
when fixing them.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: preserve orphan blocks
Jaegeuk Kim [Thu, 26 Mar 2015 20:41:22 +0000 (13:41 -0700)]
fsck.f2fs: preserve orphan blocks

If fsck.f2fs found some orphan blocks, previously fsck.f2fs drops them and
fixes checkpoint, resulting in false alarm on corruption.
This patch preserves orphan blocks to avoid such the alarms.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: skip block count fix when i_links is fixed
Jaegeuk Kim [Thu, 26 Mar 2015 02:26:25 +0000 (19:26 -0700)]
fsck.f2fs: skip block count fix when i_links is fixed

If i_links is wrong, we should not check block count, since it doesn't count
correctly which results in changing the block count to 1.

This patch fixes that.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: fix inodes having wrong i_links
Jaegeuk Kim [Thu, 26 Mar 2015 01:26:44 +0000 (18:26 -0700)]
fsck.f2fs: fix inodes having wrong i_links

This patch fixes inodes which have wrong i_links.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: check file types
Jaegeuk Kim [Thu, 26 Mar 2015 00:43:57 +0000 (17:43 -0700)]
fsck.f2fs: check file types

If the file type is mismatched, we should drop that inode.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: remove inconsistent named directories
Jaegeuk Kim [Thu, 26 Mar 2015 00:19:13 +0000 (17:19 -0700)]
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>
9 years agofsck.f2fs: reduce redundant message
Jaegeuk Kim [Thu, 26 Mar 2015 00:15:58 +0000 (17:15 -0700)]
fsck.f2fs: reduce redundant message

This assert message is unnecessary to be shown, since caller shows the reason
already.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agomkfs.f2fs: 512 UTF-16 characters for label
Jaegeuk Kim [Tue, 24 Mar 2015 07:20:15 +0000 (00:20 -0700)]
mkfs.f2fs: 512 UTF-16 characters for label

We can use 512 UTF-16 characters for label.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agomkfs.f2fs: add quite mode, -q
Jaegeuk Kim [Tue, 24 Mar 2015 07:10:15 +0000 (00:10 -0700)]
mkfs.f2fs: add quite mode, -q

This patch add a quite mode as -q.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: show total sectors consumed by filesystem
Jaegeuk Kim [Sat, 21 Mar 2015 00:07:48 +0000 (17:07 -0700)]
fsck.f2fs: show total sectors consumed by filesystem

This patch shows the information about the number of total sectors composing
filesystem.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: show cp_state for fsck.f2fs
Jaegeuk Kim [Fri, 20 Mar 2015 23:57:47 +0000 (16:57 -0700)]
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>
9 years agomkfs.f2fs: show bytes for total_sectors
Jaegeuk Kim [Fri, 20 Mar 2015 23:41:59 +0000 (16:41 -0700)]
mkfs.f2fs: show bytes for total_sectors

This patch shows correct information about total_sectors.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agoconfigure: add check for fallocate
Gustavo Zacarias [Tue, 10 Mar 2015 18:53:17 +0000 (15:53 -0300)]
configure: add check for fallocate

We need to check for fallocate() rather than just linux/falloc.h +
FALLOC_FL_PUNCH_HOLE since in uClibc we've got both but still not
fallocate() itself since it's only implemented in newer unreleased
versions.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agof2fs-tools: fix build system to make distcheck correctly
Anthony G. Basile [Sat, 7 Mar 2015 16:16:54 +0000 (11:16 -0500)]
f2fs-tools: fix build system to make distcheck correctly

The current build system fails to `make distcheck` correctly
for two reasons: 1) Some header files are not listed in the
source files for fsck.f2fs and mkfs.f2fs, and so don't make it
into the dist tarball.  2) By setting a default prefix in
configure.ac, the mock install doesn't add the correct prefix
and instead tries to install directly to the file system.

This patch corrects those problems and also adds an autogen.sh
script for convenience.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agof2fs-tools: release 1.4.1 v1.4.1
Jaegeuk Kim [Thu, 5 Mar 2015 04:33:57 +0000 (20:33 -0800)]
f2fs-tools: release 1.4.1

This version includes mostly bug fixes.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agof2fstat: fix option parsing
Michael Lass [Tue, 3 Mar 2015 23:42:17 +0000 (00:42 +0100)]
f2fstat: fix option parsing

On systems using unsigned char as default (char)EOF != EOF.
Use int to store returned value of getopt to make it work on all platforms.

Signed-off-by: Michael Lass <bevan@bi-co.net>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: remove corrupted data indices in direct node blocks
Jaegeuk Kim [Tue, 24 Feb 2015 18:09:07 +0000 (10:09 -0800)]
fsck.f2fs: remove corrupted data indices in direct node blocks

Previously, only data blocks locating in its inode block could be fixed.
This patch investigates direct node blocks to fix indices too.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agomkfs.f2fs: avoid memory leak in mkfs
Chao Yu [Fri, 6 Feb 2015 08:11:41 +0000 (16:11 +0800)]
mkfs.f2fs: avoid memory leak in mkfs

This patch fixes memory leak in mkfs.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: support large sector size
Chao Yu [Thu, 5 Feb 2015 09:38:09 +0000 (17:38 +0800)]
fsck.f2fs: support large sector size

Since f2fs support large sector size in commit 55cf9cb63f0e "f2fs: support large
sector size", block device with sector size of 512/1024/2048/4096 bytes can be
supported.

But fsck.f2fs still use default F2FS_LOG_SECTOR_SIZE/F2FS_LOG_SECTORS_PER_BLOCK to
verify related data in f2fs image, it's wrong, let's fix this issue in this patch.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agomkfs.f2fs: support large sector size
Chao Yu [Thu, 5 Feb 2015 09:36:39 +0000 (17:36 +0800)]
mkfs.f2fs: support large sector size

Since f2fs support large sector size in commit 55cf9cb63f0e "f2fs: support large
sector size", block device with sector size of 512/1024/2048/4096 bytes can be
supported.

But mkfs.f2fs still use default sector size: 512 bytes as sector size, let's fix
this issue in this patch.

v2:
 o remove unneeded printed message when sector size is large than 512 bytes
   suggested by Kinglong.
 o show correct sector size in printed message.
 o use config.sectors_per_blk instead of DEFAULT_SECTORS_PER_BLOCK suggested by
   Kinglong.
v3:
 o remove another unneeded printed message when sector size is large than 512
   bytes suggested by Kinglong.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Reviewed-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofsck.f2fs: readahead node blocks to speed up
Jaegeuk Kim [Tue, 2 Dec 2014 22:08:11 +0000 (14:08 -0800)]
fsck.f2fs: readahead node blocks to speed up

This patch adds readahead system call to speed up node block reads.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agodump.f2fs: show checkpoint flag
Jaegeuk Kim [Thu, 15 Jan 2015 00:18:15 +0000 (16:18 -0800)]
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>
9 years agofsck.f2fs: fix sit types seamlessly
Jaegeuk Kim [Fri, 9 Jan 2015 10:59:57 +0000 (02:59 -0800)]
fsck.f2fs: fix sit types seamlessly

SIT types can be wrong when active_logs are 2 or 4.
So, let's fix this implicitly.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agofibmap.f2fs: fix the wrong stat info
Chao Yu [Thu, 22 Jan 2015 03:19:05 +0000 (11:19 +0800)]
fibmap.f2fs: fix the wrong stat info

fibmap shows ino, size, blocks with incorrectly decimal number, fix it.

Before:
--------------------------------------------
dev       [8:16]
ino       [0x   238ea : 0]
mode      [0x    81a4 : 33188]
nlink     [0x       1 : 1]
uid       [0x       0 : 0]
gid       [0x       0 : 0]
size      [0x   79e00 : 0]
blksize   [0x    1000 : 4096]
blocks    [0x     268 : 0]
--------------------------------------------

Patched:
--------------------------------------------
dev       [8:16]
ino       [0x   238ea : 145642]
mode      [0x    81a4 : 33188]
nlink     [0x       1 : 1]
uid       [0x       0 : 0]
gid       [0x       0 : 0]
size      [0x   79e00 : 499200]
blksize   [0x    1000 : 4096]
blocks    [0x     268 : 616]
--------------------------------------------

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agoconfigure: add check for bswap_64
Yann E. MORIN [Thu, 25 Dec 2014 17:52:00 +0000 (18:52 +0100)]
configure: add check for bswap_64

include/f2fs_fs.h checks the HAVE_BSWAP_64 conidtional, but configure
nevers checks for it.

Add a check that the function is indeed declared, and fix the variable
name to match the naming scheme of autoconf (and not those of WAF like
is used by samba), and adapt the check as suggested in the autoconf
manual.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agoconfigure: also check for byteswap.h
Yann E. MORIN [Thu, 25 Dec 2014 17:39:19 +0000 (18:39 +0100)]
configure: also check for byteswap.h

include/f2fs_fs.h checks the HAVE_BYTESWAP_H conditional, but it is
never checked for in configure.

Add that header to the list of headers checked for.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agoparse.f2fs: add a tool to parse IO traces made by runtime f2fs
Jaegeuk Kim [Sat, 20 Dec 2014 00:05:10 +0000 (16:05 -0800)]
parse.f2fs: add a tool to parse IO traces made by runtime f2fs

This patch adds parse.f2fs to retrieve process information and an amount
of data reads and writes from given IO trace got by f2fs.

Signed-off-by: Jaegeuk Kim <jaegeuk@motorola.com>
9 years agodump.f2fs: dump owner of data given block address
Jaegeuk Kim [Sat, 13 Dec 2014 21:55:59 +0000 (13:55 -0800)]
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>
9 years agofsck.f2fs: no need to fix SIT type for COLD_DATA
Jaegeuk Kim [Tue, 25 Nov 2014 01:43:44 +0000 (17:43 -0800)]
fsck.f2fs: no need to fix SIT type for COLD_DATA

If hot or warm data blocks were moved to the cold log, we should remain them
in the cold log.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
9 years agomkfs.f2fs: introduce some macros to simplify coding style
Changman Lee [Mon, 17 Nov 2014 05:03:41 +0000 (14:03 +0900)]
mkfs.f2fs: introduce some macros to simplify coding style

This patch tries to simplify coding style for readability.
Rename shortly
 o rename super_block to sb

And, introduce some macros.
 o set/get_cp
 o set/get_sb
 o next/prev_zone, last_zone and last_section
 o ALIGN, SEG_ALIGN and ZONE_ALIGN

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: remove unused value
Jaegeuk Kim [Fri, 14 Nov 2014 05:00:39 +0000 (21:00 -0800)]
fsck.f2fs: remove unused value

Remove build warning.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agomkfs.f2fs: fix missing endian conversion
Changman Lee [Thu, 13 Nov 2014 11:15:05 +0000 (20:15 +0900)]
mkfs.f2fs: fix missing endian conversion

This is for conversion from cpu to little endian and vice versa.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agomkfs: use compact mode for data summaries
Changman Lee [Thu, 13 Nov 2014 11:15:04 +0000 (20:15 +0900)]
mkfs: use compact mode for data summaries

This patch is for optimization related to format
 o reduce 2 blocks for data summaries
 o reduce initial mount time after mkfs.f2fs

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: add a missing 'fixed' during chk_dentries()
JP Abgrall [Thu, 13 Nov 2014 23:20:05 +0000 (15:20 -0800)]
fsck.f2fs: add a missing 'fixed' during chk_dentries()

One of the cases would update the dentries but not set
fixed=1 causing the update to not be written out.

Change-Id: I111d599f93f7d5306dacd7d62da946fdb5c262ee
Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: avoid false alarm on SIT type fix
Jaegeuk Kim [Thu, 13 Nov 2014 21:30:24 +0000 (13:30 -0800)]
fsck.f2fs: avoid false alarm on SIT type fix

This patch removed a false alarm when detecting any inconsistency in SIT types.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: remove unneeded return
Jaegeuk Kim [Sun, 9 Nov 2014 06:33:49 +0000 (22:33 -0800)]
fsck.f2fs: remove unneeded return

To show better output.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: show orphan inodes when fixing partition
Jaegeuk Kim [Sun, 9 Nov 2014 06:28:42 +0000 (22:28 -0800)]
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>
10 years agomkfs.f2fs: reclaim free space in case of regular file
Changman Lee [Tue, 4 Nov 2014 09:10:54 +0000 (18:10 +0900)]
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>
10 years agomkfs.f2fs: give a kernel version for initial format
Jaegeuk Kim [Fri, 7 Nov 2014 04:44:57 +0000 (20:44 -0800)]
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>
10 years agofsck.f2fs: trigger fsck.f2fs when new change was made
Jaegeuk Kim [Fri, 7 Nov 2014 03:34:40 +0000 (19:34 -0800)]
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>
10 years agofsck.f2fs: fix SIT entry types
Jaegeuk Kim [Thu, 6 Nov 2014 04:25:49 +0000 (20:25 -0800)]
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>
10 years agofsck.f2fs: actually flag the fixed dentries as fixed
JP Abgrall [Mon, 3 Nov 2014 21:27:42 +0000 (13:27 -0800)]
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>
10 years agof2fs: use last_blk for print dentries
Jaegeuk Kim [Fri, 31 Oct 2014 19:48:42 +0000 (12:48 -0700)]
f2fs: use last_blk for print dentries

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: fix DATA_EXIST flag for old partition
Jaegeuk Kim [Fri, 31 Oct 2014 18:06:45 +0000 (11:06 -0700)]
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>
10 years agofsck.f2fs: attempt to identify bad dentries
JP Abgrall [Wed, 29 Oct 2014 02:11:52 +0000 (19:11 -0700)]
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>
10 years agofsck.f2fs: show inline status of inode
Jaegeuk Kim [Sun, 19 Oct 2014 06:51:17 +0000 (23:51 -0700)]
fsck.f2fs: show inline status of inode

This patch adds to show inline status of each inode.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: fix wrongly allocated 0'th block for inline_data
Jaegeuk Kim [Sun, 19 Oct 2014 06:49:30 +0000 (23:49 -0700)]
fsck.f2fs: fix wrongly allocated 0'th block for inline_data

This patch fixes not to allocate any 0'th block for inline_data.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: fix link count correctly
Jaegeuk Kim [Thu, 16 Oct 2014 16:40:16 +0000 (09:40 -0700)]
fsck.f2fs: fix link count correctly

We should do *goto check* if there is something to fix.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: fix wrong hash_code made by previous buggy code
Jaegeuk Kim [Wed, 15 Oct 2014 23:53:25 +0000 (16:53 -0700)]
fsck.f2fs: fix wrong hash_code made by previous buggy code

The previous f2fs remained wrong hash_code for international characters.
So, fsck.f2fs should fix that hash_code with current valid names.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: support inline_dentry
Jaegeuk Kim [Tue, 14 Oct 2014 22:15:40 +0000 (15:15 -0700)]
fsck.f2fs: support inline_dentry

This patch implements inline_dentry feature.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: fix superblock offset
Jaegeuk Kim [Thu, 9 Oct 2014 21:58:40 +0000 (14:58 -0700)]
fsck.f2fs: fix superblock offset

The second offset should be F2FS_BLKSIZE + F2FS_SUPER_OFFSET.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agomkfs.f2fs: avoid build warning
Jaegeuk Kim [Tue, 7 Oct 2014 22:34:28 +0000 (15:34 -0700)]
mkfs.f2fs: avoid build warning

Avoid build warning for printf.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: fix wrong block addres of nids
Jaegeuk Kim [Mon, 29 Sep 2014 18:29:13 +0000 (11:29 -0700)]
fsck.f2fs: fix wrong block addres of nids

This patch avoids assert when nid has wrong block address.
Let's fix this.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agomkfs.f2fs: possible endianes bug in mkfs.f2fs roll-forward speed
joerg jungermann [Fri, 26 Sep 2014 05:05:12 +0000 (22:05 -0700)]
mkfs.f2fs: possible endianes bug in mkfs.f2fs roll-forward speed

I might found a bug in mkfs.f2fs. while experimenting with f2fs on my big
endian MIPS32 device (platform lantiq, 14.07-rc3, uclibc).

I ran into an issue that mkfs.f2fs, was not able to format block devices if I
did not specify the sector count manually.

I hunted it down to lib/libf2fs.c.
After I found that the detected sector count equals to the wanted sector count
shifted left (32+9) times.

I found two issues:
Firstly it uses ioctl BLKGETSIZE, which writes to an uint32_t the size of the
device.
As c->total_sectors is of type uint64_t, the value is written in to the first
4 bytes.
That explained the left shift of 32 bits.

Secondly BLKGETSIZE determines the size of the device in bytes (AFAIK, learned
by observation).
In the first branch of the if-block patched below, the c->total_sectors is
calculated by
  c->total_sectors = stat_buf.st_size / c->sector_size;
The else branch omits the devision. sector_sice is mostly 512, that explained
the left shift by 9 bytes.

 * fixes sector count calculation
 * uses BLKGETSIZE64 if avail

Signed-off-by: joerg jungermann <jj@borkum.net>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agof2fs-tools: fix for build big-endian processors
Jaegeuk Kim [Tue, 23 Sep 2014 05:22:33 +0000 (22:22 -0700)]
f2fs-tools: fix for build big-endian processors

This patch fixes build failure on big-endian systems.

Reported-and-Tested-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agof2fs-tools: release 1.4.0 v1.4.0
Jaegeuk Kim [Thu, 18 Sep 2014 16:57:09 +0000 (09:57 -0700)]
f2fs-tools: release 1.4.0

This version includes:
 - fsck.f2fs fixing corrupted images/partitions
 - dump.f2fs retrieving speicific file
 - bug fixes on f2fsstat and fibmap.f2fs
 - refactor code blocks for android build

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agof2fstat: enhance readability of output
Jaegeuk Kim [Thu, 18 Sep 2014 18:35:53 +0000 (03:35 +0900)]
f2fstat: enhance readability of output

This patch enhances output readability of f2fstat.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agotracepoint.sh: update latest tracepoints
Jaegeuk Kim [Mon, 8 Sep 2014 18:13:00 +0000 (11:13 -0700)]
tracepoint.sh: update latest tracepoints

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agof2fs: rearrange options to remove redundant check
Jaegeuk Kim [Thu, 4 Sep 2014 02:41:44 +0000 (19:41 -0700)]
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>
10 years agofsck.f2fs: add auto_fix feature
Jaegeuk Kim [Wed, 3 Sep 2014 01:07:35 +0000 (18:07 -0700)]
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>
10 years agofsck.f2fs: avoid build warnings
Jaegeuk Kim [Tue, 2 Sep 2014 17:52:56 +0000 (10:52 -0700)]
fsck.f2fs: avoid build warnings

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: remove list.h
Jaegeuk Kim [Sat, 30 Aug 2014 00:15:09 +0000 (17:15 -0700)]
fsck.f2fs: remove list.h

Just use list_head only.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: check next block is free or not
Jaegeuk Kim [Thu, 28 Aug 2014 23:55:45 +0000 (16:55 -0700)]
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>
10 years agofsck.f2fs: fix checkpoint
Jaegeuk Kim [Thu, 28 Aug 2014 21:55:07 +0000 (14:55 -0700)]
fsck.f2fs: fix checkpoint

- fix nat entries
- fix sit entries
- fix checkpoint

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: handle correctly segment summary entries
Jaegeuk Kim [Thu, 28 Aug 2014 20:49:04 +0000 (13:49 -0700)]
fsck.f2fs: handle correctly segment summary entries

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: remove corrupted xattr block
Jaegeuk Kim [Thu, 28 Aug 2014 17:56:14 +0000 (10:56 -0700)]
fsck.f2fs: remove corrupted xattr block

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: corrupted orphan inode will be removed
Jaegeuk Kim [Thu, 28 Aug 2014 17:50:51 +0000 (10:50 -0700)]
fsck.f2fs: corrupted orphan inode will be removed

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: remove dentry if its inode block is corrupted
Jaegeuk Kim [Fri, 29 Aug 2014 18:26:57 +0000 (11:26 -0700)]
fsck.f2fs: remove dentry if its inode block is corrupted

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: add fixing messeages
Jaegeuk Kim [Thu, 28 Aug 2014 17:27:17 +0000 (10:27 -0700)]
fsck.f2fs: add fixing messeages

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: fix inode block inconsistency
Jaegeuk Kim [Fri, 29 Aug 2014 18:46:25 +0000 (11:46 -0700)]
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>
10 years agofsck.f2fs: give a chance to recover sit entries
Jaegeuk Kim [Thu, 28 Aug 2014 00:15:55 +0000 (17:15 -0700)]
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>
10 years agofsck.f2fs: cleanup mount.c
Jaegeuk Kim [Thu, 28 Aug 2014 00:13:23 +0000 (17:13 -0700)]
fsck.f2fs: cleanup mount.c

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: handle error cases
Jaegeuk Kim [Thu, 28 Aug 2014 00:06:17 +0000 (17:06 -0700)]
fsck.f2fs: handle error cases

Do sanity check first and then update metadata.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: remove return value of get_node_info
Jaegeuk Kim [Wed, 27 Aug 2014 23:39:23 +0000 (16:39 -0700)]
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>
10 years agofsck.f2fs: handle IS_VALID_BLK_ADDR
Jaegeuk Kim [Wed, 27 Aug 2014 23:32:06 +0000 (16:32 -0700)]
fsck.f2fs: handle IS_VALID_BLK_ADDR

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: clean up codes
Jaegeuk Kim [Wed, 27 Aug 2014 23:16:16 +0000 (16:16 -0700)]
fsck.f2fs: clean up codes

Fix wrong coding style.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agofsck.f2fs: retry to fix corrupted image
Jaegeuk Kim [Wed, 27 Aug 2014 00:26:01 +0000 (17:26 -0700)]
fsck.f2fs: retry to fix corrupted image

This patch adds a facility to retry conducting fsck.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agof2fs_dentry_hash: avoid casting unsigned char to singed char
Jaegeuk Kim [Tue, 26 Aug 2014 23:28:12 +0000 (16:28 -0700)]
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>
10 years agofsck.f2fs: show inode numbers
Jaegeuk Kim [Tue, 19 Aug 2014 22:10:47 +0000 (15:10 -0700)]
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>
10 years agodump.f2fs: support dump_file from image
Jaegeuk Kim [Tue, 19 Aug 2014 21:05:21 +0000 (14:05 -0700)]
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>
10 years agomkfs.f2fs: remove build warning
Jaegeuk Kim [Tue, 29 Jul 2014 23:24:52 +0000 (16:24 -0700)]
mkfs.f2fs: remove build warning

Should be unsigned int for le32_to_cpu.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agotracepoint.sh: add missing tracepoints
Jaegeuk Kim [Tue, 29 Jul 2014 23:24:11 +0000 (16:24 -0700)]
tracepoint.sh: add missing tracepoints

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agomkfs.f2fs: fix name conflict for BLKDISCARD
Sankalp Bose [Wed, 23 Jul 2014 00:28:14 +0000 (03:28 +0300)]
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>
10 years agomkfs.f2fs: large volume support
Changman Lee [Thu, 10 Jul 2014 06:26:04 +0000 (15:26 +0900)]
mkfs.f2fs: large volume support

This patch supports large volume over about 3TB.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agof2fs-tools: 64-bit compile issue
Mark Salyzyn [Mon, 30 Jun 2014 20:57:17 +0000 (13:57 -0700)]
f2fs-tools: 64-bit compile issue

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Change-Id: I9398b877571d3dabbcb29c87a67d59672ea7fbaa
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agolibf2fs: move the finalize_device() into the io lib.
JP Abgrall [Fri, 13 Jun 2014 20:25:20 +0000 (13:25 -0700)]
libf2fs: move the finalize_device() into the io lib.

This is required so that libf2fs.c can be used against any kind
of device (E.g. an in-memory sparse file) just by linking against
something that provides the libf2fs_io.c functions.

libf2fs is currently libf2fs.c + libf2fs_io.c

Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agomkfs: set BLKDISCARD by default
Jaegeuk Kim [Fri, 13 Jun 2014 08:41:58 +0000 (17:41 +0900)]
mkfs: set BLKDISCARD by default

And let's show some debug info as well.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
10 years agolibf2fs, fsck, mkfs: call f2fs_finalize_device before exit
Jaegeuk Kim [Fri, 13 Jun 2014 07:51:32 +0000 (16:51 +0900)]
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>
10 years agomkfs: support passing in the number of sectors to use
JP Abgrall [Thu, 12 Jun 2014 04:55:38 +0000 (21:55 -0700)]
mkfs: support passing in the number of sectors to use

Adds the optional sectors count:
  mkfs.f2fs [options] device [sectors]

Change-Id: I3ac83121576574bda074140ffa60195a2bc9947b

Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>