Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / obdecho / echo.c
index 541cf5d..76288a1 100644 (file)
@@ -49,8 +49,10 @@ enum {
         LPROC_ECHO_LAST = LPROC_ECHO_WRITE_BYTES +1
 };
 
-static int echo_connect(struct lustre_handle *conn, struct obd_device *obd,
-                        struct obd_uuid *cluuid, struct obd_connect_data *data)
+static int echo_connect(const struct lu_env *env,
+                        struct lustre_handle *conn, struct obd_device *obd,
+                        struct obd_uuid *cluuid, struct obd_connect_data *data,
+                        void *localdata)
 {
         data->ocd_connect_flags &= ECHO_CONNECT_SUPPORTED;
         return class_connect(conn, obd, cluuid);
@@ -128,7 +130,7 @@ int echo_create(struct obd_export *exp, struct obdo *oa,
 }
 
 int echo_destroy(struct obd_export *exp, struct obdo *oa,
-                 struct lov_stripe_md *ea, struct obd_trans_info *oti, 
+                 struct lov_stripe_md *ea, struct obd_trans_info *oti,
                  struct obd_export *md_exp)
 {
         struct obd_device *obd = class_exp2obd(exp);
@@ -166,7 +168,7 @@ static int echo_getattr(struct obd_export *exp, struct obd_info *oinfo)
         }
 
         if (!(oinfo->oi_oa->o_valid & OBD_MD_FLID)) {
-                CERROR("obdo missing FLID valid flag: "LPX64"\n", 
+                CERROR("obdo missing FLID valid flag: "LPX64"\n",
                        oinfo->oi_oa->o_valid);
                 RETURN(-EINVAL);
         }
@@ -190,7 +192,7 @@ static int echo_setattr(struct obd_export *exp, struct obd_info *oinfo,
         }
 
         if (!(oinfo->oi_oa->o_valid & OBD_MD_FLID)) {
-                CERROR("obdo missing FLID valid flag: "LPX64"\n", 
+                CERROR("obdo missing FLID valid flag: "LPX64"\n",
                        oinfo->oi_oa->o_valid);
                 RETURN(-EINVAL);
         }
@@ -269,7 +271,7 @@ echo_page_debug_check(cfs_page_t *page, obd_id id,
 int echo_preprw(int cmd, struct obd_export *export, struct obdo *oa,
                 int objcount, struct obd_ioobj *obj, int niocount,
                 struct niobuf_remote *nb, struct niobuf_local *res,
-                struct obd_trans_info *oti)
+                struct obd_trans_info *oti, struct lustre_capa *unused)
 {
         struct obd_device *obd;
         struct niobuf_local *r = res;
@@ -310,7 +312,7 @@ int echo_preprw(int cmd, struct obd_export *export, struct obdo *oa,
                                 /* Take extra ref so __free_pages() can be called OK */
                                 cfs_get_page (r->page);
                         } else {
-                                r->page = cfs_alloc_page(gfp_mask);
+                                OBD_PAGE_ALLOC(r->page, gfp_mask);
                                 if (r->page == NULL) {
                                         CERROR("can't get page %u/%u for id "
                                                LPU64"\n",
@@ -361,7 +363,7 @@ preprw_cleanup:
                 cfs_kunmap(r->page);
                 /* NB if this is a persistent page, __free_pages will just
                  * lose the extra ref gained above */
-                cfs_free_page(r->page);
+                OBD_PAGE_FREE(r->page);
                 atomic_dec(&obd->u.echo.eo_prep);
         }
         memset(res, 0, sizeof(*res) * niocount);
@@ -432,7 +434,7 @@ int echo_commitrw(int cmd, struct obd_export *export, struct obdo *oa,
 
                         cfs_kunmap(page);
                         /* NB see comment above regarding persistent pages */
-                        cfs_free_page(page);
+                        OBD_PAGE_FREE(page);
                         atomic_dec(&obd->u.echo.eo_prep);
                 }
         }
@@ -447,13 +449,13 @@ commitrw_cleanup:
                 cfs_page_t *page = r->page;
 
                 /* NB see comment above regarding persistent pages */
-                cfs_free_page(page);
+                OBD_PAGE_FREE(page);
                 atomic_dec(&obd->u.echo.eo_prep);
         }
         return rc;
 }
 
-static int echo_setup(struct obd_device *obd, obd_count len, void *buf)
+static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
 {
         struct lprocfs_static_vars lvars;
         int                        rc;
@@ -464,20 +466,21 @@ static int echo_setup(struct obd_device *obd, obd_count len, void *buf)
         spin_lock_init(&obd->u.echo.eo_lock);
         obd->u.echo.eo_lastino = ECHO_INIT_OBJID;
 
-        obd->obd_namespace = ldlm_namespace_new("echo-tgt",
-                                                LDLM_NAMESPACE_SERVER);
+        obd->obd_namespace = ldlm_namespace_new(obd, "echo-tgt",
+                                                LDLM_NAMESPACE_SERVER,
+                                                LDLM_NAMESPACE_MODEST);
         if (obd->obd_namespace == NULL) {
                 LBUG();
                 RETURN(-ENOMEM);
         }
 
-        rc = ldlm_cli_enqueue_local(obd->obd_namespace, res_id, LDLM_PLAIN, 
-                                    NULL, LCK_NL, &lock_flags, NULL, 
-                                    ldlm_completion_ast, NULL, NULL, 
+        rc = ldlm_cli_enqueue_local(obd->obd_namespace, &res_id, LDLM_PLAIN,
+                                    NULL, LCK_NL, &lock_flags, NULL,
+                                    ldlm_completion_ast, NULL, NULL,
                                     0, NULL, &obd->u.echo.eo_nl_lock);
         LASSERT (rc == ELDLM_OK);
 
-        lprocfs_init_vars(echo, &lvars);
+        lprocfs_echo_init_vars(&lvars);
         if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0 &&
             lprocfs_alloc_obd_stats(obd, LPROC_ECHO_LAST) == 0) {
                 lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_READ_BYTES,
@@ -508,7 +511,8 @@ static int echo_cleanup(struct obd_device *obd)
         set_current_state (TASK_UNINTERRUPTIBLE);
         cfs_schedule_timeout (CFS_TASK_UNINT, cfs_time_seconds(1));
 
-        ldlm_namespace_free(obd->obd_namespace, obd->obd_force);
+        ldlm_namespace_free(obd->obd_namespace, NULL, obd->obd_force);
+        obd->obd_namespace = NULL;
 
         leaked = atomic_read(&obd->u.echo.eo_prep);
         if (leaked != 0)
@@ -542,7 +546,7 @@ echo_persistent_pages_fini (void)
 
         for (i = 0; i < ECHO_PERSISTENT_PAGES; i++)
                 if (echo_persistent_pages[i] != NULL) {
-                        cfs_free_page (echo_persistent_pages[i]);
+                        OBD_PAGE_FREE(echo_persistent_pages[i]);
                         echo_persistent_pages[i] = NULL;
                 }
 }
@@ -557,7 +561,7 @@ echo_persistent_pages_init (void)
                 int gfp_mask = (i < ECHO_PERSISTENT_PAGES/2) ?
                         CFS_ALLOC_STD : CFS_ALLOC_HIGHUSER;
 
-                pg = cfs_alloc_page (gfp_mask);
+                OBD_PAGE_ALLOC(pg, gfp_mask);
                 if (pg == NULL) {
                         echo_persistent_pages_fini ();
                         return (-ENOMEM);
@@ -582,14 +586,14 @@ static int __init obdecho_init(void)
 
         LASSERT(CFS_PAGE_SIZE % OBD_ECHO_BLOCK_SIZE == 0);
 
-        lprocfs_init_vars(echo, &lvars);
+        lprocfs_echo_init_vars(&lvars);
 
         rc = echo_persistent_pages_init ();
         if (rc != 0)
                 goto failed_0;
 
-        rc = class_register_type(&echo_obd_ops, lvars.module_vars,
-                                 LUSTRE_ECHO_NAME);
+        rc = class_register_type(&echo_obd_ops, NULL, lvars.module_vars,
+                                 LUSTRE_ECHO_NAME, NULL);
         if (rc != 0)
                 goto failed_1;