diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/ptlrpc/llog_client.c')
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/llog_client.c | 80 |
1 files changed, 51 insertions, 29 deletions
diff --git a/drivers/staging/lustre/lustre/ptlrpc/llog_client.c b/drivers/staging/lustre/lustre/ptlrpc/llog_client.c index 6a1ab5c..56f825f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/llog_client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/llog_client.c @@ -93,8 +93,10 @@ static int llog_client_open(const struct lu_env *env, LASSERT(lgh); req = ptlrpc_request_alloc(imp, &RQF_LLOG_ORIGIN_HANDLE_CREATE); - if (req == NULL) - GOTO(out, rc = -ENOMEM); + if (req == NULL) { + rc = -ENOMEM; + goto out; + } if (name) req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT, @@ -105,7 +107,7 @@ static int llog_client_open(const struct lu_env *env, if (rc) { ptlrpc_request_free(req); req = NULL; - GOTO(out, rc); + goto out; } ptlrpc_request_set_replen(req); @@ -124,11 +126,13 @@ static int llog_client_open(const struct lu_env *env, rc = ptlrpc_queue_wait(req); if (rc) - GOTO(out, rc); + goto out; body = req_capsule_server_get(&req->rq_pill, &RMF_LLOGD_BODY); - if (body == NULL) - GOTO(out, rc = -EFAULT); + if (body == NULL) { + rc = -EFAULT; + goto out; + } lgh->lgh_id = body->lgd_logid; lgh->lgh_ctxt = ctxt; @@ -150,8 +154,10 @@ static int llog_client_destroy(const struct lu_env *env, req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_DESTROY, LUSTRE_LOG_VERSION, LLOG_ORIGIN_HANDLE_DESTROY); - if (req == NULL) - GOTO(err_exit, rc =-ENOMEM); + if (req == NULL) { + rc = -ENOMEM; + goto err_exit; + } body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); body->lgd_logid = loghandle->lgh_id; @@ -186,8 +192,10 @@ static int llog_client_next_block(const struct lu_env *env, req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK, LUSTRE_LOG_VERSION, LLOG_ORIGIN_HANDLE_NEXT_BLOCK); - if (req == NULL) - GOTO(err_exit, rc =-ENOMEM); + if (req == NULL) { + rc = -ENOMEM; + goto err_exit; + } body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); body->lgd_logid = loghandle->lgh_id; @@ -202,16 +210,20 @@ static int llog_client_next_block(const struct lu_env *env, ptlrpc_request_set_replen(req); rc = ptlrpc_queue_wait(req); if (rc) - GOTO(out, rc); + goto out; body = req_capsule_server_get(&req->rq_pill, &RMF_LLOGD_BODY); - if (body == NULL) - GOTO(out, rc =-EFAULT); + if (body == NULL) { + rc = -EFAULT; + goto out; + } /* The log records are swabbed as they are processed */ ptr = req_capsule_server_get(&req->rq_pill, &RMF_EADATA); - if (ptr == NULL) - GOTO(out, rc =-EFAULT); + if (ptr == NULL) { + rc = -EFAULT; + goto out; + } *cur_idx = body->lgd_saved_index; *cur_offset = body->lgd_cur_offset; @@ -238,8 +250,10 @@ static int llog_client_prev_block(const struct lu_env *env, req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_PREV_BLOCK, LUSTRE_LOG_VERSION, LLOG_ORIGIN_HANDLE_PREV_BLOCK); - if (req == NULL) - GOTO(err_exit, rc = -ENOMEM); + if (req == NULL) { + rc = -ENOMEM; + goto err_exit; + } body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); body->lgd_logid = loghandle->lgh_id; @@ -253,15 +267,19 @@ static int llog_client_prev_block(const struct lu_env *env, rc = ptlrpc_queue_wait(req); if (rc) - GOTO(out, rc); + goto out; body = req_capsule_server_get(&req->rq_pill, &RMF_LLOGD_BODY); - if (body == NULL) - GOTO(out, rc =-EFAULT); + if (body == NULL) { + rc = -EFAULT; + goto out; + } ptr = req_capsule_server_get(&req->rq_pill, &RMF_EADATA); - if (ptr == NULL) - GOTO(out, rc =-EFAULT); + if (ptr == NULL) { + rc = -EFAULT; + goto out; + } memcpy(buf, ptr, len); out: @@ -282,11 +300,13 @@ static int llog_client_read_header(const struct lu_env *env, int rc; LLOG_CLIENT_ENTRY(handle->lgh_ctxt, imp); - req = ptlrpc_request_alloc_pack(imp,&RQF_LLOG_ORIGIN_HANDLE_READ_HEADER, + req = ptlrpc_request_alloc_pack(imp, &RQF_LLOG_ORIGIN_HANDLE_READ_HEADER, LUSTRE_LOG_VERSION, LLOG_ORIGIN_HANDLE_READ_HEADER); - if (req == NULL) - GOTO(err_exit, rc = -ENOMEM); + if (req == NULL) { + rc = -ENOMEM; + goto err_exit; + } body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY); body->lgd_logid = handle->lgh_id; @@ -296,11 +316,13 @@ static int llog_client_read_header(const struct lu_env *env, ptlrpc_request_set_replen(req); rc = ptlrpc_queue_wait(req); if (rc) - GOTO(out, rc); + goto out; hdr = req_capsule_server_get(&req->rq_pill, &RMF_LLOG_LOG_HDR); - if (hdr == NULL) - GOTO(out, rc =-EFAULT); + if (hdr == NULL) { + rc = -EFAULT; + goto out; + } memcpy(handle->lgh_hdr, hdr, sizeof(*hdr)); handle->lgh_last_idx = handle->lgh_hdr->llh_tail.lrt_index; @@ -331,7 +353,7 @@ static int llog_client_close(const struct lu_env *env, /* this doesn't call LLOG_ORIGIN_HANDLE_CLOSE because the servers all close the file at the end of every other LLOG_ RPC. */ - return(0); + return 0; } struct llog_operations llog_client_ops = { |