History log of /external/f2fs-tools/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
a32b1b97037bc6b7b3bd47dcf2a84ac599725f6a 04-Apr-2017 Dan Willemsen <dwillemsen@google.com> LOCAL_EXPORT_CFLAGS doesn't exist

It's about to exist, but it will be an error to use in normal
Android.mk files.

Test: none, this is a no-op
Change-Id: Id6ed07061a28caf83a54bc06be916446a09b939a
ndroid.mk
5f31e7ad2f783072891c9f2a515821d00dd38cda 26-Jan-2017 Alex Deymo <deymo@google.com> Remove "-host" suffix from libext2* references. am: 52a2cdcb1a am: cd957bfe94 am: efe9697e68
am: 3f26d468d9

Change-Id: I6e6d89e2dac616bdb29921838de7f6cd96c04306
3f26d468d922059f97cfed62c830a04a096d6a0d 26-Jan-2017 Alex Deymo <deymo@google.com> Remove "-host" suffix from libext2* references. am: 52a2cdcb1a am: cd957bfe94
am: efe9697e68

Change-Id: Ib6113b1fc48b908c07dd8462af44abc38faef304
efe9697e6848035da4b0ce843686144b3b7268ff 26-Jan-2017 Alex Deymo <deymo@google.com> Remove "-host" suffix from libext2* references. am: 52a2cdcb1a
am: cd957bfe94

Change-Id: Ib9c1352c15acfd2ef4bc9c97ad3ebfb08af5d049
cd957bfe946e85d105a5490e4d0dead962ab5661 26-Jan-2017 Alex Deymo <deymo@google.com> Remove "-host" suffix from libext2* references.
am: 52a2cdcb1a

Change-Id: I6cc3c8b1d502d75d122545e0803e9a6e052d67ea
52a2cdcb1a313428d9f1b7c72daa2ffcd9f7f805 13-Jan-2017 Alex Deymo <deymo@google.com> Remove "-host" suffix from libext2* references.

Bug: 34220783
Test: make checkbuild

Change-Id: I16b5969da75cc58297c35c34a698a5a5aa80f683
ndroid.mk
7d5285d57f1034ff935665d4527d2bda2fb6a36d 12-Jan-2017 Alex Deymo <deymo@google.com> Remote "_host" and "_static" suffix from libsparse. am: b54dc047e6 am: 4690bb2996 am: 365f4cdb6b
am: 46a72c5e17

Change-Id: Ib27fe08a05d75840b30d13b0057886c334720f56
46a72c5e17b2edaf9c2c45ec205bea5c64ad4f81 12-Jan-2017 Alex Deymo <deymo@google.com> Remote "_host" and "_static" suffix from libsparse. am: b54dc047e6 am: 4690bb2996
am: 365f4cdb6b

Change-Id: Idb4f4a642f70b44b5ace926ed27a16497407fa3c
365f4cdb6b296d067ce531ee8b35dbc1fac21a45 12-Jan-2017 Alex Deymo <deymo@google.com> Remote "_host" and "_static" suffix from libsparse. am: b54dc047e6
am: 4690bb2996

Change-Id: I84d765449d0b4c79a0ee5e3019c84d4a3294825e
4690bb299600aab77e93486d927aa024a9d70129 12-Jan-2017 Alex Deymo <deymo@google.com> Remote "_host" and "_static" suffix from libsparse.
am: b54dc047e6

Change-Id: Iaf9375511455071ab36107ebd5a9807785311c56
b54dc047e6712368a3eb1213e0b902e353cdc1ae 11-Jan-2017 Alex Deymo <deymo@google.com> Remote "_host" and "_static" suffix from libsparse.

Bug: 34220783
Change-Id: Id53ad62fb9d0e9c43e11126c8ce10fde2694c267
ndroid.mk
5bd943d50d103eb6f48a72f199a49dce4feeb61a 11-Dec-2015 Alex Deymo <deymo@google.com> Merge "Rename libext2 host libraries to standard suffix."
fe44650f0c54aa3caebfb5dd6156cd36fbb6c871 10-Dec-2015 Alex Deymo <deymo@google.com> Rename libext2 host libraries to standard suffix.

libext2_uuid_host was renamed to libext2_uuid-host to match the
"-host" suffix used in most libraries.

Bug: 24619596
TEST=m

Change-Id: I1360afa2c507a767a9c1671a5b36d780f53cef62
ndroid.mk
183da748b2ef4a1ae2b0e516fe02a0c8c421a5ce 10-Dec-2015 Alex Deymo <deymo@google.com> Rename libext2 host libraries to standard suffix.

libext2_uuid_host was renamed to libext2_uuid-host to match the
"-host" suffix used in most libraries.

Bug: 24619596
TEST=m

Change-Id: I1360afa2c507a767a9c1671a5b36d780f53cef62
ndroid.mk
3686eecd8c8511ae7ecd7611a2f065b48b484b13 22-May-2015 Jeff Sharkey <jsharkey@android.com> Add make_f2fs module for device.

We now have a lightweight binary (not statically linked) to create
f2fs filesystems on a device. Leaves the existing mkfs.f2fs intact
for recovery to continue using.

Bug: 20275581
Change-Id: Ibe0495ee6fa620f76d77f4dd0b89012ce9682b1b
ndroid.mk
0ba31900a9bb7df6067feabc83bc7c18f04eb1d2 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am 9351bc8f: f2fs-tools: release 1.4.1

* commit '9351bc8fb103be316216a4acde114756172d52d5':
f2fs-tools: release 1.4.1
0cd8b02732b6a7cb255fd899870cec1343e7c6fc 24-Mar-2015 Michael Lass <bevan@bi-co.net> am a16ec08f: f2fstat: fix option parsing

* commit 'a16ec08f3e715c0b4f7cf9c0377e6f18173d410d':
f2fstat: fix option parsing
f20f69c6f7cf5f0e9e2cda22adda22278eb1fe67 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am 3e2c7b7e: fsck.f2fs: remove corrupted data indices in direct node blocks

* commit '3e2c7b7ed31829c836958b87656b286d9ddfa10c':
fsck.f2fs: remove corrupted data indices in direct node blocks
fe5220cd3e0a57833449fa22637462175fef482c 24-Mar-2015 Chao Yu <chao2.yu@samsung.com> am 0bdc3811: mkfs.f2fs: avoid memory leak in mkfs

* commit '0bdc381123301faf15867e8728f6dca34d6a78d6':
mkfs.f2fs: avoid memory leak in mkfs
11d13e72f8ff844a3296436416b890d6633ea741 24-Mar-2015 Chao Yu <chao2.yu@samsung.com> am 400a8406: fsck.f2fs: support large sector size

* commit '400a84068b47b92a45c30a756669062e7d81077c':
fsck.f2fs: support large sector size
45d60078db5c9905ffacd42b29e49cd1a5744fd0 24-Mar-2015 Chao Yu <chao2.yu@samsung.com> am 29ab4d87: mkfs.f2fs: support large sector size

* commit '29ab4d8788d204edb362f01879e1d3d4f516e967':
mkfs.f2fs: support large sector size
4b2d3450ea9ce5216562e12bb67ba60b3837c4ff 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am 8bcdc5fd: fsck.f2fs: readahead node blocks to speed up

* commit '8bcdc5fdb206196241dc6fc535e6d285d4985201':
fsck.f2fs: readahead node blocks to speed up
7efcf4753b3b14be44cf2f26fcb3b86436338ba0 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am 3bcf2237: dump.f2fs: show checkpoint flag

* commit '3bcf2237352307b2e9820e635097358eda3d356e':
dump.f2fs: show checkpoint flag
4115784b9650a6b9bc7ff099e2bec80198f2482a 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am f3b55c8f: fsck.f2fs: fix sit types seamlessly

* commit 'f3b55c8ff22bfd7bfb5588637d08804aca9ac148':
fsck.f2fs: fix sit types seamlessly
69ff5a62777cb3e95d23020cc7d9622c88e4a173 24-Mar-2015 Chao Yu <chao2.yu@samsung.com> am 3f4bcefe: fibmap.f2fs: fix the wrong stat info

* commit '3f4bcefe561da90a2639436dc66a8e6e783ea040':
fibmap.f2fs: fix the wrong stat info
df700233e632a7a16ac0c0b1a967b3c640dc584e 24-Mar-2015 Yann E. MORIN <yann.morin.1998@free.fr> am 55070209: configure: add check for bswap_64

* commit '550702090691af07a3282119ef4f37440c93829e':
configure: add check for bswap_64
08e912905bfe82173c0b263505f3328ef975e7b9 24-Mar-2015 Yann E. MORIN <yann.morin.1998@free.fr> am 3cd5ba14: configure: also check for byteswap.h

* commit '3cd5ba14a4d83e94e1402c4ba1a5c3f030f20d50':
configure: also check for byteswap.h
988eb658633d0fe1cadbb71d96343300cd462453 24-Mar-2015 Jaegeuk Kim <jaegeuk@motorola.com> am 74435241: parse.f2fs: add a tool to parse IO traces made by runtime f2fs

* commit '744352418daf27a99d73649d8d22b315ceafcd34':
parse.f2fs: add a tool to parse IO traces made by runtime f2fs
0e01ed60eb8f845db5728d2c24d87be5f5f0c3ca 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am c511d5d0: dump.f2fs: dump owner of data given block address

* commit 'c511d5d0ec5290dbf1e4e1bc8afc8ddd8feac4c4':
dump.f2fs: dump owner of data given block address
58130ab297860e8243aaf5b20de08d4d07004852 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am 1e69ed2c: fsck.f2fs: no need to fix SIT type for COLD_DATA

* commit '1e69ed2c8a4164968f853a28a8ae54afefaaae4c':
fsck.f2fs: no need to fix SIT type for COLD_DATA
52fd354b827fb61e4ac35c7c7b5a021e43179bd8 24-Mar-2015 Changman Lee <cm224.lee@samsung.com> am 060292e6: mkfs.f2fs: introduce some macros to simplify coding style

* commit '060292e67ad6c191be086c6dd520fd7365050ed6':
mkfs.f2fs: introduce some macros to simplify coding style
96dbe5090f23645298d51d38159ae17c091a0ab6 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am 7dce30f2: fsck.f2fs: remove unused value

* commit '7dce30f2acad0f1f23d566c43e83d3f0098b1c1b':
fsck.f2fs: remove unused value
a7b44af5782f9196ae7c8633472089c1a8ca9dd7 24-Mar-2015 Changman Lee <cm224.lee@samsung.com> am 631e2d98: mkfs.f2fs: fix missing endian conversion

* commit '631e2d9820b5bdb9f79cdcd8c9df7ca7f7ee3e41':
mkfs.f2fs: fix missing endian conversion
a2c2dfcc94ea967f71a2241fdd7ecaa579a54222 24-Mar-2015 Changman Lee <cm224.lee@samsung.com> am a0b4fabc: mkfs: use compact mode for data summaries

* commit 'a0b4fabc5dbadcc523de116dae5151e770a1475f':
mkfs: use compact mode for data summaries
3d212fabdcc1d1aad662668c2d456fb6a22de4cc 24-Mar-2015 JP Abgrall <jpa@google.com> am 97e299da: fsck.f2fs: add a missing \'fixed\' during chk_dentries()

* commit '97e299da3a91d8f558f551d452b4149cb6781750':
fsck.f2fs: add a missing 'fixed' during chk_dentries()
e707715732cb7d5bd2a40f1c8e5ecb5da7855b44 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am 7b5d1181: fsck.f2fs: avoid false alarm on SIT type fix

* commit '7b5d1181a4663c9a55658791de6c04c30e52602a':
fsck.f2fs: avoid false alarm on SIT type fix
1b05470cecd3a3f591a76152de6869db26eb7052 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am fbfd8e3a: fsck.f2fs: remove unneeded return

* commit 'fbfd8e3ae04a2f91ce28d0cb26e4e677b3a0076c':
fsck.f2fs: remove unneeded return
557f29137e9dec8f518a450e86e27ace84dc4807 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am a21f461a: fsck.f2fs: show orphan inodes when fixing partition

* commit 'a21f461a0f945b081e64d4d47356bca918940af7':
fsck.f2fs: show orphan inodes when fixing partition
f2654fd7ae6d230a30105a375e2b8852fb1c87c2 24-Mar-2015 Changman Lee <cm224.lee@samsung.com> am 650ad1e3: mkfs.f2fs: reclaim free space in case of regular file

* commit '650ad1e30cfa51d4e6db639e3da422385b7f7872':
mkfs.f2fs: reclaim free space in case of regular file
f992212c2e36e1da9cdffafe9776db9bf77ef438 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am 0f736527: mkfs.f2fs: give a kernel version for initial format

* commit '0f736527eb38eae3778b8be81921a9c458ad647f':
mkfs.f2fs: give a kernel version for initial format
439de721ea02c07c123db7bcceccd71c2a5dfc51 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am c07795e7: fsck.f2fs: trigger fsck.f2fs when new change was made

* commit 'c07795e73cbc509286e35193759e80d65ee12a44':
fsck.f2fs: trigger fsck.f2fs when new change was made
f0c5e942aec83798c36f71e81a08ac262cb2ae11 24-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> am f54dd91d: fsck.f2fs: fix SIT entry types

* commit 'f54dd91d065c15b84686a3fde7a096786e368201':
fsck.f2fs: fix SIT entry types
9351bc8fb103be316216a4acde114756172d52d5 05-Mar-2015 Jaegeuk Kim <jaegeuk@kernel.org> f2fs-tools: release 1.4.1

This version includes mostly bug fixes.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
ERSION
a16ec08f3e715c0b4f7cf9c0377e6f18173d410d 04-Mar-2015 Michael Lass <bevan@bi-co.net> 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>
ools/f2fstat.c
3e2c7b7ed31829c836958b87656b286d9ddfa10c 24-Feb-2015 Jaegeuk Kim <jaegeuk@kernel.org> 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>
sck/fsck.c
0bdc381123301faf15867e8728f6dca34d6a78d6 06-Feb-2015 Chao Yu <chao2.yu@samsung.com> 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>
kfs/f2fs_format.c
400a84068b47b92a45c30a756669062e7d81077c 05-Feb-2015 Chao Yu <chao2.yu@samsung.com> 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>
sck/mount.c
nclude/f2fs_fs.h
29ab4d8788d204edb362f01879e1d3d4f516e967 05-Feb-2015 Chao Yu <chao2.yu@samsung.com> 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>
ib/libf2fs.c
kfs/f2fs_format.c
kfs/f2fs_format_utils.c
8bcdc5fdb206196241dc6fc535e6d285d4985201 02-Dec-2014 Jaegeuk Kim <jaegeuk@kernel.org> 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>
sck/fsck.c
nclude/f2fs_fs.h
ib/libf2fs_io.c
3bcf2237352307b2e9820e635097358eda3d356e 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>
sck/main.c
nclude/f2fs_fs.h
f3b55c8ff22bfd7bfb5588637d08804aca9ac148 09-Jan-2015 Jaegeuk Kim <jaegeuk@kernel.org> 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>
sck/fsck.c
3f4bcefe561da90a2639436dc66a8e6e783ea040 22-Jan-2015 Chao Yu <chao2.yu@samsung.com> 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>
ools/fibmap.c
550702090691af07a3282119ef4f37440c93829e 25-Dec-2014 Yann E. MORIN <yann.morin.1998@free.fr> 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>
onfigure.ac
nclude/f2fs_fs.h
3cd5ba14a4d83e94e1402c4ba1a5c3f030f20d50 25-Dec-2014 Yann E. MORIN <yann.morin.1998@free.fr> 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>
onfigure.ac
744352418daf27a99d73649d8d22b315ceafcd34 20-Dec-2014 Jaegeuk Kim <jaegeuk@motorola.com> 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>
ools/Makefile.am
ools/f2fs_io_parse.c
c511d5d0ec5290dbf1e4e1bc8afc8ddd8feac4c4 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>
sck/dump.c
sck/f2fs.h
sck/fsck.h
sck/main.c
sck/mount.c
1e69ed2c8a4164968f853a28a8ae54afefaaae4c 25-Nov-2014 Jaegeuk Kim <jaegeuk@kernel.org> 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>
sck/fsck.c
060292e67ad6c191be086c6dd520fd7365050ed6 17-Nov-2014 Changman Lee <cm224.lee@samsung.com> 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>
nclude/f2fs_fs.h
ib/libf2fs.c
kfs/f2fs_format.c
kfs/f2fs_format_main.c
7dce30f2acad0f1f23d566c43e83d3f0098b1c1b 14-Nov-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: remove unused value

Remove build warning.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/fsck.c
631e2d9820b5bdb9f79cdcd8c9df7ca7f7ee3e41 13-Nov-2014 Changman Lee <cm224.lee@samsung.com> 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>
kfs/f2fs_format.c
a0b4fabc5dbadcc523de116dae5151e770a1475f 13-Nov-2014 Changman Lee <cm224.lee@samsung.com> 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>
kfs/f2fs_format.c
97e299da3a91d8f558f551d452b4149cb6781750 14-Nov-2014 JP Abgrall <jpa@google.com> 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>
sck/fsck.c
7b5d1181a4663c9a55658791de6c04c30e52602a 13-Nov-2014 Jaegeuk Kim <jaegeuk@kernel.org> 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>
sck/f2fs.h
sck/fsck.c
sck/mount.c
fbfd8e3ae04a2f91ce28d0cb26e4e677b3a0076c 09-Nov-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: remove unneeded return

To show better output.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/fsck.c
a21f461a0f945b081e64d4d47356bca918940af7 09-Nov-2014 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>
sck/fsck.c
650ad1e30cfa51d4e6db639e3da422385b7f7872 04-Nov-2014 Changman Lee <cm224.lee@samsung.com> 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>
onfigure.ac
kfs/f2fs_format_utils.c
0f736527eb38eae3778b8be81921a9c458ad647f 07-Nov-2014 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>
sck/mount.c
nclude/f2fs_fs.h
kfs/f2fs_format.c
c07795e73cbc509286e35193759e80d65ee12a44 07-Nov-2014 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>
sck/mount.c
nclude/f2fs_fs.h
ib/libf2fs.c
ib/libf2fs_io.c
f54dd91d065c15b84686a3fde7a096786e368201 06-Nov-2014 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>
sck/fsck.c
sck/mount.c
a9b19778ab036b55f7b1a2edcb27c438bc80364e 12-Mar-2015 Ying Wang <wangying@google.com> am 5d72a91b: Install mkfs.f2fs directly to the recovery image.

* commit '5d72a91b852fbb66b9888618de1aeaeb54d120fe':
Install mkfs.f2fs directly to the recovery image.
5d72a91b852fbb66b9888618de1aeaeb54d120fe 10-Mar-2015 Ying Wang <wangying@google.com> Install mkfs.f2fs directly to the recovery image.

Previously it was installed to the ramdisk first and then got copied to
the recovery.img. The depenency wsn't reliable in that way.

Bug: 19666886
Change-Id: I3cb7c3e9b1db67fa2b8174c55ac12775f2cb5b28
ndroid.mk
2a1bc928b621284209c1f5213f8b1a6cf64121b2 10-Mar-2015 Ying Wang <wangying@google.com> Install mkfs.f2fs directly to the recovery image.

Previously it was installed to the ramdisk first and then got copied to
the recovery.img. The depenency wsn't reliable in that way.

Bug: 19666886
Change-Id: I3cb7c3e9b1db67fa2b8174c55ac12775f2cb5b28
ndroid.mk
3f4408b13665bd82dd7edf5c76ed9dccc3a3fce7 08-Nov-2014 JP Abgrall <jpa@google.com> Update fsck to latest version (1.2 -> 1.4.0++ with better fix support)

Merge remote-tracking branch 'goog/lmp-mr1-dev-plus-aosp' into update_to_140

* goog/lmp-mr1-dev-plus-aosp: (45 commits)
fsck.f2fs: actually flag the fixed dentries as fixed
f2fs: use last_blk for print dentries
fsck.f2fs: fix DATA_EXIST flag for old partition
fsck.f2fs: attempt to identify bad dentries
Update build version from 1.2.0 to 1.4.0 after merge.
fsck.f2fs: show inline status of inode
fsck.f2fs: fix wrongly allocated 0'th block for inline_data
fsck.f2fs: fix link count correctly
fsck.f2fs: fix wrong hash_code made by previous buggy code
fsck.f2fs: support inline_dentry
fsck.f2fs: fix superblock offset
mkfs.f2fs: avoid build warning
fsck.f2fs: fix wrong block addres of nids
mkfs.f2fs: possible endianes bug in mkfs.f2fs roll-forward speed
f2fs-tools: fix for build big-endian processors
f2fs-tools: release 1.4.0
f2fstat: enhance readability of output
tracepoint.sh: update latest tracepoints
f2fs: rearrange options to remove redundant check
fsck.f2fs: add auto_fix feature
...

Bug: 17640053
Bug: 18292088
Change-Id: Idab448af4fccd7033ca5e3e55e3f3472673df622
Signed-off-by: JP Abgrall <jpa@google.com>
100ea9f321b92fa1e15889ec0ef72b6b8929459d 03-Nov-2014 JP Abgrall <jpa@google.com> 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>
sck/fsck.c
0ca82d1b7231fdda4d1062b4a852d2aa53fa8316 31-Oct-2014 Jaegeuk Kim <jaegeuk@kernel.org> f2fs: use last_blk for print dentries

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/fsck.c
9464be283ebdbb17c8940bea6c8a4f7acb75299a 31-Oct-2014 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>
sck/fsck.c
nclude/f2fs_fs.h
2c82eafaa38922a370545dc56d6210bf94b929e9 29-Oct-2014 JP Abgrall <jpa@google.com> 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>
sck/fsck.c
nclude/f2fs_fs.h
93fa3d4f268e8c772fd00812077a9a8cb3173fde 28-Oct-2014 JP Abgrall <jpa@google.com> Update build version from 1.2.0 to 1.4.0 after merge.

Change-Id: I055399adc13a81a7007a5723720368274b012fe7
ndroid.mk
20cc47abbad6e8aa7c0301ffa0f9947dad32a0dd 19-Oct-2014 Jaegeuk Kim <jaegeuk@kernel.org> 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>
sck/mount.c
e90e81703d3245e14d90fcb1bdb5a6c6cdd6393e 19-Oct-2014 Jaegeuk Kim <jaegeuk@kernel.org> 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>
sck/fsck.c
df2501e140764a8b67fc22388985359836760a0b 16-Oct-2014 Jaegeuk Kim <jaegeuk@kernel.org> 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>
sck/fsck.c
866c86a6376598c1e72141de2805ba0f43e6daaa 16-Oct-2014 Jaegeuk Kim <jaegeuk@kernel.org> 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>
sck/fsck.c
3a8c9a69525f75a6c59bee0eb3d882ddc341b3f1 15-Oct-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: support inline_dentry

This patch implements inline_dentry feature.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/f2fs.h
sck/fsck.c
sck/fsck.h
nclude/f2fs_fs.h
4c992fe23ae6739767f584a96157d0585282d8e2 09-Oct-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: fix superblock offset

The second offset should be F2FS_BLKSIZE + F2FS_SUPER_OFFSET.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/mount.c
0b72253b7e46d3c0d98769a0afcbf71efc0153ec 08-Oct-2014 Jaegeuk Kim <jaegeuk@kernel.org> mkfs.f2fs: avoid build warning

Avoid build warning for printf.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
kfs/f2fs_format_main.c
e1a8e74e66682503dfdc497ccbb5900eede0ccaf 29-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> 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>
sck/f2fs.h
290d040e855230dbc21c35ccec7ee76fa6696567 26-Sep-2014 joerg jungermann <jj@borkum.net> 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>
ib/libf2fs.c
7b74ed3d7cc84c3bb7e85b825cf17540baa3bbfa 23-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> 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>
nclude/f2fs_fs.h
cc5b242329f977271f19a06e9e584aee11ba48e0 18-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> 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>
ERSION
d83693c3de5497a09d66d7a1ea3a62dab7c7c452 18-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> f2fstat: enhance readability of output

This patch enhances output readability of f2fstat.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
ools/f2fstat.c
15ddc8243e3d5183a068b7a3ca7191a6324c9b8e 08-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> tracepoint.sh: update latest tracepoints

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
cripts/tracepoint.sh
f62ef03338d2a69f78bd04e611899ce8fb73f096 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 73b6e3eb: f2fs: rearrange options to remove redundant check

* commit '73b6e3eb4e944338edd80b4f27c29b7aa31c76f2':
f2fs: rearrange options to remove redundant check
f67245ed91a6a1ab1e6c5afb6fe071b6af097800 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am de6c1c7c: fsck.f2fs: add auto_fix feature

* commit 'de6c1c7ce25841547813c71ca3b6d067300f0530':
fsck.f2fs: add auto_fix feature
05e1b039b0a7a73e90e0b558b9368eb6a008f5c4 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am bc6a7000: fsck.f2fs: avoid build warnings

* commit 'bc6a70006baab16bf51e9cc7a7b042f734d4ccd2':
fsck.f2fs: avoid build warnings
724c037a5d1a536858972af97c8d258d1de40f0e 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 50442acc: fsck.f2fs: remove list.h

* commit '50442accacf4e9c49e87bdb00378fe0ddee0266a':
fsck.f2fs: remove list.h
27ff19fcb82c9084c156b4a27f5f409695bba033 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 10d97dd1: fsck.f2fs: check next block is free or not

* commit '10d97dd1b386abcceec1b1bf590a3711d93e8c1c':
fsck.f2fs: check next block is free or not
649b22362722394eb85516cb16c974672e8cd503 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 893312ce: fsck.f2fs: fix checkpoint

* commit '893312ced238b9ee93c5427aa6e6c1f29fe39899':
fsck.f2fs: fix checkpoint
0e294ee6f57245fb9e1667ab776b50f0b53b9aa9 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 6591dadc: fsck.f2fs: handle correctly segment summary entries

* commit '6591dadcb05b7787dfa4c703728f773069dece04':
fsck.f2fs: handle correctly segment summary entries
93076c0be489793f1d0286d3ad0846a697afc604 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 1118af29: fsck.f2fs: remove corrupted xattr block

* commit '1118af29cae53275851c3b1f7ef266e67cc7e2a7':
fsck.f2fs: remove corrupted xattr block
292ae251c246e68a9b6afdafc25fd6fad0d630b5 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 83e54446: fsck.f2fs: corrupted orphan inode will be removed

* commit '83e54446710466a0c4493236079184131f0004ce':
fsck.f2fs: corrupted orphan inode will be removed
6338a48f79eb3f8fcc592aa65dc873f81e556163 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 6b20b0d6: fsck.f2fs: remove dentry if its inode block is corrupted

* commit '6b20b0d6788b4e7241c3acad1560d8eaad80b319':
fsck.f2fs: remove dentry if its inode block is corrupted
776f186654a4d1e1c831ec8fbc51a80c59987cec 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 269eac2e: fsck.f2fs: add fixing messeages

* commit '269eac2e0346e92fa1428bbfbc3fa50233f8c4ef':
fsck.f2fs: add fixing messeages
9a13ab5de452a47a7a637554371f8bea7111f76e 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am dc530859: fsck.f2fs: fix inode block inconsistency

* commit 'dc530859c5e422b10ab70bc3b9d4b7ff0d004d57':
fsck.f2fs: fix inode block inconsistency
d7fce61c51193548e4501fde3d55d3acf203ab94 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am fffeed79: fsck.f2fs: give a chance to recover sit entries

* commit 'fffeed796a79fa6621d01b0e4c5fa18d9d89cdd7':
fsck.f2fs: give a chance to recover sit entries
d2318d927a8b1ffd6b64810a5da3eb5922fa0415 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 59c0e13e: fsck.f2fs: cleanup mount.c

* commit '59c0e13ed90a6395e5cdaaed1608358c799bb0e4':
fsck.f2fs: cleanup mount.c
8dbe9bb91255c7a9a7b46a009594377e1a92950d 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 3b4b8263: fsck.f2fs: handle error cases

* commit '3b4b82634489b2f9d367b1f897d51a341208d163':
fsck.f2fs: handle error cases
48dd55399347b63d9dec383f30618df8f231ef7d 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 02d04218: fsck.f2fs: remove return value of get_node_info

* commit '02d04218720248f35ee2bcf4ca34c8b0e6e05140':
fsck.f2fs: remove return value of get_node_info
6c1b1aa144df3c7045f8213b65ad52bbf90cbca8 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am e9cd4dee: fsck.f2fs: handle IS_VALID_BLK_ADDR

* commit 'e9cd4deec85930bed5862c7cd136d2dcc0e02907':
fsck.f2fs: handle IS_VALID_BLK_ADDR
6b7580013091c2c8227578fe52cc29d2d22d0d2f 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am b3a4f945: fsck.f2fs: clean up codes

* commit 'b3a4f9457718eb1aecb85d082f9e6f737ce3af86':
fsck.f2fs: clean up codes
d9b0c97d5951ab479007265ba1432bdf0cec9264 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am f4ef4a14: fsck.f2fs: retry to fix corrupted image

* commit 'f4ef4a14e978e7328037b43a8a6ec9d2a2d4bb5a':
fsck.f2fs: retry to fix corrupted image
e0a581f169513e63f5a669c45b01b923dcf3ad79 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 347fe81d: f2fs_dentry_hash: avoid casting unsigned char to singed char

* commit '347fe81d8e860d29a254ac066d87c5efe87d717b':
f2fs_dentry_hash: avoid casting unsigned char to singed char
39118ee4b55361917d80bfb9cf80a2e39d3a8880 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am ab258b43: fsck.f2fs: show inode numbers

* commit 'ab258b431b634f4980f279db22cbee83271f6f16':
fsck.f2fs: show inode numbers
df72e3f63415e07e33bc4120a23cd1645f716009 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am f70644c5: dump.f2fs: support dump_file from image

* commit 'f70644c5047f9f912836724a994ccab18b5b5dd1':
dump.f2fs: support dump_file from image
81fb55f336c87c80fc2690bc70e872d395398aff 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 7ee48ff6: mkfs.f2fs: remove build warning

* commit '7ee48ff62736696b7277559f30459a80ce3c41a7':
mkfs.f2fs: remove build warning
a1ed22b4a26aa34e47d3a9e208cb0d5c9dcdca95 09-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> am b2e14869: tracepoint.sh: add missing tracepoints

* commit 'b2e1486930099e858d81a2e3b11ee98b227fd38e':
tracepoint.sh: add missing tracepoints
44dfb798abb7aed64d810fde9f6162ea3320e5a5 09-Sep-2014 Sankalp Bose <sankalp@tuxera.com> am ba91378e: mkfs.f2fs: fix name conflict for BLKDISCARD

* commit 'ba91378ec599572f0a47c44f4cd6a975a2f99653':
mkfs.f2fs: fix name conflict for BLKDISCARD
210340c32781763e88ead50d428b1e09064d581b 09-Sep-2014 Changman Lee <cm224.lee@samsung.com> am 2794728f: mkfs.f2fs: large volume support

* commit '2794728f818c72541be052d1b54559d79d8a3aa7':
mkfs.f2fs: large volume support
6a641fecc45a700ec5651f48a73c8b02dac9df24 09-Sep-2014 Mark Salyzyn <salyzyn@google.com> am c246ccf8: f2fs-tools: 64-bit compile issue

* commit 'c246ccf8447c47801ae0912ca356831a18c77895':
f2fs-tools: 64-bit compile issue
73b6e3eb4e944338edd80b4f27c29b7aa31c76f2 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>
sck/fsck.c
sck/main.c
sck/mount.c
nclude/f2fs_fs.h
de6c1c7ce25841547813c71ca3b6d067300f0530 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>
sck/main.c
sck/mount.c
nclude/f2fs_fs.h
bc6a70006baab16bf51e9cc7a7b042f734d4ccd2 02-Sep-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: avoid build warnings

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/dump.c
sck/fsck.c
50442accacf4e9c49e87bdb00378fe0ddee0266a 30-Aug-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: remove list.h

Just use list_head only.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/f2fs.h
10d97dd1b386abcceec1b1bf590a3711d93e8c1c 29-Aug-2014 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>
sck/f2fs.h
sck/fsck.c
sck/mount.c
893312ced238b9ee93c5427aa6e6c1f29fe39899 28-Aug-2014 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>
sck/f2fs.h
sck/fsck.c
sck/fsck.h
sck/mount.c
6591dadcb05b7787dfa4c703728f773069dece04 28-Aug-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: handle correctly segment summary entries

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/fsck.c
sck/mount.c
1118af29cae53275851c3b1f7ef266e67cc7e2a7 28-Aug-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: remove corrupted xattr block

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/fsck.c
sck/fsck.h
83e54446710466a0c4493236079184131f0004ce 28-Aug-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: corrupted orphan inode will be removed

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/fsck.c
6b20b0d6788b4e7241c3acad1560d8eaad80b319 29-Aug-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: remove dentry if its inode block is corrupted

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/fsck.c
269eac2e0346e92fa1428bbfbc3fa50233f8c4ef 28-Aug-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: add fixing messeages

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/fsck.c
nclude/f2fs_fs.h
dc530859c5e422b10ab70bc3b9d4b7ff0d004d57 29-Aug-2014 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>
sck/fsck.c
nclude/f2fs_fs.h
ib/libf2fs_io.c
fffeed796a79fa6621d01b0e4c5fa18d9d89cdd7 28-Aug-2014 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>
sck/fsck.c
sck/fsck.h
sck/mount.c
59c0e13ed90a6395e5cdaaed1608358c799bb0e4 28-Aug-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: cleanup mount.c

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/mount.c
3b4b82634489b2f9d367b1f897d51a341208d163 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>
sck/fsck.c
sck/fsck.h
sck/main.c
sck/mount.c
nclude/f2fs_fs.h
02d04218720248f35ee2bcf4ca34c8b0e6e05140 28-Aug-2014 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>
sck/dump.c
sck/fsck.c
sck/fsck.h
sck/mount.c
e9cd4deec85930bed5862c7cd136d2dcc0e02907 28-Aug-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: handle IS_VALID_BLK_ADDR

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/f2fs.h
sck/fsck.c
b3a4f9457718eb1aecb85d082f9e6f737ce3af86 28-Aug-2014 Jaegeuk Kim <jaegeuk@kernel.org> fsck.f2fs: clean up codes

Fix wrong coding style.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/dump.c
sck/f2fs.h
sck/fsck.c
sck/fsck.h
nclude/f2fs_fs.h
f4ef4a14e978e7328037b43a8a6ec9d2a2d4bb5a 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>
sck/fsck.c
sck/main.c
nclude/f2fs_fs.h
347fe81d8e860d29a254ac066d87c5efe87d717b 27-Aug-2014 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>
sck/fsck.c
nclude/f2fs_fs.h
ib/libf2fs.c
ab258b431b634f4980f279db22cbee83271f6f16 20-Aug-2014 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>
sck/fsck.c
f70644c5047f9f912836724a994ccab18b5b5dd1 19-Aug-2014 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>
sck/dump.c
nclude/f2fs_fs.h
ib/libf2fs_io.c
7ee48ff62736696b7277559f30459a80ce3c41a7 30-Jul-2014 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>
kfs/f2fs_format.c
b2e1486930099e858d81a2e3b11ee98b227fd38e 30-Jul-2014 Jaegeuk Kim <jaegeuk@kernel.org> tracepoint.sh: add missing tracepoints

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
cripts/tracepoint.sh
ba91378ec599572f0a47c44f4cd6a975a2f99653 23-Jul-2014 Sankalp Bose <sankalp@tuxera.com> 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>
onfigure.ac
kfs/Makefile.am
kfs/f2fs_format_utils.c
2794728f818c72541be052d1b54559d79d8a3aa7 10-Jul-2014 Changman Lee <cm224.lee@samsung.com> 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>
nclude/f2fs_fs.h
kfs/f2fs_format.c
c246ccf8447c47801ae0912ca356831a18c77895 30-Jun-2014 Mark Salyzyn <salyzyn@google.com> 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>
sck/dump.c
sck/mount.c
fc24ac8347630a14d62ffafa93a27ec3b81cc44b 30-Jun-2014 JP Abgrall <jpa@google.com> am ce2c9c36: libf2fs: move the finalize_device() into the io lib.

* commit 'ce2c9c36924b4fc3786cd0e6440031d788f641aa':
libf2fs: move the finalize_device() into the io lib.
a78c2885b591a8fbcfc572bbd0b4b614434bde1c 30-Jun-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 1ddf6367: libf2fs, fsck, mkfs: call f2fs_finalize_device before exit

* commit '1ddf6367a3b5e8e586dee1bcbf9c363439ea3ec8':
libf2fs, fsck, mkfs: call f2fs_finalize_device before exit
ce2c9c36924b4fc3786cd0e6440031d788f641aa 13-Jun-2014 JP Abgrall <jpa@google.com> 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

Change-Id: I65451596e6b9c654b1ff356de4812d113e80dda8
Signed-off-by: JP Abgrall <jpa@google.com>
ib/libf2fs.c
ib/libf2fs_io.c
1ddf6367a3b5e8e586dee1bcbf9c363439ea3ec8 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>
Change-Id: I145413c94339d8941e4d7da8545ca017e76c61f2
sck/main.c
nclude/f2fs_fs.h
ib/libf2fs.c
kfs/f2fs_format.c
kfs/f2fs_format_main.c
kfs/f2fs_format_utils.c
kfs/f2fs_format_utils.h
e32870c4a28432c488eef59b878516b61bbb059f 25-Jun-2014 JP Abgrall <jpa@google.com> am 00dc8a1c: F2FS fmt as shared lib, and static tool for /sbin/

* commit '00dc8a1c6c87acf687e64e66cfc2fd7ca28e646e':
F2FS fmt as shared lib, and static tool for /sbin/
00dc8a1c6c87acf687e64e66cfc2fd7ca28e646e 14-Jun-2014 JP Abgrall <jpa@google.com> F2FS fmt as shared lib, and static tool for /sbin/

It now uses
external/e2fsprogs/lib/uuid: for uuid routine.
system/extras/f2fs_utils: io utils to work on sparse files.

Change-Id: I3d86315f2f6f8693532e26a664c7f2c230fd60e3
Signed-off-by: JP Abgrall <jpa@google.com>
ndroid.mk
84a009de3fb28cb78255393f7703719f5e14f6be 21-Jun-2014 JP Abgrall <jpa@google.com> am f590f39c: Update the NOTICE + license files to match LGPL v2.1 in COPYING

* commit 'f590f39c3542b502891ed24941b688b44b8f44af':
Update the NOTICE + license files to match LGPL v2.1 in COPYING
f590f39c3542b502891ed24941b688b44b8f44af 20-Jun-2014 JP Abgrall <jpa@google.com> Update the NOTICE + license files to match LGPL v2.1 in COPYING

Bug: 14572627
Change-Id: I0cc770a5eb5f8e493a8827c34d9fc3b893ba3927
Signed-off-by: JP Abgrall <jpa@google.com>
ODULE_LICENSE_GPL
ODULE_LICENSE_LGPL
OTICE
4541c654d214dfda426f3ee9590a78b1c8d2a79e 14-Jun-2014 JP Abgrall <jpa@google.com> F2FS fmt as shared lib, and static tool for /sbin/

It now uses
external/e2fsprogs/lib/uuid: for uuid routine.
system/extras/f2fs_utils: io utils to work on sparse files.

Change-Id: I3d86315f2f6f8693532e26a664c7f2c230fd60e3
Signed-off-by: JP Abgrall <jpa@google.com>
ndroid.mk
5e62d3ab84335733a5d9150fcd075181957dfd7b 14-Jun-2014 JP Abgrall <jpa@google.com> am 5005fb18: libf2fs: move the finalize_device() into the io lib.

* commit '5005fb18214a234e944dcb74a10b8719f672add2':
libf2fs: move the finalize_device() into the io lib.
5d14a84b10585057864f0b70bba124287c7528c9 14-Jun-2014 Jaegeuk Kim <jaegeuk@kernel.org> am 46bf13d5: mkfs: set BLKDISCARD by default

* commit '46bf13d5afbdd87d0cacaa06ec159cf9546c5726':
mkfs: set BLKDISCARD by default
dc06d265a4bbfd918bdbf3225e0d07fb878cb890 14-Jun-2014 Jaegeuk Kim <jaegeuk@kernel.org> am c5786963: libf2fs, fsck, mkfs: call f2fs_finalize_device before exit

* commit 'c5786963aef93bb7747cb04454e1041738b3255f':
libf2fs, fsck, mkfs: call f2fs_finalize_device before exit
5005fb18214a234e944dcb74a10b8719f672add2 13-Jun-2014 JP Abgrall <jpa@google.com> 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

Change-Id: I65451596e6b9c654b1ff356de4812d113e80dda8
Signed-off-by: JP Abgrall <jpa@google.com>
ib/libf2fs.c
ib/libf2fs_io.c
46bf13d5afbdd87d0cacaa06ec159cf9546c5726 13-Jun-2014 Jaegeuk Kim <jaegeuk@kernel.org> mkfs: set BLKDISCARD by default

And let's show some debug info as well.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Change-Id: I0a1e1b251038968ef884eec55a770e747582ace5
kfs/Makefile.am
kfs/f2fs_format_utils.c
c5786963aef93bb7747cb04454e1041738b3255f 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>
Change-Id: I145413c94339d8941e4d7da8545ca017e76c61f2
sck/main.c
nclude/f2fs_fs.h
ib/libf2fs.c
kfs/f2fs_format.c
kfs/f2fs_format_main.c
kfs/f2fs_format_utils.c
kfs/f2fs_format_utils.h
7d7fe9a01a24bf2a10a87e08dedb061d28dbbb9a 13-Jun-2014 JP Abgrall <jpa@google.com> am 94f92855: mkfs: support passing in the number of sectors to use

* commit '94f92855ceae3de54cbbfef146b14fdedac49654':
mkfs: support passing in the number of sectors to use
9055af2e91460743ea4a775187dcb7714d11c4b6 13-Jun-2014 JP Abgrall <jpa@google.com> am 4b32bd42: License tweak: LGPL v2.1 vs LGPL v2

* commit '4b32bd42bc5bef74c4d8d8d3c7a503289dc676bc':
License tweak: LGPL v2.1 vs LGPL v2
1ed23e3dc3cc8ecbb38e4fa0e1341f1bcf037576 13-Jun-2014 Changman Lee <cm224.lee@samsung.com> am fd9816f3: fsck.f2fs: large volume support

* commit 'fd9816f31e5cd668962f00511d7a91d055d76048':
fsck.f2fs: large volume support
94f92855ceae3de54cbbfef146b14fdedac49654 12-Jun-2014 JP Abgrall <jpa@google.com> 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>
ib/libf2fs.c
kfs/f2fs_format_main.c
4b32bd42bc5bef74c4d8d8d3c7a503289dc676bc 12-Jun-2014 JP Abgrall <jpa@google.com> License tweak: LGPL v2.1 vs LGPL v2

The important part is

b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.

Change-Id: Ic1a02ec5cfcb2bedda3d53f3061037e1e7437221
Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
OPYING
fd9816f31e5cd668962f00511d7a91d055d76048 12-May-2014 Changman Lee <cm224.lee@samsung.com> fsck.f2fs: large volume support

This patch support large volume over about 3TB.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
[Jaegeuk Kim: add missing cp_payload in f2fs_super_block]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
sck/f2fs.h
sck/fsck.c
sck/mount.c
nclude/f2fs_fs.h
ib/libf2fs.c
55254964df702000ab43bee38baf066355dea641 06-Jun-2014 Jaegeuk Kim <jaegeuk@kernel.org> am f2a99037: fibmap: need linux/fs.h for FIBMAP

* commit 'f2a99037496d7139d61c0170f620ee891e2892c8':
fibmap: need linux/fs.h for FIBMAP
f4eea4e2efc24ca4ee443876594aa2d9e775fb07 06-Jun-2014 Jaegeuk Kim <jaegeuk.kim@samsung.com> am 6d7fd131: f2fs: fix to remove the test code that should not be merged

* commit '6d7fd1311b82025646fbe6581fdef2583be33455':
f2fs: fix to remove the test code that should not be merged
51c7e2f0fc6426edd69659b65f175eb62a7123ee 06-Jun-2014 Jaegeuk Kim <jaegeuk.kim@samsung.com> am 0fbdf6cb: f2fs-tools: announce dual licenses with GPL and LGPL v2

* commit '0fbdf6cbd4dfc633454eba2f841c123789e297ad':
f2fs-tools: announce dual licenses with GPL and LGPL v2
f2a99037496d7139d61c0170f620ee891e2892c8 20-May-2014 Jaegeuk Kim <jaegeuk@kernel.org> fibmap: need linux/fs.h for FIBMAP

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
ools/fibmap.c
6d7fd1311b82025646fbe6581fdef2583be33455 09-May-2014 Jaegeuk Kim <jaegeuk.kim@samsung.com> f2fs: fix to remove the test code that should not be merged

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
0fbdf6cbd4dfc633454eba2f841c123789e297ad 06-Apr-2014 Jaegeuk Kim <jaegeuk.kim@samsung.com> f2fs-tools: announce dual licenses with GPL and LGPL v2

This patch announces LGPL v2 for the following files.
- include/f2fs_fs.h
- lib/libf2fs.c
- lib/libf2fs_io.c
- mkfs/f2fs_format.c
- mkfs/f2fs_format_main.c
- mkfs/f2fs_format_utils.c
- mkfs/f2fs_format_utils.h

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
OPYING
nclude/f2fs_fs.h
ib/libf2fs.c
ib/libf2fs_io.c
kfs/f2fs_format.c
kfs/f2fs_format_main.c
kfs/f2fs_format_utils.c
kfs/f2fs_format_utils.h
2ce6396c85757fcf4d1a944509064231725aded1 15-May-2014 JP Abgrall <jpa@google.com> am 6c759bb0: am 3c85e737: Cleanup various build warnings (signed vs unsigned, unused vars,...)

* commit '6c759bb0b0f49e03ecbb545da14c542f7814ff5b':
Cleanup various build warnings (signed vs unsigned, unused vars,...)
6c759bb0b0f49e03ecbb545da14c542f7814ff5b 15-May-2014 JP Abgrall <jpa@google.com> am 3c85e737: Cleanup various build warnings (signed vs unsigned, unused vars,...)

* commit '3c85e737308ef95629b232745d6a8d141d87cc9a':
Cleanup various build warnings (signed vs unsigned, unused vars,...)
3c85e737308ef95629b232745d6a8d141d87cc9a 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>
sck/fsck.c
sck/fsck.h
sck/main.c
sck/mount.c
nclude/f2fs_fs.h
nclude/list.h
ib/libf2fs.c
ib/libf2fs_io.c
kfs/f2fs_format.c
kfs/f2fs_format_main.c
kfs/f2fs_format_utils.c
ools/fibmap.c
2337a74a8199015eba39aa4b93e78f43fa8578d5 14-May-2014 Torne (Richard Coles) <torne@google.com> am af1c5a6a: am 9948e364: Disable building f2fs-tools on non-linux.

* commit 'af1c5a6ab1c510e5092a43a4298692c0870e37c1':
Disable building f2fs-tools on non-linux.
dcb8f9d56712dd308e9db3ea3f52adba0bf83ef4 14-May-2014 JP Abgrall <jpa@google.com> am 161a3260: (-s ours) am c1b507fb: Build mkfs, mkfs lib, and fsck for Android

* commit '161a32609d788f9d14357e7ec05608573dc271e9':
Build mkfs, mkfs lib, and fsck for Android
af1c5a6ab1c510e5092a43a4298692c0870e37c1 14-May-2014 Torne (Richard Coles) <torne@google.com> am 9948e364: Disable building f2fs-tools on non-linux.

* commit '9948e364c3ebd5b11750f91d444ac1afe1369833':
Disable building f2fs-tools on non-linux.
161a32609d788f9d14357e7ec05608573dc271e9 14-May-2014 JP Abgrall <jpa@google.com> am c1b507fb: Build mkfs, mkfs lib, and fsck for Android

* commit 'c1b507fb329eac46b938ad45573f587a4dd838a2':
Build mkfs, mkfs lib, and fsck for Android
9948e364c3ebd5b11750f91d444ac1afe1369833 14-May-2014 Torne (Richard Coles) <torne@google.com> Disable building f2fs-tools on non-linux.

The f2fs-tools code depends on the linux kernel headers being available
in the system include path; disable building it on non-linux platforms
until this is fixed.

Change-Id: Ibf490863cc31a694ce9d05845fea9e570c4104d2
ndroid.mk
140f403b6bb3f6b694d759a86ebe07185e45eae5 14-May-2014 Torne (Richard Coles) <torne@google.com> Disable building f2fs-tools on non-linux.

The f2fs-tools code depends on the linux kernel headers being available
in the system include path; disable building it on non-linux platforms
until this is fixed.

Change-Id: Ibf490863cc31a694ce9d05845fea9e570c4104d2
ndroid.mk
3b1946fe0bc5cee4eedcf1134e198cfa947280da 08-May-2014 JP Abgrall <jpa@google.com> Build mkfs, mkfs lib, and fsck for Android

For now it relies on the e2fsprogs uuid library.
It also uses the un-implemented functions from mntent.h.
It gracefully falls back to something else, but will complain with
"""FILE* setmntent(...)(3) is not implemented on Android"""

Change-Id: Ic4c44c596656191a0b2291ce3cf93f994d5c8552
ndroid.mk
c1b507fb329eac46b938ad45573f587a4dd838a2 08-May-2014 JP Abgrall <jpa@google.com> Build mkfs, mkfs lib, and fsck for Android

For now it relies on the e2fsprogs uuid library.
It also uses the un-implemented functions from mntent.h.
It gracefully falls back to something else, but will complain with
"""FILE* setmntent(...)(3) is not implemented on Android"""

Change-Id: Ic4c44c596656191a0b2291ce3cf93f994d5c8552
ndroid.mk
f6c72bbfc2ffde1d1aeb138bc2622286c59aa98c 07-May-2014 Qiwen Zhao <zhao@google.com> reset to 64a201c with history
64a201c8987d484fc47c6940494cdf860cb06f85 07-May-2014 Bill Yi <byi@google.com> Add NOTICE and MODULE_LICENSE_GPL
ODULE_LICENSE_GPL
OTICE
feab6f4a9954cc1b2c779b43af3e1b1fc8c4b5bf 07-May-2014 Qiwen Zhao <zhao@google.com> initial blank commit
a35529fce0c5171562ec0ebebcc6120d1604924b 01-Apr-2014 JP Abgrall <jpa@google.com> format: add support for dev_fill() and extra dev_*() debugging.

Support an fs_io dev_fill().
This helps with devices that actually already return 0 on uninitialized
data. It also helps with in memory devices using sparse libs: don't
allocate a block of 0s.

Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
nclude/f2fs_fs.h
ib/libf2fs_io.c
kfs/f2fs_format.c
15ea79b3ae7f0474ade43ba8b6eb328806e01e15 06-Feb-2014 JP Abgrall <jpa@google.com> further split up lib2fs so that it does not do any IO directly.

This will allow turning mkfs into a libarary more easily.

Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ib/Makefile.am
ib/libf2fs.c
ib/libf2fs_io.c
af3c6803bd3db784531ff5675c539eef4bae1a15 06-Feb-2014 JP Abgrall <jpa@google.com> split up mkfs format into main and just the format code.

This will allow using the format code as a library.

Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/Makefile.am
kfs/f2fs_format.c
kfs/f2fs_format_main.c
kfs/f2fs_format_utils.h
2f229b89a7756be7df9f36f232b7b0901c1c6e53 26-Mar-2014 Dongho Sim <dh.sim@samsung.com> mkfs: fix wrong extension count

fix an bug related to extension list.
there was the potential bug in set_cold_files function, namei.c.

Signed-off-by: Dongho Sim <dh.sim@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
379ff8916e8b3fd19bca44265b70e50584be2c31 03-Mar-2014 Natanael Copa <ncopa@alpinelinux.org> fibmap.f2fs: compile fix for musl libc

Include sys/types.h for major/minor macros.

This fixes the following compile error with musl libc:
fibmap.o: In function `print_stat':
/home/ncopa/src/f2fs-tools/tools/fibmap.c:34: undefined reference to `minor'
/home/ncopa/src/f2fs-tools/tools/fibmap.c:34: undefined reference to `major'
fibmap.o: In function `stat_bdev':
/home/ncopa/src/f2fs-tools/tools/fibmap.c:54: undefined reference to `minor'
/home/ncopa/src/f2fs-tools/tools/fibmap.c:54: undefined reference to `major'
collect2: error: ld returned 1 exit status

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ools/fibmap.c
99250ec1aa15ea329fb090fd8f4c1e7e7b50bba3 27-Feb-2014 Jaegeuk Kim <jaegeuk.kim@samsung.com> mkfs: support large directory

This patch synchronizes mkfs with the latest f2fs configuration in which
supports large directory by assigning dir_level.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
nclude/f2fs_fs.h
kfs/f2fs_format.c
192d979c61719dd1a44eb845033e949dcabba3e7 25-Feb-2014 Jaegeuk Kim <jaegeuk.kim@samsung.com> fsck: remove build warnings

This patch casts some variable types to remove build warnings.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/fsck.c
c15df2285d1e6b7cee8bd9fd23007ab23db16d82 13-Feb-2014 Changman Lee <cm224.lee@samsung.com> f2fstat: add nat caches and free nids

This patch shows nat caches and free nids using f2fs.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ools/f2fstat.c
b7906af37f1de9d4dfc47c55fa4578d204f5ea3f 13-Feb-2014 Changman Lee <cm224.lee@samsung.com> f2fstat: show cp count calling f2fs

This patch is to inform how many checkpoint is called.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ools/f2fstat.c
4ff7400c519a8f644b8181756939fcb313345c12 06-Feb-2014 Changman Lee <cm224.lee@samsung.com> f2fstat: add memory information used by f2fs

This patch adds memory information used by f2fs.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ools/f2fstat.c
858c4039c85f7c00c57925902985701b1e083555 05-Feb-2014 Jaegeuk Kim <jaegeuk.kim@samsung.com> mkfs, fsck: change the results for readability

This patch cleans up several printing formats.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/dump.c
sck/fsck.c
sck/mount.c
nclude/f2fs_fs.h
kfs/f2fs_format.c
28d45d09cd138420449d63c479755339a7b33050 29-Jan-2014 Changman Lee <cm224.lee@samsung.com> f2fstat: add option to select partition to see status

If there are some partitions, this may select a partition to see its
status. If no selection, you will see first section of status.

e.g.) f2fstat -p /dev/sda3

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ools/f2fstat.c
0255d52ebf3ce596804d6a631c61e6039b2bf271 28-Jan-2014 Jaegeuk Kim <jaegeuk.kim@samsung.com> mkfs: fix the wrong nat bitmap size

We should consider checksum bytes in the checkpoint block.
Previously, this bug incured very critical panics for node entry handling.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
4f267323a28c3fb50fa08256517e2dae4e347b2d 20-Jan-2014 Jaegeuk Kim <jaegeuk.kim@samsung.com> f2fs-tools: resolve build warnings

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/fsck.c
kfs/f2fs_format.c
kfs/f2fs_format_utils.c
b611e1155a67be8220ceefc36d8ab5abae926d19 15-Jan-2014 Changman Lee <cm224.lee@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.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ools/fibmap.c
e296161af0a2429f36b155a1ab75095f6e0a81f9 15-Jan-2014 Changman Lee <cm224.lee@samsung.com> f2fs-tools: move fsck/fibmap.f2fs to tools/

Let's move miscellaneous utilities into tools directory.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/Makefile.am
sck/fibmap.c
ools/Makefile.am
ools/fibmap.c
a0a5567e3e2bdf81b71c7e8c6f801f8d55dcbb6e 10-Jan-2014 Changman Lee <cm224.lee@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.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
akefile.am
onfigure.ac
ools/Makefile.am
ools/f2fstat.c
6da30100ee0f64687c5e1bc84bf86f0e312261d9 10-Jan-2014 JP Abgrall <jpa@google.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.

Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
cb54e79739672366d849e02a3068f857c6bb544c 09-Jan-2014 JP Abgrall <jpa@google.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.

Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
nclude/f2fs_fs.h
437dbf67730d2765c4dfc8539b07258e1ca3966f 11-Jan-2014 JP Abgrall <jpa@google.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.

Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/Makefile.am
kfs/f2fs_format.c
kfs/f2fs_format_utils.c
kfs/f2fs_format_utils.h
1aae03594ba111174ed4902a29b969a1fb145adf 26-Dec-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> fibmap: fix wrong block count

This is an obvious bug fix patch.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/fibmap.c
061ee67915ba3e8c86bde89a2efb1b8a9aadfb37 25-Oct-2013 Huajun Li <huajun.li@intel.com> f2fs-tools: add inline data check

Add inline data check

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>
sck/fsck.c
nclude/f2fs_fs.h
11d187cdfa2dcf504aa25b5a1aab4228f19f22ff 15-Dec-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> README: add libtool guide

The f2fs-tools needs libtool package to compile sources.

Suggested-by: Sérgio Benjamim <sergio_br2@ig.com.br>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
EADME
ffbada4298c7aed059bb99a8d553d6dd555963c0 11-Nov-2013 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.

Reported-and-tested-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
f1d452af4a353380483b916a3e1c44fc8eb796b7 30-Oct-2013 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.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/fsck.c
576cb469e73b9342f1d10ba5d0428bbce22cbc3b 25-Oct-2013 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

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ERSION
2ad1fcd800747851a1db9a84acc87086c621f54d 17-Oct-2013 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.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
5b9f641c0608ad87f127b4cb766de91d7d80449a 17-Oct-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> scripts: add some scripts

1. dumpf2fs.sh
: to see internal device with hexdump
2. spo_test.sh
: to run SPOR
3. tracepoint.sh
: to turn on tracepoints

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
cripts/dumpf2fs.sh
cripts/spo_test.sh
cripts/tracepoint.sh
050e8712a60c7d982a7be8c076fb72452364dae4 17-Oct-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> README: add description how to cross-compile

This patch adds description for the cross-compilation.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
EADME
8e678b2edfba95f3edbb1730c69da365d659e95d 16-Oct-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> fsck: fix checking orphan inodes

This patch fixes bugs in the orphan inode procedure.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/fsck.c
465e4e7f10f59efba184fdd0788e92ea1488011c 08-Oct-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> libf2fs: avoid warning of implicit declaration

This patch adds extern declaration.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
nclude/f2fs_fs.h
76a069430a295a27bf478d4a5d2fd71112a11a54 08-Oct-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> fsck: fix to handle file types correctly

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

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/fsck.c
nclude/f2fs_fs.h
78b795e05d411e28f2480f78ad9225bd21e199fe 08-Oct-2013 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.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/fsck.c
b155ea8e18a2de5a5d09d3c969cc6fd79a04cb1d 31-Aug-2013 Changman Lee <cm224.lee@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

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ib/libf2fs.c
kfs/f2fs_format.c
cd1e4704d0cbf1cbb49b3f33c576566b4b1e296e 20-Aug-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> fsck, lib: support inline xattr

This patch adjusts the modification to handle inline xattrs.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/fsck.c
sck/mount.c
nclude/f2fs_fs.h
ib/libf2fs.c
9455376cd0edcc37219bcb089dff440624719667 08-Aug-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> fibmap.f2fs: change fibmap to fibmap.f2fs

The fibmap tool is for debugging f2fs especially.

CC: Changman Lee <cm224.lee@samsung.com>
CC: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/Makefile.am
e23d58533c631a1babd29dcf732c99c9cc4f8e89 08-Aug-2013 Changman Lee <cm224.lee@samsung.com> f2fs-tools: add stat information into fibmap

This patch shows stat information about a file with fragmented state.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/fibmap.c
6e8f2d5d222eff0abea4b5c0abc7433834094924 07-Aug-2013 Changman Lee <cm224.lee@samsung.com> f2fs-tools: add debug message for checking xattr

This patch adds debug message to confirm xattr block is checked.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/fsck.c
sck/fsck.h
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>
sck/main.c
nclude/f2fs_fs.h
ib/libf2fs.c
kfs/f2fs_format.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>
sck/fsck.c
sck/main.c
nclude/f2fs_fs.h
ib/libf2fs.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>
sck/main.c
223fdf3e00a56cb32fb8c69dc4523ee53ff7731a 30-Jul-2013 Changman Lee <cm224.lee@samsung.com> f2fs-tools: cleanup debug statement

The debug message is too verbose therefore decrease message.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/dump.c
sck/mount.c
c81ded6cf03fc15e5f48a24664713fdc714875ec 30-Jul-2013 Changman Lee <cm224.lee@samsung.com> f2fs-tools: fix missing function declaration

Explicitly declare function name.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/fsck.h
8e19033a635ca778ba089d5cf341e26728d77711 30-Jul-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> libf2fs: add an error message for a mounted device

We need to notify the mounted device.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ib/libf2fs.c
dfe2a3384fbacb960463088176654bbf13c106e4 18-Jul-2013 Changman Lee <cm224.lee@samsung.com> f2fs-tools: add fibmap

This is to get physical location of file data.
We can check the percentage of fragmentation on a file.

Note that it uses fsync to get exact blkaddr.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/Makefile.am
sck/fibmap.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>
sck/dump.c
sck/fsck.c
sck/fsck.h
sck/main.c
sck/mount.c
0307b93ce2e44e80a1efb279894601ae64ffaf47 15-Jul-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> fsck: fix name search

The next name slots should be calculated by F2FS_SLOT_LEN not F2FS_NAME_LEN.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
sck/fsck.c
679ca83b9e1a0ca36da9de0919e91377055bd9a9 16-Jul-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> mkfs: add apk extension to indicate cold files

Android systems uses apks for their application packages.
These files are normally used as read-only.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.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>
hangeLog
akefile.am
onfigure.ac
sck/Makefile.am
sck/dump.c
sck/f2fs.h
sck/fsck.c
sck/fsck.h
sck/main.c
sck/mount.c
nclude/f2fs_fs.h
nclude/list.h
ib/libf2fs.c
716ea385bee0afe55ca7b18d49ed23df473288ef 28-Jun-2013 Wang Sheng-Hui <shhuiw@gmail.com> mkfs: fix the total_zones calculation in f2fs_prepare_super_block

We can count the main area as the data zones. Remove the '-1' miscalcuation.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
c5bf205a4d7a4e8efad80849bf016e4299935734 19-Jun-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> mkfs: fix to store __le32 for checkpoint flags

The checkpoint flags also should be stored as little endian style.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
cc9d9caeb6853d38297d97d3dd4731c452418f02 19-Jun-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> lib, mkfs: fix endian conversion for crc calculation

Let's store the crc value for the checkpoint blocks with __le32.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
nclude/f2fs_fs.h
kfs/f2fs_format.c
b6ae58ed44827fb10f04227d5b1b79d68228f994 13-Jun-2013 Oded Gabbay <ogabbay@advaoptical.com> mkfs: fix bug in endianness at f2fs_update_nat_root

This patch fixes a bug in the function "f2fs_update_nat_root", where the
access to the array "nat_blk->entries" was done using an index without
encapsulation of the "le32_to_cpu" macro.
The bug happens when trying to format an SD card in a powerpc architecture,
which natively runs at big-endian mode

Signed-off-by: Oded Gabbay <ogabbay@advaoptical.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
fef98ebdf3a7728017cb3d0ae4ffedc5405e531d 03-Apr-2013 Changman Lee <cm224.lee@samsung.com> mkfs: add option to disable trim at format

This patch adds an option to disable trim command at format.
Default operation sends trim command to device.

Signed-off-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
nclude/f2fs_fs.h
kfs/f2fs_format.c
9799d6364dc93e1fd259d812d4a50ed984a6456b 03-Apr-2013 Mike Fleetwood <mike.fleetwood@googlemail.com> mkfs: handle labels longer than 16 characters

Mkfs copies labels up to 512 characters into a the 16 character buffer
config.vol_label corrupting memory afterwards and causing a core dump.

# mkfs.f2fs -l aaaaaaaaaabbbbbbbbbbcccccccccc /dev/sda12

F2FS-tools: mkfs.f2fs Ver: 1.1.0 (2013-03-08)

Info: Label = aaaaaaaaaabbbbbbbbbbcccccccccc
Info: sector size = 512
Info: total sectors = 2097152 (in 512bytes)
Info: zone aligned segment0 blkaddr: 256
Segmentation fault (core dumped)

Make config.vol_label a pointer to the label in argv, rather than
copying it into a too small buffer.

Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
nclude/f2fs_fs.h
ib/libf2fs.c
kfs/f2fs_format.c
089d0e7202147a7e81796c38e2d704c144403fef 03-Apr-2013 Mike Fleetwood <mike.fleetwood@googlemail.com> mkfs: default to blank label

Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ib/libf2fs.c
8d3802b257de83686a327c8e4fa84fba32b563ff 31-Mar-2013 Namjae Jeon <namjae.jeon@samsung.com> mkfs: fix to avoid format of device when already mounted

In case of embedded devices, where /etc/ is mounted as 'read-only'.
We donot have the /etc/mtab file. So, checking if the device is already
mounted from this file is not sufficient.
Try to read /proc/mounts in case of failure from /etc/mtab.

Issue logs:
/dev/sdb4 /mnt vfat rw,relatime,fmask=0022,dmask=0022,codepage=cp437,
iocharset=ascii,errors=remount-ro 0 0

Here device - sb4 is already mounted.
But, when trying to format using mkfs.f2fs

F2FS-tools: Ver: 1.1.0 (2013-01-14)
Info: sector size = 512
Info: total sectors = 13108784 (in 512bytes)
WARN: Align start sector number in a unit of pages
i.e., start sector: 2542124, ofs:4 (sectors per page: 8)
Info: zone aligned segment0 blkaddr: 186
Info: This device doesn't support TRIM
Info: format successful

After Change:

F2FS-tools: Ver: 1.1.0 (2013-01-14)
Error: /dev/sdb4 is already mounted

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ib/libf2fs.c
1dc688d2fd232697c91613c63205387a1952194d 02-Apr-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> build: revert "Compile static by default"

By default, we should use dynamic linking.
If anyone need to build 100% statically, add -all-static.

This reverts commit 2eb19102d4c5bec57c04c944ee697584a493ef9c.
kfs/Makefile.am
f5f440f08643f6b35ad0dd70a54805a5383c4a62 03-Mar-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> build: change f2fs_fs.h

Let's sync f2fs_fs.h in the kernel source tree.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
nclude/f2fs_fs.h
e1e843d29cf00962113f5239952fef434b1011ac 12-Feb-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> build: compile static by default

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/Makefile.am
5043dffbd1d2b89c71966dde31780b0ca313b5c9 12-Feb-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> build: clean up the base functions

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
nclude/f2fs_fs.h
ib/libf2fs.c
kfs/f2fs_format.c
e69e4378500b836863dfb7f6e88e39935f23ae80 25-Jan-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> build: make several base functions as a library

Let's make a library and relocate functions for other tools like fsck.f2fs.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
gitignore
akefile.am
onfigure.ac
nclude/f2fs_fs.h
ib/Makefile.am
ib/libf2fs.c
an/mkfs.f2fs.8
kfs/Makefile.am
kfs/f2fs_format.c
2784bd55dd9730f3a5d2126c82094990fad053c1 25-Jan-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> build: sync f2fs_fs.h with current f2fs sources

Rearrange positions of all the data structures for easy synchronization between
f2fs-tools and f2fs kernel sources.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
nclude/f2fs_fs.h
40b9f96587c191269a41b20bd2bd5000fc9db259 25-Jan-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> build: move f2fs_format.h to ../include/f2fs_fs.h

This is to use f2fs.h globally, which will be used by other tools such as
fsck.f2fs.

Siged-mff-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
nclude/f2fs_fs.h
kfs/Makefile.am
kfs/f2fs_format.c
kfs/f2fs_format.h
28af021c91bb0d86187f9b81b3ff6ceafe6867c1 23-Jan-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> build: add description of prerequisite to build

Let's check two more packages before building f2fs-tools.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
EADME
d2387723a8f47a3c860d2c67436232ccad764caf 14-Jan-2013 Jaegeuk Kim <jaegeuk.kim@samsung.com> mkfs: reserve x2 sections

This is due to GC on data sections.
When a data section is cleaned, it produces maximum same number of dirty node
blocks additionally.
So, we should reserve x2 sections to flush dirty node blocks safely.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
c7e0a01375c82307e07dd7527f0a57ed41273575 12-Dec-2012 Jan Engelhardt <jengelh@inai.de> build: place mkfs into sbindir

Filesystem creation utilities have always been in *sbin*.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
kfs/Makefile.am
8471b6a2000da44711706f9874e8cf42fb2aa51d 12-Dec-2012 Jan Engelhardt <jengelh@inai.de> build: replace obsolete build macros

AM_CONFIG_HEADER is obsolete. Since v1.6.1b(!) already.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
onfigure.ac
2a8c4b1373f04b33f438eb44d0f88b29d292b7bf 12-Dec-2012 Jan Engelhardt <jengelh@inai.de> build: set some automake options

Use "foreign", so that we are not forced to have all files GNU
requires. It also gets us rid of the INSTALL boilerplate.

Use tar-pax dist-xz to select a modern compression scheme.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
NSTALL
EWS
onfigure.ac
ec1a5da78810b5b6f6b4c829b8a77971f6b7b834 12-Dec-2012 Jan Engelhardt <jengelh@inai.de> build: make use of AC_CONFIG_AUX_DIR

Place most of the autogenerated files in a separate directory that can
be ignored wholesale, thereby reducing files in the top-level
directory.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
gitignore
onfigure.ac
abb6bb88bca47908be5bd88f51225cf92c370e29 12-Dec-2012 Jan Engelhardt <jengelh@inai.de> Update .gitignore

Mark directories to be ignored as such.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
gitignore
fe2928a79363c6c339d74105251e4f4675e08021 12-Dec-2012 Jan Engelhardt <jengelh@inai.de> build: use pkgconfig to determine libuuid's parameters

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
onfigure.ac
kfs/Makefile.am
b1bce4d3b754fdd0d92adfb0c4ba0c6690abf49c 12-Dec-2012 Jan Engelhardt <jengelh@inai.de> build: remove unnecessary m4_flatten

automake can cope with it as-is.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
onfigure.ac
07b815d39509135e35856cfd30b83930a0af8250 12-Dec-2012 Ezequiel Garcia <ezequiel@free-electrons.com> mkfs: Make HDIO_GETGEO ioctl optional

Some block devices don't implement HDIO_GETGEP ioctl;
loop device being a notable example.
Without this patch, it's not possible to make a f2fs
on a file mounted over a loop device.

Signed-off-by: Ezequiel Garcia <ezequiel@free-electrons.com>
kfs/f2fs_format.c
807776acbf4baf038b23b82928e19d0f591a3be1 07-Dec-2012 Sven-Göran Bergh <sgb@systemasis.org> More files git should ignore

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
gitignore
dd1ba078fae270c4174a221a873026fea85aae32 07-Dec-2012 Sven-Göran Bergh <sgb@systemasis.org> Unify version and date management

Patch 1:
Now we have two different versions that produce different superblocks/
filesystems with the same version info. Major/minor version in the sb
should reflect the version of the tool creating the filesystem. This
patch will ensure that the version entered in the file VERSION will
be used consistently throughout the code.

Patch 2:
In order to simplify the maintenance with a new release the date
in F2FS_TOOLS_DATE is now take from the last commit in git. Thus,
git is needed to run autoconf. However, git is not needed for the
simple build procedure, ./configure && make, that should be the
only things needed to build the tool from a tar.gz package.

Pros & Cons:
[+] Automated
[+] True
[-] Git needed to run autoreconf

Change log by Jaegeuk from the initial patch-set:

- Merge two patches into one
: Eliminate the intermediate state having version.h and VERSION.

- Remove the Git dependency which is one of Cons
: If there is no git tree, just use DATE described in VERSION.

- Minor coding style

Pros & Cons:
[+] Automated
[+] True
[+] No Git dependency

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ERSION
onfigure.ac
kfs/f2fs_format.c
kfs/f2fs_format.h
ersion.h
c0f2b9065c36213a271f18c6c7672a9311d26b5b 05-Dec-2012 Sven-Göran Bergh <sgb@systemasis.org> Ignore configure.lineno

Autotools may spit out the file configure.lineno, which git
should ignore as well.

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
gitignore
da59f6146c37e727bb83ae4922ca56d42958e61c 28-Nov-2012 Jaegeuk Kim <jaegeuk.kim@samsung.com> Sync the version management

For debian packaing, I should have matched the previous verions, v1.1.0.
So, this is the start of f2fs-tools version.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
ersion.h
8bdf26205db63dad57fb477620bf6456d4613ae2 26-Nov-2012 Jaegeuk Kim <jaegeuk.kim@samsung.com> Add version information

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
ersion.h
c6ff6d09de5fdacbab7c31e861238397d3bd788e 13-Nov-2012 Jaegeuk Kim <jaegeuk.kim@samsung.com> Bug fix: Fix overflow when calculating block address

This patch fixes the bug as follows.
"I'm trying to roll out f2fs on top of SDHC card and faced with following
issue - after mounting card I cannot read device root entry. It returns
-1 EINVAL (entry too big).
getdents(3, /* 1 entries */, 32768) = 24
getdents(3, 0x1082c88, 32768) = -1 EINVAL (Invalid argument)"
reported by Ruslan N. Marchenko [me@ruff.mobi].

This bug is easily reproducible and I couldn't have checked the mount
entry cautiously.
Due to the bug, f2fs couldn't get default dentries, . and .., in the root
directory. In the case of other newly created directories, that's fine.

The problem was the overflow during casting variables while calculating the
block address of the root dentry block.
In order to avoid that, I simply split the equation under consideration of
the casting issue.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
bbf6e62360d8eae415dc7d19325b7d70079db0e1 31-Oct-2012 Jaegeuk Kim <jaegeuk.kim@samsung.com> Cleanup: sync comments to kernel source

Remove unnecessary data fields too.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
kfs/f2fs_format.h
4ed75df3792dc700fd7f38eefcae61e05c5b12b4 30-Oct-2012 Jaegeuk Kim <jaegeuk.kim@samsung.com> Bug fix: store superblocks with correct offset

There are two superblock writes in mkfs.f2fs.

offset: 0 1024 4095 5119 8191
|------> 1'st superblock ----|--------> 2'nd superblock ----|

Therefore, each superblocks has 1024 byte-size offset.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
kfs/f2fs_format.h
0903d1e42908aab9fe0cd90de1c4a0733a645ed6 29-Oct-2012 Mike Frysinger <vapier@gentoo.org> touch up autotools

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
onfigure.ac
e12214e836318348070f26a42425f52b6b0c0ed7 29-Oct-2012 Mike Frysinger <vapier@gentoo.org> ignore generated files

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
gitignore
3dd5f8b400a27c2a14945a1c09d5585aee3e4dd8 29-Oct-2012 Mike Frysinger <vapier@gentoo.org> use proper priu64 type to be portable

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
kfs/f2fs_format.c
9db27ee071d576027d91e74d8c610e7fb238fb94 29-Oct-2012 Jaegeuk Kim <jaegeuk.kim@samsung.com> Cleanup: add comments

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.h
22a75edd47adea7d466ecd245c62b75fd1866628 29-Oct-2012 Jaegeuk Kim <jaegeuk.kim@samsung.com> Enhancement: shorten umount time

When f2fs is unmounted cleanly, it stores active summmary blocks of nodes in the
checkpoint pack in order to avoid reconstruct all of them at the later mount
time. Previously, mkfs didn't prepare that, which is why the initial mount time
is so huge.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
kfs/f2fs_format.h
99b74393403aab847587d6c37cd1aaf1d935a81d 29-Oct-2012 Jaegeuk Kim <jaegeuk.kim@samsung.com> Enhancement: add uuid

"Usually, it is used 128-bits UUID for serial number. Why do you use
__le32 as volume_serial_number?"
>From Vyacheslav Dubeyko.

I added an uuid facility for the serial number.
And sync with kernel/include/linux/f2fs_fs.h.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
EADME
onfigure.ac
kfs/Makefile.am
kfs/f2fs_format.c
kfs/f2fs_format.h
b5af7953f81018c9edd844bd1bc9f4f6752a756a 29-Oct-2012 Jaegeuk Kim <jaegeuk.kim@samsung.com> Enhancement: add i_atime and i_generation

"You appear to have dropped i_btime - no big deal, you weren't using it anyway.
However if you ever want to support NFS export you will need some value which
is assigned when the inode is allocated and never changed until it is
de-allocated. This is used to detect when an NFS file-handle refers to a
previous incarnation of an inode and so should be rejected as STALE.
i_btime could have possibly provided this, but not any more. You might want
to add something back.
ext3 uses "i_generation" and has an 's_next_generation' in the superblock to
ensure that each new inode gets a new generation number.

You've also dropped i_atime. I can certainly understand the desire to do
that, but I wonder if it is entirely wise. There are some use-cases where
i_mtime is a poor substitute.

Also 'current_depth' looks a little odd without a 'i_' prefix. It wouldn't
hurt to have a comment noting that it is for directories."

>From Neil Brown.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
kfs/f2fs_format.c
kfs/f2fs_format.h
036d45e551ca5405c726f8ccb51f446620cd4af4 26-Oct-2012 Jaegeuk Kim <jaegeuk.kim@gmail.com> mkfs: Initial commit for patch v2 series

This is same as f2fs-tools-1.1.0.tar.gz, and for patch v2 in kernel.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@gmail.com>
UTHORS
OPYING
hangeLog
NSTALL
akefile.am
EWS
EADME
onfigure.ac
4/.gitignore
an/Makefile.am
an/mkfs.f2fs.8
kfs/Makefile.am
kfs/f2fs_format.c
kfs/f2fs_format.h