Whamcloud - gitweb
Branch: HEAD
[fs/lustre-release.git] / lustre / obdclass / llog_test.c
index 82bc3d7..ce887c8 100644 (file)
@@ -184,7 +184,7 @@ static int llog_test_3(struct obd_device *obd, struct llog_handle *llh)
         struct llog_create_rec lcr;
         int rc, i;
         int num_recs = 1;       /* 1 for the header */
-       ENTRY;
+        ENTRY;
 
         lcr.lcr_hdr.lrh_len = lcr.lcr_tail.lrt_len = sizeof(lcr);
         lcr.lcr_hdr.lrh_type = OST_SZ_REC;
@@ -236,8 +236,8 @@ static int llog_test_3(struct obd_device *obd, struct llog_handle *llh)
 
         if ((rc = verify_handle("3c", llh, num_recs)))
                 RETURN(rc);
-       
-       CWARN("3d: write log more than BITMAP_SIZE, return -ENOSPC\n");
+
+        CWARN("3d: write log more than BITMAP_SIZE, return -ENOSPC\n");
         for (i = 0; i < LLOG_BITMAP_SIZE(llh->lgh_hdr) + 1; i++) {
                 struct llog_rec_hdr hdr;
                 char buf_even[24];
@@ -245,30 +245,30 @@ static int llog_test_3(struct obd_device *obd, struct llog_handle *llh)
 
                 memset(buf_odd, 0, sizeof buf_odd);
                 memset(buf_even, 0, sizeof buf_even);
-               if ((i % 2) == 0) {
-                       hdr.lrh_len = 24;
-                       hdr.lrh_type = OBD_CFG_REC;
-                       rc = llog_write_rec(llh, &hdr, NULL, 0, buf_even, -1);
-               } else {
-                       hdr.lrh_len = 32;
-                       hdr.lrh_type = OBD_CFG_REC;
-                       rc = llog_write_rec(llh, &hdr, NULL, 0, buf_odd, -1);
-               }
+                if ((i % 2) == 0) {
+                        hdr.lrh_len = 24;
+                        hdr.lrh_type = OBD_CFG_REC;
+                        rc = llog_write_rec(llh, &hdr, NULL, 0, buf_even, -1);
+                } else {
+                        hdr.lrh_len = 32;
+                        hdr.lrh_type = OBD_CFG_REC;
+                        rc = llog_write_rec(llh, &hdr, NULL, 0, buf_odd, -1);
+                }
                 if (rc) {
-                       if (rc == -ENOSPC) {
-                               break;
-                       } else {
-                               CERROR("3c: write 8k recs failed at #%d: %d\n",
-                                               i + 1, rc);
-                               RETURN(rc);
-                       }
+                        if (rc == -ENOSPC) {
+                                break;
+                        } else {
+                                CERROR("3c: write recs failed at #%d: %d\n",
+                                        i + 1, rc);
+                                RETURN(rc);
+                        }
                 }
                 num_recs++;
         }
-       if (rc != -ENOSPC) {
-               CWARN("3d: write record more than BITMAP size!\n");
-               RETURN(-EINVAL);
-       }
+        if (rc != -ENOSPC) {
+                CWARN("3d: write record more than BITMAP size!\n");
+                RETURN(-EINVAL);
+        }
         if ((rc = verify_handle("3d", llh, num_recs)))
                 RETURN(rc);
 
@@ -449,7 +449,7 @@ static int llog_test_5(struct obd_device *obd)
         }
 
         CWARN("5c: Cancel 40000 records, see one log zapped\n");
-        rc = llog_cat_process(llh, llog_cancel_rec_cb, "foobar");
+        rc = llog_cat_process(llh, llog_cancel_rec_cb, "foobar", 0, 0);
         if (rc != -4711) {
                 CERROR("5c: process with cat_cancel_cb failed: %d\n", rc);
                 GOTO(out, rc);
@@ -471,7 +471,7 @@ static int llog_test_5(struct obd_device *obd)
         }
 
         CWARN("5e: print plain log entries.. expect 6\n");
-        rc = llog_cat_process(llh, plain_print_cb, "foobar");
+        rc = llog_cat_process(llh, plain_print_cb, "foobar", 0, 0);
         if (rc) {
                 CERROR("5e: process with plain_print_cb failed: %d\n", rc);
                 GOTO(out, rc);
@@ -501,7 +501,6 @@ static int llog_test_6(struct obd_device *obd, char *name)
         struct obd_device *mgc_obd;
         struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_TEST_ORIG_CTXT);
         struct obd_uuid *mgs_uuid = &ctxt->loc_exp->exp_obd->obd_uuid;
-        struct lustre_handle exph = {0, };
         struct obd_export *exp;
         struct obd_uuid uuid = {"LLOG_TEST6_UUID"};
         struct llog_handle *llh = NULL;
@@ -516,13 +515,13 @@ static int llog_test_6(struct obd_device *obd, char *name)
                 GOTO(ctxt_release, rc = -ENOENT);
         }
 
-        rc = obd_connect(NULL, &exph, mgc_obd, &uuid,
+        rc = obd_connect(NULL, &exp, mgc_obd, &uuid,
                          NULL /* obd_connect_data */, NULL);
         if (rc) {
                 CERROR("6: failed to connect to MGC: %s\n", mgc_obd->obd_name);
                 GOTO(ctxt_release, rc);
         }
-        exp = class_conn2export(&exph);
+        LASSERTF(exp->exp_obd == mgc_obd, "%p - %p - %p\n", exp, exp->exp_obd, mgc_obd);
 
         nctxt = llog_get_context(mgc_obd, LLOG_CONFIG_REPL_CTXT);
         rc = llog_create(nctxt, &llh, NULL, name);
@@ -552,6 +551,8 @@ parse_out:
         if (rc) {
                 CERROR("6: llog_close failed: rc = %d\n", rc);
         }
+       CDEBUG(D_INFO, "obd %p - %p - %p - %p\n",
+              mgc_obd, exp, exp->exp_obd, exp->exp_obd->obd_type);
         rc = obd_disconnect(exp);
 ctxt_release:
         llog_ctxt_put(ctxt);
@@ -722,7 +723,7 @@ static int llog_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                 RETURN(-EINVAL);
         }
 
-        rc = obd_llog_init(obd, OBD_LLOG_GROUP, tgt, 0, NULL, NULL);
+        rc = obd_llog_init(obd, NULL, tgt, 0, NULL, NULL);
         if (rc)
                 RETURN(rc);