Whamcloud - gitweb
Branch: b_new_cmd
authorwangdi <wangdi>
Mon, 17 Jul 2006 09:49:56 +0000 (09:49 +0000)
committerwangdi <wangdi>
Mon, 17 Jul 2006 09:49:56 +0000 (09:49 +0000)
remove md_lov_ctxt from md_lov_info, it is per_thread item

lustre/cmm/cmm_device.c
lustre/include/md_object.h
lustre/include/obd.h
lustre/mdd/mdd_internal.h
lustre/mdd/mdd_lov.c
lustre/mds/mds_lov.c
lustre/mdt/mdt_handler.c

index 561d93a..efc93aa 100644 (file)
@@ -77,14 +77,15 @@ static int cmm_statfs(const struct lu_context *ctxt, struct md_device *md,
         RETURN (rc);
 }
 
-int cmm_notify(struct md_device *md, struct obd_device *watched, 
+int cmm_notify(const struct lu_context *ctxt, struct md_device *md, 
+               struct obd_device *watched, 
                enum obd_notify_event ev, void *data)
 {
         struct cmm_device *cmm_dev = md2cmm_dev(md);
         int rc;
 
-        rc = cmm_child_ops(cmm_dev)->mdo_notify(cmm_dev->cmm_child, watched,
-                                                ev, data);
+        rc = cmm_child_ops(cmm_dev)->mdo_notify(ctxt, cmm_dev->cmm_child, 
+                                                watched, ev, data);
 
         return rc;
 }
index ddb1ac6..f221666 100644 (file)
@@ -111,7 +111,8 @@ struct md_device_operations {
         /*
          * notify function for metadata stack
          */
-        int (*mdo_notify)(struct md_device *m, struct obd_device *watched, 
+        int (*mdo_notify)(const struct lu_context *ctx, 
+                          struct md_device *m, struct obd_device *watched, 
                           enum obd_notify_event ev, void *data);
 
 };
index 1326bc3..71a5c72 100644 (file)
@@ -427,7 +427,6 @@ struct md_lov_info {
         int                              md_lov_max_mdsize;
         int                              md_lov_max_cookiesize;
         struct semaphore                 md_lov_orphan_recovery_sem;
-        struct lu_context                md_lov_ctxt;
         struct md_lov_ops                *md_lov_ops;
 };
 
index 6be1f5a..1498ad3 100644 (file)
@@ -55,8 +55,9 @@ struct mdd_thread_info {
 int mdd_lov_init(const struct lu_context *ctxt, struct mdd_device *mdd,
                  struct lustre_cfg *cfg);
 int mdd_lov_fini(const struct lu_context *ctxt, struct mdd_device *mdd);
-int mdd_notify(struct md_device *md, struct obd_device *watched, 
-               enum obd_notify_event ev, void *data);
+int mdd_notify(const struct lu_context *ctxt, struct md_device *md, 
+               struct obd_device *watched, enum obd_notify_event ev, 
+               void *data);
 
 int mdd_xattr_set(const struct lu_context *ctxt, struct md_object *obj,
                   const void *buf, int buf_len, const char *name);
index f37d8e0..85516aa 100644 (file)
@@ -143,7 +143,6 @@ int mdd_lov_fini(const struct lu_context *ctxt, struct mdd_device *mdd)
                 mli->md_lov_exp = NULL;
         }
         
-        lu_context_fini(&mli->md_lov_ctxt);
         dt_object_fini(mli->md_lov_objid_obj);
         return 0;
 }
@@ -180,12 +179,11 @@ int mdd_lov_init(const struct lu_context *ctxt, struct mdd_device *mdd,
                 CERROR("No such OBD %s\n", srv);
                 LBUG();
         }
-        rc = md_lov_connect(obd, lov_info, lov_name, 
+        CDEBUG(D_INFO, "srv name %s, obd %p \n", obd->obd_name, obd);
+        rc = md_lov_connect(obd, lov_info, lov_name,
                             &obd->obd_uuid, &mdd_lov_ops, ctxt);
         if (rc)
                 GOTO(out, rc);
-        
-        rc = lu_context_init(&lov_info->md_lov_ctxt);
 out:
         if (rc)
                 mdd_lov_fini(ctxt, mdd);
@@ -193,7 +191,8 @@ out:
         RETURN(rc);
 }
 
-int mdd_notify(struct md_device *md, struct obd_device *watched, 
+int mdd_notify(const struct lu_context *ctxt, struct md_device *md, 
+               struct obd_device *watched, 
                enum obd_notify_event ev, void *data)
 {
        struct mdd_device *mdd = lu2mdd_dev(&md->md_lu_dev);
@@ -208,11 +207,8 @@ int mdd_notify(struct md_device *md, struct obd_device *watched,
                 RETURN(rc);
         }
         
-        lu_context_enter(&mdd->mdd_lov_info.md_lov_ctxt);
         rc = md_lov_start_synchronize(obd, &mdd->mdd_lov_info, watched, data,
-                                      !(ev == OBD_NOTIFY_SYNC),
-                                      &mdd->mdd_lov_info.md_lov_ctxt);
-        lu_context_exit(&mdd->mdd_lov_info.md_lov_ctxt);
+                                      !(ev == OBD_NOTIFY_SYNC), ctxt);
         
         RETURN(rc);
 }
index 451b952..78464de 100644 (file)
@@ -364,6 +364,8 @@ int md_lov_connect(struct obd_device *obd, struct md_lov_info *mli,
                        lov_name, rc);
                 GOTO(out, rc);
         }
+        CDEBUG(D_INFO, "regist observer %s to lov %s \n",
+                        obd->obd_name, mli->md_lov_obd->obd_name);
         
         rc = mli->md_lov_ops->ml_read_objids(obd, mli, ctxt);
         if (rc) {
index c84e853..0295be7 100644 (file)
@@ -2553,14 +2553,20 @@ static int mdt_notify(struct obd_device *obd, struct obd_device *watched,
 {
         struct mdt_device *mdt;
         struct md_device *next;
+        struct lu_context ctxt;
         int rc;
         ENTRY;
 
+        lu_context_init(&ctxt);
+
         mdt = mdt_dev(obd->obd_lu_dev);
         next = mdt->mdt_child;
-
-        rc = next->md_ops->mdo_notify(next, watched, ev, data);
-        
+       
+        lu_context_enter(&ctxt);
+        rc = next->md_ops->mdo_notify(&ctxt, next, watched, ev, data);
+        lu_context_exit(&ctxt);
+       
+        lu_context_fini(&ctxt);
         RETURN(rc);
 }
 
@@ -2570,7 +2576,7 @@ static struct obd_ops mdt_obd_device_ops = {
         .o_disconnect     = mdt_obd_disconnect,
         .o_init_export    = mdt_init_export,    /* By Huang Hua*/
         .o_destroy_export = mdt_destroy_export, /* By Huang Hua*/
-        //.o_notify         = mdt_notify,
+        .o_notify         = mdt_notify,
 };
 
 static void mdt_device_free(const struct lu_context *ctx, struct lu_device *d)