Whamcloud - gitweb
b=2111
authorrread <rread>
Wed, 15 Oct 2003 23:55:27 +0000 (23:55 +0000)
committerrread <rread>
Wed, 15 Oct 2003 23:55:27 +0000 (23:55 +0000)
r=peter

- most of this is Peter patch from 2111, including making sure
  obd_log_exp is set once.
- my integration with 0conf
- add an obd method "obd_pre_cleanup" so the log export can be
  disconnected, and allow the device to be fully cleaned up.

lnet/klnds/socklnd/socklnd.c
lustre/lov/lov_log.c
lustre/obdclass/llog_obd.c
lustre/portals/knals/socknal/socknal.c
lustre/tests/replay-single.sh

index c72717d..345882d 100644 (file)
@@ -241,9 +241,8 @@ ksocknal_destroy_route (ksock_route_t *route)
 void
 ksocknal_put_route (ksock_route_t *route)
 {
-        CDEBUG (D_OTHER, "putting route[%p] -> "LPX64" (%d)\n",
-                route, route->ksnr_peer->ksnp_nid,
-                atomic_read (&route->ksnr_refcount));
+        CDEBUG (D_OTHER, "putting route[%p] (%d)\n",
+                route, atomic_read (&route->ksnr_refcount));
 
         LASSERT (atomic_read (&route->ksnr_refcount) > 0);
         if (!atomic_dec_and_test (&route->ksnr_refcount))
index c65dc3d..b5a022d 100644 (file)
@@ -63,9 +63,10 @@ int lov_llog_setup(struct obd_device *obd, struct obd_device *disk_obd,
         for (i = 0; i < lov->desc.ld_tgt_count; i++) {
                 struct obd_device *child = lov->tgts[i].ltd_exp->exp_obd;
                 rc = obd_llog_setup(child, disk_obd, index, 1, logids + i);
-                CERROR("error lov_llog_open %d\n", i);
-                if (rc) 
+                if (rc) {
+                        CERROR("error lov_llog_open %d\n", i);
                         break;
+                }
         }
         RETURN(rc);
 }
index 7eb19e6..e9269ac 100644 (file)
@@ -1,3 +1,4 @@
+
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
@@ -79,8 +80,8 @@ int obd_llog_repl_cancel(struct obd_device *obd, struct lov_stripe_md *lsm,
 EXPORT_SYMBOL(obd_llog_repl_cancel);
 
 /* now some implementations of these stubs useful on the OSC and OBDFILTER */
-int llog_obd_setup_logid(struct obd_device *obd, struct obd_device *disk_obd,
-                         int index, int count, struct llog_logid *logid)
+int llog_obd_setup(struct obd_device *obd, struct obd_device *disk_obd,
+                   int index, int count, struct llog_logid *logid)
 {
         struct llog_obd_ctxt *ctxt;
         struct llog_handle *handle;
@@ -93,14 +94,14 @@ int llog_obd_setup_logid(struct obd_device *obd, struct obd_device *disk_obd,
                 if (!ctxt)
                         RETURN(-ENOMEM);
                 
-                if (obd->obd_llog_ctxt) {
+                if (disk_obd->obd_llog_ctxt) {
                         CERROR("llog_ctxt already allocated\n");
                         LBUG();
                 }
-                obd->obd_llog_ctxt = ctxt;
-                sema_init(&obd->obd_llog_ctxt->loc_sem, 1);
+                disk_obd->obd_llog_ctxt = ctxt;
+                sema_init(&disk_obd->obd_llog_ctxt->loc_sem, 1);
         } else 
-                ctxt = obd->obd_llog_ctxt;
+                ctxt = disk_obd->obd_llog_ctxt;
 
         if (index < 0 || index >= LLOG_OBD_MAX_HANDLES) { 
                 CERROR("llog_ctxt index out of range\n");
@@ -117,15 +118,14 @@ int llog_obd_setup_logid(struct obd_device *obd, struct obd_device *disk_obd,
         if (rc) 
                 GOTO(out, rc);
 
-        obd->obd_llog_ctxt->loc_handles[index] = handle;
-        llog_init_handle(handle,  LLOG_F_IS_CAT, NULL);
-
+        disk_obd->obd_llog_ctxt->loc_handles[index] = handle;
+        rc = llog_init_handle(handle,  LLOG_F_IS_CAT, NULL);
  out:
         if (ctxt && rc) 
                 OBD_FREE(ctxt, sizeof(*ctxt));
         RETURN(rc);
 }
-EXPORT_SYMBOL(llog_obd_setup_logid);
+EXPORT_SYMBOL(llog_obd_setup);
 
 int llog_obd_cleanup(struct obd_device *obd)
 {
@@ -135,7 +135,6 @@ int llog_obd_cleanup(struct obd_device *obd)
         if (!ctxt)
                 return 0;
 
-
         if (ctxt->loc_imp) {
                 //class_destroy_import(ctxt->loc_imp);
                 ctxt->loc_imp = NULL;
@@ -145,7 +144,7 @@ int llog_obd_cleanup(struct obd_device *obd)
                 if (obd->obd_llog_ctxt->loc_handles[i])
                         llog_cat_put(obd->obd_llog_ctxt->loc_handles[i]);
         
-        OBD_FREE(obd->obd_llog_ctxt, sizeof(obd->obd_llog_ctxt));
+        OBD_FREE(obd->obd_llog_ctxt, sizeof(*obd->obd_llog_ctxt));
         obd->obd_llog_ctxt = NULL;
         return 0;
 }
@@ -157,8 +156,6 @@ int llog_obd_origin_add(struct obd_export *exp,
                     struct llog_cookie *logcookies, int numcookies)
 {
         struct llog_handle *cathandle;
-        struct obd_device *obd = class_exp2obd(exp->exp_obd->obd_log_exp);
-        struct obd_run_ctxt saved;
         int rc;
         ENTRY;
 
@@ -169,16 +166,30 @@ int llog_obd_origin_add(struct obd_export *exp,
 
         cathandle = exp->exp_obd->obd_llog_ctxt->loc_handles[index];
         LASSERT(cathandle != NULL);
-        push_ctxt(&saved, &obd->obd_ctxt, NULL); 
         rc = llog_cat_add_rec(cathandle, rec, logcookies, NULL);
         if (rc != 1)
                 CERROR("write one catalog record failed: %d\n", rc);
-        pop_ctxt(&saved, &obd->obd_ctxt, NULL);
-
         RETURN(rc);
 }
 EXPORT_SYMBOL(llog_obd_origin_add);
 
+/* initialize the local storage obd for the logs */
+int llog_initialize(struct obd_device *obd)
+{
+        struct obd_export *exp = class_new_export(obd);
+        ENTRY;
+
+        if (exp == NULL)
+                RETURN(-ENOMEM);
+        memcpy(&exp->exp_client_uuid, &obd->obd_uuid, 
+               sizeof(exp->exp_client_uuid));
+        obd->obd_log_exp = exp;
+        class_export_put(exp);
+
+        obd->obd_logops = &llog_lvfs_ops;
+        RETURN(0);
+}
+EXPORT_SYMBOL(llog_initialize);
 
 int llog_cat_initialize(struct obd_device *obd, int count)
 {
@@ -188,12 +199,12 @@ int llog_cat_initialize(struct obd_device *obd, int count)
         int size = sizeof(*idarray) * count;
         ENTRY;
 
+        LASSERT(obd->obd_log_exp);
+
         OBD_ALLOC(idarray, size);
         if (!idarray)
                 RETURN(-ENOMEM);
 
-        obd->obd_logops = &llog_lvfs_ops;
-
         for (i = 0; i < LLOG_OBD_MAX_HANDLES; i++) {
                 sprintf(name, "CATLIST-%d", i);
                 memset(idarray, 0, size);
index c72717d..345882d 100644 (file)
@@ -241,9 +241,8 @@ ksocknal_destroy_route (ksock_route_t *route)
 void
 ksocknal_put_route (ksock_route_t *route)
 {
-        CDEBUG (D_OTHER, "putting route[%p] -> "LPX64" (%d)\n",
-                route, route->ksnr_peer->ksnp_nid,
-                atomic_read (&route->ksnr_refcount));
+        CDEBUG (D_OTHER, "putting route[%p] (%d)\n",
+                route, atomic_read (&route->ksnr_refcount));
 
         LASSERT (atomic_read (&route->ksnr_refcount) > 0);
         if (!atomic_dec_and_test (&route->ksnr_refcount))
index 6b99216..479bec7 100755 (executable)
@@ -41,7 +41,7 @@ build_test_filter
 cleanup() {
     [ "$DAEMONFILE" ] && lctl debug_daemon stop
     umount $MOUNT || true
-    rmmod llite
+    rmmod llite || true
     stop mds ${FORCE} $MDSLCONFARGS
     stop ost ${FORCE} --dump cleanup.log
 }
@@ -55,6 +55,7 @@ fi
 gen_config
 
 start ost --reformat $OSTLCONFARGS
+[ "$DAEMONFILE" ] && lctl debug_daemon start $DAEMONFILE $DAEMONSIZE
 start mds --write_conf --reformat $MDSLCONFARGS
 
 # 0-conf client
@@ -63,7 +64,9 @@ insmod ../llite/llite.o || true
 [ -d $MOUNT ] || mkdir $MOUNT 
 mount -t lustre_lite -o mds_uuid=mds1_UUID,profile=client_facet replay-single $MOUNT
 
-[ "$DAEMONFILE" ] && lctl debug_daemon start $DAEMONFILE $DAEMONSIZE
+if [ "$ONLY" == "setup" ]; then
+    exit 0
+fi
 
 mkdir -p $DIR