- rc = llog_create(ctxt, &llh, NULL, name);
+ rc = llog_open(ctxt, &llh, NULL, name, OBD_LLOG_FL_CREATE);
- rc = llog_create(ctxt, llh, NULL, name);
+ rc = llog_open(ctxt, llh, NULL, name, 0);
- rc = llog_create(ctxt, &loghandle, NULL, NULL);
+ rc = llog_open(ctxt, &loghandle, NULL, NULL, OBD_LLOG_FL_CREATE);
- rc = llog_create(ctxt, &loghandle, &logid, NULL);
+ rc = llog_open(ctxt, &loghandle, &logid, NULL, 0);
lmr.lmr_hdr.lrh_len = lmr.lmr_tail.lrt_len = LLOG_MIN_REC_SIZE;
lmr.lmr_hdr.lrh_type = 0xf00f00;
sprintf(name, "%x", llog_test_rand+1);
CWARN("4a: create a catalog log with name: %s\n", name);
lmr.lmr_hdr.lrh_len = lmr.lmr_tail.lrt_len = LLOG_MIN_REC_SIZE;
lmr.lmr_hdr.lrh_type = 0xf00f00;
sprintf(name, "%x", llog_test_rand+1);
CWARN("4a: create a catalog log with name: %s\n", name);
- rc = llog_create(ctxt, &cath, NULL, name);
+ rc = llog_open(ctxt, &cath, NULL, name, OBD_LLOG_FL_CREATE);
- rc = llog_cat_add_rec(cath, &lmr.lmr_hdr, &cookie, NULL);
+ rc = llog_cat_add_rec(cath, &lmr.lmr_hdr, &cookie, NULL, NULL, NULL);
CWARN("4d: write 40,000 more log records\n");
for (i = 0; i < 40000; i++) {
CWARN("4d: write 40,000 more log records\n");
for (i = 0; i < 40000; i++) {
- rc = llog_cat_add_rec(cath, &lmr.lmr_hdr, NULL, NULL);
+ rc = llog_cat_add_rec(cath, &lmr.lmr_hdr, NULL, NULL, NULL, NULL);
- rc = llog_cat_add_rec(cath, &rec, NULL, buf);
+ rc = llog_cat_add_rec(cath, &rec, NULL, buf, NULL, NULL);
lmr.lmr_hdr.lrh_len = lmr.lmr_tail.lrt_len = LLOG_MIN_REC_SIZE;
lmr.lmr_hdr.lrh_type = 0xf00f00;
CWARN("5a: re-open catalog by id\n");
lmr.lmr_hdr.lrh_len = lmr.lmr_tail.lrt_len = LLOG_MIN_REC_SIZE;
lmr.lmr_hdr.lrh_type = 0xf00f00;
CWARN("5a: re-open catalog by id\n");
- rc = llog_create(ctxt, &llh, &cat_logid, NULL);
+ rc = llog_open(ctxt, &llh, &cat_logid, NULL, 0);
- rc = llog_cat_add_rec(llh, &lmr.lmr_hdr, NULL, NULL);
+ rc = llog_cat_add_rec(llh, &lmr.lmr_hdr, NULL, NULL, NULL, NULL);
+ CWARN("5f: print plain log entries reversely.. expect 6\n");
+ rc = llog_cat_reverse_process(llh, plain_print_cb, "foobar");
+ if (rc) {
+ CERROR("5f: reversely process with plain_print_cb failed: %d\n",
+ rc);
+ GOTO(out, rc);
+ }
+
static int llog_test_6(struct obd_device *obd, char *name)
{
struct obd_device *mdc_obd;
static int llog_test_6(struct obd_device *obd, char *name)
{
struct obd_device *mdc_obd;
- struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_TEST_ORIG_CTXT);
- struct obd_uuid *mds_uuid = &ctxt->loc_exp->exp_obd->obd_uuid;
+ struct llog_ctxt *ctxt;
+ struct obd_uuid *mds_uuid;
struct lustre_handle exph = {0, };
struct obd_export *exp;
struct obd_uuid uuid = {"LLOG_TEST6_UUID"};
struct lustre_handle exph = {0, };
struct obd_export *exp;
struct obd_uuid uuid = {"LLOG_TEST6_UUID"};
CWARN("6a: re-open log %s using client API\n", name);
mdc_obd = class_find_client_obd(mds_uuid, LUSTRE_MDC_NAME, NULL);
if (mdc_obd == NULL) {
CWARN("6a: re-open log %s using client API\n", name);
mdc_obd = class_find_client_obd(mds_uuid, LUSTRE_MDC_NAME, NULL);
if (mdc_obd == NULL) {
- rc = obd_connect(&exph, mdc_obd, &uuid);
+ rc = obd_connect(&exph, mdc_obd, &uuid, NULL, 0);
if (rc) {
CERROR("6: failed to connect to MDC: %s\n", mdc_obd->obd_name);
RETURN(rc);
}
exp = class_conn2export(&exph);
if (rc) {
CERROR("6: failed to connect to MDC: %s\n", mdc_obd->obd_name);
RETURN(rc);
}
exp = class_conn2export(&exph);
- nctxt = llog_get_context(mdc_obd, LLOG_CONFIG_REPL_CTXT);
- rc = llog_create(nctxt, &llh, NULL, name);
+ nctxt = llog_get_context(&mdc_obd->obd_llogs, LLOG_CONFIG_REPL_CTXT);
+ rc = llog_open(nctxt, &llh, NULL, name, 0);
sprintf(name, "%x", llog_test_rand+2);
CWARN("7: create a log with name: %s\n", name);
LASSERT(ctxt);
sprintf(name, "%x", llog_test_rand+2);
CWARN("7: create a log with name: %s\n", name);
LASSERT(ctxt);
- rc = llog_create(ctxt, &llh, NULL, name);
+ rc = llog_open(ctxt, &llh, NULL, name, OBD_LLOG_FL_CREATE);
* ------------------------------------------------------------------------- */
static int llog_run_tests(struct obd_device *obd)
{
* ------------------------------------------------------------------------- */
static int llog_run_tests(struct obd_device *obd)
{
-static int llog_test_llog_init(struct obd_device *obd, struct obd_device *tgt,
- int count, struct llog_catid *logid)
+static int llog_test_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
+ struct obd_device *tgt, int count,
+ struct llog_catid *logid)
- rc = llog_setup(obd, LLOG_TEST_ORIG_CTXT, tgt, 0, NULL, &llog_lvfs_ops);
+ rc = obd_llog_setup(obd, llogs, LLOG_TEST_ORIG_CTXT, tgt, 0, NULL,
+ &llog_lvfs_ops);
-static int llog_test_llog_finish(struct obd_device *obd, int count)
+static int llog_test_llog_finish(struct obd_device *obd,
+ struct obd_llogs *llogs, int count)
if (!tgt || !tgt->obd_attached || !tgt->obd_set_up) {
CERROR("target device not attached or not set up (%s)\n",
if (!tgt || !tgt->obd_attached || !tgt->obd_set_up) {
CERROR("target device not attached or not set up (%s)\n",
- rc = obd_llog_init(obd, tgt, 0, NULL);
+ rc = obd_llog_init(obd, &obd->obd_llogs, tgt, 0, NULL);
.o_llog_init = llog_test_llog_init,
.o_llog_finish = llog_test_llog_finish,
};
.o_llog_init = llog_test_llog_init,
.o_llog_finish = llog_test_llog_finish,
};
struct lprocfs_static_vars lvars;
lprocfs_init_vars(llog_test, &lvars);
struct lprocfs_static_vars lvars;
lprocfs_init_vars(llog_test, &lvars);