Whamcloud - gitweb
LU-181 obdclass: fix portal_handle memory wastage
[fs/lustre-release.git] / lustre / obdclass / genops.c
index 9839fcd..081b55e 100644 (file)
@@ -798,6 +798,11 @@ static void export_handle_addref(void *export)
         class_export_get(export);
 }
 
+static struct portals_handle_ops export_handle_ops = {
+       .hop_addref = export_handle_addref,
+       .hop_free   = NULL,
+};
+
 struct obd_export *class_export_get(struct obd_export *exp)
 {
         cfs_atomic_inc(&exp->exp_refcount);
@@ -863,8 +868,8 @@ struct obd_export *class_new_export(struct obd_device *obd,
         CFS_INIT_LIST_HEAD(&export->exp_req_replay_queue);
         CFS_INIT_LIST_HEAD(&export->exp_handle.h_link);
         CFS_INIT_LIST_HEAD(&export->exp_hp_rpcs);
-        class_handle_hash(&export->exp_handle, export_handle_addref);
-        export->exp_last_request_time = cfs_time_current_sec();
+       class_handle_hash(&export->exp_handle, &export_handle_ops);
+       export->exp_last_request_time = cfs_time_current_sec();
         cfs_spin_lock_init(&export->exp_lock);
         cfs_spin_lock_init(&export->exp_rpc_lock);
         CFS_INIT_HLIST_NODE(&export->exp_uuid_hash);
@@ -976,6 +981,11 @@ static void import_handle_addref(void *import)
         class_import_get(import);
 }
 
+static struct portals_handle_ops import_handle_ops = {
+       .hop_addref = import_handle_addref,
+       .hop_free   = NULL,
+};
+
 struct obd_import *class_import_get(struct obd_import *import)
 {
         cfs_atomic_inc(&import->imp_refcount);
@@ -1044,7 +1054,7 @@ struct obd_import *class_new_import(struct obd_device *obd)
         cfs_atomic_set(&imp->imp_inval_count, 0);
         CFS_INIT_LIST_HEAD(&imp->imp_conn_list);
         CFS_INIT_LIST_HEAD(&imp->imp_handle.h_link);
-        class_handle_hash(&imp->imp_handle, import_handle_addref);
+       class_handle_hash(&imp->imp_handle, &import_handle_ops);
         init_imp_at(&imp->imp_at);
 
         /* the default magic is V2, will be used in connect RPC, and