diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/obdclass/llog.c')
-rw-r--r-- | drivers/staging/lustre/lustre/obdclass/llog.c | 124 |
1 files changed, 46 insertions, 78 deletions
diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c b/drivers/staging/lustre/lustre/obdclass/llog.c index b1d215e56991..0cb44287502b 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog.c +++ b/drivers/staging/lustre/lustre/obdclass/llog.c @@ -111,21 +111,20 @@ int llog_cancel_rec(const struct lu_env *env, struct llog_handle *loghandle, { struct llog_log_hdr *llh = loghandle->lgh_hdr; int rc = 0; - ENTRY; CDEBUG(D_RPCTRACE, "Canceling %d in log "DOSTID"\n", index, POSTID(&loghandle->lgh_id.lgl_oi)); if (index == 0) { CERROR("Can't cancel index 0 which is header\n"); - RETURN(-EINVAL); + return -EINVAL; } spin_lock(&loghandle->lgh_hdr_lock); if (!ext2_clear_bit(index, llh->llh_bitmap)) { spin_unlock(&loghandle->lgh_hdr_lock); CDEBUG(D_RPCTRACE, "Catalog index %u already clear?\n", index); - RETURN(-ENOENT); + return -ENOENT; } llh->llh_count--; @@ -143,7 +142,7 @@ int llog_cancel_rec(const struct lu_env *env, struct llog_handle *loghandle, loghandle->lgh_id.lgl_ogen, rc); GOTO(out_err, rc); } - RETURN(1); + return 1; } spin_unlock(&loghandle->lgh_hdr_lock); @@ -156,7 +155,7 @@ int llog_cancel_rec(const struct lu_env *env, struct llog_handle *loghandle, loghandle->lgh_id.lgl_ogen, rc); GOTO(out_err, rc); } - RETURN(0); + return 0; out_err: spin_lock(&loghandle->lgh_hdr_lock); ext2_set_bit(index, llh->llh_bitmap); @@ -175,10 +174,10 @@ static int llog_read_header(const struct lu_env *env, rc = llog_handle2ops(handle, &lop); if (rc) - RETURN(rc); + return rc; if (lop->lop_read_header == NULL) - RETURN(-EOPNOTSUPP); + return -EOPNOTSUPP; rc = lop->lop_read_header(env, handle); if (rc == LLOG_EEMPTY) { @@ -206,12 +205,11 @@ int llog_init_handle(const struct lu_env *env, struct llog_handle *handle, struct llog_log_hdr *llh; int rc; - ENTRY; LASSERT(handle->lgh_hdr == NULL); OBD_ALLOC_PTR(llh); if (llh == NULL) - RETURN(-ENOMEM); + return -ENOMEM; handle->lgh_hdr = llh; /* first assign flags to use llog_client_ops */ llh->llh_flags = flags; @@ -263,7 +261,7 @@ out: OBD_FREE_PTR(llh); handle->lgh_hdr = NULL; } - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_init_handle); @@ -277,7 +275,6 @@ int llog_copy_handler(const struct lu_env *env, char *cfg_buf = (char*) (rec + 1); struct lustre_cfg *lcfg; int rc = 0; - ENTRY; /* Append all records */ local_rec.lrh_len -= sizeof(*rec) + sizeof(struct llog_rec_tail); @@ -289,7 +286,7 @@ int llog_copy_handler(const struct lu_env *env, rec->lrh_index, rc, rec->lrh_len, lcfg->lcfg_command, lustre_cfg_string(lcfg, 0), lustre_cfg_string(lcfg, 1)); - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_copy_handler); @@ -306,14 +303,12 @@ static int llog_process_thread(void *arg) int saved_index = 0; int last_called_index = 0; - ENTRY; - LASSERT(llh); OBD_ALLOC(buf, LLOG_CHUNK_SIZE); if (!buf) { lpi->lpi_rc = -ENOMEM; - RETURN(0); + return 0; } if (cd != NULL) { @@ -457,12 +452,10 @@ int llog_process_or_fork(const struct lu_env *env, struct llog_process_info *lpi; int rc; - ENTRY; - OBD_ALLOC_PTR(lpi); if (lpi == NULL) { CERROR("cannot alloc pointer\n"); - RETURN(-ENOMEM); + return -ENOMEM; } lpi->lpi_loghandle = loghandle; lpi->lpi_cb = cb; @@ -480,7 +473,7 @@ int llog_process_or_fork(const struct lu_env *env, CERROR("%s: cannot start thread: rc = %d\n", loghandle->lgh_ctxt->loc_obd->obd_name, rc); OBD_FREE_PTR(lpi); - RETURN(rc); + return rc; } wait_for_completion(&lpi->lpi_completion); } else { @@ -489,7 +482,7 @@ int llog_process_or_fork(const struct lu_env *env, } rc = lpi->lpi_rc; OBD_FREE_PTR(lpi); - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_process_or_fork); @@ -516,11 +509,10 @@ int llog_reverse_process(const struct lu_env *env, struct llog_process_cat_data *cd = catdata; void *buf; int rc = 0, first_index = 1, index, idx; - ENTRY; OBD_ALLOC(buf, LLOG_CHUNK_SIZE); if (!buf) - RETURN(-ENOMEM); + return -ENOMEM; if (cd != NULL) first_index = cd->lpcd_first_idx + 1; @@ -594,7 +586,7 @@ int llog_reverse_process(const struct lu_env *env, out: if (buf) OBD_FREE(buf, LLOG_CHUNK_SIZE); - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_reverse_process); @@ -617,16 +609,14 @@ int llog_exist(struct llog_handle *loghandle) struct llog_operations *lop; int rc; - ENTRY; - rc = llog_handle2ops(loghandle, &lop); if (rc) - RETURN(rc); + return rc; if (lop->lop_exist == NULL) - RETURN(-EOPNOTSUPP); + return -EOPNOTSUPP; rc = lop->lop_exist(loghandle); - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_exist); @@ -636,13 +626,11 @@ int llog_declare_create(const struct lu_env *env, struct llog_operations *lop; int raised, rc; - ENTRY; - rc = llog_handle2ops(loghandle, &lop); if (rc) - RETURN(rc); + return rc; if (lop->lop_declare_create == NULL) - RETURN(-EOPNOTSUPP); + return -EOPNOTSUPP; raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) @@ -650,7 +638,7 @@ int llog_declare_create(const struct lu_env *env, rc = lop->lop_declare_create(env, loghandle, th); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_declare_create); @@ -660,13 +648,11 @@ int llog_create(const struct lu_env *env, struct llog_handle *handle, struct llog_operations *lop; int raised, rc; - ENTRY; - rc = llog_handle2ops(handle, &lop); if (rc) - RETURN(rc); + return rc; if (lop->lop_create == NULL) - RETURN(-EOPNOTSUPP); + return -EOPNOTSUPP; raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) @@ -674,7 +660,7 @@ int llog_create(const struct lu_env *env, struct llog_handle *handle, rc = lop->lop_create(env, handle, th); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_create); @@ -686,14 +672,12 @@ int llog_declare_write_rec(const struct lu_env *env, struct llog_operations *lop; int raised, rc; - ENTRY; - rc = llog_handle2ops(handle, &lop); if (rc) - RETURN(rc); + return rc; LASSERT(lop); if (lop->lop_declare_write_rec == NULL) - RETURN(-EOPNOTSUPP); + return -EOPNOTSUPP; raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) @@ -701,7 +685,7 @@ int llog_declare_write_rec(const struct lu_env *env, rc = lop->lop_declare_write_rec(env, handle, rec, idx, th); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_declare_write_rec); @@ -712,15 +696,13 @@ int llog_write_rec(const struct lu_env *env, struct llog_handle *handle, struct llog_operations *lop; int raised, rc, buflen; - ENTRY; - rc = llog_handle2ops(handle, &lop); if (rc) - RETURN(rc); + return rc; LASSERT(lop); if (lop->lop_write_rec == NULL) - RETURN(-EOPNOTSUPP); + return -EOPNOTSUPP; if (buf) buflen = rec->lrh_len + sizeof(struct llog_rec_hdr) + @@ -736,7 +718,7 @@ int llog_write_rec(const struct lu_env *env, struct llog_handle *handle, buf, idx, th); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_write_rec); @@ -746,10 +728,8 @@ int llog_add(const struct lu_env *env, struct llog_handle *lgh, { int raised, rc; - ENTRY; - if (lgh->lgh_logops->lop_add == NULL) - RETURN(-EOPNOTSUPP); + return -EOPNOTSUPP; raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) @@ -757,7 +737,7 @@ int llog_add(const struct lu_env *env, struct llog_handle *lgh, rc = lgh->lgh_logops->lop_add(env, lgh, rec, logcookies, buf, th); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_add); @@ -766,10 +746,8 @@ int llog_declare_add(const struct lu_env *env, struct llog_handle *lgh, { int raised, rc; - ENTRY; - if (lgh->lgh_logops->lop_declare_add == NULL) - RETURN(-EOPNOTSUPP); + return -EOPNOTSUPP; raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) @@ -777,7 +755,7 @@ int llog_declare_add(const struct lu_env *env, struct llog_handle *lgh, rc = lgh->lgh_logops->lop_declare_add(env, lgh, rec, th); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_declare_add); @@ -792,14 +770,12 @@ int llog_open_create(const struct lu_env *env, struct llog_ctxt *ctxt, struct thandle *th; int rc; - ENTRY; - rc = llog_open(env, ctxt, res, logid, name, LLOG_OPEN_NEW); if (rc) - RETURN(rc); + return rc; if (llog_exist(*res)) - RETURN(0); + return 0; if ((*res)->lgh_obj != NULL) { struct dt_device *d; @@ -825,7 +801,7 @@ int llog_open_create(const struct lu_env *env, struct llog_ctxt *ctxt, out: if (rc) llog_close(env, *res); - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_open_create); @@ -838,15 +814,13 @@ int llog_erase(const struct lu_env *env, struct llog_ctxt *ctxt, struct llog_handle *handle; int rc = 0, rc2; - ENTRY; - /* nothing to erase */ if (name == NULL && logid == NULL) - RETURN(0); + return 0; rc = llog_open(env, ctxt, &handle, logid, name, LLOG_OPEN_EXISTS); if (rc < 0) - RETURN(rc); + return rc; rc = llog_init_handle(env, handle, LLOG_F_IS_PLAIN, NULL); if (rc == 0) @@ -855,7 +829,7 @@ int llog_erase(const struct lu_env *env, struct llog_ctxt *ctxt, rc2 = llog_close(env, handle); if (rc == 0) rc = rc2; - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_erase); @@ -870,8 +844,6 @@ int llog_write(const struct lu_env *env, struct llog_handle *loghandle, { int rc; - ENTRY; - LASSERT(loghandle); LASSERT(loghandle->lgh_ctxt); @@ -883,7 +855,7 @@ int llog_write(const struct lu_env *env, struct llog_handle *loghandle, th = dt_trans_create(env, dt); if (IS_ERR(th)) - RETURN(PTR_ERR(th)); + return PTR_ERR(th); rc = llog_declare_write_rec(env, loghandle, rec, idx, th); if (rc) @@ -905,7 +877,7 @@ out_trans: cookiecount, buf, idx, NULL); up_write(&loghandle->lgh_lock); } - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_write); @@ -916,19 +888,17 @@ int llog_open(const struct lu_env *env, struct llog_ctxt *ctxt, int raised; int rc; - ENTRY; - LASSERT(ctxt); LASSERT(ctxt->loc_logops); if (ctxt->loc_logops->lop_open == NULL) { *lgh = NULL; - RETURN(-EOPNOTSUPP); + return -EOPNOTSUPP; } *lgh = llog_alloc_handle(); if (*lgh == NULL) - RETURN(-ENOMEM); + return -ENOMEM; (*lgh)->lgh_ctxt = ctxt; (*lgh)->lgh_logops = ctxt->loc_logops; @@ -942,7 +912,7 @@ int llog_open(const struct lu_env *env, struct llog_ctxt *ctxt, llog_free_handle(*lgh); *lgh = NULL; } - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_open); @@ -951,8 +921,6 @@ int llog_close(const struct lu_env *env, struct llog_handle *loghandle) struct llog_operations *lop; int rc; - ENTRY; - rc = llog_handle2ops(loghandle, &lop); if (rc) GOTO(out, rc); @@ -961,6 +929,6 @@ int llog_close(const struct lu_env *env, struct llog_handle *loghandle) rc = lop->lop_close(env, loghandle); out: llog_handle_put(loghandle); - RETURN(rc); + return rc; } EXPORT_SYMBOL(llog_close); |