Skip to content

Commit

Permalink
f2fs-tools: do not support user-space cache
Browse files Browse the repository at this point in the history
We don't have lots of benefits from this, since block devices already
have page caches in the kernel. Moreover, this feature has some
stability issues corrupting metadata. So, we better make this deprecated.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Daeho Jeong authored and Jaegeuk Kim committed Sep 29, 2023
1 parent 50fd00b commit 2835107
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 363 deletions.
18 changes: 2 additions & 16 deletions fsck/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
* Liu Shuoran <liushuoran@huawei.com>
* Jaegeuk Kim <jaegeuk@kernel.org>
* : add sload.f2fs
* Copyright (c) 2019 Google Inc.
* Robin Hsu <robinhsu@google.com>
* : add cache layer
* Copyright (c) 2020 Google Inc.
* Robin Hsu <robinhsu@google.com>
* : add sload compression support
Expand All @@ -26,7 +23,6 @@
#include <ctype.h>
#include <time.h>
#include <getopt.h>
#include <stdbool.h>
#include "quotaio.h"
#include "compress.h"

Expand Down Expand Up @@ -59,10 +55,6 @@ void fsck_usage()
MSG(0, "\nUsage: fsck.f2fs [options] device\n");
MSG(0, "[options]:\n");
MSG(0, " -a check/fix potential corruption, reported by f2fs\n");
MSG(0, " -c <num-cache-entry> set number of cache entries"
" (default 0)\n");
MSG(0, " -m <max-hash-collision> set max cache hash collision"
" (default 16)\n");
MSG(0, " -C encoding[:flag1,flag2] Set options for enabling"
" casefolding\n");
MSG(0, " -d debug level [default:0]\n");
Expand All @@ -80,7 +72,6 @@ void fsck_usage()
MSG(0, " --dry-run do not really fix corruptions\n");
MSG(0, " --no-kernel-check skips detecting kernel change\n");
MSG(0, " --kernel-check checks kernel change\n");
MSG(0, " --debug-cache to debug cache when -c is used\n");
exit(1);
}

Expand Down Expand Up @@ -241,8 +232,6 @@ void f2fs_parse_options(int argc, char *argv[])
};

c.func = FSCK;
c.cache_config.max_hash_collision = 16;
c.cache_config.dbg_en = false;
while ((option = getopt_long(argc, argv, option_string,
long_opt, &opt)) != EOF) {
switch (option) {
Expand All @@ -259,18 +248,15 @@ void f2fs_parse_options(int argc, char *argv[])
MSG(0, "Info: Do Kernel Check\n");
break;
case 4:
c.cache_config.dbg_en = true;
MSG(0, "Info: Deprecated option \"debug-cache\"\n");
break;
case 'a':
c.auto_fix = 1;
MSG(0, "Info: Automatic fix mode enabled.\n");
break;
case 'c':
c.cache_config.num_cache_entry = atoi(optarg);
break;
case 'm':
c.cache_config.max_hash_collision =
atoi(optarg);
MSG(0, "Info: Deprecated option \'%c\'\n", option);
break;
case 'g':
if (!strcmp(optarg, "android")) {
Expand Down
18 changes: 0 additions & 18 deletions include/f2fs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*
* Copyright (c) 2012 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
* Copyright (c) 2019 Google Inc.
* http://www.google.com/
* Copyright (c) 2020 Google Inc.
* Robin Hsu <robinhsu@google.com>
* : add sload compression support
Expand Down Expand Up @@ -452,16 +450,6 @@ struct device_info {
size_t *zone_cap_blocks;
};

typedef struct {
/* Value 0 means no cache, minimum 1024 */
long num_cache_entry;

/* Value 0 means always overwrite (no collision allowed). maximum 16 */
unsigned max_hash_collision;

bool dbg_en;
} dev_cache_config_t;

/* f2fs_configration for compression used for sload.f2fs */
typedef struct {
void (*init)(struct compress_ctx *cc);
Expand Down Expand Up @@ -1545,9 +1533,6 @@ struct f2fs_configuration {
/* precomputed fs UUID checksum for seeding other checksums */
uint32_t chksum_seed;

/* cache parameters */
dev_cache_config_t cache_config;

/* compression support for sload.f2fs */
compress_config_t compress;

Expand Down Expand Up @@ -1599,9 +1584,6 @@ extern void f2fs_release_sparse_resource(void);
extern int f2fs_finalize_device(void);
extern int f2fs_fsync_device(void);

extern void dcache_init(void);
extern void dcache_release(void);

extern int dev_read(void *, __u64, size_t);
#ifdef POSIX_FADV_WILLNEED
extern int dev_readahead(__u64, size_t);
Expand Down
Loading

0 comments on commit 2835107

Please sign in to comment.