summaryrefslogtreecommitdiff
path: root/drivers/staging/lustre/lustre/obdclass/llog_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/lustre/lustre/obdclass/llog_test.c')
-rw-r--r--drivers/staging/lustre/lustre/obdclass/llog_test.c89
1 files changed, 35 insertions, 54 deletions
diff --git a/drivers/staging/lustre/lustre/obdclass/llog_test.c b/drivers/staging/lustre/lustre/obdclass/llog_test.c
index d397f781ec43..d9e6d12215f9 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog_test.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog_test.c
@@ -78,22 +78,22 @@ static int verify_handle(char *test, struct llog_handle *llh, int num_recs)
if (active_recs != num_recs) {
CERROR("%s: expected %d active recs after write, found %d\n",
test, num_recs, active_recs);
- RETURN(-ERANGE);
+ return -ERANGE;
}
if (llh->lgh_hdr->llh_count != num_recs) {
CERROR("%s: handle->count is %d, expected %d after write\n",
test, llh->lgh_hdr->llh_count, num_recs);
- RETURN(-ERANGE);
+ return -ERANGE;
}
if (llh->lgh_last_idx < last_idx) {
CERROR("%s: handle->last_idx is %d, expected %d after write\n",
test, llh->lgh_last_idx, last_idx);
- RETURN(-ERANGE);
+ return -ERANGE;
}
- RETURN(0);
+ return 0;
}
/* Test named-log create/open, close */
@@ -105,8 +105,6 @@ static int llog_test_1(const struct lu_env *env,
int rc;
int rc2;
- ENTRY;
-
CWARN("1a: create a log with name: %s\n", name);
ctxt = llog_get_context(obd, LLOG_TEST_ORIG_CTXT);
LASSERT(ctxt);
@@ -134,7 +132,7 @@ out_close:
}
out:
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
/* Test named-log reopen; returns opened log on success */
@@ -146,8 +144,6 @@ static int llog_test_2(const struct lu_env *env, struct obd_device *obd,
struct llog_logid logid;
int rc;
- ENTRY;
-
CWARN("2a: re-open a log with name: %s\n", name);
ctxt = llog_get_context(obd, LLOG_TEST_ORIG_CTXT);
LASSERT(ctxt);
@@ -213,7 +209,7 @@ out_close_llh:
out_put:
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
/* Test record writing, single and in bulk */
@@ -224,8 +220,6 @@ static int llog_test_3(const struct lu_env *env, struct obd_device *obd,
int rc, i;
int num_recs = 1; /* 1 for the header */
- ENTRY;
-
lgr.lgr_hdr.lrh_len = lgr.lgr_tail.lrt_len = sizeof(lgr);
lgr.lgr_hdr.lrh_type = LLOG_GEN_REC;
@@ -234,12 +228,12 @@ static int llog_test_3(const struct lu_env *env, struct obd_device *obd,
num_recs++;
if (rc < 0) {
CERROR("3a: write one log record failed: %d\n", rc);
- RETURN(rc);
+ return rc;
}
rc = verify_handle("3a", llh, num_recs);
if (rc)
- RETURN(rc);
+ return rc;
CWARN("3b: write 10 cfg log records with 8 bytes bufs\n");
for (i = 0; i < 10; i++) {
@@ -253,14 +247,14 @@ static int llog_test_3(const struct lu_env *env, struct obd_device *obd,
if (rc < 0) {
CERROR("3b: write 10 records failed at #%d: %d\n",
i + 1, rc);
- RETURN(rc);
+ return rc;
}
num_recs++;
}
rc = verify_handle("3b", llh, num_recs);
if (rc)
- RETURN(rc);
+ return rc;
CWARN("3c: write 1000 more log records\n");
for (i = 0; i < 1000; i++) {
@@ -268,14 +262,14 @@ static int llog_test_3(const struct lu_env *env, struct obd_device *obd,
if (rc < 0) {
CERROR("3c: write 1000 records failed at #%d: %d\n",
i + 1, rc);
- RETURN(rc);
+ return rc;
}
num_recs++;
}
rc = verify_handle("3c", llh, num_recs);
if (rc)
- RETURN(rc);
+ return rc;
CWARN("3d: write log more than BITMAP_SIZE, return -ENOSPC\n");
for (i = 0; i < LLOG_BITMAP_SIZE(llh->lgh_hdr) + 1; i++) {
@@ -299,20 +293,20 @@ static int llog_test_3(const struct lu_env *env, struct obd_device *obd,
} else if (rc < 0) {
CERROR("3d: write recs failed at #%d: %d\n",
i + 1, rc);
- RETURN(rc);
+ return rc;
}
num_recs++;
}
if (rc != -ENOSPC) {
CWARN("3d: write record more than BITMAP size!\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
CWARN("3d: wrote %d more records before end of llog is reached\n",
num_recs);
rc = verify_handle("3d", llh, num_recs);
- RETURN(rc);
+ return rc;
}
/* Test catalogue additions */
@@ -328,8 +322,6 @@ static int llog_test_4(const struct lu_env *env, struct obd_device *obd)
char *buf;
struct llog_rec_hdr rec;
- ENTRY;
-
ctxt = llog_get_context(obd, LLOG_TEST_ORIG_CTXT);
LASSERT(ctxt);
@@ -424,7 +416,7 @@ out:
}
ctxt_release:
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
static int cat_counter;
@@ -437,7 +429,7 @@ static int cat_print_cb(const struct lu_env *env, struct llog_handle *llh,
if (rec->lrh_type != LLOG_LOGID_MAGIC) {
CERROR("invalid record in catalog\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
logid_to_fid(&lir->lid_id, &fid);
@@ -448,7 +440,7 @@ static int cat_print_cb(const struct lu_env *env, struct llog_handle *llh,
cat_counter++;
- RETURN(0);
+ return 0;
}
static int plain_counter;
@@ -460,7 +452,7 @@ static int plain_print_cb(const struct lu_env *env, struct llog_handle *llh,
if (!(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN)) {
CERROR("log is not plain\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
logid_to_fid(&llh->lgh_id, &fid);
@@ -470,7 +462,7 @@ static int plain_print_cb(const struct lu_env *env, struct llog_handle *llh,
plain_counter++;
- RETURN(0);
+ return 0;
}
static int cancel_count;
@@ -483,7 +475,7 @@ static int llog_cancel_rec_cb(const struct lu_env *env,
if (!(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN)) {
CERROR("log is not plain\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
cookie.lgc_lgl = llh->lgh_id;
@@ -492,8 +484,8 @@ static int llog_cancel_rec_cb(const struct lu_env *env,
llog_cat_cancel_records(env, llh->u.phd.phd_cat_handle, 1, &cookie);
cancel_count++;
if (cancel_count == LLOG_TEST_RECNUM)
- RETURN(-LLOG_EEMPTY);
- RETURN(0);
+ return -LLOG_EEMPTY;
+ return 0;
}
/* Test log and catalogue processing */
@@ -505,8 +497,6 @@ static int llog_test_5(const struct lu_env *env, struct obd_device *obd)
struct llog_mini_rec lmr;
struct llog_ctxt *ctxt;
- ENTRY;
-
ctxt = llog_get_context(obd, LLOG_TEST_ORIG_CTXT);
LASSERT(ctxt);
@@ -602,7 +592,7 @@ out:
out_put:
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
/* Test client api; open log by name and process */
@@ -686,7 +676,7 @@ nctxt_put:
llog_ctxt_put(nctxt);
ctxt_release:
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
static union {
@@ -728,12 +718,10 @@ static int llog_test_7_sub(const struct lu_env *env, struct llog_ctxt *ctxt)
int rc = 0, i, process_count;
int num_recs = 0;
- ENTRY;
-
rc = llog_open_create(env, ctxt, &llh, NULL, NULL);
if (rc) {
CERROR("7_sub: create log failed\n");
- RETURN(rc);
+ return rc;
}
rc = llog_init_handle(env, llh,
@@ -804,7 +792,7 @@ out_close:
if (rc)
llog_destroy(env, llh);
llog_close(env, llh);
- RETURN(rc);
+ return rc;
}
/* Test all llog records writing and processing */
@@ -813,8 +801,6 @@ static int llog_test_7(const struct lu_env *env, struct obd_device *obd)
struct llog_ctxt *ctxt;
int rc;
- ENTRY;
-
ctxt = llog_get_context(obd, LLOG_TEST_ORIG_CTXT);
CWARN("7a: test llog_logid_rec\n");
@@ -895,7 +881,7 @@ static int llog_test_7(const struct lu_env *env, struct obd_device *obd)
}
out:
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
/* -------------------------------------------------------------------------
@@ -908,7 +894,6 @@ static int llog_run_tests(const struct lu_env *env, struct obd_device *obd)
int rc, err;
char name[10];
- ENTRY;
ctxt = llog_get_context(obd, LLOG_TEST_ORIG_CTXT);
LASSERT(ctxt);
@@ -970,18 +955,16 @@ static int llog_test_cleanup(struct obd_device *obd)
struct lu_env env;
int rc;
- ENTRY;
-
rc = lu_env_init(&env, LCT_LOCAL | LCT_MG_THREAD);
if (rc)
- RETURN(rc);
+ return rc;
tgt = obd->obd_lvfs_ctxt.dt->dd_lu_dev.ld_obd;
rc = llog_cleanup(&env, llog_get_context(tgt, LLOG_TEST_ORIG_CTXT));
if (rc)
CERROR("failed to llog_test_llog_finish: %d\n", rc);
lu_env_fini(&env);
- RETURN(rc);
+ return rc;
}
static int llog_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
@@ -993,16 +976,14 @@ static int llog_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
struct lu_context test_session;
int rc;
- ENTRY;
-
if (lcfg->lcfg_bufcount < 2) {
CERROR("requires a TARGET OBD name\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (lcfg->lcfg_buflens[1] < 1) {
CERROR("requires a TARGET OBD name\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* disk obd */
@@ -1010,12 +991,12 @@ static int llog_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
if (!tgt || !tgt->obd_attached || !tgt->obd_set_up) {
CERROR("target device not attached or not set up (%s)\n",
lustre_cfg_string(lcfg, 1));
- RETURN(-EINVAL);
+ return -EINVAL;
}
rc = lu_env_init(&env, LCT_LOCAL | LCT_MG_THREAD);
if (rc)
- RETURN(rc);
+ return rc;
rc = lu_context_init(&test_session, LCT_SESSION);
if (rc)
@@ -1056,7 +1037,7 @@ cleanup_session:
lu_context_fini(&test_session);
cleanup_env:
lu_env_fini(&env);
- RETURN(rc);
+ return rc;
}
static struct obd_ops llog_obd_ops = {