void lustre_jobid_clear(const char *jobid);
void jobid_cache_fini(void);
int jobid_cache_init(void);
+char *jobid_current(void);
+int jobid_set_current(char *jobid);
struct lu_device_type;
/* genops.c */
struct obd_export *class_conn2export(struct lustre_handle *);
#ifdef HAVE_SERVER_SUPPORT
-struct obd_type *class_setup_tunables(const char *name);
+struct obd_type *class_add_symlinks(const char *name, bool enable_proc);
#endif
int class_register_type(struct obd_ops *, struct md_ops *, bool enable_proc,
struct lprocfs_vars *module_vars,
struct obd_device *class_uuid2obd(struct obd_uuid *uuid);
void class_obd_list(void);
struct obd_device * class_find_client_obd(struct obd_uuid *tgt_uuid,
- const char * typ_name,
+ const char *type_name,
struct obd_uuid *grp_uuid);
struct obd_device * class_devices_in_group(struct obd_uuid *grp_uuid,
int *next);
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);
int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg);
int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg);
struct obd_import *class_new_import(struct obd_device *obd);
void class_destroy_import(struct obd_import *exp);
+#ifdef HAVE_SERVER_SUPPORT
struct obd_type *class_search_type(const char *name);
struct obd_type *class_get_type(const char *name);
+#endif
void class_put_type(struct obd_type *type);
int class_connect(struct lustre_handle *conn, struct obd_device *obd,
struct obd_uuid *cluuid);
ENTRY;
if (ldt != NULL && d != NULL) {
- struct lu_env env;
-
- rc = lu_env_init(&env, ldt->ldt_ctx_tags);
- if (rc == 0) {
- ldt->ldt_ops->ldto_device_fini(&env, d);
- lu_env_fini(&env);
+ struct lu_env *env = lu_env_find();
+ struct lu_env _env;
+
+ if (!env) {
+ env = &_env;
+ rc = lu_env_init(env, ldt->ldt_ctx_tags);
+ LASSERT(rc == 0);
+ lu_env_add(env);
+ }
+ ldt->ldt_ops->ldto_device_fini(env, d);
+ if (env == &_env) {
+ lu_env_remove(env);
+ lu_env_fini(env);
}
}
CDEBUG(D_SUPER, "%s: age %lld, max_age %lld\n",
obd->obd_name, 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,
- "%s: use %p cache blocks %llu/%llu objects %llu/%llu\n",
- obd->obd_name, &obd->obd_osfs,
- obd->obd_osfs.os_bavail, obd->obd_osfs.os_blocks,
- obd->obd_osfs.os_ffree, obd->obd_osfs.os_files);
- spin_lock(&obd->obd_osfs_lock);
- memcpy(oinfo->oi_osfs, &obd->obd_osfs, sizeof(*oinfo->oi_osfs));
- spin_unlock(&obd->obd_osfs_lock);
- oinfo->oi_flags |= OBD_STATFS_FROM_CACHE;
- if (oinfo->oi_cb_up)
- oinfo->oi_cb_up(oinfo, 0);
- }
+ rc = OBP(obd, statfs_async)(exp, oinfo, max_age, rqset);
+
RETURN(rc);
}
if (obd->obd_osfs_age < max_age ||
((obd->obd_osfs.os_state & OS_STATE_SUM) &&
!(flags & OBD_STATFS_SUM))) {
- rc = OBP(obd, statfs)(env, exp, osfs, max_age, flags);
+ bool update_age = false;
+ /* the RPC will block anyway, so avoid sending many at once */
+ rc = mutex_lock_interruptible(&obd->obd_dev_mutex);
+ if (rc)
+ RETURN(rc);
+ if (obd->obd_osfs_age < max_age ||
+ ((obd->obd_osfs.os_state & OS_STATE_SUM) &&
+ !(flags & OBD_STATFS_SUM))) {
+ rc = OBP(obd, statfs)(env, exp, osfs, max_age, flags);
+ update_age = true;
+ } else {
+ CDEBUG(D_SUPER,
+ "%s: new %p cache blocks %llu/%llu objects %llu/%llu\n",
+ obd->obd_name, &obd->obd_osfs,
+ obd->obd_osfs.os_bavail, obd->obd_osfs.os_blocks,
+ obd->obd_osfs.os_ffree, obd->obd_osfs.os_files);
+ }
if (rc == 0) {
spin_lock(&obd->obd_osfs_lock);
memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
- obd->obd_osfs_age = ktime_get_seconds();
+ if (update_age)
+ obd->obd_osfs_age = ktime_get_seconds();
spin_unlock(&obd->obd_osfs_lock);
}
+ mutex_unlock(&obd->obd_dev_mutex);
} else {
CDEBUG(D_SUPER,
"%s: use %p cache blocks %llu/%llu objects %llu/%llu\n",
return MDP(exp->exp_obd, unpackmd)(exp, plsm, lmm, lmm_size);
}
+static inline int md_rmfid(struct obd_export *exp, struct fid_array *fa,
+ int *rcs, struct ptlrpc_request_set *set)
+{
+ int rc;
+
+ rc = exp_check_ops(exp);
+ if (rc)
+ return rc;
+
+ return MDP(exp->exp_obd, rmfid)(exp, fa, rcs, set);
+}
+
/* OBD Metadata Support */
extern int obd_init_caches(void);
void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs);
/* root squash info */
-struct rw_semaphore;
struct root_squash_info {
uid_t rsi_uid;
gid_t rsi_gid;
struct list_head rsi_nosquash_nids;
- struct rw_semaphore rsi_sem;
+ spinlock_t rsi_lock;
};
int server_name2index(const char *svname, __u32 *idx, const char **endptr);