Commit Graph

967 Commits

Author SHA1 Message Date
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
Changman Lee
28d45d09cd 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>
2014-02-03 15:05:03 +09:00
Jaegeuk Kim
0255d52ebf 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>
2014-01-28 19:31:35 +09:00
Jaegeuk Kim
4f267323a2 f2fs-tools: resolve build warnings
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2014-01-20 17:42:21 +09:00
Changman Lee
b611e1155a 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>
2014-01-16 17:29:13 +09:00
Changman Lee
e296161af0 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>
2014-01-16 17:29:13 +09:00
Changman Lee
a0a5567e3e 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>
2014-01-14 17:48:35 +09:00
JP Abgrall
6da30100ee 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>
2014-01-13 10:21:56 +09:00
JP Abgrall
cb54e79739 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>
2014-01-13 10:21:19 +09:00
JP Abgrall
437dbf6773 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>
2014-01-13 10:21:08 +09:00
Jaegeuk Kim
1aae03594b fibmap: fix wrong block count
This is an obvious bug fix patch.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2013-12-27 12:57:51 +09:00
Huajun Li
061ee67915 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>
2013-12-16 12:42:43 +09:00
Jaegeuk Kim
11d187cdfa 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>
2013-12-16 12:33:41 +09:00