Commit 33ce83ef authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

NFS: Replace fs_context-related dprintk() call sites with tracepoints

Contributed as part of the long patch series that converts NFS from
using dprintk to tracepoints for observability.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent f67939e4
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include "nfs.h" #include "nfs.h"
#include "internal.h" #include "internal.h"
#include "nfstrace.h"
#define NFSDBG_FACILITY NFSDBG_MOUNT #define NFSDBG_FACILITY NFSDBG_MOUNT
#if IS_ENABLED(CONFIG_NFS_V3) #if IS_ENABLED(CONFIG_NFS_V3)
...@@ -284,7 +286,6 @@ static int nfs_verify_server_address(struct sockaddr *addr) ...@@ -284,7 +286,6 @@ static int nfs_verify_server_address(struct sockaddr *addr)
} }
} }
dfprintk(MOUNT, "NFS: Invalid IP address specified\n");
return 0; return 0;
} }
...@@ -378,7 +379,7 @@ static int nfs_parse_security_flavors(struct fs_context *fc, ...@@ -378,7 +379,7 @@ static int nfs_parse_security_flavors(struct fs_context *fc,
char *string = param->string, *p; char *string = param->string, *p;
int ret; int ret;
dfprintk(MOUNT, "NFS: parsing %s=%s option\n", param->key, param->string); trace_nfs_mount_assign(param->key, string);
while ((p = strsep(&string, ":")) != NULL) { while ((p = strsep(&string, ":")) != NULL) {
if (!*p) if (!*p)
...@@ -480,7 +481,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, ...@@ -480,7 +481,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
unsigned int len; unsigned int len;
int ret, opt; int ret, opt;
dfprintk(MOUNT, "NFS: parsing nfs mount option '%s'\n", param->key); trace_nfs_mount_option(param);
opt = fs_parse(fc, nfs_fs_parameters, param, &result); opt = fs_parse(fc, nfs_fs_parameters, param, &result);
if (opt < 0) if (opt < 0)
...@@ -683,6 +684,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, ...@@ -683,6 +684,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
return ret; return ret;
break; break;
case Opt_vers: case Opt_vers:
trace_nfs_mount_assign(param->key, param->string);
ret = nfs_parse_version_string(fc, param->string); ret = nfs_parse_version_string(fc, param->string);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -694,6 +696,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, ...@@ -694,6 +696,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
break; break;
case Opt_proto: case Opt_proto:
trace_nfs_mount_assign(param->key, param->string);
protofamily = AF_INET; protofamily = AF_INET;
switch (lookup_constant(nfs_xprt_protocol_tokens, param->string, -1)) { switch (lookup_constant(nfs_xprt_protocol_tokens, param->string, -1)) {
case Opt_xprt_udp6: case Opt_xprt_udp6:
...@@ -729,6 +732,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, ...@@ -729,6 +732,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
break; break;
case Opt_mountproto: case Opt_mountproto:
trace_nfs_mount_assign(param->key, param->string);
mountfamily = AF_INET; mountfamily = AF_INET;
switch (lookup_constant(nfs_xprt_protocol_tokens, param->string, -1)) { switch (lookup_constant(nfs_xprt_protocol_tokens, param->string, -1)) {
case Opt_xprt_udp6: case Opt_xprt_udp6:
...@@ -751,6 +755,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, ...@@ -751,6 +755,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
break; break;
case Opt_addr: case Opt_addr:
trace_nfs_mount_assign(param->key, param->string);
len = rpc_pton(fc->net_ns, param->string, param->size, len = rpc_pton(fc->net_ns, param->string, param->size,
&ctx->nfs_server.address, &ctx->nfs_server.address,
sizeof(ctx->nfs_server._address)); sizeof(ctx->nfs_server._address));
...@@ -759,16 +764,19 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, ...@@ -759,16 +764,19 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
ctx->nfs_server.addrlen = len; ctx->nfs_server.addrlen = len;
break; break;
case Opt_clientaddr: case Opt_clientaddr:
trace_nfs_mount_assign(param->key, param->string);
kfree(ctx->client_address); kfree(ctx->client_address);
ctx->client_address = param->string; ctx->client_address = param->string;
param->string = NULL; param->string = NULL;
break; break;
case Opt_mounthost: case Opt_mounthost:
trace_nfs_mount_assign(param->key, param->string);
kfree(ctx->mount_server.hostname); kfree(ctx->mount_server.hostname);
ctx->mount_server.hostname = param->string; ctx->mount_server.hostname = param->string;
param->string = NULL; param->string = NULL;
break; break;
case Opt_mountaddr: case Opt_mountaddr:
trace_nfs_mount_assign(param->key, param->string);
len = rpc_pton(fc->net_ns, param->string, param->size, len = rpc_pton(fc->net_ns, param->string, param->size,
&ctx->mount_server.address, &ctx->mount_server.address,
sizeof(ctx->mount_server._address)); sizeof(ctx->mount_server._address));
...@@ -846,7 +854,6 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, ...@@ -846,7 +854,6 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
*/ */
case Opt_sloppy: case Opt_sloppy:
ctx->sloppy = true; ctx->sloppy = true;
dfprintk(MOUNT, "NFS: relaxing parsing rules\n");
break; break;
} }
...@@ -879,10 +886,8 @@ static int nfs_parse_source(struct fs_context *fc, ...@@ -879,10 +886,8 @@ static int nfs_parse_source(struct fs_context *fc,
size_t len; size_t len;
const char *end; const char *end;
if (unlikely(!dev_name || !*dev_name)) { if (unlikely(!dev_name || !*dev_name))
dfprintk(MOUNT, "NFS: device name not specified\n");
return -EINVAL; return -EINVAL;
}
/* Is the host name protected with square brakcets? */ /* Is the host name protected with square brakcets? */
if (*dev_name == '[') { if (*dev_name == '[') {
...@@ -922,7 +927,7 @@ static int nfs_parse_source(struct fs_context *fc, ...@@ -922,7 +927,7 @@ static int nfs_parse_source(struct fs_context *fc,
if (!ctx->nfs_server.export_path) if (!ctx->nfs_server.export_path)
goto out_nomem; goto out_nomem;
dfprintk(MOUNT, "NFS: MNTPATH: '%s'\n", ctx->nfs_server.export_path); trace_nfs_mount_path(ctx->nfs_server.export_path);
return 0; return 0;
out_bad_devname: out_bad_devname:
...@@ -1116,7 +1121,6 @@ static int nfs23_parse_monolithic(struct fs_context *fc, ...@@ -1116,7 +1121,6 @@ static int nfs23_parse_monolithic(struct fs_context *fc,
return nfs_invalf(fc, "NFS: nfs_mount_data version supports only AUTH_SYS"); return nfs_invalf(fc, "NFS: nfs_mount_data version supports only AUTH_SYS");
out_nomem: out_nomem:
dfprintk(MOUNT, "NFS: not enough memory to handle mount options");
return -ENOMEM; return -ENOMEM;
out_no_address: out_no_address:
...@@ -1248,7 +1252,7 @@ static int nfs4_parse_monolithic(struct fs_context *fc, ...@@ -1248,7 +1252,7 @@ static int nfs4_parse_monolithic(struct fs_context *fc,
if (IS_ERR(c)) if (IS_ERR(c))
return PTR_ERR(c); return PTR_ERR(c);
ctx->nfs_server.export_path = c; ctx->nfs_server.export_path = c;
dfprintk(MOUNT, "NFS: MNTPATH: '%s'\n", c); trace_nfs_mount_path(c);
c = strndup_user(data->client_addr.data, 16); c = strndup_user(data->client_addr.data, 16);
if (IS_ERR(c)) if (IS_ERR(c))
......
...@@ -1678,6 +1678,65 @@ TRACE_EVENT(nfs_fh_to_dentry, ...@@ -1678,6 +1678,65 @@ TRACE_EVENT(nfs_fh_to_dentry,
) )
); );
TRACE_EVENT(nfs_mount_assign,
TP_PROTO(
const char *option,
const char *value
),
TP_ARGS(option, value),
TP_STRUCT__entry(
__string(option, option)
__string(value, value)
),
TP_fast_assign(
__assign_str(option, option);
__assign_str(value, value);
),
TP_printk("option %s=%s",
__get_str(option), __get_str(value)
)
);
TRACE_EVENT(nfs_mount_option,
TP_PROTO(
const struct fs_parameter *param
),
TP_ARGS(param),
TP_STRUCT__entry(
__string(option, param->key)
),
TP_fast_assign(
__assign_str(option, param->key);
),
TP_printk("option %s", __get_str(option))
);
TRACE_EVENT(nfs_mount_path,
TP_PROTO(
const char *path
),
TP_ARGS(path),
TP_STRUCT__entry(
__string(path, path)
),
TP_fast_assign(
__assign_str(path, path);
),
TP_printk("path='%s'", __get_str(path))
);
DECLARE_EVENT_CLASS(nfs_xdr_event, DECLARE_EVENT_CLASS(nfs_xdr_event,
TP_PROTO( TP_PROTO(
const struct xdr_stream *xdr, const struct xdr_stream *xdr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment