Commit Graph

55 Commits

Author SHA1 Message Date
xlfeng
059d1b3f4c BUILD.gn and config.h modify Huawei license to GPL-2.0 license.Add #ifndef CONFIG_H #define CONFIG_H on the head of file and #endif on the end of config.h. Modify the value of Name in README.OpenSource.
Signed-off-by: xlfeng <xulifeng7@huawei.com>
2021-12-20 21:44:20 +08:00
xlfeng
81c31712a5 Build successful,add one config.h and four BUILD.gn, modify seven files to relsove macro redefined,.Delete two Android.bp files.Add OAT related files,OAT.xml,README.OpenSource and README.md.
Signed-off-by: xlfeng <xulifeng7@huawei.com>
2021-12-15 10:45:47 +08:00
Jaegeuk Kim
1e3dd7ae5d f2fs_io: measure performance of write()
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-08-20 09:08:31 -07:00
Jaegeuk Kim
334047bdca f2fs_io: add OSYNC option
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-08-20 09:08:07 -07:00
Daeho Jeong
5c92399f8f f2fs_io: open file in read only mode for pinning file
To use "pinfile" command even with read only file, changed open
mode for it.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-08-04 17:52:56 -07:00
Jaegeuk Kim
17463f9c42 f2fs_io: add mmap read operation
This patch adds an option, mmap, when reading data.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-07-20 17:39:02 -07:00
Rolf Eike Beer
4b55c43828 lib: use ${libuuid_LIBS} instead of -luuid everywhere
Otherwise linking will fail if the library is in an uncommon location or has a
non-standard name.

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-06-18 12:34:23 -07:00
Rolf Eike Beer
59a37413f8 lib: fix include path for uuid.h
$ pkg-config --cflags uuid
-I/usr/include/uuid

The "uuid/" directory is actually part of the include path. This usually still
works because most people have the path one level up in their default include
path.

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-06-18 12:34:03 -07:00
Daeho Jeong
b23b2b97a6 f2fs_io: add randread
I've added a new command to evaluate random read.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-05-27 13:59:25 -07:00
Jaegeuk Kim
42f739c4c7 f2fs_io: show more flags
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-05-06 07:37:55 -07:00
Jaegeuk Kim
d21dd9aaca f2fs_io: don't give garbage data in upper 32bits
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-05-06 07:37:50 -07:00
Jaegeuk Kim
850861988f f2fs_io: add fsync
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-05-01 17:29:07 -07:00
Chao Yu
596408fd82 f2fs_io: support compress blocks ioctls
Adds to support below three commands to operate reserved blocks
in compressed inode.
- get_cblocks
- release_cblocks
- reserve_cblocks

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-03-18 18:07:18 -07:00
Jaegeuk Kim
f0f29da924 f2fs_io: add set_fsverity
f2fs_io set_verity [file]

Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2020-01-14 07:42:02 -08:00
Santiago Hormazabal
59478d343a sg_write_buffer: fix sg_write_buffer build outside the source dir
Current Makefile.am included the 'include' directory
directly as -I./include, but this doesn't guarantee that
said directory exists when building outside of the source
directory.
By adding $(srcdir) instead of '.' this gets fixed automatically.

Signed-off-by: Santiago Hormazabal <santiagohssl@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2020-01-14 07:41:05 -08:00
Jaegeuk Kim
e6cd27722a f2fs_io: accept fallocate to have bigger size
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-12-18 10:20:23 -08:00
Jaegeuk Kim
e0e1c2a790 tools/fibmap: fix build error
fibmap.c:28:10: fatal error: 'sys/sysmacros.h' file not found
         ^~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [fibmap.o] Error 1
make[3]: *** Waiting for unfinished jobs....

Fixes: ce64ea0815 ("f2fs-tools: Add support for Casefolding")
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-10-22 09:33:13 -07:00
Eric Biggers
d5bc55f7c7 f2fs_io: add copy command
Add a copy command to f2fs_io, to allow testing direct I/O writes where
the source page is from a different file (mmap) or an internal kernel
page (sendfile).  It could be useful for other tests in the future too.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-10-07 09:24:50 -07:00
Eric Biggers
7a9422f092 f2fs_io: add helper functions for handling errors
Add and use helper functions for:

- Printing an error message (optionally with errno) and exiting.
- Allocating memory, exiting on error.
- Opening a file, exiting on error.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-10-07 09:24:44 -07:00
Jaegeuk Kim
ab72bb1a42 f2fs_io: add get/setflags
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-08-27 14:51:05 -07:00
Chao Yu
5eb2d84559 f2fs_io: support defrag_file
Support 'defrag_file' sub command to trigger file based defragment via
ioctl in f2fs.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-08-27 14:51:05 -07:00
Daniel Rosenberg
ce64ea0815 f2fs-tools: Add support for Casefolding
This adds support for f2fs casefolding. Similarly to ext4 casefolding,
this is controlled per-folder via the +F attribute. It can be toggled on
empty directories only. It is not currently compatible with encryption,
but that will likely change.

When enabling the casefold feature, use the -C flag. The format is:
-C encoding[:flag1,flag2,etc]

Signed-off-by: Daniel Rosenberg <drosen@google.com>
[Jaegeuk Kim: print "casefold" in sb->feature]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-08-27 14:51:05 -07:00
Jaegeuk Kim
7c8df9e026 f2fs_io: add fallocate
This simply supports keep_size.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-08-20 11:23:51 -07:00
Jaegeuk Kim
e8728ca25c f2fs_io: fix wrong buffered/dio option
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-08-20 11:23:51 -07:00
Jaegeuk Kim
e87d54e90d f2fs_io: exit if system(3) is failed
Exit the request, if system(3) is failed to be executed.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-03-26 11:25:11 -07:00
Damien Le Moal
8f80581f0d f2fs-tools: Fix various compilation warnings
Avoid various compilation warnings due to strncpy:

libf2fs.c:590:33: warning: ‘snprintf’ output may be truncated before
the last format character [-Wformat-truncation=]
  snprintf(rootdev, ret, "/dev/%s", buf);

../include/f2fs_fs.h:1384:2: warning: ‘strncpy’ specified bound
depends on the length of the source argument [-Wstringop-overflow=]
  strncpy(buf, features, strlen(features) + 1);

f2fstat.c:243:3: warning: ‘strncpy’ output truncated before
terminating nul copying as many bytes from a string as its length
[-Wstringop-truncation]
   strncpy(ptr_buf, name[i], strlen(name[i]));

This patch does not change any functionality.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-03-23 18:59:24 +09:00
Jaegeuk Kim
50e22bd947 f2fs-tools: add c++ for UNUSED
This can avoid build failure for f2fscrypt.

Change-Id: I33eddc62eea486dc219c25d089112e011864dd4f
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-03-01 14:18:16 -08:00
Jaegeuk Kim
af915e4571 f2fscrypt: avoid to fail android build
This fixes some static build errors.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-03-01 14:18:13 -08:00
Jaegeuk Kim
560f99942f f2fs-tools: fix build breakage
Fix this first, and will do upstream right away.

Change-Id: I6debbb0988595772452f7a878c2cc177fa2e26f3
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-03-01 11:27:34 -08:00
Jaegeuk Kim
22d758e2e6 f2fs_io: add gc_urgent
e.g.,
f2fs_io gc_urgent dm-4 [start/end/run] [time in sec]

This controls sysfs/gc_urgent to run f2fs_gc urgently.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-02-19 21:02:56 -08:00
Jaegeuk Kim
70f937a263 f2fs_io: add fiemap
f2fs_io fiemap [offset in 4kb] [count] [file_path]

Change-Id: Iee9e8b742ada6a12a9f761b3a6de8d82a60e1b59
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-02-11 18:36:47 -08:00
Jaegeuk Kim
d69fb9879d f2fs_io: add read
f2fs_io read [chunk_size in 4kb] [offset in chunk_size] [count] [IO] [print_nbytes] [file_path]

Read data in file_path and print nbytes
IO can be
  buffered : buffered IO
  dio      : direct IO

Change-Id: I912adc4f443c3656ad067d29a1e2f581b79d28e6
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-02-11 18:36:46 -08:00
Jaegeuk Kim
7de6738bd5 f2fs_io: add write
f2fs_io write [chunk_size in 4kb] [offset in chunk_size] [count] [pattern] [IO] [file_path]

Write given patten data in file_path
pattern can be
  zero     : zeros
  inc_num  : incrementing numbers
  rand     : random numbers
IO can be
  buffered : buffered IO
  dio      : direct IO

Change-Id: Icc866d5b9933423639d1d0e4d5e556ddf4f15feb
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-02-11 18:36:44 -08:00
Jaegeuk Kim
1ca1437c2e f2fs_io: add pin_file control command
This requires a kernel patch "f2fs: export pin_file flag to user".

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-01-08 15:44:08 -08:00
Jaegeuk Kim
bbff9a6d04 tools: add f2fs_io
This is initial commit to support shutdown ioctl.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-01-03 20:38:34 -08:00
Sahitya Tummala
3f6c613444 parse.f2fs: fix parsing of f2fs_trace_ios
It is incorrectly taking blkaddr as len because it missed to parse
op_flags in the trace print of f2fs_trace_ios.

Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2018-12-28 12:55:36 -08:00
Sheng Yong
4d4a9f2d45 fibmap: include f2fs_fs.h before other header files
GCC 7.2.0 is unhappy with the usage of major/minor:

fibmap.c: In function ‘print_stat’:
fibmap.c:70:13: warning: In the GNU C Library, "major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>.
  printf("dev       [%d:%d]\n", major(st->st_dev), minor(st->st_dev));
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is because config.h is not included first, as a result, macros
defined in config.h is not recognized. So let's include f2fs_fs.h
before other header files.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2018-05-07 14:49:38 -07:00
Hyojun Kim
b39f62dce4 tools: sg_write_buffer: add sg_write_buffer for FFU
sg_write_buffer sources are added for FFU.

Signed-off-by: Hyojun Kim <hyojun@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2018-03-14 13:19:09 +09:00
Jaegeuk Kim
43bb7b6c99 f2fs-tools: build binaries in Mac
This patch modifies f2fs-tools to be built in mac.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2017-11-14 19:43:48 -08:00
Kinglong Mee
7f00dd441c f2fscrypt: add a tool for encryption management in the f2fs filesystem
It's migrated from e4crypt.
Adds an example to the f2fscrypt manpages.

v3, add /tools/f2fscrypt to .gitignore
v2, migrate those micro defines for encrypt to f2fs internal,
    drop unless of libsha etc.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2017-03-16 08:15:37 +08:00
Mike Frysinger
0e14e39d38 fibmap: pull in sys/sysmacros.h for major/minor
These funcs are provided by sys/sysmacros.h, so include the header
directly.  Building with alternative C libraries can fail otherwise
like so:

fibmap.c: In function 'print_stat':
fibmap.c:36:32: warning: implicit declaration of function 'major' [-Wimplicit-function-declaration]
  printf("dev       [%d:%d]\n", major(st->st_dev), minor(st->st_dev));
                                ^
fibmap.c:36:51: warning: implicit declaration of function 'minor' [-Wimplicit-function-declaration]
  printf("dev       [%d:%d]\n", major(st->st_dev), minor(st->st_dev));
                                                   ^
fibmap.o: In function 'print_stat':
tools/fibmap.c:36: undefined reference to 'minor'
tools/fibmap.c:36: undefined reference to 'major'
fibmap.o: In function 'stat_bdev':
tools/fibmap.c:59: undefined reference to 'minor'
tools/fibmap.c:59: undefined reference to 'major'

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2016-04-18 21:10:59 -04: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
Chao Yu
5a510076b7 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>
2015-01-23 13:15:52 -08:00
Jaegeuk Kim
4757ef07d9 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>
2014-12-19 16:07:55 -08:00
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
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
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
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