Whamcloud - gitweb
LU-10698 obdclass: allow specifying complex jobids
[fs/lustre-release.git] / lustre / include / obd_class.h
index 8828789..f9c02dd 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2016, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -32,7 +32,7 @@
 #ifndef __CLASS_OBD_H
 #define __CLASS_OBD_H
 
-
+#include <linux/kobject.h>
 #include <obd_support.h>
 #include <lustre_import.h>
 #include <lustre_net.h>
@@ -54,7 +54,7 @@ extern rwlock_t obd_dev_lock;
 extern struct obd_device *class_conn2obd(struct lustre_handle *);
 extern struct obd_device *class_exp2obd(struct obd_export *);
 extern int class_handle_ioctl(unsigned int cmd, unsigned long arg);
-int lustre_get_jobid(char *jobid);
+int lustre_get_jobid(char *jobid, size_t len);
 void lustre_jobid_clear(const char *jobid);
 void jobid_cache_fini(void);
 int jobid_cache_init(void);
@@ -63,6 +63,7 @@ struct lu_device_type;
 
 /* genops.c */
 struct obd_export *class_conn2export(struct lustre_handle *);
+struct kobject *class_setup_tunables(const char *name);
 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);
@@ -138,7 +139,11 @@ struct cfg_interop_param {
 char *lustre_cfg_string(struct lustre_cfg *lcfg, u32 index);
 struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg,
                                     const char *new_name);
+void print_lustre_cfg(struct lustre_cfg *lcfg);
 int class_process_config(struct lustre_cfg *lcfg);
+ssize_t class_set_global(const char *param);
+ssize_t class_modify_config(struct lustre_cfg *lcfg, const char *prefix,
+                           struct kobject *kobj);
 int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
                             struct lustre_cfg *lcfg, void *data);
 int class_attach(struct lustre_cfg *lcfg);
@@ -222,7 +227,7 @@ static inline bool logname_is_barrier(const char *logname)
 struct config_llog_data {
        struct ldlm_res_id          cld_resid;
        struct config_llog_instance cld_cfg;
-       struct list_head            cld_list_chain;
+       struct list_head            cld_list_chain;/* on config_llog_list */
        atomic_t                    cld_refcount;
        struct config_llog_data    *cld_sptlrpc;/* depended sptlrpc log */
        struct config_llog_data    *cld_params; /* common parameters log */
@@ -639,7 +644,7 @@ static inline int obd_cleanup(struct obd_device *obd)
                 }
         }
        if (!obd->obd_type->typ_dt_ops->o_cleanup)
-               RETURN(-EOPNOTSUPP);
+               RETURN(0);
 
         OBD_COUNTER_INCREMENT(obd, cleanup);
 
@@ -1073,12 +1078,13 @@ static inline int obd_destroy_export(struct obd_export *exp)
        RETURN(0);
 }
 
-/* @max_age is the oldest time in jiffies that we accept using a cached data.
+/* @max_age is the oldest time in seconds that we accept using a cached data.
  * If the cache is older than @max_age we will get a new value from the
- * target.  Use a value of "cfs_time_current() + HZ" to guarantee freshness. */
+ * target. Use a value of 'ktime_get_seconds() + X' to guarantee freshness.
+ */
 static inline int obd_statfs_async(struct obd_export *exp,
                                   struct obd_info *oinfo,
-                                  __u64 max_age,
+                                  time64_t max_age,
                                   struct ptlrpc_request_set *rqset)
 {
        int rc = 0;
@@ -1096,9 +1102,9 @@ static inline int obd_statfs_async(struct obd_export *exp,
        }
        OBD_COUNTER_INCREMENT(obd, statfs);
 
-       CDEBUG(D_SUPER, "%s: osfs %p age %llu, max_age %llu\n",
+       CDEBUG(D_SUPER, "%s: osfs %p age %lld, max_age %lld\n",
               obd->obd_name, &obd->obd_osfs, obd->obd_osfs_age, max_age);
-       if (cfs_time_before_64(obd->obd_osfs_age, max_age)) {
+       if (obd->obd_osfs_age < max_age) {
                rc = OBP(obd, statfs_async)(exp, oinfo, max_age, rqset);
        } else {
                CDEBUG(D_SUPER,
@@ -1117,37 +1123,12 @@ static inline int obd_statfs_async(struct obd_export *exp,
        RETURN(rc);
 }
 
-static inline int obd_statfs_rqset(struct obd_export *exp,
-                                   struct obd_statfs *osfs, __u64 max_age,
-                                   __u32 flags)
-{
-       struct ptlrpc_request_set *set = NULL;
-       struct obd_info oinfo = {
-               .oi_osfs = osfs,
-               .oi_flags = flags,
-       };
-       int rc = 0;
-
-       ENTRY;
-
-       set = ptlrpc_prep_set();
-       if (set == NULL)
-               RETURN(-ENOMEM);
-
-       rc = obd_statfs_async(exp, &oinfo, max_age, set);
-       if (rc == 0)
-               rc = ptlrpc_set_wait(set);
-
-       ptlrpc_set_destroy(set);
-
-       RETURN(rc);
-}
-
-/* @max_age is the oldest time in jiffies that we accept using a cached data.
+/* @max_age is the oldest time in seconds that we accept using a cached data.
  * If the cache is older than @max_age we will get a new value from the
- * target.  Use a value of "cfs_time_current() + HZ" to guarantee freshness. */
+ * target. Use a value of 'ktime_get_seconds() + X' to guarantee freshness.
+ */
 static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp,
-                             struct obd_statfs *osfs, __u64 max_age,
+                            struct obd_statfs *osfs, time64_t max_age,
                              __u32 flags)
 {
         int rc = 0;
@@ -1157,20 +1138,22 @@ static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp,
         if (obd == NULL)
                 RETURN(-EINVAL);
 
+       OBD_CHECK_DEV_ACTIVE(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);
        }
         OBD_COUNTER_INCREMENT(obd, statfs);
 
-       CDEBUG(D_SUPER, "osfs %llu, max_age %llu\n",
+       CDEBUG(D_SUPER, "osfs %lld, max_age %lld\n",
                obd->obd_osfs_age, max_age);
-        if (cfs_time_before_64(obd->obd_osfs_age, max_age)) {
+       if (obd->obd_osfs_age < max_age) {
                 rc = OBP(obd, statfs)(env, exp, osfs, max_age, flags);
                 if (rc == 0) {
                        spin_lock(&obd->obd_osfs_lock);
                        memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
-                       obd->obd_osfs_age = cfs_time_current_64();
+                       obd->obd_osfs_age = ktime_get_seconds();
                        spin_unlock(&obd->obd_osfs_lock);
                }
        } else {
@@ -1890,10 +1873,6 @@ int lustre_register_fs(void);
 int lustre_unregister_fs(void);
 int lustre_check_exclusion(struct super_block *sb, char *svname);
 
-/* sysctl.c */
-extern int obd_sysctl_init(void);
-extern void obd_sysctl_clean(void);
-
 typedef __u8 class_uuid_t[16];
 static inline void class_uuid_unparse(class_uuid_t uu, struct obd_uuid *out)
 {
@@ -1910,7 +1889,7 @@ int class_del_uuid (const char *uuid);
 int class_check_uuid(struct obd_uuid *uuid, __u64 nid);
 
 /* class_obd.c */
-extern char obd_jobid_node[];
+extern char obd_jobid_name[];
 
 /* prng.c */
 #define ll_generate_random_uuid(uuid_out) cfs_get_random_bytes(uuid_out, sizeof(class_uuid_t))