Whamcloud - gitweb
LU-11233 build: support for gcc8
[fs/lustre-release.git] / lustre / obdclass / genops.c
index 1325398..0a840c9 100644 (file)
@@ -239,7 +239,7 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
        if (enable_proc) {
                type->typ_procroot = lprocfs_register(type->typ_name,
                                                      proc_lustre_root,
-                                                     vars, type);
+                                                     NULL, type);
                if (IS_ERR(type->typ_procroot)) {
                        rc = PTR_ERR(type->typ_procroot);
                        type->typ_procroot = NULL;
@@ -262,7 +262,7 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
 
        type->typ_debugfs_entry = ldebugfs_register(type->typ_name,
                                                    debugfs_lustre_root,
-                                                   NULL, type);
+                                                   vars, type);
        if (IS_ERR_OR_NULL(type->typ_debugfs_entry)) {
                rc = type->typ_debugfs_entry ? PTR_ERR(type->typ_debugfs_entry)
                                             : -ENOMEM;
@@ -445,7 +445,7 @@ struct obd_device *class_newdev(const char *type_name, const char *name,
 
        newdev->obd_conn_inprogress = 0;
 
-       strncpy(newdev->obd_uuid.uuid, uuid, strlen(uuid));
+       strncpy(newdev->obd_uuid.uuid, uuid, UUID_MAX);
 
        CDEBUG(D_IOCTL, "Allocate new device %s (%p)\n",
               newdev->obd_name, newdev);
@@ -952,18 +952,6 @@ struct obd_device *class_exp2obd(struct obd_export *exp)
 }
 EXPORT_SYMBOL(class_exp2obd);
 
-struct obd_device *class_conn2obd(struct lustre_handle *conn)
-{
-        struct obd_export *export;
-        export = class_conn2export(conn);
-        if (export) {
-                struct obd_device *obd = export->exp_obd;
-                class_export_put(export);
-                return obd;
-        }
-        return NULL;
-}
-
 struct obd_import *class_exp2cliimp(struct obd_export *exp)
 {
         struct obd_device *obd = exp->exp_obd;
@@ -973,14 +961,6 @@ struct obd_import *class_exp2cliimp(struct obd_export *exp)
 }
 EXPORT_SYMBOL(class_exp2cliimp);
 
-struct obd_import *class_conn2cliimp(struct lustre_handle *conn)
-{
-        struct obd_device *obd = class_conn2obd(conn);
-        if (obd == NULL)
-                return NULL;
-        return obd->u.cli.cl_import;
-}
-
 /* Export management functions */
 static void class_export_destroy(struct obd_export *exp)
 {
@@ -1106,7 +1086,7 @@ struct obd_export *__class_new_export(struct obd_device *obd,
        spin_lock_init(&export->exp_uncommitted_replies_lock);
        INIT_LIST_HEAD(&export->exp_uncommitted_replies);
        INIT_LIST_HEAD(&export->exp_req_replay_queue);
-       INIT_LIST_HEAD(&export->exp_handle.h_link);
+       INIT_LIST_HEAD_RCU(&export->exp_handle.h_link);
        INIT_LIST_HEAD(&export->exp_hp_rpcs);
        INIT_LIST_HEAD(&export->exp_reg_rpcs);
        class_handle_hash(&export->exp_handle, &export_handle_ops);
@@ -1236,7 +1216,7 @@ void class_unlink_export(struct obd_export *exp)
 EXPORT_SYMBOL(class_unlink_export);
 
 /* Import management functions */
-static void class_import_destroy(struct obd_import *imp)
+static void obd_zombie_import_free(struct obd_import *imp)
 {
         ENTRY;
 
@@ -1259,20 +1239,10 @@ static void class_import_destroy(struct obd_import *imp)
 
         LASSERT(imp->imp_sec == NULL);
         class_decref(imp->imp_obd, "import", imp);
-        OBD_FREE_RCU(imp, sizeof(*imp), &imp->imp_handle);
-        EXIT;
-}
-
-static void import_handle_addref(void *import)
-{
-        class_import_get(import);
+       OBD_FREE_PTR(imp);
+       EXIT;
 }
 
-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)
 {
        atomic_inc(&import->imp_refcount);
@@ -1321,7 +1291,7 @@ static void obd_zombie_imp_cull(struct work_struct *ws)
        struct obd_import *import;
 
        import = container_of(ws, struct obd_import, imp_zombie_work);
-       class_import_destroy(import);
+       obd_zombie_import_free(import);
 }
 
 struct obd_import *class_new_import(struct obd_device *obd)
@@ -1360,8 +1330,6 @@ struct obd_import *class_new_import(struct obd_device *obd)
        atomic_set(&imp->imp_replay_inflight, 0);
        atomic_set(&imp->imp_inval_count, 0);
        INIT_LIST_HEAD(&imp->imp_conn_list);
-       INIT_LIST_HEAD(&imp->imp_handle.h_link);
-       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
@@ -1377,8 +1345,6 @@ void class_destroy_import(struct obd_import *import)
        LASSERT(import != NULL);
        LASSERT(import != LP_POISON);
 
-       class_handle_unhash(&import->imp_handle);
-
        spin_lock(&import->imp_lock);
        import->imp_generation++;
        spin_unlock(&import->imp_lock);
@@ -2259,8 +2225,6 @@ int obd_set_max_mod_rpcs_in_flight(struct client_obd *cli, __u16 max)
 }
 EXPORT_SYMBOL(obd_set_max_mod_rpcs_in_flight);
 
-
-#define pct(a, b) (b ? a * 100 / b : 0)
 int obd_mod_rpc_stats_seq_show(struct client_obd *cli,
                               struct seq_file *seq)
 {
@@ -2286,7 +2250,7 @@ int obd_mod_rpc_stats_seq_show(struct client_obd *cli,
        for (i = 0; i < OBD_HIST_MAX; i++) {
                unsigned long mod = cli->cl_mod_rpcs_hist.oh_buckets[i];
                mod_cum += mod;
-               seq_printf(seq, "%d:\t\t%10lu %3lu %3lu\n",
+               seq_printf(seq, "%d:\t\t%10lu %3u %3u\n",
                           i, mod, pct(mod, mod_tot),
                           pct(mod_cum, mod_tot));
                if (mod_cum == mod_tot)
@@ -2298,8 +2262,6 @@ int obd_mod_rpc_stats_seq_show(struct client_obd *cli,
        return 0;
 }
 EXPORT_SYMBOL(obd_mod_rpc_stats_seq_show);
-#undef pct
-
 
 /* The number of modify RPCs sent in parallel is limited
  * because the server has a finite number of slots per client to