Commit Graph

1064 Commits

Author SHA1 Message Date
Liu Xue
43095ca4c2 fsck.f2fs: deal with realloc failure
Deal with realloc failure to avoid memory leak and memory free.

Signed-off-by: Xue Liu <liuxueliu.liu@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-12-02 13:35:46 -08:00
Jaegeuk Kim
67de42f76a fsck.f2fs: support a readonly filesystem
If f2fs is mounted as ro, we can do fsck.f2fs.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-11-22 11:26:52 +08:00
Jaegeuk Kim
ee48fd2ced fsck.f2fs: declare static function
This avoids the following warning.

mount.c:783:27: warning: SM_I is static but used in inline function
check_seg_range which is not static.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-11-22 11:26:52 +08:00
Jaegeuk Kim
c134e0eb2b f2fs-tools: release 1.5.0
This version includes bug fixes on fsck.f2fs and also support of more precise
overprovision selection and a preen mode.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-11-05 10:47:04 -08:00
Jaegeuk Kim
5489249c23 fsck.f2fs: support a preen mode
Generic fsck uses -p, preen mode, and fsck.f2fs can support it as -a for now.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-10-23 14:03:29 -07:00
Jaegeuk Kim
2cdb04b52f mkfs.f2fs: support <1% overprovision ratio
Big partition size needs uner 1% overprovision space to acquire more space.

    section  ovp ratio  ovp size
For 8TB,
    -s1    : 0.07%     -> 10GB
    -s32   : 0.39%     -> 65GB
    -s64   : 0.55%     -> 92GB
    -s128  : 0.78%     -> 132GB

For 128GB,
    -s1    : 0.55%     -> 1.4GB
    -s32   : 3.14%     -> 8GB
    -s64   : 4.45%     -> 12GB
    -s128  : 6.32%     -> 17GB

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-09-25 10:32:12 -07:00
Jaegeuk Kim
e8766f2887 fsck.f2fs: check sit types for node or data only
Previously, check_sit_types didn't handle different numbers of active logs and
SSR cases. But, it didn't cause any problem since fixing sit types is harmless.
Nevertheless, we still don't need to change them all.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-09-24 09:52:14 -07:00
Jaegeuk Kim
555138c23b man: fix missing description for overprovision ratio
This patch updates mkfs.f2fs man page to indicate the automatic ovp
calculation.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-09-23 15:20:49 -07:00
Jaegeuk Kim
6e2b58dcaf mkfs.f2fs: fix wrong ovp space calculation on large section
If a section consists of multiple segments, we should change the equation
to apply it on reserved space.

On 128GB,

option                 overprovision area         reserved area
-o5 -s128              9094                       6144
-o5 -s64               6179                       3072
-o5 -s1                3309                       48
-o1 -s128              27009                      26624
-o1 -s64               13831                      13312
-o1 -s1                858                        208

-s1                    858                        208
-s64   *               13831                      13312
-s128  *               27009                      26624
: * should be wrong.

After patch,

-s1    (ovp:1%)        858                        208
-s64   (ovp:4%)        6172                       3712
-s128  (ovp:6%)        8721                       5120

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-09-23 14:59:30 -07:00
Jaegeuk Kim
6f9c275125 mkfs.f2fs: don't need to limit MIN_VOLUME SIZE
The minimum volume size is determined while preparing superblock.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-08-10 17:58:40 -07:00
Jaegeuk Kim
0d6d08e3f5 mkfs.f2fs: set overprovision size more precisely
This patch introduces to set the default overprovision space according to the
partition size in order to provide more space.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-08-10 17:57:17 -07:00
Jaegeuk Kim
01219c7b19 mkfs.f2fs: fix wrong documentation
The -s should be the number of segments per a section.

Reported-by: Marc Lehmann <schmorp@schmorp.de>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-08-10 10:59:36 -07:00
Yunlei He
e9f8ae8b3e fsck.f2fs: add segment type in sit_dump
Add segment type information in sit_dump:

	[sit_dump:  48] SIT[0x12905] : 0x  1 : 0
	[sit_dump:  48] SIT[0x12906] : 0x  1 : 5
	[sit_dump:  48] SIT[0x12907] : 0x  7 : 4
	[sit_dump:  48] SIT[0x12908] : 0x  1 : 3

The last column output message on behalf of segment type like
CURSEG_XXX_TYPE.

Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-07-16 13:39:55 -07:00
Jaegeuk Kim
ca1436eeef fsck.f2fs: drop extent_info to avoid potential wrong access
This patch avoids wrong extent information modified by fixing block addresses.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-07-01 18:54:00 -07:00
Jaegeuk Kim
7ac070116b fsck.f2fs: select to update the latest valid summary
If two dnode blocks indicate one block address, it needs to keep the latest
valid address selectively.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-07-01 18:53:58 -07:00
Jaegeuk Kim
d24f1bb16d fsck.f2fs: add hash conversion for encrypted dentries
If dentry is encrypted, we should convert its hash value.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-05-07 15:50:49 -07:00
Jaegeuk Kim
641d98f26d fsck.f2fs: avoid build warning
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-05-07 15:48:18 -07:00
Jaegeuk Kim
4476615d26 dump.f2fs: show i_advise field in inode
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-04-23 18:40:52 -07:00
Jaegeuk Kim
f6eef57a69 fsck.f2fs: show superblock features and encryption info
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-04-23 17:36:21 -07:00
Jaegeuk Kim
6e6c713240 mkfs.f2fs: set encryption feature
This patch add to support encryption feature.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-04-21 20:06:16 -07:00
Jaegeuk Kim
65950fc736 fsck.f2fs: show ckeckpoint version info
This patch shows the valid checkpoint version number.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-04-10 10:36:06 -07:00
Jaegeuk Kim
97c08935f8 Revert "mkfs.f2fs: 512 UTF-16 characters for label"
The mkfs.f2fs gets 512 characters, which will be recorded as UTF-16 characters.

This reverts commit fb5eef1d7e.
2015-04-03 15:59:31 -07:00
Jaegeuk Kim
1f65c1f61f fsck.f2fs: fix orphan inode's link count
This patch fixes orphan inode's link count as 0.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-31 20:32:12 -07:00
Jaegeuk Kim
f1e4f9c0e9 fsck.f2fs: fix missing dentries
If a directory has no dot and dotdot dentries, fsck.f2fs sets inline_dots for
the inode so that f2fs module can handle that properly.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-30 13:37:24 -07:00
Jaegeuk Kim
56b8930368 fsck.f2fs: clean up child information
This patch adds a child_info data structure to clean up dirty parameters.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-30 13:00:54 -07:00
Jaegeuk Kim
e358413d4c fsck.f2fs: fix missing i_links
If a child is a directory, we should increase parent's i_links.
Previously, it counts direct dentry blocks excluding indirect blocks.
This patch fixes to count child_cnt correctly in order to get precise i_links.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-30 12:27:40 -07:00
Jaegeuk Kim
4d60a126e1 fsck.f2fs: count child directories correctly for i_links
If some of children including directories are corrupted, we should not include
them into i_links of their parent.
This patch fixes that.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-30 10:40:17 -07:00
Jaegeuk Kim
22a8ae0a1f fsck.f2fs: fix corrupted dentries
This patch fixes corrupted dentries such as name_len == 0.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-27 16:34:48 -07:00
Jaegeuk Kim
562ec5aaf9 fsck.f2fs: fix summary block
Previously, if data and node summary was corrupted, the block was deallocated.
But, this patch fixes their summary first, so that we can keep their blocks.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-27 16:34:48 -07:00
Jaegeuk Kim
fce2ff183e fsck.f2fs: return summary block pointer and types
This patch adds to return summry_block pointer to callers, which will be used
when fixing them.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-27 16:34:48 -07:00
Jaegeuk Kim
4a3116409f fsck.f2fs: preserve orphan blocks
If fsck.f2fs found some orphan blocks, previously fsck.f2fs drops them and
fixes checkpoint, resulting in false alarm on corruption.
This patch preserves orphan blocks to avoid such the alarms.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-27 16:34:46 -07:00
Jaegeuk Kim
278863e9ee fsck.f2fs: skip block count fix when i_links is fixed
If i_links is wrong, we should not check block count, since it doesn't count
correctly which results in changing the block count to 1.

This patch fixes that.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-25 19:26:25 -07:00
Jaegeuk Kim
c0feedadd9 fsck.f2fs: fix inodes having wrong i_links
This patch fixes inodes which have wrong i_links.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-25 18:51:53 -07:00
Jaegeuk Kim
e17732608c fsck.f2fs: check file types
If the file type is mismatched, we should drop that inode.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-25 18:18:04 -07:00
Jaegeuk Kim
7d253ac582 fsck.f2fs: remove inconsistent named directories
Each inode has its filename inside inode block.
For directory, the name should be matched all the time.
In other cases, it shouldn't, since there is able to be linked to other file
names.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-25 17:50:06 -07:00
Jaegeuk Kim
a81e54404c fsck.f2fs: reduce redundant message
This assert message is unnecessary to be shown, since caller shows the reason
already.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-25 17:16:51 -07:00
Jaegeuk Kim
fb5eef1d7e mkfs.f2fs: 512 UTF-16 characters for label
We can use 512 UTF-16 characters for label.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-24 00:20:15 -07:00
Jaegeuk Kim
e3ab1425c7 mkfs.f2fs: add quite mode, -q
This patch add a quite mode as -q.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-24 00:19:27 -07:00
Jaegeuk Kim
fea6162a6d fsck.f2fs: show total sectors consumed by filesystem
This patch shows the information about the number of total sectors composing
filesystem.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-20 17:07:48 -07:00
Jaegeuk Kim
7ba9eec293 fsck.f2fs: show cp_state for fsck.f2fs
This patch adds to show cp_state during fsck.f2fs.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-20 17:01:41 -07:00
Jaegeuk Kim
c93d54a186 mkfs.f2fs: show bytes for total_sectors
This patch shows correct information about total_sectors.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-20 16:49:24 -07:00
Gustavo Zacarias
3c160e7d11 configure: add check for fallocate
We need to check for fallocate() rather than just linux/falloc.h +
FALLOC_FL_PUNCH_HOLE since in uClibc we've got both but still not
fallocate() itself since it's only implemented in newer unreleased
versions.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-13 16:37:09 -04:00
Anthony G. Basile
5792951de2 f2fs-tools: fix build system to make distcheck correctly
The current build system fails to `make distcheck` correctly
for two reasons: 1) Some header files are not listed in the
source files for fsck.f2fs and mkfs.f2fs, and so don't make it
into the dist tarball.  2) By setting a default prefix in
configure.ac, the mock install doesn't add the correct prefix
and instead tries to install directly to the file system.

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

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-08 20:23:13 -07:00
Jaegeuk Kim
fd32210229 f2fs-tools: release 1.4.1
This version includes mostly bug fixes.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-03-04 20:35:37 -08:00
Michael Lass
737e0e9564 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>
2015-03-03 16:10:23 -08:00
Jaegeuk Kim
e1f3c00695 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>
2015-02-24 19:12:46 -08:00
Chao Yu
0c12db3410 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>
2015-02-08 23:09:46 -08:00
Chao Yu
37580f1c5b 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>
2015-02-05 18:42:46 -08:00
Chao Yu
b6012fd6a1 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>
2015-02-05 18:42:01 -08:00
Jaegeuk Kim
631f8166bb 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>
2015-01-29 13:36:54 -08:00