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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>