Whamcloud - gitweb
LU-8066 obd: embed typ_kobj in obd_type
[fs/lustre-release.git] / lustre / include / obd_class.h
index 8682248..359e7ef 100644 (file)
@@ -63,7 +63,9 @@ struct lu_device_type;
 
 /* genops.c */
 struct obd_export *class_conn2export(struct lustre_handle *);
-struct kobject *class_setup_tunables(const char *name);
+#ifdef HAVE_SERVER_SUPPORT
+struct obd_type *class_setup_tunables(const char *name);
+#endif
 int class_register_type(struct obd_ops *, struct md_ops *, bool enable_proc,
                        struct lprocfs_vars *module_vars,
                        const char *nm, struct lu_device_type *ldt);
@@ -189,7 +191,7 @@ int class_add_conn(struct obd_device *obd, struct lustre_cfg *lcfg);
 
 /* Passed as data param to class_config_parse_llog */
 struct config_llog_instance {
-       void                    *cfg_instance;
+       unsigned long            cfg_instance;
        struct super_block      *cfg_sb;
        struct obd_uuid          cfg_uuid;
        llog_cb_t                cfg_callback;
@@ -201,6 +203,19 @@ struct config_llog_instance {
 int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt,
                            char *name, struct config_llog_instance *cfg);
 
+/**
+ * Generate a unique configuration instance for this mount
+ *
+ * Temporary hack to bypass ASLR in 4.15+ kernels, a better fix soon.
+ * For now, use the same value as before - the superblock pointer value.
+ *
+ * Using the client UUID would be an option, but it needs more testing.
+ */
+static inline unsigned long ll_get_cfg_instance(struct super_block *sb)
+{
+       return (unsigned long)sb;
+}
+
 #define CONFIG_SUB_SPTLRPC     0x01
 #define CONFIG_SUB_RECOVER     0x02
 #define CONFIG_SUB_PARAMS      0x04
@@ -898,19 +913,6 @@ static inline int obd_fid_alloc(const struct lu_env *env,
        RETURN(rc);
 }
 
-static inline int obd_ping(const struct lu_env *env, struct obd_export *exp)
-{
-        int rc;
-        ENTRY;
-
-       if (!exp->exp_obd->obd_type ||
-           !exp->exp_obd->obd_type->typ_dt_ops->o_ping)
-               RETURN(0);
-
-        rc = OBP(exp->exp_obd, ping)(env, exp);
-        RETURN(rc);
-}
-
 static inline int obd_pool_new(struct obd_device *obd, char *poolname)
 {
         int rc;
@@ -1007,8 +1009,9 @@ static inline int obd_statfs_async(struct obd_export *exp,
 
        obd = exp->exp_obd;
        if (!obd->obd_type || !obd->obd_type->typ_dt_ops->o_statfs) {
-               CERROR("%s: no %s operation\n", obd->obd_name, __func__);
-               RETURN(-EOPNOTSUPP);
+               rc = -EOPNOTSUPP;
+               CERROR("%s: no statfs operation: rc = %d\n", obd->obd_name, rc);
+               RETURN(rc);
        }
 
        CDEBUG(D_SUPER, "%s: age %lld, max_age %lld\n",
@@ -1801,15 +1804,6 @@ int lustre_register_fs(void);
 int lustre_unregister_fs(void);
 int lustre_check_exclusion(struct super_block *sb, char *svname);
 
-typedef __u8 class_uuid_t[16];
-static inline void class_uuid_unparse(class_uuid_t uu, struct obd_uuid *out)
-{
-       snprintf(out->uuid, sizeof(out->uuid), "%02x%02x%02x%02x-%02x%02x-"
-                "%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-                uu[14], uu[15], uu[12], uu[13], uu[10], uu[11], uu[8], uu[9],
-                uu[6], uu[7], uu[4], uu[5], uu[2], uu[3], uu[0], uu[1]);
-}
-
 /* lustre_peer.c    */
 int lustre_uuid_to_peer(const char *uuid, lnet_nid_t *peer_nid, int index);
 int class_add_uuid(const char *uuid, __u64 nid);
@@ -1819,9 +1813,6 @@ int class_check_uuid(struct obd_uuid *uuid, __u64 nid);
 /* class_obd.c */
 extern char obd_jobid_name[];
 
-/* prng.c */
-#define ll_generate_random_uuid(uuid_out) cfs_get_random_bytes(uuid_out, sizeof(class_uuid_t))
-
 /* statfs_pack.c */
 struct kstatfs;
 void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs);
@@ -1843,4 +1834,15 @@ extern struct miscdevice obd_psdev;
 int obd_ioctl_getdata(char **buf, int *len, void __user *arg);
 int class_procfs_init(void);
 int class_procfs_clean(void);
+
+extern void obd_heat_add(struct obd_heat_instance *instance,
+                        unsigned int time_second, __u64 count,
+                        unsigned int weight, unsigned int period_second);
+extern void obd_heat_decay(struct obd_heat_instance *instance,
+                          __u64 time_second, unsigned int weight,
+                          unsigned int period_second);
+extern __u64 obd_heat_get(struct obd_heat_instance *instance,
+                         unsigned int time_second, unsigned int weight,
+                         unsigned int period_second);
+extern void obd_heat_clear(struct obd_heat_instance *instance, int count);
 #endif /* __LINUX_OBD_CLASS_H */