diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2015-06-17 17:34:16 -0700 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2016-10-07 12:34:31 -0800 |
commit | b6f11ba1f954e09cbbc9f595280a81d30e580f71 (patch) | |
tree | ba7c0abfd01b1fd5fef72d54b7e193319a2ad761 | |
parent | 6f41a2a4421057e0a3f9b26bc1ac3457d46506ee (diff) |
bcachefs: mount option for verbose recovery
-rw-r--r-- | drivers/md/bcache/fs-gc.c | 10 | ||||
-rw-r--r-- | drivers/md/bcache/fs.c | 5 | ||||
-rw-r--r-- | drivers/md/bcache/super.c | 1 | ||||
-rw-r--r-- | drivers/md/bcache/super_types.h | 1 |
4 files changed, 14 insertions, 3 deletions
diff --git a/drivers/md/bcache/fs-gc.c b/drivers/md/bcache/fs-gc.c index cd819bfbfd7d..9032c2d3edae 100644 --- a/drivers/md/bcache/fs-gc.c +++ b/drivers/md/bcache/fs-gc.c @@ -85,14 +85,17 @@ static int bch_gc_do_inode(struct cache_set *c, struct btree_iter *iter, bch_empty_dir(c, inode.k->p.inode), c, "non empty directory with link count 0,inode nlink %u, dir links found %u", inode.v->i_nlink, link.dir_count); - pr_info("deleting inum %llu", inode.k->p.inode); + + if (c->opts.verbose_recovery) + pr_info("deleting inum %llu", inode.k->p.inode); bch_btree_iter_unlock(iter); return bch_inode_rm(c, inode.k->p.inode); } if (inode.v->i_flags & BCH_INODE_I_SIZE_DIRTY) { - pr_info("truncating inode %llu", inode.k->p.inode); + if (c->opts.verbose_recovery) + pr_info("truncating inode %llu", inode.k->p.inode); /* * XXX: need to truncate partial blocks too here - or ideally @@ -108,7 +111,8 @@ static int bch_gc_do_inode(struct cache_set *c, struct btree_iter *iter, if (inode.v->i_nlink != link.count + link.dir_count || inode.v->i_flags & BCH_INODE_I_SIZE_DIRTY) { - if (inode.v->i_nlink != link.count + link.dir_count) + if (c->opts.verbose_recovery && + inode.v->i_nlink != link.count + link.dir_count) pr_info("setting inum %llu nlinks from %u to %u", inode.k->p.inode, inode.v->i_nlink, link.count + link.dir_count); diff --git a/drivers/md/bcache/fs.c b/drivers/md/bcache/fs.c index 7fe55b683c2f..8ccf8c3f291c 100644 --- a/drivers/md/bcache/fs.c +++ b/drivers/md/bcache/fs.c @@ -2018,6 +2018,7 @@ enum { Opt_err_cont, Opt_err_panic, Opt_err_ro, Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, + Opt_verbose_recovery, Opt_err }; @@ -2029,6 +2030,7 @@ static const match_table_t tokens = { {Opt_nouser_xattr, "nouser_xattr"}, {Opt_acl, "acl"}, {Opt_noacl, "noacl"}, + {Opt_verbose_recovery, "verbose_recovery"}, {Opt_err, NULL} }; @@ -2070,6 +2072,9 @@ static int parse_options(struct cache_set_opts *opts, int flags, char *options) case Opt_noacl: opts->posix_acl = false; break; + case Opt_verbose_recovery: + opts->verbose_recovery = true; + break; default: return 0; } diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index efa03f795bab..c7db7faa6e8a 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -992,6 +992,7 @@ static struct cache_set *bch_cache_set_alloc(struct cache_sb *sb, c->opts = (struct cache_set_opts) { .read_only = 0, .on_error_action = CACHE_ERROR_ACTION(&c->sb), + .verbose_recovery = 0, }; if (opts.read_only >= 0) diff --git a/drivers/md/bcache/super_types.h b/drivers/md/bcache/super_types.h index 25f0e203acf1..9e110428c2af 100644 --- a/drivers/md/bcache/super_types.h +++ b/drivers/md/bcache/super_types.h @@ -16,6 +16,7 @@ struct cache_set_opts { /* filesystem options: */ int posix_acl:2; + int verbose_recovery:2; }; #endif /* _BCACHE_SUPER_TYPES_H */ |