diff options
author | David Howells <dhowells@redhat.com> | 2017-11-02 15:27:51 +0000 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2017-11-13 15:38:19 +0000 |
commit | 025db80c9e421efef11f2b83b7f78a11476f06db (patch) | |
tree | 1c6e049f2ae3a380f4242d0eda61d759412cdc41 /fs | |
parent | becfcc7e576eed03b93f412769573c93de550527 (diff) | |
download | op-kernel-dev-025db80c9e421efef11f2b83b7f78a11476f06db.zip op-kernel-dev-025db80c9e421efef11f2b83b7f78a11476f06db.tar.gz |
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: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/afs/fsclient.c | 75 | ||||
-rw-r--r-- | fs/afs/internal.h | 1 | ||||
-rw-r--r-- | fs/afs/rxrpc.c | 25 | ||||
-rw-r--r-- | fs/afs/vlclient.c | 10 |
4 files changed, 91 insertions, 20 deletions
diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c index 72ff367..10e5ead 100644 --- a/fs/afs/fsclient.c +++ b/fs/afs/fsclient.c @@ -16,6 +16,8 @@ #include "internal.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 * than we asked for in FS.FetchData{,64}. @@ -299,6 +301,7 @@ static int afs_deliver_fs_fetch_status(struct afs_call *call) */ static const struct afs_call_type afs_RXFSFetchStatus = { .name = "FS.FetchStatus", + .op = afs_FS_FetchStatus, .deliver = afs_deliver_fs_fetch_status, .destructor = afs_flat_call_destructor, }; @@ -335,6 +338,7 @@ int afs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy call->cb_break = fc->cb_break; afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -497,12 +501,14 @@ static void afs_fetch_data_destructor(struct afs_call *call) */ static const struct afs_call_type afs_RXFSFetchData = { .name = "FS.FetchData", + .op = afs_FS_FetchData, .deliver = afs_deliver_fs_fetch_data, .destructor = afs_fetch_data_destructor, }; static const struct afs_call_type afs_RXFSFetchData64 = { .name = "FS.FetchData64", + .op = afs_FS_FetchData64, .deliver = afs_deliver_fs_fetch_data, .destructor = afs_fetch_data_destructor, }; @@ -527,7 +533,6 @@ static int afs_fs_fetch_data64(struct afs_fs_cursor *fc, struct afs_read *req) call->reply[0] = vnode; call->reply[1] = NULL; /* volsync */ call->reply[2] = req; - call->operation_ID = FSFETCHDATA64; /* marshall the parameters */ bp = call->request; @@ -543,6 +548,7 @@ static int afs_fs_fetch_data64(struct afs_fs_cursor *fc, struct afs_read *req) atomic_inc(&req->usage); call->cb_break = fc->cb_break; afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -571,7 +577,6 @@ int afs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req) call->reply[0] = vnode; call->reply[1] = NULL; /* volsync */ call->reply[2] = req; - call->operation_ID = FSFETCHDATA; /* marshall the parameters */ bp = call->request; @@ -585,6 +590,7 @@ int afs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req) atomic_inc(&req->usage); call->cb_break = fc->cb_break; afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -618,8 +624,16 @@ static int afs_deliver_fs_create_vnode(struct afs_call *call) /* * FS.CreateFile and FS.MakeDir operation type */ -static const struct afs_call_type afs_RXFSCreateXXXX = { - .name = "FS.CreateXXXX", +static const struct afs_call_type afs_RXFSCreateFile = { + .name = "FS.CreateFile", + .op = afs_FS_CreateFile, + .deliver = afs_deliver_fs_create_vnode, + .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, .destructor = afs_flat_call_destructor, }; @@ -646,8 +660,9 @@ int afs_fs_create(struct afs_fs_cursor *fc, padsz = (4 - (namesz & 3)) & 3; reqsz = (5 * 4) + namesz + padsz + (6 * 4); - call = afs_alloc_flat_call(net, &afs_RXFSCreateXXXX, reqsz, - (3 + 21 + 21 + 3 + 6) * 4); + call = afs_alloc_flat_call( + net, S_ISDIR(mode) ? &afs_RXFSMakeDir : &afs_RXFSCreateFile, + reqsz, (3 + 21 + 21 + 3 + 6) * 4); if (!call) return -ENOMEM; @@ -678,6 +693,7 @@ int afs_fs_create(struct afs_fs_cursor *fc, *bp++ = 0; /* segment size */ afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -708,8 +724,16 @@ static int afs_deliver_fs_remove(struct afs_call *call) /* * FS.RemoveDir/FS.RemoveFile operation type */ -static const struct afs_call_type afs_RXFSRemoveXXXX = { - .name = "FS.RemoveXXXX", +static const struct afs_call_type afs_RXFSRemoveFile = { + .name = "FS.RemoveFile", + .op = afs_FS_RemoveFile, + .deliver = afs_deliver_fs_remove, + .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, .destructor = afs_flat_call_destructor, }; @@ -731,7 +755,9 @@ int afs_fs_remove(struct afs_fs_cursor *fc, const char *name, bool isdir) padsz = (4 - (namesz & 3)) & 3; reqsz = (5 * 4) + namesz + padsz; - call = afs_alloc_flat_call(net, &afs_RXFSRemoveXXXX, reqsz, (21 + 6) * 4); + call = afs_alloc_flat_call( + net, isdir ? &afs_RXFSRemoveDir : &afs_RXFSRemoveFile, + reqsz, (21 + 6) * 4); if (!call) return -ENOMEM; @@ -753,6 +779,7 @@ int afs_fs_remove(struct afs_fs_cursor *fc, const char *name, bool isdir) } afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -786,6 +813,7 @@ static int afs_deliver_fs_link(struct afs_call *call) */ static const struct afs_call_type afs_RXFSLink = { .name = "FS.Link", + .op = afs_FS_Link, .deliver = afs_deliver_fs_link, .destructor = afs_flat_call_destructor, }; @@ -834,6 +862,7 @@ int afs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode, *bp++ = htonl(vnode->fid.unique); afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -868,6 +897,7 @@ static int afs_deliver_fs_symlink(struct afs_call *call) */ static const struct afs_call_type afs_RXFSSymlink = { .name = "FS.Symlink", + .op = afs_FS_Symlink, .deliver = afs_deliver_fs_symlink, .destructor = afs_flat_call_destructor, }; @@ -935,6 +965,7 @@ int afs_fs_symlink(struct afs_fs_cursor *fc, *bp++ = 0; /* segment size */ afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -970,6 +1001,7 @@ static int afs_deliver_fs_rename(struct afs_call *call) */ static const struct afs_call_type afs_RXFSRename = { .name = "FS.Rename", + .op = afs_FS_Rename, .deliver = afs_deliver_fs_rename, .destructor = afs_flat_call_destructor, }; @@ -1035,6 +1067,7 @@ int afs_fs_rename(struct afs_fs_cursor *fc, } afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &orig_dvnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -1070,12 +1103,14 @@ static int afs_deliver_fs_store_data(struct afs_call *call) */ static const struct afs_call_type afs_RXFSStoreData = { .name = "FS.StoreData", + .op = afs_FS_StoreData, .deliver = afs_deliver_fs_store_data, .destructor = afs_flat_call_destructor, }; static const struct afs_call_type afs_RXFSStoreData64 = { .name = "FS.StoreData64", + .op = afs_FS_StoreData64, .deliver = afs_deliver_fs_store_data, .destructor = afs_flat_call_destructor, }; @@ -1135,6 +1170,7 @@ static int afs_fs_store_data64(struct afs_fs_cursor *fc, *bp++ = htonl(i_size >> 32); *bp++ = htonl((u32) i_size); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -1208,6 +1244,7 @@ int afs_fs_store_data(struct afs_fs_cursor *fc, struct afs_writeback *wb, *bp++ = htonl(i_size); afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -1245,18 +1282,21 @@ static int afs_deliver_fs_store_status(struct afs_call *call) */ static const struct afs_call_type afs_RXFSStoreStatus = { .name = "FS.StoreStatus", + .op = afs_FS_StoreStatus, .deliver = afs_deliver_fs_store_status, .destructor = afs_flat_call_destructor, }; static const struct afs_call_type afs_RXFSStoreData_as_Status = { .name = "FS.StoreData", + .op = afs_FS_StoreData, .deliver = afs_deliver_fs_store_status, .destructor = afs_flat_call_destructor, }; static const struct afs_call_type afs_RXFSStoreData64_as_Status = { .name = "FS.StoreData64", + .op = afs_FS_StoreData64, .deliver = afs_deliver_fs_store_status, .destructor = afs_flat_call_destructor, }; @@ -1286,7 +1326,6 @@ static int afs_fs_setattr_size64(struct afs_fs_cursor *fc, struct iattr *attr) call->key = fc->key; call->reply[0] = vnode; call->store_version = vnode->status.data_version + 1; - call->operation_ID = FSSTOREDATA; /* marshall the parameters */ bp = call->request; @@ -1305,6 +1344,7 @@ static int afs_fs_setattr_size64(struct afs_fs_cursor *fc, struct iattr *attr) *bp++ = htonl((u32) attr->ia_size); afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -1335,7 +1375,6 @@ static int afs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr) call->key = fc->key; call->reply[0] = vnode; call->store_version = vnode->status.data_version + 1; - call->operation_ID = FSSTOREDATA; /* marshall the parameters */ bp = call->request; @@ -1351,6 +1390,7 @@ static int afs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr) *bp++ = htonl(attr->ia_size); /* new file length */ afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -1379,7 +1419,6 @@ int afs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr) call->key = fc->key; call->reply[0] = vnode; - call->operation_ID = FSSTORESTATUS; /* marshall the parameters */ bp = call->request; @@ -1391,6 +1430,7 @@ int afs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr) xdr_encode_AFS_StoreStatus(&bp, attr); afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -1581,6 +1621,7 @@ static void afs_get_volume_status_call_destructor(struct afs_call *call) */ static const struct afs_call_type afs_RXFSGetVolumeStatus = { .name = "FS.GetVolumeStatus", + .op = afs_FS_GetVolumeStatus, .deliver = afs_deliver_fs_get_volume_status, .destructor = afs_get_volume_status_call_destructor, }; @@ -1620,6 +1661,7 @@ int afs_fs_get_volume_status(struct afs_fs_cursor *fc, bp[1] = htonl(vnode->fid.vid); afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -1650,6 +1692,7 @@ static int afs_deliver_fs_xxxx_lock(struct afs_call *call) */ static const struct afs_call_type afs_RXFSSetLock = { .name = "FS.SetLock", + .op = afs_FS_SetLock, .deliver = afs_deliver_fs_xxxx_lock, .destructor = afs_flat_call_destructor, }; @@ -1659,6 +1702,7 @@ static const struct afs_call_type afs_RXFSSetLock = { */ static const struct afs_call_type afs_RXFSExtendLock = { .name = "FS.ExtendLock", + .op = afs_FS_ExtendLock, .deliver = afs_deliver_fs_xxxx_lock, .destructor = afs_flat_call_destructor, }; @@ -1668,6 +1712,7 @@ static const struct afs_call_type afs_RXFSExtendLock = { */ static const struct afs_call_type afs_RXFSReleaseLock = { .name = "FS.ReleaseLock", + .op = afs_FS_ReleaseLock, .deliver = afs_deliver_fs_xxxx_lock, .destructor = afs_flat_call_destructor, }; @@ -1700,6 +1745,7 @@ int afs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type) *bp++ = htonl(type); afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -1730,6 +1776,7 @@ int afs_fs_extend_lock(struct afs_fs_cursor *fc) *bp++ = htonl(vnode->fid.unique); afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -1760,6 +1807,7 @@ int afs_fs_release_lock(struct afs_fs_cursor *fc) *bp++ = htonl(vnode->fid.unique); afs_use_fs_server(call, fc->cbi); + trace_afs_make_fs_call(call, &vnode->fid); return afs_make_call(&fc->ac, call, GFP_NOFS, false); } @@ -1776,6 +1824,7 @@ static int afs_deliver_fs_give_up_all_callbacks(struct afs_call *call) */ static const struct afs_call_type afs_RXFSGiveUpAllCallBacks = { .name = "FS.GiveUpAllCallBacks", + .op = afs_FS_GiveUpAllCallBacks, .deliver = afs_deliver_fs_give_up_all_callbacks, .destructor = afs_flat_call_destructor, }; @@ -1866,6 +1915,7 @@ again: */ static const struct afs_call_type afs_RXFSGetCapabilities = { .name = "FS.GetCapabilities", + .op = afs_FS_GetCapabilities, .deliver = afs_deliver_fs_get_capabilities, .destructor = afs_flat_call_destructor, }; @@ -1895,5 +1945,6 @@ int afs_fs_get_capabilities(struct afs_net *net, *bp++ = htonl(FSGETCAPABILITIES); /* Can't take a ref on server */ + trace_afs_make_fs_call(call, NULL); return afs_make_call(ac, call, GFP_NOFS, false); } diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 767317b..aad1254 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -124,6 +124,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 diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c index 1d07569..59cc580 100644 --- a/fs/afs/rxrpc.c +++ b/fs/afs/rxrpc.c @@ -219,6 +219,7 @@ struct afs_call *afs_alloc_flat_call(struct afs_net *net, goto nomem_free; } + call->operation_ID = type->op; init_waitqueue_head(&call->waitq); return call; @@ -422,6 +423,8 @@ error_do_abort: ac->abort_code = call->abort_code; ac->responded = true; } + call->error = ret; + trace_afs_call_done(call); error_kill_call: afs_put_call(call); ac->error = ret; @@ -455,10 +458,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; } @@ -466,7 +469,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: @@ -505,7 +508,11 @@ out: save_error: call->error = ret; - call->state = AFS_CALL_COMPLETE; +call_complete: + if (call->state != AFS_CALL_COMPLETE) { + call->state = AFS_CALL_COMPLETE; + trace_afs_call_done(call); + } goto done; } @@ -567,8 +574,10 @@ static long afs_wait_for_call_to_complete(struct afs_call *call, if (call->state < AFS_CALL_COMPLETE) { _debug("call interrupted"); if (rxrpc_kernel_abort_call(call->net->socket, call->rxcall, - RX_USER_ABORT, -EINTR, "KWI")) + RX_USER_ABORT, -EINTR, "KWI")) { call->error = -ERESTARTSYS; + trace_afs_call_done(call); + } } ac->abort_code = call->abort_code; @@ -882,6 +891,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; @@ -894,5 +904,6 @@ int afs_extract_data(struct afs_call *call, void *buf, size_t count, call->error = ret; call->state = AFS_CALL_COMPLETE; + trace_afs_call_done(call); return ret; } diff --git a/fs/afs/vlclient.c b/fs/afs/vlclient.c index 1d38cbd..e372f89 100644 --- a/fs/afs/vlclient.c +++ b/fs/afs/vlclient.c @@ -114,6 +114,7 @@ static void afs_destroy_vl_get_entry_by_name_u(struct afs_call *call) */ static const struct afs_call_type afs_RXVLGetEntryByNameU = { .name = "VL.GetEntryByNameU", + .op = afs_VL_GetEntryByNameU, .deliver = afs_deliver_vl_get_entry_by_name_u, .destructor = afs_destroy_vl_get_entry_by_name_u, }; @@ -161,6 +162,7 @@ struct afs_vldb_entry *afs_vl_get_entry_by_name_u(struct afs_net *net, if (padsz > 0) memset((void *)bp + volnamesz, 0, padsz); + trace_afs_make_vl_call(call); return (struct afs_vldb_entry *)afs_make_call(ac, call, GFP_KERNEL, false); } @@ -251,6 +253,7 @@ static void afs_vl_get_addrs_u_destructor(struct afs_call *call) */ static const struct afs_call_type afs_RXVLGetAddrsU = { .name = "VL.GetAddrsU", + .op = afs_VL_GetAddrsU, .deliver = afs_deliver_vl_get_addrs_u, .destructor = afs_vl_get_addrs_u_destructor, }; @@ -298,6 +301,7 @@ struct afs_addr_list *afs_vl_get_addrs_u(struct afs_net *net, for (i = 0; i < 6; i++) r->uuid.node[i] = ntohl(u->node[i]); + trace_afs_make_vl_call(call); return (struct afs_addr_list *)afs_make_call(ac, call, GFP_KERNEL, false); } @@ -362,6 +366,7 @@ again: */ static const struct afs_call_type afs_RXVLGetCapabilities = { .name = "VL.GetCapabilities", + .op = afs_VL_GetCapabilities, .deliver = afs_deliver_vl_get_capabilities, .destructor = afs_flat_call_destructor, }; @@ -396,6 +401,7 @@ int afs_vl_get_capabilities(struct afs_net *net, *bp++ = htonl(VLGETCAPABILITIES); /* Can't take a ref on server */ + trace_afs_make_vl_call(call); return afs_make_call(ac, call, GFP_KERNEL, false); } @@ -598,7 +604,8 @@ again: * YFSVL.GetEndpoints operation type. */ static const struct afs_call_type afs_YFSVLGetEndpoints = { - .name = "VL.GetEndpoints", + .name = "YFSVL.GetEndpoints", + .op = afs_YFSVL_GetEndpoints, .deliver = afs_deliver_yfsvl_get_endpoints, .destructor = afs_vl_get_addrs_u_destructor, }; @@ -633,5 +640,6 @@ struct afs_addr_list *afs_yfsvl_get_endpoints(struct afs_net *net, *bp++ = htonl(YFS_SERVER_UUID); memcpy(bp, uuid, sizeof(*uuid)); /* Type opr_uuid */ + trace_afs_make_vl_call(call); return (struct afs_addr_list *)afs_make_call(ac, call, GFP_KERNEL, false); } |