Commit Graph

129 Commits

Author SHA1 Message Date
Jaegeuk Kim
7f47499d43 f2fstat: enhance readability of output
This patch enhances output readability of f2fstat.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-09-18 18:10:34 -07:00
Jaegeuk Kim
c7ac585c9f tracepoint.sh: update latest tracepoints
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-09-08 11:13:00 -07:00
Jaegeuk Kim
cfeb015e88 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>
2014-09-03 19:45:42 -07:00
Jaegeuk Kim
7eb6c5a03b 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>
2014-09-02 18:23:11 -07:00
Jaegeuk Kim
a6a7ac8e9d fsck.f2fs: avoid build warnings
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-09-02 11:07:33 -07:00
Jaegeuk Kim
7d96d138a3 fsck.f2fs: remove list.h
Just use list_head only.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-08-29 17:15:09 -07:00
Jaegeuk Kim
a6b2870ddb 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>
2014-08-29 16:37:46 -07:00
Jaegeuk Kim
b700e313b4 fsck.f2fs: fix checkpoint
- fix nat entries
- fix sit entries
- fix checkpoint

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-08-29 13:43:29 -07:00
Jaegeuk Kim
1dc1edfbcb fsck.f2fs: handle correctly segment summary entries
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-08-29 13:43:29 -07:00
Jaegeuk Kim
1bc74e1eed fsck.f2fs: remove corrupted xattr block
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-08-29 13:43:29 -07:00
Jaegeuk Kim
a89223b220 fsck.f2fs: corrupted orphan inode will be removed
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-08-29 13:43:29 -07:00
Jaegeuk Kim
32edfeaac7 fsck.f2fs: remove dentry if its inode block is corrupted
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-08-29 13:43:29 -07:00
Jaegeuk Kim
48ffea7ba8 fsck.f2fs: add fixing messeages
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-08-29 13:43:29 -07:00
Jaegeuk Kim
634dfb1552 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>
2014-08-29 13:43:29 -07:00
Jaegeuk Kim
48863d422e 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>
2014-08-29 13:43:29 -07:00
Jaegeuk Kim
1ce70c67e3 fsck.f2fs: cleanup mount.c
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-08-29 13:43:29 -07:00
Jaegeuk Kim
5cd7001f5d fsck.f2fs: handle error cases
Do sanity check first and then update metadata.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-08-29 13:43:29 -07:00
Jaegeuk Kim
2701c94ab0 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>
2014-08-29 13:43:29 -07:00
Jaegeuk Kim
7aafb1b5f4 fsck.f2fs: handle IS_VALID_BLK_ADDR
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-08-29 13:43:29 -07:00
Jaegeuk Kim
f6d1d582e9 fsck.f2fs: clean up codes
Fix wrong coding style.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-08-29 13:43:29 -07:00
Jaegeuk Kim
6f4106c12b fsck.f2fs: retry to fix corrupted image
This patch adds a facility to retry conducting fsck.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-08-29 13:43:27 -07:00
Jaegeuk Kim
f46078949b 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>
2014-08-29 10:52:19 -07:00
Jaegeuk Kim
347e94f4b2 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>
2014-08-26 17:30:18 -07:00
Jaegeuk Kim
6cd2c51c20 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>
2014-08-26 17:30:15 -07:00
Jaegeuk Kim
f381590f80 mkfs.f2fs: remove build warning
Should be unsigned int for le32_to_cpu.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-07-29 16:24:52 -07:00
Jaegeuk Kim
4b80852d76 tracepoint.sh: add missing tracepoints
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-07-29 16:24:11 -07:00
Sankalp Bose
92a65a44e5 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>
2014-07-25 08:11:16 -07:00
Changman Lee
092e3d9da3 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>
2014-07-10 16:22:04 -07:00
Mark Salyzyn
58edb106a8 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>
2014-07-03 09:27:47 -07:00
JP Abgrall
e91da2f664 libf2fs: move the finalize_device() into the io lib.
This is required so that libf2fs.c can be used against any kind
of device (E.g. an in-memory sparse file) just by linking against
something that provides the libf2fs_io.c functions.

libf2fs is currently libf2fs.c + libf2fs_io.c

Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-06-14 14:22:02 +09:00
Jaegeuk Kim
09f8f56066 mkfs: set BLKDISCARD by default
And let's show some debug info as well.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-06-13 17:48:42 +09:00
Jaegeuk Kim
0575dd1c56 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>
2014-06-13 17:06:02 +09:00
JP Abgrall
3ba4ce8950 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>
2014-06-12 17:01:41 +09:00
JP Abgrall
97fd9037ec 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>
2014-06-12 16:52:59 +09:00
Changman Lee
4ea4f1db27 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>
2014-06-04 13:32:07 +09:00
Jaegeuk Kim
03ca33c407 fibmap: need linux/fs.h for FIBMAP
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2014-05-26 10:42:08 +09:00
JP Abgrall
a68ee58a5d 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>
2014-05-15 08:40:55 +09:00
Jaegeuk Kim
a4499dbe93 f2fs: fix to remove the test code that should not be merged
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2014-05-09 10:32:14 +09:00
Jaegeuk Kim
e35b8afb34 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>
2014-04-25 14:07:17 +09:00
JP Abgrall
a35529fce0 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>
2014-04-07 12:14:32 +09:00
JP Abgrall
15ea79b3ae 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>
2014-04-07 12:14:10 +09:00
JP Abgrall
af3c6803bd 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>
2014-04-07 12:13:51 +09:00
Dongho Sim
2f229b89a7 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>
2014-04-01 18:56:13 +09:00
Natanael Copa
379ff8916e 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>
2014-03-04 18:26:30 +09:00
Jaegeuk Kim
99250ec1aa 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>
2014-02-27 20:32:09 +09:00
Jaegeuk Kim
192d979c61 fsck: remove build warnings
This patch casts some variable types to remove build warnings.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2014-02-25 08:31:49 +09:00
Changman Lee
c15df2285d 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>
2014-02-14 11:12:07 +09:00
Changman Lee
b7906af37f 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>
2014-02-14 11:12:01 +09:00
Changman Lee
4ff7400c51 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>
2014-02-07 14:44:56 +09:00
Jaegeuk Kim
858c4039c8 mkfs, fsck: change the results for readability
This patch cleans up several printing formats.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2014-02-06 11:09:41 +09:00