From 0b9bf3812ad1f0d937584e300826285694f53e2b Mon Sep 17 00:00:00 2001 From: David Howells Date: Thu, 25 Apr 2019 14:26:50 +0100 Subject: afs: Split wait from afs_make_call() Split the call to afs_wait_for_call_to_complete() from afs_make_call() to make it easier to handle asynchronous calls and to make it easier to convert a synchronous call to an asynchronous one in future, for instance when someone tries to interrupt an operation by pressing Ctrl-C. Signed-off-by: David Howells --- fs/afs/yfsclient.c | 54 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 18 deletions(-) (limited to 'fs/afs/yfsclient.c') diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c index 6e97a42d24d1..95b04cb76c8c 100644 --- a/fs/afs/yfsclient.c +++ b/fs/afs/yfsclient.c @@ -519,7 +519,8 @@ int yfs_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); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -708,7 +709,8 @@ int yfs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req) 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); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -808,7 +810,8 @@ int yfs_fs_create_file(struct afs_fs_cursor *fc, 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); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } static const struct afs_call_type yfs_RXFSMakeDir = { @@ -871,7 +874,8 @@ int yfs_fs_make_dir(struct afs_fs_cursor *fc, 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); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -961,7 +965,8 @@ int yfs_fs_remove_file2(struct afs_fs_cursor *fc, struct afs_vnode *vnode, afs_use_fs_server(call, fc->cbi); trace_afs_make_fs_call(call, &dvnode->fid); - return afs_make_call(&fc->ac, call, GFP_NOFS, false); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -1048,7 +1053,8 @@ int yfs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode, afs_use_fs_server(call, fc->cbi); trace_afs_make_fs_call(call, &dvnode->fid); - return afs_make_call(&fc->ac, call, GFP_NOFS, false); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -1133,7 +1139,8 @@ int yfs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode, 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); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -1229,7 +1236,8 @@ int yfs_fs_symlink(struct afs_fs_cursor *fc, afs_use_fs_server(call, fc->cbi); trace_afs_make_fs_call(call, &dvnode->fid); - return afs_make_call(&fc->ac, call, GFP_NOFS, false); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -1327,7 +1335,8 @@ int yfs_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); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -1433,7 +1442,8 @@ int yfs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping, 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); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -1521,7 +1531,8 @@ static int yfs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *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); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -1564,7 +1575,8 @@ int yfs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *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); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -1751,7 +1763,8 @@ int yfs_fs_get_volume_status(struct afs_fs_cursor *fc, 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); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -1845,7 +1858,8 @@ int yfs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t 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); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -1880,7 +1894,8 @@ int yfs_fs_extend_lock(struct afs_fs_cursor *fc) 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); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -1915,7 +1930,8 @@ int yfs_fs_release_lock(struct afs_fs_cursor *fc) 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); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -2003,7 +2019,8 @@ int yfs_fs_fetch_status(struct afs_fs_cursor *fc, call->cb_break = fc->cb_break; afs_use_fs_server(call, fc->cbi); trace_afs_make_fs_call(call, fid); - return afs_make_call(&fc->ac, call, GFP_NOFS, false); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } /* @@ -2180,5 +2197,6 @@ int yfs_fs_inline_bulk_status(struct afs_fs_cursor *fc, call->cb_break = fc->cb_break; afs_use_fs_server(call, fc->cbi); trace_afs_make_fs_call(call, &fids[0]); - return afs_make_call(&fc->ac, call, GFP_NOFS, false); + afs_make_call(&fc->ac, call, GFP_NOFS); + return afs_wait_for_call_to_complete(call, &fc->ac); } -- cgit