Commit bdfd1105 authored by David Howells's avatar David Howells

afs: Trace the initiation and completion of client calls

Add tracepoints to trace the initiation and completion of client calls
within the kafs filesystem.

The afs_make_vl_call tracepoint watches calls to the volume location
database server.

The afs_make_fs_call tracepoint watches calls to the file server.

The afs_call_done tracepoint watches for call completion.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 80f5be5a
This diff is collapsed.
......@@ -110,6 +110,7 @@ struct afs_call {
struct afs_call_type {
const char *name;
unsigned int op; /* Really enum afs_fs_operation */
/* deliver request or reply data to an call
* - returning an error will cause the call to be aborted
......
......@@ -237,6 +237,7 @@ struct afs_call *afs_alloc_flat_call(const struct afs_call_type *type,
goto nomem_free;
}
call->operation_ID = type->op;
init_waitqueue_head(&call->waitq);
return call;
......@@ -420,12 +421,16 @@ int afs_make_call(struct in_addr *addr, struct afs_call *call, gfp_t gfp,
if (ret != -ECONNABORTED) {
rxrpc_kernel_abort_call(afs_socket, rxcall, RX_USER_ABORT,
ret, "KSD");
call->error = ret;
trace_afs_call_done(call);
} else {
abort_code = 0;
offset = 0;
rxrpc_kernel_recv_data(afs_socket, rxcall, NULL, 0, &offset,
false, &abort_code);
ret = call->type->abort_to_error(abort_code);
false, &call->abort_code);
ret = call->type->abort_to_error(call->abort_code);
call->error = ret;
trace_afs_call_done(call);
}
error_kill_call:
afs_put_call(call);
......@@ -457,10 +462,10 @@ static void afs_deliver_to_call(struct afs_call *call)
if (ret == -EINPROGRESS || ret == -EAGAIN)
return;
if (ret == 1 || ret < 0) {
call->state = AFS_CALL_COMPLETE;
goto done;
}
if (ret < 0)
call->error = ret;
if (ret < 0 || ret == 1)
goto call_complete;
return;
}
......@@ -468,7 +473,7 @@ static void afs_deliver_to_call(struct afs_call *call)
switch (ret) {
case 0:
if (call->state == AFS_CALL_AWAIT_REPLY)
call->state = AFS_CALL_COMPLETE;
goto call_complete;
goto done;
case -EINPROGRESS:
case -EAGAIN:
......@@ -508,7 +513,10 @@ static void afs_deliver_to_call(struct afs_call *call)
save_error:
call->error = ret;
call_complete:
call->state = AFS_CALL_COMPLETE;
if (call->state != AFS_CALL_COMPLETE) {
call->state = AFS_CALL_COMPLETE;
trace_afs_call_done(call);
}
goto done;
}
......@@ -821,6 +829,7 @@ int afs_extract_data(struct afs_call *call, void *buf, size_t count,
switch (call->state) {
case AFS_CALL_AWAIT_REPLY:
call->state = AFS_CALL_COMPLETE;
trace_afs_call_done(call);
break;
case AFS_CALL_AWAIT_REQUEST:
call->state = AFS_CALL_REPLYING;
......@@ -836,5 +845,6 @@ int afs_extract_data(struct afs_call *call, void *buf, size_t count,
else
call->error = ret;
call->state = AFS_CALL_COMPLETE;
trace_afs_call_done(call);
return ret;
}
......@@ -125,6 +125,7 @@ static int afs_deliver_vl_get_entry_by_xxx(struct afs_call *call)
*/
static const struct afs_call_type afs_RXVLGetEntryByName = {
.name = "VL.GetEntryByName",
.op = afs_VL_GetEntryByName,
.deliver = afs_deliver_vl_get_entry_by_xxx,
.abort_to_error = afs_vl_abort_to_error,
.destructor = afs_flat_call_destructor,
......@@ -135,6 +136,7 @@ static const struct afs_call_type afs_RXVLGetEntryByName = {
*/
static const struct afs_call_type afs_RXVLGetEntryById = {
.name = "VL.GetEntryById",
.op = afs_VL_GetEntryByID,
.deliver = afs_deliver_vl_get_entry_by_xxx,
.abort_to_error = afs_vl_abort_to_error,
.destructor = afs_flat_call_destructor,
......@@ -177,6 +179,7 @@ int afs_vl_get_entry_by_name(struct in_addr *addr,
memset((void *) bp + volnamesz, 0, padsz);
/* initiate the call */
trace_afs_make_vl_call(call);
return afs_make_call(addr, call, GFP_KERNEL, async);
}
......@@ -211,5 +214,6 @@ int afs_vl_get_entry_by_id(struct in_addr *addr,
*bp = htonl(voltype);
/* initiate the call */
trace_afs_make_vl_call(call);
return afs_make_call(addr, call, GFP_KERNEL, async);
}
......@@ -30,6 +30,36 @@ enum afs_call_trace {
afs_call_trace_work,
};
enum afs_fs_operation {
afs_FS_FetchData = 130, /* AFS Fetch file data */
afs_FS_FetchStatus = 132, /* AFS Fetch file status */
afs_FS_StoreData = 133, /* AFS Store file data */
afs_FS_StoreStatus = 135, /* AFS Store file status */
afs_FS_RemoveFile = 136, /* AFS Remove a file */
afs_FS_CreateFile = 137, /* AFS Create a file */
afs_FS_Rename = 138, /* AFS Rename or move a file or directory */
afs_FS_Symlink = 139, /* AFS Create a symbolic link */
afs_FS_Link = 140, /* AFS Create a hard link */
afs_FS_MakeDir = 141, /* AFS Create a directory */
afs_FS_RemoveDir = 142, /* AFS Remove a directory */
afs_FS_GiveUpCallbacks = 147, /* AFS Discard callback promises */
afs_FS_GetVolumeInfo = 148, /* AFS Get information about a volume */
afs_FS_GetVolumeStatus = 149, /* AFS Get volume status information */
afs_FS_GetRootVolume = 151, /* AFS Get root volume name */
afs_FS_SetLock = 156, /* AFS Request a file lock */
afs_FS_ExtendLock = 157, /* AFS Extend a file lock */
afs_FS_ReleaseLock = 158, /* AFS Release a file lock */
afs_FS_Lookup = 161, /* AFS lookup file in directory */
afs_FS_FetchData64 = 65537, /* AFS Fetch file data */
afs_FS_StoreData64 = 65538, /* AFS Store file data */
};
enum afs_vl_operation {
afs_VL_GetEntryByID = 503, /* AFS Get Cache Entry By ID operation ID */
afs_VL_GetEntryByName = 504, /* AFS Get Cache Entry By Name operation ID */
afs_VL_Probe = 514, /* AFS Probe Volume Location Service operation ID */
};
#endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
/*
......@@ -42,6 +72,35 @@ enum afs_call_trace {
EM(afs_call_trace_wake, "WAKE ") \
E_(afs_call_trace_work, "WORK ")
#define afs_fs_operations \
EM(afs_FS_FetchData, "FS.FetchData") \
EM(afs_FS_FetchStatus, "FS.FetchStatus") \
EM(afs_FS_StoreData, "FS.StoreData") \
EM(afs_FS_StoreStatus, "FS.StoreStatus") \
EM(afs_FS_RemoveFile, "FS.RemoveFile") \
EM(afs_FS_CreateFile, "FS.CreateFile") \
EM(afs_FS_Rename, "FS.Rename") \
EM(afs_FS_Symlink, "FS.Symlink") \
EM(afs_FS_Link, "FS.Link") \
EM(afs_FS_MakeDir, "FS.MakeDir") \
EM(afs_FS_RemoveDir, "FS.RemoveDir") \
EM(afs_FS_GiveUpCallbacks, "FS.GiveUpCallbacks") \
EM(afs_FS_GetVolumeInfo, "FS.GetVolumeInfo") \
EM(afs_FS_GetVolumeStatus, "FS.GetVolumeStatus") \
EM(afs_FS_GetRootVolume, "FS.GetRootVolume") \
EM(afs_FS_SetLock, "FS.SetLock") \
EM(afs_FS_ExtendLock, "FS.ExtendLock") \
EM(afs_FS_ReleaseLock, "FS.ReleaseLock") \
EM(afs_FS_Lookup, "FS.Lookup") \
EM(afs_FS_FetchData64, "FS.FetchData64") \
E_(afs_FS_StoreData64, "FS.StoreData64")
#define afs_vl_operations \
EM(afs_VL_GetEntryByID, "VL.GetEntryByID") \
EM(afs_VL_GetEntryByName, "VL.GetEntryByName") \
E_(afs_VL_Probe, "VL.Probe")
/*
* Export enum symbols via userspace.
*/
......@@ -51,6 +110,8 @@ enum afs_call_trace {
#define E_(a, b) TRACE_DEFINE_ENUM(a);
afs_call_traces;
afs_fs_operations;
afs_vl_operations;
/*
* Now redefine the EM() and E_() macros to map the enums to the strings that
......@@ -178,6 +239,77 @@ TRACE_EVENT(afs_call,
__entry->where)
);
TRACE_EVENT(afs_make_fs_call,
TP_PROTO(struct afs_call *call, const struct afs_fid *fid),
TP_ARGS(call, fid),
TP_STRUCT__entry(
__field(struct afs_call *, call )
__field(enum afs_fs_operation, op )
__field_struct(struct afs_fid, fid )
),
TP_fast_assign(
__entry->call = call;
__entry->op = call->operation_ID;
__entry->fid = *fid;
),
TP_printk("c=%p %06x:%06x:%06x %s",
__entry->call,
__entry->fid.vid,
__entry->fid.vnode,
__entry->fid.unique,
__print_symbolic(__entry->op, afs_fs_operations))
);
TRACE_EVENT(afs_make_vl_call,
TP_PROTO(struct afs_call *call),
TP_ARGS(call),
TP_STRUCT__entry(
__field(struct afs_call *, call )
__field(enum afs_vl_operation, op )
),
TP_fast_assign(
__entry->call = call;
__entry->op = call->operation_ID;
),
TP_printk("c=%p %s",
__entry->call,
__print_symbolic(__entry->op, afs_vl_operations))
);
TRACE_EVENT(afs_call_done,
TP_PROTO(struct afs_call *call),
TP_ARGS(call),
TP_STRUCT__entry(
__field(struct afs_call *, call )
__field(struct rxrpc_call *, rx_call )
__field(int, ret )
__field(u32, abort_code )
),
TP_fast_assign(
__entry->call = call;
__entry->rx_call = call->rxcall;
__entry->ret = call->error;
__entry->abort_code = call->abort_code;
),
TP_printk(" c=%p ret=%d ab=%d [%p]",
__entry->call,
__entry->ret,
__entry->abort_code,
__entry->rx_call)
);
#endif /* _TRACE_AFS_H */
/* This part must be outside protection */
......
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