diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-02-08 13:26:41 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-02-08 13:26:41 -0800 |
commit | c9d35ee049b40f1d73e890bf88dd55f83b1e9be8 (patch) | |
tree | 7b942b7ee530f5a183df80f506d1292b9966d53c /fs/ceph | |
parent | 236f45329460f76d058111de1a1cea12f5a8b734 (diff) | |
parent | f35aa2bc809eacc44c3cee41b52cef1c451d4a89 (diff) |
Merge branch 'merge.nfs-fs_parse.1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs file system parameter updates from Al Viro:
"Saner fs_parser.c guts and data structures. The system-wide registry
of syntax types (string/enum/int32/oct32/.../etc.) is gone and so is
the horror switch() in fs_parse() that would have to grow another case
every time something got added to that system-wide registry.
New syntax types can be added by filesystems easily now, and their
namespace is that of functions - not of system-wide enum members. IOW,
they can be shared or kept private and if some turn out to be widely
useful, we can make them common library helpers, etc., without having
to do anything whatsoever to fs_parse() itself.
And we already get that kind of requests - the thing that finally
pushed me into doing that was "oh, and let's add one for timeouts -
things like 15s or 2h". If some filesystem really wants that, let them
do it. Without somebody having to play gatekeeper for the variants
blessed by direct support in fs_parse(), TYVM.
Quite a bit of boilerplate is gone. And IMO the data structures make a
lot more sense now. -200LoC, while we are at it"
* 'merge.nfs-fs_parse.1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (25 commits)
tmpfs: switch to use of invalfc()
cgroup1: switch to use of errorfc() et.al.
procfs: switch to use of invalfc()
hugetlbfs: switch to use of invalfc()
cramfs: switch to use of errofc() et.al.
gfs2: switch to use of errorfc() et.al.
fuse: switch to use errorfc() et.al.
ceph: use errorfc() and friends instead of spelling the prefix out
prefix-handling analogues of errorf() and friends
turn fs_param_is_... into functions
fs_parse: handle optional arguments sanely
fs_parse: fold fs_parameter_desc/fs_parameter_spec
fs_parser: remove fs_parameter_description name field
add prefix to fs_context->log
ceph_parse_param(), ceph_parse_mon_ips(): switch to passing fc_log
new primitive: __fs_parse()
switch rbd and libceph to p_log-based primitives
struct p_log, variants of warnf() et.al. taking that one instead
teach logfc() to handle prefices, give it saner calling conventions
get rid of cg_invalf()
...
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/cache.c | 4 | ||||
-rw-r--r-- | fs/ceph/super.c | 40 |
2 files changed, 19 insertions, 25 deletions
diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c index 73f24f307a4a..270b769607a2 100644 --- a/fs/ceph/cache.c +++ b/fs/ceph/cache.c @@ -67,7 +67,7 @@ int ceph_fscache_register_fs(struct ceph_fs_client* fsc, struct fs_context *fc) if (uniq_len && memcmp(ent->uniquifier, fscache_uniq, uniq_len)) continue; - errorf(fc, "ceph: fscache cookie already registered for fsid %pU, use fsc=<uniquifier> option", + errorfc(fc, "fscache cookie already registered for fsid %pU, use fsc=<uniquifier> option", fsid); err = -EBUSY; goto out_unlock; @@ -96,7 +96,7 @@ int ceph_fscache_register_fs(struct ceph_fs_client* fsc, struct fs_context *fc) list_add_tail(&ent->list, &ceph_fscache_list); } else { kfree(ent); - errorf(fc, "ceph: unable to register fscache cookie for fsid %pU", + errorfc(fc, "unable to register fscache cookie for fsid %pU", fsid); /* all other fs ignore this error */ } diff --git a/fs/ceph/super.c b/fs/ceph/super.c index bfb8aead0555..1d9f083b8a11 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -162,13 +162,13 @@ enum ceph_recover_session_mode { ceph_recover_session_clean }; -static const struct fs_parameter_enum ceph_mount_param_enums[] = { - { Opt_recover_session, "no", ceph_recover_session_no }, - { Opt_recover_session, "clean", ceph_recover_session_clean }, +static const struct constant_table ceph_param_recover[] = { + { "no", ceph_recover_session_no }, + { "clean", ceph_recover_session_clean }, {} }; -static const struct fs_parameter_spec ceph_mount_param_specs[] = { +static const struct fs_parameter_spec ceph_mount_parameters[] = { fsparam_flag_no ("acl", Opt_acl), fsparam_flag_no ("asyncreaddir", Opt_asyncreaddir), fsparam_s32 ("caps_max", Opt_caps_max), @@ -178,8 +178,8 @@ static const struct fs_parameter_spec ceph_mount_param_specs[] = { fsparam_flag_no ("copyfrom", Opt_copyfrom), fsparam_flag_no ("dcache", Opt_dcache), fsparam_flag_no ("dirstat", Opt_dirstat), - __fsparam (fs_param_is_string, "fsc", Opt_fscache, - fs_param_neg_with_no | fs_param_v_optional), + fsparam_flag_no ("fsc", Opt_fscache), // fsc|nofsc + fsparam_string ("fsc", Opt_fscache), // fsc=... fsparam_flag_no ("ino32", Opt_ino32), fsparam_string ("mds_namespace", Opt_mds_namespace), fsparam_flag_no ("poolperm", Opt_poolperm), @@ -188,7 +188,7 @@ static const struct fs_parameter_spec ceph_mount_param_specs[] = { fsparam_flag_no ("rbytes", Opt_rbytes), fsparam_u32 ("readdir_max_bytes", Opt_readdir_max_bytes), fsparam_u32 ("readdir_max_entries", Opt_readdir_max_entries), - fsparam_enum ("recover_session", Opt_recover_session), + fsparam_enum ("recover_session", Opt_recover_session, ceph_param_recover), fsparam_flag_no ("require_active_mds", Opt_require_active_mds), fsparam_u32 ("rsize", Opt_rsize), fsparam_string ("snapdirname", Opt_snapdirname), @@ -197,12 +197,6 @@ static const struct fs_parameter_spec ceph_mount_param_specs[] = { {} }; -static const struct fs_parameter_description ceph_mount_parameters = { - .name = "ceph", - .specs = ceph_mount_param_specs, - .enums = ceph_mount_param_enums, -}; - struct ceph_parse_opts_ctx { struct ceph_options *copts; struct ceph_mount_options *opts; @@ -226,7 +220,7 @@ static int ceph_parse_source(struct fs_parameter *param, struct fs_context *fc) dout("%s '%s'\n", __func__, dev_name); if (!dev_name || !*dev_name) - return invalf(fc, "ceph: Empty source"); + return invalfc(fc, "Empty source"); dev_name_end = strchr(dev_name, '/'); if (dev_name_end) { @@ -245,14 +239,14 @@ static int ceph_parse_source(struct fs_parameter *param, struct fs_context *fc) dev_name_end--; /* back up to ':' separator */ if (dev_name_end < dev_name || *dev_name_end != ':') - return invalf(fc, "ceph: No path or : separator in source"); + return invalfc(fc, "No path or : separator in source"); dout("device name '%.*s'\n", (int)(dev_name_end - dev_name), dev_name); if (fsopt->server_path) dout("server path '%s'\n", fsopt->server_path); ret = ceph_parse_mon_ips(param->string, dev_name_end - dev_name, - pctx->copts, fc); + pctx->copts, fc->log.log); if (ret) return ret; @@ -270,11 +264,11 @@ static int ceph_parse_mount_param(struct fs_context *fc, unsigned int mode; int token, ret; - ret = ceph_parse_param(param, pctx->copts, fc); + ret = ceph_parse_param(param, pctx->copts, fc->log.log); if (ret != -ENOPARAM) return ret; - token = fs_parse(fc, &ceph_mount_parameters, param, &result); + token = fs_parse(fc, ceph_mount_parameters, param, &result); dout("%s fs_parse '%s' token %d\n", __func__, param->key, token); if (token < 0) return token; @@ -301,7 +295,7 @@ static int ceph_parse_mount_param(struct fs_context *fc, break; case Opt_source: if (fc->source) - return invalf(fc, "ceph: Multiple sources specified"); + return invalfc(fc, "Multiple sources specified"); return ceph_parse_source(param, fc); case Opt_wsize: if (result.uint_32 < PAGE_SIZE || @@ -392,7 +386,7 @@ static int ceph_parse_mount_param(struct fs_context *fc, } break; #else - return invalf(fc, "ceph: fscache support is disabled"); + return invalfc(fc, "fscache support is disabled"); #endif case Opt_poolperm: if (!result.negated) @@ -423,7 +417,7 @@ static int ceph_parse_mount_param(struct fs_context *fc, #ifdef CONFIG_CEPH_FS_POSIX_ACL fc->sb_flags |= SB_POSIXACL; #else - return invalf(fc, "ceph: POSIX ACL support is disabled"); + return invalfc(fc, "POSIX ACL support is disabled"); #endif } else { fc->sb_flags &= ~SB_POSIXACL; @@ -435,7 +429,7 @@ static int ceph_parse_mount_param(struct fs_context *fc, return 0; out_of_range: - return invalf(fc, "ceph: %s out of range", param->key); + return invalfc(fc, "%s out of range", param->key); } static void destroy_mount_options(struct ceph_mount_options *args) @@ -1101,7 +1095,7 @@ static int ceph_get_tree(struct fs_context *fc) dout("ceph_get_tree\n"); if (!fc->source) - return invalf(fc, "ceph: No source"); + return invalfc(fc, "No source"); #ifdef CONFIG_CEPH_FS_POSIX_ACL fc->sb_flags |= SB_POSIXACL; |