aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2019-12-21 00:16:49 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2020-02-07 14:48:35 -0500
commitcc3c0b533ab9142eac2e291628fbfca3685f38cd (patch)
tree1e030853f8a0bed9225eb392a4faad4f24477fb5
parentc80c98f0dc5dc709b04254b5f30145c6ab8800a4 (diff)
add prefix to fs_context->log
... turning it into struct p_log embedded into fs_context. Initialize the prefix with fs_type->name, turning fs_parse() into a trivial inline wrapper for __fs_parse(). This makes fs_parameter_description->name completely unused. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/ceph/super.c4
-rw-r--r--fs/fs_context.c9
-rw-r--r--fs/fs_parser.c10
-rw-r--r--fs/fsopen.c10
-rw-r--r--include/linux/fs_context.h4
-rw-r--r--include/linux/fs_parser.h13
6 files changed, 23 insertions, 27 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 0fe0aa575585..4125de07221b 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -250,7 +250,7 @@ static int ceph_parse_source(struct fs_parameter *param, struct fs_context *fc)
dout("server path '%s'\n", fsopt->server_path);
ret = ceph_parse_mon_ips(param->string, dev_name_end - dev_name,
- pctx->copts, fc->log);
+ pctx->copts, fc->log.log);
if (ret)
return ret;
@@ -268,7 +268,7 @@ static int ceph_parse_mount_param(struct fs_context *fc,
unsigned int mode;
int token, ret;
- ret = ceph_parse_param(param, pctx->copts, fc->log);
+ ret = ceph_parse_param(param, pctx->copts, fc->log.log);
if (ret != -ENOPARAM)
return ret;
diff --git a/fs/fs_context.c b/fs/fs_context.c
index fb6329c21384..fc9f6ef93b55 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -271,6 +271,7 @@ static struct fs_context *alloc_fs_context(struct file_system_type *fs_type,
fc->fs_type = get_filesystem(fs_type);
fc->cred = get_current_cred();
fc->net_ns = get_net(current->nsproxy->net_ns);
+ fc->log.prefix = fs_type->name;
mutex_init(&fc->uapi_mutex);
@@ -364,8 +365,8 @@ struct fs_context *vfs_dup_fs_context(struct fs_context *src_fc)
get_net(fc->net_ns);
get_user_ns(fc->user_ns);
get_cred(fc->cred);
- if (fc->log)
- refcount_inc(&fc->log->usage);
+ if (fc->log.log)
+ refcount_inc(&fc->log.log->usage);
/* Can't call put until we've called ->dup */
ret = fc->ops->dup(fc, src_fc);
@@ -442,12 +443,12 @@ EXPORT_SYMBOL(logfc);
*/
static void put_fc_log(struct fs_context *fc)
{
- struct fc_log *log = fc->log;
+ struct fc_log *log = fc->log.log;
int i;
if (log) {
if (refcount_dec_and_test(&log->usage)) {
- fc->log = NULL;
+ fc->log.log = NULL;
for (i = 0; i <= 7; i++)
if (log->need_free & (1 << i))
kfree(log->buffer[i]);
diff --git a/fs/fs_parser.c b/fs/fs_parser.c
index dadb6582874d..4c410eef0173 100644
--- a/fs/fs_parser.c
+++ b/fs/fs_parser.c
@@ -243,16 +243,6 @@ unknown_parameter:
}
EXPORT_SYMBOL(__fs_parse);
-int fs_parse(struct fs_context *fc,
- const struct fs_parameter_description *desc,
- struct fs_parameter *param,
- struct fs_parse_result *result)
-{
- struct p_log log = {.prefix = desc->name, .log = fc->log};
- return __fs_parse(&log, desc, param, result);
-}
-EXPORT_SYMBOL(fs_parse);
-
/**
* fs_lookup_param - Look up a path referred to by a parameter
* @fc: The filesystem context to log errors through.
diff --git a/fs/fsopen.c b/fs/fsopen.c
index c822d8924ca9..2fa3f241b762 100644
--- a/fs/fsopen.c
+++ b/fs/fsopen.c
@@ -25,7 +25,7 @@ static ssize_t fscontext_read(struct file *file,
char __user *_buf, size_t len, loff_t *pos)
{
struct fs_context *fc = file->private_data;
- struct fc_log *log = fc->log;
+ struct fc_log *log = fc->log.log;
unsigned int logsize = ARRAY_SIZE(log->buffer);
ssize_t ret;
char *p;
@@ -97,11 +97,11 @@ static int fscontext_create_fd(struct fs_context *fc, unsigned int o_flags)
static int fscontext_alloc_log(struct fs_context *fc)
{
- fc->log = kzalloc(sizeof(*fc->log), GFP_KERNEL);
- if (!fc->log)
+ fc->log.log = kzalloc(sizeof(*fc->log.log), GFP_KERNEL);
+ if (!fc->log.log)
return -ENOMEM;
- refcount_set(&fc->log->usage, 1);
- fc->log->owner = fc->fs_type->owner;
+ refcount_set(&fc->log.log->usage, 1);
+ fc->log.log->owner = fc->fs_type->owner;
return 0;
}
diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h
index 41f37d33e358..b2ad9b0a7af4 100644
--- a/include/linux/fs_context.h
+++ b/include/linux/fs_context.h
@@ -97,7 +97,7 @@ struct fs_context {
struct user_namespace *user_ns; /* The user namespace for this mount */
struct net *net_ns; /* The network namespace for this mount */
const struct cred *cred; /* The mounter's credentials */
- struct fc_log *log; /* Logging buffer */
+ struct p_log log; /* Logging buffer */
const char *source; /* The source name (eg. dev path) */
void *security; /* Linux S&M options */
void *s_fs_info; /* Proposed s_fs_info */
@@ -189,7 +189,7 @@ struct fc_log {
extern __attribute__((format(printf, 4, 5)))
void logfc(struct fc_log *log, const char *prefix, char level, const char *fmt, ...);
-#define __logfc(fc, l, fmt, ...) logfc((fc)->log, NULL, \
+#define __logfc(fc, l, fmt, ...) logfc((fc)->log.log, NULL, \
l, fmt, ## __VA_ARGS__)
#define __plog(p, l, fmt, ...) logfc((p)->log, (p)->prefix, \
l, fmt, ## __VA_ARGS__)
diff --git a/include/linux/fs_parser.h b/include/linux/fs_parser.h
index b0fba26a4ffe..37459124c1c1 100644
--- a/include/linux/fs_parser.h
+++ b/include/linux/fs_parser.h
@@ -78,10 +78,15 @@ extern int __fs_parse(struct p_log *log,
const struct fs_parameter_description *desc,
struct fs_parameter *value,
struct fs_parse_result *result);
-extern int fs_parse(struct fs_context *fc,
- const struct fs_parameter_description *desc,
- struct fs_parameter *value,
- struct fs_parse_result *result);
+
+static inline int fs_parse(struct fs_context *fc,
+ const struct fs_parameter_description *desc,
+ struct fs_parameter *param,
+ struct fs_parse_result *result)
+{
+ return __fs_parse(&fc->log, desc, param, result);
+}
+
extern int fs_lookup_param(struct fs_context *fc,
struct fs_parameter *param,
bool want_bdev,