Whamcloud - gitweb
LU-3963 obdclass: convert to linux list api
[fs/lustre-release.git] / lustre / obdclass / class_obd.c
index 71b479a..da38c9a 100644 (file)
@@ -53,6 +53,7 @@
 # include <dt_object.h>
 # include <md_object.h>
 #endif /* HAVE_SERVER_SUPPORT */
+#include <lustre_ioctl.h>
 #include "llog_internal.h"
 
 #ifndef __KERNEL__
@@ -62,7 +63,7 @@ atomic_t libcfs_kmemory = {0};
 
 struct obd_device *obd_devs[MAX_OBD_DEVICES];
 EXPORT_SYMBOL(obd_devs);
-cfs_list_t obd_types;
+struct list_head obd_types;
 DEFINE_RWLOCK(obd_dev_lock);
 
 __u64 obd_max_pages = 0;
@@ -84,8 +85,6 @@ unsigned int obd_dump_on_eviction;
 EXPORT_SYMBOL(obd_dump_on_eviction);
 unsigned int obd_max_dirty_pages = 256;
 EXPORT_SYMBOL(obd_max_dirty_pages);
-atomic_t obd_unstable_pages;
-EXPORT_SYMBOL(obd_unstable_pages);
 atomic_t obd_dirty_pages;
 EXPORT_SYMBOL(obd_dirty_pages);
 unsigned int obd_timeout = OBD_TIMEOUT_DEFAULT;   /* seconds */
@@ -145,7 +144,8 @@ int lustre_get_jobid(char *jobid)
        /* Use process name + fsuid as jobid */
        if (strcmp(obd_jobid_var, JOBSTATS_PROCNAME_UID) == 0) {
                snprintf(jobid, JOBSTATS_JOBID_SIZE, "%s.%u",
-                        current_comm(), current_fsuid());
+                        current_comm(),
+                        from_kuid(&init_user_ns, current_fsuid()));
                RETURN(0);
        }
 
@@ -198,19 +198,6 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,
 }
 EXPORT_SYMBOL(obd_alloc_fail);
 
-static inline void obd_data2conn(struct lustre_handle *conn,
-                                 struct obd_ioctl_data *data)
-{
-        memset(conn, 0, sizeof *conn);
-        conn->cookie = data->ioc_cookie;
-}
-
-static inline void obd_conn2data(struct obd_ioctl_data *data,
-                                 struct lustre_handle *conn)
-{
-        data->ioc_cookie = conn->cookie;
-}
-
 int class_resolve_dev_name(__u32 len, const char *name)
 {
         int rc;
@@ -357,12 +344,6 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
                 GOTO(out, err);
         }
 
-        case OBD_IOC_CLOSE_UUID: {
-                CDEBUG(D_IOCTL, "closing all connections to uuid %s (NOOP)\n",
-                       data->ioc_inlbuf1);
-                GOTO(out, err = 0);
-        }
-
         case OBD_IOC_GETDEVICE: {
                 int     index = data->ioc_count;
                 char    *status, *str;
@@ -533,7 +514,6 @@ int obd_init_checks(void)
 #define obd_init_checks() do {} while(0)
 #endif
 
-extern spinlock_t obd_types_lock;
 extern int class_procfs_init(void);
 extern int class_procfs_clean(void);
 
@@ -548,7 +528,7 @@ int init_obdclass(void)
         int lustre_register_fs(void);
 
         for (i = CAPA_SITE_CLIENT; i < CAPA_SITE_MAX; i++)
-                CFS_INIT_LIST_HEAD(&capa_list[i]);
+               INIT_LIST_HEAD(&capa_list[i]);
 #endif
 
         LCONSOLE_INFO("Lustre: Build Version: "BUILD_VERSION"\n");
@@ -580,7 +560,7 @@ int init_obdclass(void)
         if (err)
                 return err;
 
-        CFS_INIT_LIST_HEAD(&obd_types);
+       INIT_LIST_HEAD(&obd_types);
 
        err = misc_register(&obd_psdev);
        if (err) {
@@ -689,7 +669,6 @@ EXPORT_SYMBOL(obd_pages_max);
 #ifdef __KERNEL__
 static void cleanup_obdclass(void)
 {
-        int i;
         int lustre_unregister_fs(void);
         __u64 memory_leaked, pages_leaked;
         __u64 memory_max, pages_max;
@@ -698,15 +677,6 @@ static void cleanup_obdclass(void)
         lustre_unregister_fs();
 
        misc_deregister(&obd_psdev);
-       for (i = 0; i < class_devno_max(); i++) {
-               struct obd_device *obd = class_num2obd(i);
-               if (obd && obd->obd_set_up &&
-                   OBT(obd) && OBP(obd, detach)) {
-                       /* XXX should this call generic detach otherwise? */
-                       LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
-                       OBP(obd, detach)(obd);
-               }
-       }
        llog_info_fini();
 #ifdef HAVE_SERVER_SUPPORT
        lu_ucred_global_fini();