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
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include "internal.h" #include "internal.h"
#include "afs_fs.h" #include "afs_fs.h"
static const struct afs_fid afs_zero_fid;
/* /*
* We need somewhere to discard into in case the server helpfully returns more * We need somewhere to discard into in case the server helpfully returns more
* than we asked for in FS.FetchData{,64}. * than we asked for in FS.FetchData{,64}.
...@@ -269,6 +271,7 @@ static int afs_deliver_fs_fetch_status(struct afs_call *call) ...@@ -269,6 +271,7 @@ static int afs_deliver_fs_fetch_status(struct afs_call *call)
*/ */
static const struct afs_call_type afs_RXFSFetchStatus = { static const struct afs_call_type afs_RXFSFetchStatus = {
.name = "FS.FetchStatus", .name = "FS.FetchStatus",
.op = afs_FS_FetchStatus,
.deliver = afs_deliver_fs_fetch_status, .deliver = afs_deliver_fs_fetch_status,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -306,6 +309,7 @@ int afs_fs_fetch_file_status(struct afs_server *server, ...@@ -306,6 +309,7 @@ int afs_fs_fetch_file_status(struct afs_server *server,
bp[2] = htonl(vnode->fid.vnode); bp[2] = htonl(vnode->fid.vnode);
bp[3] = htonl(vnode->fid.unique); bp[3] = htonl(vnode->fid.unique);
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -468,6 +472,7 @@ static void afs_fetch_data_destructor(struct afs_call *call) ...@@ -468,6 +472,7 @@ static void afs_fetch_data_destructor(struct afs_call *call)
*/ */
static const struct afs_call_type afs_RXFSFetchData = { static const struct afs_call_type afs_RXFSFetchData = {
.name = "FS.FetchData", .name = "FS.FetchData",
.op = afs_FS_FetchData,
.deliver = afs_deliver_fs_fetch_data, .deliver = afs_deliver_fs_fetch_data,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_fetch_data_destructor, .destructor = afs_fetch_data_destructor,
...@@ -475,6 +480,7 @@ static const struct afs_call_type afs_RXFSFetchData = { ...@@ -475,6 +480,7 @@ static const struct afs_call_type afs_RXFSFetchData = {
static const struct afs_call_type afs_RXFSFetchData64 = { static const struct afs_call_type afs_RXFSFetchData64 = {
.name = "FS.FetchData64", .name = "FS.FetchData64",
.op = afs_FS_FetchData64,
.deliver = afs_deliver_fs_fetch_data, .deliver = afs_deliver_fs_fetch_data,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_fetch_data_destructor, .destructor = afs_fetch_data_destructor,
...@@ -504,7 +510,6 @@ static int afs_fs_fetch_data64(struct afs_server *server, ...@@ -504,7 +510,6 @@ static int afs_fs_fetch_data64(struct afs_server *server,
call->reply3 = req; call->reply3 = req;
call->service_id = FS_SERVICE; call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT); call->port = htons(AFS_FS_PORT);
call->operation_ID = FSFETCHDATA64;
/* marshall the parameters */ /* marshall the parameters */
bp = call->request; bp = call->request;
...@@ -518,6 +523,7 @@ static int afs_fs_fetch_data64(struct afs_server *server, ...@@ -518,6 +523,7 @@ static int afs_fs_fetch_data64(struct afs_server *server,
bp[7] = htonl(lower_32_bits(req->len)); bp[7] = htonl(lower_32_bits(req->len));
atomic_inc(&req->usage); atomic_inc(&req->usage);
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -550,7 +556,6 @@ int afs_fs_fetch_data(struct afs_server *server, ...@@ -550,7 +556,6 @@ int afs_fs_fetch_data(struct afs_server *server,
call->reply3 = req; call->reply3 = req;
call->service_id = FS_SERVICE; call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT); call->port = htons(AFS_FS_PORT);
call->operation_ID = FSFETCHDATA;
/* marshall the parameters */ /* marshall the parameters */
bp = call->request; bp = call->request;
...@@ -562,6 +567,7 @@ int afs_fs_fetch_data(struct afs_server *server, ...@@ -562,6 +567,7 @@ int afs_fs_fetch_data(struct afs_server *server,
bp[5] = htonl(lower_32_bits(req->len)); bp[5] = htonl(lower_32_bits(req->len));
atomic_inc(&req->usage); atomic_inc(&req->usage);
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -581,6 +587,7 @@ static int afs_deliver_fs_give_up_callbacks(struct afs_call *call) ...@@ -581,6 +587,7 @@ static int afs_deliver_fs_give_up_callbacks(struct afs_call *call)
*/ */
static const struct afs_call_type afs_RXFSGiveUpCallBacks = { static const struct afs_call_type afs_RXFSGiveUpCallBacks = {
.name = "FS.GiveUpCallBacks", .name = "FS.GiveUpCallBacks",
.op = afs_FS_GiveUpCallbacks,
.deliver = afs_deliver_fs_give_up_callbacks, .deliver = afs_deliver_fs_give_up_callbacks,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -645,6 +652,7 @@ int afs_fs_give_up_callbacks(struct afs_server *server, ...@@ -645,6 +652,7 @@ int afs_fs_give_up_callbacks(struct afs_server *server,
ASSERT(ncallbacks > 0); ASSERT(ncallbacks > 0);
wake_up_nr(&server->cb_break_waitq, ncallbacks); wake_up_nr(&server->cb_break_waitq, ncallbacks);
trace_afs_make_fs_call(call, &afs_zero_fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -678,8 +686,17 @@ static int afs_deliver_fs_create_vnode(struct afs_call *call) ...@@ -678,8 +686,17 @@ static int afs_deliver_fs_create_vnode(struct afs_call *call)
/* /*
* FS.CreateFile and FS.MakeDir operation type * FS.CreateFile and FS.MakeDir operation type
*/ */
static const struct afs_call_type afs_RXFSCreateXXXX = { static const struct afs_call_type afs_RXFSCreateFile = {
.name = "FS.CreateXXXX", .name = "FS.CreateFile",
.op = afs_FS_CreateFile,
.deliver = afs_deliver_fs_create_vnode,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
static const struct afs_call_type afs_RXFSMakeDir = {
.name = "FS.MakeDir",
.op = afs_FS_MakeDir,
.deliver = afs_deliver_fs_create_vnode, .deliver = afs_deliver_fs_create_vnode,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -708,8 +725,9 @@ int afs_fs_create(struct afs_server *server, ...@@ -708,8 +725,9 @@ int afs_fs_create(struct afs_server *server,
padsz = (4 - (namesz & 3)) & 3; padsz = (4 - (namesz & 3)) & 3;
reqsz = (5 * 4) + namesz + padsz + (6 * 4); reqsz = (5 * 4) + namesz + padsz + (6 * 4);
call = afs_alloc_flat_call(&afs_RXFSCreateXXXX, reqsz, call = afs_alloc_flat_call(
(3 + 21 + 21 + 3 + 6) * 4); S_ISDIR(mode) ? &afs_RXFSMakeDir : &afs_RXFSCreateFile,
reqsz, (3 + 21 + 21 + 3 + 6) * 4);
if (!call) if (!call)
return -ENOMEM; return -ENOMEM;
...@@ -741,6 +759,7 @@ int afs_fs_create(struct afs_server *server, ...@@ -741,6 +759,7 @@ int afs_fs_create(struct afs_server *server,
*bp++ = htonl(mode & S_IALLUGO); /* unix mode */ *bp++ = htonl(mode & S_IALLUGO); /* unix mode */
*bp++ = 0; /* segment size */ *bp++ = 0; /* segment size */
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -771,8 +790,17 @@ static int afs_deliver_fs_remove(struct afs_call *call) ...@@ -771,8 +790,17 @@ static int afs_deliver_fs_remove(struct afs_call *call)
/* /*
* FS.RemoveDir/FS.RemoveFile operation type * FS.RemoveDir/FS.RemoveFile operation type
*/ */
static const struct afs_call_type afs_RXFSRemoveXXXX = { static const struct afs_call_type afs_RXFSRemoveFile = {
.name = "FS.RemoveXXXX", .name = "FS.RemoveFile",
.op = afs_FS_RemoveFile,
.deliver = afs_deliver_fs_remove,
.abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor,
};
static const struct afs_call_type afs_RXFSRemoveDir = {
.name = "FS.RemoveDir",
.op = afs_FS_RemoveDir,
.deliver = afs_deliver_fs_remove, .deliver = afs_deliver_fs_remove,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -798,7 +826,9 @@ int afs_fs_remove(struct afs_server *server, ...@@ -798,7 +826,9 @@ int afs_fs_remove(struct afs_server *server,
padsz = (4 - (namesz & 3)) & 3; padsz = (4 - (namesz & 3)) & 3;
reqsz = (5 * 4) + namesz + padsz; reqsz = (5 * 4) + namesz + padsz;
call = afs_alloc_flat_call(&afs_RXFSRemoveXXXX, reqsz, (21 + 6) * 4); call = afs_alloc_flat_call(
isdir ? &afs_RXFSRemoveDir : &afs_RXFSRemoveFile,
reqsz, (21 + 6) * 4);
if (!call) if (!call)
return -ENOMEM; return -ENOMEM;
...@@ -821,6 +851,7 @@ int afs_fs_remove(struct afs_server *server, ...@@ -821,6 +851,7 @@ int afs_fs_remove(struct afs_server *server,
bp = (void *) bp + padsz; bp = (void *) bp + padsz;
} }
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -854,6 +885,7 @@ static int afs_deliver_fs_link(struct afs_call *call) ...@@ -854,6 +885,7 @@ static int afs_deliver_fs_link(struct afs_call *call)
*/ */
static const struct afs_call_type afs_RXFSLink = { static const struct afs_call_type afs_RXFSLink = {
.name = "FS.Link", .name = "FS.Link",
.op = afs_FS_Link,
.deliver = afs_deliver_fs_link, .deliver = afs_deliver_fs_link,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -906,6 +938,7 @@ int afs_fs_link(struct afs_server *server, ...@@ -906,6 +938,7 @@ int afs_fs_link(struct afs_server *server,
*bp++ = htonl(vnode->fid.vnode); *bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique); *bp++ = htonl(vnode->fid.unique);
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -940,6 +973,7 @@ static int afs_deliver_fs_symlink(struct afs_call *call) ...@@ -940,6 +973,7 @@ static int afs_deliver_fs_symlink(struct afs_call *call)
*/ */
static const struct afs_call_type afs_RXFSSymlink = { static const struct afs_call_type afs_RXFSSymlink = {
.name = "FS.Symlink", .name = "FS.Symlink",
.op = afs_FS_Symlink,
.deliver = afs_deliver_fs_symlink, .deliver = afs_deliver_fs_symlink,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -1010,6 +1044,7 @@ int afs_fs_symlink(struct afs_server *server, ...@@ -1010,6 +1044,7 @@ int afs_fs_symlink(struct afs_server *server,
*bp++ = htonl(S_IRWXUGO); /* unix mode */ *bp++ = htonl(S_IRWXUGO); /* unix mode */
*bp++ = 0; /* segment size */ *bp++ = 0; /* segment size */
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -1045,6 +1080,7 @@ static int afs_deliver_fs_rename(struct afs_call *call) ...@@ -1045,6 +1080,7 @@ static int afs_deliver_fs_rename(struct afs_call *call)
*/ */
static const struct afs_call_type afs_RXFSRename = { static const struct afs_call_type afs_RXFSRename = {
.name = "FS.Rename", .name = "FS.Rename",
.op = afs_FS_Rename,
.deliver = afs_deliver_fs_rename, .deliver = afs_deliver_fs_rename,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -1113,6 +1149,7 @@ int afs_fs_rename(struct afs_server *server, ...@@ -1113,6 +1149,7 @@ int afs_fs_rename(struct afs_server *server,
bp = (void *) bp + n_padsz; bp = (void *) bp + n_padsz;
} }
trace_afs_make_fs_call(call, &orig_dvnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -1148,6 +1185,7 @@ static int afs_deliver_fs_store_data(struct afs_call *call) ...@@ -1148,6 +1185,7 @@ static int afs_deliver_fs_store_data(struct afs_call *call)
*/ */
static const struct afs_call_type afs_RXFSStoreData = { static const struct afs_call_type afs_RXFSStoreData = {
.name = "FS.StoreData", .name = "FS.StoreData",
.op = afs_FS_StoreData,
.deliver = afs_deliver_fs_store_data, .deliver = afs_deliver_fs_store_data,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -1155,6 +1193,7 @@ static const struct afs_call_type afs_RXFSStoreData = { ...@@ -1155,6 +1193,7 @@ static const struct afs_call_type afs_RXFSStoreData = {
static const struct afs_call_type afs_RXFSStoreData64 = { static const struct afs_call_type afs_RXFSStoreData64 = {
.name = "FS.StoreData64", .name = "FS.StoreData64",
.op = afs_FS_StoreData64,
.deliver = afs_deliver_fs_store_data, .deliver = afs_deliver_fs_store_data,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -1217,6 +1256,7 @@ static int afs_fs_store_data64(struct afs_server *server, ...@@ -1217,6 +1256,7 @@ static int afs_fs_store_data64(struct afs_server *server,
*bp++ = htonl(i_size >> 32); *bp++ = htonl(i_size >> 32);
*bp++ = htonl((u32) i_size); *bp++ = htonl((u32) i_size);
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -1293,6 +1333,7 @@ int afs_fs_store_data(struct afs_server *server, ...@@ -1293,6 +1333,7 @@ int afs_fs_store_data(struct afs_server *server,
*bp++ = htonl(size); *bp++ = htonl(size);
*bp++ = htonl(i_size); *bp++ = htonl(i_size);
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -1330,6 +1371,7 @@ static int afs_deliver_fs_store_status(struct afs_call *call) ...@@ -1330,6 +1371,7 @@ static int afs_deliver_fs_store_status(struct afs_call *call)
*/ */
static const struct afs_call_type afs_RXFSStoreStatus = { static const struct afs_call_type afs_RXFSStoreStatus = {
.name = "FS.StoreStatus", .name = "FS.StoreStatus",
.op = afs_FS_StoreStatus,
.deliver = afs_deliver_fs_store_status, .deliver = afs_deliver_fs_store_status,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -1337,6 +1379,7 @@ static const struct afs_call_type afs_RXFSStoreStatus = { ...@@ -1337,6 +1379,7 @@ static const struct afs_call_type afs_RXFSStoreStatus = {
static const struct afs_call_type afs_RXFSStoreData_as_Status = { static const struct afs_call_type afs_RXFSStoreData_as_Status = {
.name = "FS.StoreData", .name = "FS.StoreData",
.op = afs_FS_StoreData,
.deliver = afs_deliver_fs_store_status, .deliver = afs_deliver_fs_store_status,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -1344,6 +1387,7 @@ static const struct afs_call_type afs_RXFSStoreData_as_Status = { ...@@ -1344,6 +1387,7 @@ static const struct afs_call_type afs_RXFSStoreData_as_Status = {
static const struct afs_call_type afs_RXFSStoreData64_as_Status = { static const struct afs_call_type afs_RXFSStoreData64_as_Status = {
.name = "FS.StoreData64", .name = "FS.StoreData64",
.op = afs_FS_StoreData64,
.deliver = afs_deliver_fs_store_status, .deliver = afs_deliver_fs_store_status,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -1376,7 +1420,6 @@ static int afs_fs_setattr_size64(struct afs_server *server, struct key *key, ...@@ -1376,7 +1420,6 @@ static int afs_fs_setattr_size64(struct afs_server *server, struct key *key,
call->service_id = FS_SERVICE; call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT); call->port = htons(AFS_FS_PORT);
call->store_version = vnode->status.data_version + 1; call->store_version = vnode->status.data_version + 1;
call->operation_ID = FSSTOREDATA;
/* marshall the parameters */ /* marshall the parameters */
bp = call->request; bp = call->request;
...@@ -1394,6 +1437,7 @@ static int afs_fs_setattr_size64(struct afs_server *server, struct key *key, ...@@ -1394,6 +1437,7 @@ static int afs_fs_setattr_size64(struct afs_server *server, struct key *key,
*bp++ = htonl(attr->ia_size >> 32); /* new file length */ *bp++ = htonl(attr->ia_size >> 32); /* new file length */
*bp++ = htonl((u32) attr->ia_size); *bp++ = htonl((u32) attr->ia_size);
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -1427,7 +1471,6 @@ static int afs_fs_setattr_size(struct afs_server *server, struct key *key, ...@@ -1427,7 +1471,6 @@ static int afs_fs_setattr_size(struct afs_server *server, struct key *key,
call->service_id = FS_SERVICE; call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT); call->port = htons(AFS_FS_PORT);
call->store_version = vnode->status.data_version + 1; call->store_version = vnode->status.data_version + 1;
call->operation_ID = FSSTOREDATA;
/* marshall the parameters */ /* marshall the parameters */
bp = call->request; bp = call->request;
...@@ -1442,6 +1485,7 @@ static int afs_fs_setattr_size(struct afs_server *server, struct key *key, ...@@ -1442,6 +1485,7 @@ static int afs_fs_setattr_size(struct afs_server *server, struct key *key,
*bp++ = 0; /* size of write */ *bp++ = 0; /* size of write */
*bp++ = htonl(attr->ia_size); /* new file length */ *bp++ = htonl(attr->ia_size); /* new file length */
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -1473,7 +1517,6 @@ int afs_fs_setattr(struct afs_server *server, struct key *key, ...@@ -1473,7 +1517,6 @@ int afs_fs_setattr(struct afs_server *server, struct key *key,
call->reply = vnode; call->reply = vnode;
call->service_id = FS_SERVICE; call->service_id = FS_SERVICE;
call->port = htons(AFS_FS_PORT); call->port = htons(AFS_FS_PORT);
call->operation_ID = FSSTORESTATUS;
/* marshall the parameters */ /* marshall the parameters */
bp = call->request; bp = call->request;
...@@ -1484,6 +1527,7 @@ int afs_fs_setattr(struct afs_server *server, struct key *key, ...@@ -1484,6 +1527,7 @@ int afs_fs_setattr(struct afs_server *server, struct key *key,
xdr_encode_AFS_StoreStatus(&bp, attr); xdr_encode_AFS_StoreStatus(&bp, attr);
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -1674,6 +1718,7 @@ static void afs_get_volume_status_call_destructor(struct afs_call *call) ...@@ -1674,6 +1718,7 @@ static void afs_get_volume_status_call_destructor(struct afs_call *call)
*/ */
static const struct afs_call_type afs_RXFSGetVolumeStatus = { static const struct afs_call_type afs_RXFSGetVolumeStatus = {
.name = "FS.GetVolumeStatus", .name = "FS.GetVolumeStatus",
.op = afs_FS_GetVolumeStatus,
.deliver = afs_deliver_fs_get_volume_status, .deliver = afs_deliver_fs_get_volume_status,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_get_volume_status_call_destructor, .destructor = afs_get_volume_status_call_destructor,
...@@ -1716,6 +1761,7 @@ int afs_fs_get_volume_status(struct afs_server *server, ...@@ -1716,6 +1761,7 @@ int afs_fs_get_volume_status(struct afs_server *server,
bp[0] = htonl(FSGETVOLUMESTATUS); bp[0] = htonl(FSGETVOLUMESTATUS);
bp[1] = htonl(vnode->fid.vid); bp[1] = htonl(vnode->fid.vid);
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -1746,6 +1792,7 @@ static int afs_deliver_fs_xxxx_lock(struct afs_call *call) ...@@ -1746,6 +1792,7 @@ static int afs_deliver_fs_xxxx_lock(struct afs_call *call)
*/ */
static const struct afs_call_type afs_RXFSSetLock = { static const struct afs_call_type afs_RXFSSetLock = {
.name = "FS.SetLock", .name = "FS.SetLock",
.op = afs_FS_SetLock,
.deliver = afs_deliver_fs_xxxx_lock, .deliver = afs_deliver_fs_xxxx_lock,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -1756,6 +1803,7 @@ static const struct afs_call_type afs_RXFSSetLock = { ...@@ -1756,6 +1803,7 @@ static const struct afs_call_type afs_RXFSSetLock = {
*/ */
static const struct afs_call_type afs_RXFSExtendLock = { static const struct afs_call_type afs_RXFSExtendLock = {
.name = "FS.ExtendLock", .name = "FS.ExtendLock",
.op = afs_FS_ExtendLock,
.deliver = afs_deliver_fs_xxxx_lock, .deliver = afs_deliver_fs_xxxx_lock,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -1766,6 +1814,7 @@ static const struct afs_call_type afs_RXFSExtendLock = { ...@@ -1766,6 +1814,7 @@ static const struct afs_call_type afs_RXFSExtendLock = {
*/ */
static const struct afs_call_type afs_RXFSReleaseLock = { static const struct afs_call_type afs_RXFSReleaseLock = {
.name = "FS.ReleaseLock", .name = "FS.ReleaseLock",
.op = afs_FS_ReleaseLock,
.deliver = afs_deliver_fs_xxxx_lock, .deliver = afs_deliver_fs_xxxx_lock,
.abort_to_error = afs_abort_to_error, .abort_to_error = afs_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -1802,6 +1851,7 @@ int afs_fs_set_lock(struct afs_server *server, ...@@ -1802,6 +1851,7 @@ int afs_fs_set_lock(struct afs_server *server,
*bp++ = htonl(vnode->fid.unique); *bp++ = htonl(vnode->fid.unique);
*bp++ = htonl(type); *bp++ = htonl(type);
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -1834,6 +1884,7 @@ int afs_fs_extend_lock(struct afs_server *server, ...@@ -1834,6 +1884,7 @@ int afs_fs_extend_lock(struct afs_server *server,
*bp++ = htonl(vnode->fid.vnode); *bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique); *bp++ = htonl(vnode->fid.unique);
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -1866,5 +1917,6 @@ int afs_fs_release_lock(struct afs_server *server, ...@@ -1866,5 +1917,6 @@ int afs_fs_release_lock(struct afs_server *server,
*bp++ = htonl(vnode->fid.vnode); *bp++ = htonl(vnode->fid.vnode);
*bp++ = htonl(vnode->fid.unique); *bp++ = htonl(vnode->fid.unique);
trace_afs_make_fs_call(call, &vnode->fid);
return afs_make_call(&server->addr, call, GFP_NOFS, async); return afs_make_call(&server->addr, call, GFP_NOFS, async);
} }
...@@ -110,6 +110,7 @@ struct afs_call { ...@@ -110,6 +110,7 @@ struct afs_call {
struct afs_call_type { struct afs_call_type {
const char *name; const char *name;
unsigned int op; /* Really enum afs_fs_operation */
/* deliver request or reply data to an call /* deliver request or reply data to an call
* - returning an error will cause the call to be aborted * - 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, ...@@ -237,6 +237,7 @@ struct afs_call *afs_alloc_flat_call(const struct afs_call_type *type,
goto nomem_free; goto nomem_free;
} }
call->operation_ID = type->op;
init_waitqueue_head(&call->waitq); init_waitqueue_head(&call->waitq);
return call; return call;
...@@ -420,12 +421,16 @@ int afs_make_call(struct in_addr *addr, struct afs_call *call, gfp_t gfp, ...@@ -420,12 +421,16 @@ int afs_make_call(struct in_addr *addr, struct afs_call *call, gfp_t gfp,
if (ret != -ECONNABORTED) { if (ret != -ECONNABORTED) {
rxrpc_kernel_abort_call(afs_socket, rxcall, RX_USER_ABORT, rxrpc_kernel_abort_call(afs_socket, rxcall, RX_USER_ABORT,
ret, "KSD"); ret, "KSD");
call->error = ret;
trace_afs_call_done(call);
} else { } else {
abort_code = 0; abort_code = 0;
offset = 0; offset = 0;
rxrpc_kernel_recv_data(afs_socket, rxcall, NULL, 0, &offset, rxrpc_kernel_recv_data(afs_socket, rxcall, NULL, 0, &offset,
false, &abort_code); false, &call->abort_code);
ret = call->type->abort_to_error(abort_code); ret = call->type->abort_to_error(call->abort_code);
call->error = ret;
trace_afs_call_done(call);
} }
error_kill_call: error_kill_call:
afs_put_call(call); afs_put_call(call);
...@@ -457,10 +462,10 @@ static void afs_deliver_to_call(struct afs_call *call) ...@@ -457,10 +462,10 @@ static void afs_deliver_to_call(struct afs_call *call)
if (ret == -EINPROGRESS || ret == -EAGAIN) if (ret == -EINPROGRESS || ret == -EAGAIN)
return; return;
if (ret == 1 || ret < 0) { if (ret < 0)
call->state = AFS_CALL_COMPLETE; call->error = ret;
goto done; if (ret < 0 || ret == 1)
} goto call_complete;
return; return;
} }
...@@ -468,7 +473,7 @@ static void afs_deliver_to_call(struct afs_call *call) ...@@ -468,7 +473,7 @@ static void afs_deliver_to_call(struct afs_call *call)
switch (ret) { switch (ret) {
case 0: case 0:
if (call->state == AFS_CALL_AWAIT_REPLY) if (call->state == AFS_CALL_AWAIT_REPLY)
call->state = AFS_CALL_COMPLETE; goto call_complete;
goto done; goto done;
case -EINPROGRESS: case -EINPROGRESS:
case -EAGAIN: case -EAGAIN:
...@@ -508,7 +513,10 @@ static void afs_deliver_to_call(struct afs_call *call) ...@@ -508,7 +513,10 @@ static void afs_deliver_to_call(struct afs_call *call)
save_error: save_error:
call->error = ret; call->error = ret;
call_complete: 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; goto done;
} }
...@@ -821,6 +829,7 @@ int afs_extract_data(struct afs_call *call, void *buf, size_t count, ...@@ -821,6 +829,7 @@ int afs_extract_data(struct afs_call *call, void *buf, size_t count,
switch (call->state) { switch (call->state) {
case AFS_CALL_AWAIT_REPLY: case AFS_CALL_AWAIT_REPLY:
call->state = AFS_CALL_COMPLETE; call->state = AFS_CALL_COMPLETE;
trace_afs_call_done(call);
break; break;
case AFS_CALL_AWAIT_REQUEST: case AFS_CALL_AWAIT_REQUEST:
call->state = AFS_CALL_REPLYING; call->state = AFS_CALL_REPLYING;
...@@ -836,5 +845,6 @@ int afs_extract_data(struct afs_call *call, void *buf, size_t count, ...@@ -836,5 +845,6 @@ int afs_extract_data(struct afs_call *call, void *buf, size_t count,
else else
call->error = ret; call->error = ret;
call->state = AFS_CALL_COMPLETE; call->state = AFS_CALL_COMPLETE;
trace_afs_call_done(call);
return ret; return ret;
} }
...@@ -125,6 +125,7 @@ static int afs_deliver_vl_get_entry_by_xxx(struct afs_call *call) ...@@ -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 = { static const struct afs_call_type afs_RXVLGetEntryByName = {
.name = "VL.GetEntryByName", .name = "VL.GetEntryByName",
.op = afs_VL_GetEntryByName,
.deliver = afs_deliver_vl_get_entry_by_xxx, .deliver = afs_deliver_vl_get_entry_by_xxx,
.abort_to_error = afs_vl_abort_to_error, .abort_to_error = afs_vl_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -135,6 +136,7 @@ static const struct afs_call_type afs_RXVLGetEntryByName = { ...@@ -135,6 +136,7 @@ static const struct afs_call_type afs_RXVLGetEntryByName = {
*/ */
static const struct afs_call_type afs_RXVLGetEntryById = { static const struct afs_call_type afs_RXVLGetEntryById = {
.name = "VL.GetEntryById", .name = "VL.GetEntryById",
.op = afs_VL_GetEntryByID,
.deliver = afs_deliver_vl_get_entry_by_xxx, .deliver = afs_deliver_vl_get_entry_by_xxx,
.abort_to_error = afs_vl_abort_to_error, .abort_to_error = afs_vl_abort_to_error,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
...@@ -177,6 +179,7 @@ int afs_vl_get_entry_by_name(struct in_addr *addr, ...@@ -177,6 +179,7 @@ int afs_vl_get_entry_by_name(struct in_addr *addr,
memset((void *) bp + volnamesz, 0, padsz); memset((void *) bp + volnamesz, 0, padsz);
/* initiate the call */ /* initiate the call */
trace_afs_make_vl_call(call);
return afs_make_call(addr, call, GFP_KERNEL, async); return afs_make_call(addr, call, GFP_KERNEL, async);
} }
...@@ -211,5 +214,6 @@ int afs_vl_get_entry_by_id(struct in_addr *addr, ...@@ -211,5 +214,6 @@ int afs_vl_get_entry_by_id(struct in_addr *addr,
*bp = htonl(voltype); *bp = htonl(voltype);
/* initiate the call */ /* initiate the call */
trace_afs_make_vl_call(call);
return afs_make_call(addr, call, GFP_KERNEL, async); return afs_make_call(addr, call, GFP_KERNEL, async);
} }
...@@ -30,6 +30,36 @@ enum afs_call_trace { ...@@ -30,6 +30,36 @@ enum afs_call_trace {
afs_call_trace_work, 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 */ #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
/* /*
...@@ -42,6 +72,35 @@ enum afs_call_trace { ...@@ -42,6 +72,35 @@ enum afs_call_trace {
EM(afs_call_trace_wake, "WAKE ") \ EM(afs_call_trace_wake, "WAKE ") \
E_(afs_call_trace_work, "WORK ") 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. * Export enum symbols via userspace.
*/ */
...@@ -51,6 +110,8 @@ enum afs_call_trace { ...@@ -51,6 +110,8 @@ enum afs_call_trace {
#define E_(a, b) TRACE_DEFINE_ENUM(a); #define E_(a, b) TRACE_DEFINE_ENUM(a);
afs_call_traces; afs_call_traces;
afs_fs_operations;
afs_vl_operations;
/* /*
* Now redefine the EM() and E_() macros to map the enums to the strings that * Now redefine the EM() and E_() macros to map the enums to the strings that
...@@ -178,6 +239,77 @@ TRACE_EVENT(afs_call, ...@@ -178,6 +239,77 @@ TRACE_EVENT(afs_call,
__entry->where) __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 */ #endif /* _TRACE_AFS_H */
/* This part must be outside protection */ /* 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