4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2011, 2015, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
35 #include <obd_support.h>
36 #include <lustre_import.h>
37 #include <lustre_net.h>
39 #include <lustre_lib.h>
40 #include <lprocfs_status.h>
42 #define OBD_STATFS_NODELAY 0x0001 /* requests should be send without delay
43 * and resends for avoid deadlocks
45 #define OBD_STATFS_FROM_CACHE 0x0002 /* the statfs callback should not update
48 #define OBD_STATFS_FOR_MDT0 0x0004 /* The statfs is only for retrieving
49 * information from MDT0.
52 /* OBD Device Declarations */
53 extern struct obd_device *obd_devs[MAX_OBD_DEVICES];
54 extern rwlock_t obd_dev_lock;
56 /* OBD Operations Declarations */
57 struct obd_device *class_exp2obd(struct obd_export *);
58 int class_handle_ioctl(unsigned int cmd, unsigned long arg);
59 int lustre_get_jobid(char *jobid);
61 struct lu_device_type;
64 extern struct list_head obd_types;
65 struct obd_export *class_conn2export(struct lustre_handle *);
66 int class_register_type(struct obd_ops *, struct md_ops *,
67 const char *nm, struct lu_device_type *ldt);
68 int class_unregister_type(const char *nm);
70 struct obd_device *class_newdev(const char *type_name, const char *name);
71 void class_release_dev(struct obd_device *obd);
73 int class_name2dev(const char *name);
74 struct obd_device *class_name2obd(const char *name);
75 int class_uuid2dev(struct obd_uuid *uuid);
76 struct obd_device *class_find_client_obd(struct obd_uuid *tgt_uuid,
78 struct obd_uuid *grp_uuid);
79 struct obd_device *class_devices_in_group(struct obd_uuid *grp_uuid,
81 struct obd_device *class_num2obd(int num);
83 int class_notify_sptlrpc_conf(const char *fsname, int namelen);
85 int obd_connect_flags2str(char *page, int count, __u64 flags, char *sep);
87 int obd_zombie_impexp_init(void);
88 void obd_zombie_impexp_stop(void);
89 void obd_zombie_barrier(void);
91 int obd_get_request_slot(struct client_obd *cli);
92 void obd_put_request_slot(struct client_obd *cli);
93 __u32 obd_get_max_rpcs_in_flight(struct client_obd *cli);
94 int obd_set_max_rpcs_in_flight(struct client_obd *cli, __u32 max);
95 int obd_set_max_mod_rpcs_in_flight(struct client_obd *cli, u16 max);
96 int obd_mod_rpc_stats_seq_show(struct client_obd *cli, struct seq_file *seq);
98 u16 obd_get_mod_rpc_slot(struct client_obd *cli, u32 opc,
99 struct lookup_intent *it);
100 void obd_put_mod_rpc_slot(struct client_obd *cli, u32 opc,
101 struct lookup_intent *it, u16 tag);
105 typedef int (*llog_cb_t)(const struct lu_env *, struct llog_handle *,
106 struct llog_rec_hdr *, void *);
109 char *lustre_cfg_string(struct lustre_cfg *lcfg, u32 index);
110 int class_process_config(struct lustre_cfg *lcfg);
111 int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
112 struct lustre_cfg *lcfg, void *data);
114 /* For interoperability */
115 struct cfg_interop_param {
120 int class_find_param(char *buf, char *key, char **valp);
121 struct cfg_interop_param *class_find_old_param(const char *param,
122 struct cfg_interop_param *ptr);
123 int class_get_next_param(char **params, char *copy);
124 int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh);
125 int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh);
126 int class_parse_net(char *buf, u32 *net, char **endh);
127 int class_match_nid(char *buf, char *key, lnet_nid_t nid);
128 int class_match_net(char *buf, char *key, u32 net);
130 struct obd_device *class_incref(struct obd_device *obd,
131 const char *scope, const void *source);
132 void class_decref(struct obd_device *obd,
133 const char *scope, const void *source);
134 int class_config_llog_handler(const struct lu_env *env,
135 struct llog_handle *handle,
136 struct llog_rec_hdr *rec, void *data);
137 int class_add_uuid(const char *uuid, __u64 nid);
140 void lprocfs_echo_init_vars(struct lprocfs_static_vars *lvars);
142 #define CFG_F_START 0x01 /* Set when we start updating from a log */
143 #define CFG_F_MARKER 0x02 /* We are within a maker */
144 #define CFG_F_SKIP 0x04 /* We should ignore this cfg command */
145 #define CFG_F_COMPAT146 0x08 /* Allow old-style logs */
146 #define CFG_F_EXCLUDE 0x10 /* OST exclusion list */
148 /* Passed as data param to class_config_parse_llog */
149 struct config_llog_instance {
152 struct super_block *cfg_sb;
153 struct obd_uuid cfg_uuid;
154 llog_cb_t cfg_callback;
155 int cfg_last_idx; /* for partial llog processing */
159 int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt,
160 char *name, struct config_llog_instance *cfg);
163 CONFIG_T_SPTLRPC = 1,
164 CONFIG_T_RECOVER = 2,
169 #define PARAMS_FILENAME "params"
170 #define LCTL_UPCALL "lctl"
172 /* list of active configuration logs */
173 struct config_llog_data {
174 struct ldlm_res_id cld_resid;
175 struct config_llog_instance cld_cfg;
176 struct list_head cld_list_chain;
177 atomic_t cld_refcount;
178 struct config_llog_data *cld_sptlrpc;/* depended sptlrpc log */
179 struct config_llog_data *cld_params; /* common parameters log */
180 struct config_llog_data *cld_recover;/* imperative recover log */
181 struct obd_export *cld_mgcexp;
182 struct mutex cld_lock;
184 unsigned int cld_stopping:1, /* we were told to stop
187 cld_lostlock:1; /* lock not requeued */
191 struct lustre_profile {
192 struct list_head lp_list;
197 bool lp_list_deleted;
200 struct lustre_profile *class_get_profile(const char *prof);
201 void class_del_profile(const char *prof);
202 void class_put_profile(struct lustre_profile *lprof);
203 void class_del_profiles(void);
205 #if LUSTRE_TRACKS_LOCK_EXP_REFS
207 void __class_export_add_lock_ref(struct obd_export *, struct ldlm_lock *);
208 void __class_export_del_lock_ref(struct obd_export *, struct ldlm_lock *);
209 extern void (*class_export_dump_hook)(struct obd_export *);
213 #define __class_export_add_lock_ref(exp, lock) do {} while (0)
214 #define __class_export_del_lock_ref(exp, lock) do {} while (0)
219 struct obd_export *class_export_get(struct obd_export *exp);
220 void class_export_put(struct obd_export *exp);
221 struct obd_export *class_new_export(struct obd_device *obddev,
222 struct obd_uuid *cluuid);
223 void class_unlink_export(struct obd_export *exp);
225 struct obd_import *class_import_get(struct obd_import *);
226 void class_import_put(struct obd_import *);
227 struct obd_import *class_new_import(struct obd_device *obd);
228 void class_destroy_import(struct obd_import *exp);
230 void class_put_type(struct obd_type *type);
231 int class_connect(struct lustre_handle *conn, struct obd_device *obd,
232 struct obd_uuid *cluuid);
233 int class_disconnect(struct obd_export *exp);
234 void class_fail_export(struct obd_export *exp);
235 int class_manual_cleanup(struct obd_device *obd);
237 static inline void class_export_rpc_inc(struct obd_export *exp)
239 atomic_inc(&(exp)->exp_rpc_count);
240 CDEBUG(D_INFO, "RPC GETting export %p : new rpc_count %d\n",
241 (exp), atomic_read(&(exp)->exp_rpc_count));
244 static inline void class_export_rpc_dec(struct obd_export *exp)
246 LASSERT_ATOMIC_POS(&exp->exp_rpc_count);
247 atomic_dec(&(exp)->exp_rpc_count);
248 CDEBUG(D_INFO, "RPC PUTting export %p : new rpc_count %d\n",
249 (exp), atomic_read(&(exp)->exp_rpc_count));
252 static inline struct obd_export *class_export_lock_get(struct obd_export *exp,
253 struct ldlm_lock *lock)
255 atomic_inc(&(exp)->exp_locks_count);
256 __class_export_add_lock_ref(exp, lock);
257 CDEBUG(D_INFO, "lock GETting export %p : new locks_count %d\n",
258 (exp), atomic_read(&(exp)->exp_locks_count));
259 return class_export_get(exp);
262 static inline void class_export_lock_put(struct obd_export *exp,
263 struct ldlm_lock *lock)
265 LASSERT_ATOMIC_POS(&exp->exp_locks_count);
266 atomic_dec(&(exp)->exp_locks_count);
267 __class_export_del_lock_ref(exp, lock);
268 CDEBUG(D_INFO, "lock PUTting export %p : new locks_count %d\n",
269 (exp), atomic_read(&(exp)->exp_locks_count));
270 class_export_put(exp);
273 static inline enum obd_option exp_flags_from_obd(struct obd_device *obd)
275 return ((obd->obd_fail ? OBD_OPT_FAILOVER : 0) |
276 (obd->obd_force ? OBD_OPT_FORCE : 0) |
280 static inline int lprocfs_climp_check(struct obd_device *obd)
282 down_read(&(obd)->u.cli.cl_sem);
283 if (!(obd)->u.cli.cl_import) {
284 up_read(&(obd)->u.cli.cl_sem);
294 void obdo_to_ioobj(const struct obdo *oa, struct obd_ioobj *ioobj);
296 #define OBT(dev) (dev)->obd_type
297 #define OBP(dev, op) (dev)->obd_type->typ_dt_ops->op
298 #define MDP(dev, op) (dev)->obd_type->typ_md_ops->op
299 #define CTXTP(ctxt, op) (ctxt)->loc_logops->lop_##op
301 /* Ensure obd_setup: used for cleanup which must be called
302 * while obd is stopping
304 static inline int obd_check_dev(struct obd_device *obd)
307 CERROR("NULL device\n");
313 /* ensure obd_setup and !obd_stopping */
314 static inline int obd_check_dev_active(struct obd_device *obd)
318 rc = obd_check_dev(obd);
321 if (!obd->obd_set_up || obd->obd_stopping) {
322 CERROR("Device %d not setup\n", obd->obd_minor);
328 #define OBD_COUNTER_OFFSET(op) \
329 ((offsetof(struct obd_ops, op) - \
330 offsetof(struct obd_ops, iocontrol)) \
331 / sizeof(((struct obd_ops *)(0))->iocontrol))
333 #define OBD_COUNTER_INCREMENT(obdx, op) \
334 if ((obdx)->obd_stats) { \
335 unsigned int coffset; \
336 coffset = (unsigned int)((obdx)->obd_cntr_base) + \
337 OBD_COUNTER_OFFSET(op); \
338 LASSERT(coffset < (obdx)->obd_stats->ls_num); \
339 lprocfs_counter_incr((obdx)->obd_stats, coffset); \
342 #define EXP_COUNTER_INCREMENT(export, op) \
343 if ((export)->exp_obd->obd_stats) { \
344 unsigned int coffset; \
345 coffset = (unsigned int)((export)->exp_obd->obd_cntr_base) + \
346 OBD_COUNTER_OFFSET(op); \
347 LASSERT(coffset < (export)->exp_obd->obd_stats->ls_num); \
348 lprocfs_counter_incr((export)->exp_obd->obd_stats, coffset); \
351 #define MD_COUNTER_OFFSET(op) \
352 ((offsetof(struct md_ops, op) - \
353 offsetof(struct md_ops, getstatus)) \
354 / sizeof(((struct md_ops *)(0))->getstatus))
356 #define MD_COUNTER_INCREMENT(obdx, op) \
357 if ((obd)->md_stats) { \
358 unsigned int coffset; \
359 coffset = (unsigned int)((obdx)->md_cntr_base) + \
360 MD_COUNTER_OFFSET(op); \
361 LASSERT(coffset < (obdx)->md_stats->ls_num); \
362 lprocfs_counter_incr((obdx)->md_stats, coffset); \
365 #define EXP_MD_COUNTER_INCREMENT(export, op) \
366 if ((export)->exp_obd->obd_stats) { \
367 unsigned int coffset; \
368 coffset = (unsigned int)((export)->exp_obd->md_cntr_base) + \
369 MD_COUNTER_OFFSET(op); \
370 LASSERT(coffset < (export)->exp_obd->md_stats->ls_num); \
371 lprocfs_counter_incr((export)->exp_obd->md_stats, coffset); \
372 if ((export)->exp_md_stats) \
373 lprocfs_counter_incr( \
374 (export)->exp_md_stats, coffset); \
377 #define EXP_CHECK_MD_OP(exp, op) \
380 CERROR("obd_" #op ": NULL export\n"); \
383 if (!(exp)->exp_obd || !OBT((exp)->exp_obd)) { \
384 CERROR("obd_" #op ": cleaned up obd\n"); \
385 return -EOPNOTSUPP; \
387 if (!OBT((exp)->exp_obd) || !MDP((exp)->exp_obd, op)) { \
388 CERROR("obd_" #op ": dev %s/%d no operation\n", \
389 (exp)->exp_obd->obd_name, \
390 (exp)->exp_obd->obd_minor); \
391 return -EOPNOTSUPP; \
395 #define OBD_CHECK_DT_OP(obd, op, err) \
397 if (!OBT(obd) || !OBP((obd), op)) { \
399 CERROR("obd_" #op ": dev %d no operation\n", \
405 #define EXP_CHECK_DT_OP(exp, op) \
408 CERROR("obd_" #op ": NULL export\n"); \
411 if (!(exp)->exp_obd || !OBT((exp)->exp_obd)) { \
412 CERROR("obd_" #op ": cleaned up obd\n"); \
413 return -EOPNOTSUPP; \
415 if (!OBT((exp)->exp_obd) || !OBP((exp)->exp_obd, op)) { \
416 CERROR("obd_" #op ": dev %d no operation\n", \
417 (exp)->exp_obd->obd_minor); \
418 return -EOPNOTSUPP; \
422 #define CTXT_CHECK_OP(ctxt, op, err) \
424 if (!OBT(ctxt->loc_obd) || !CTXTP((ctxt), op)) { \
426 CERROR("lop_" #op ": dev %d no operation\n", \
427 ctxt->loc_obd->obd_minor); \
432 static inline int class_devno_max(void)
434 return MAX_OBD_DEVICES;
437 static inline int obd_get_info(const struct lu_env *env,
438 struct obd_export *exp, __u32 keylen,
439 void *key, __u32 *vallen, void *val)
443 EXP_CHECK_DT_OP(exp, get_info);
444 EXP_COUNTER_INCREMENT(exp, get_info);
446 rc = OBP(exp->exp_obd, get_info)(env, exp, keylen, key, vallen, val);
450 static inline int obd_set_info_async(const struct lu_env *env,
451 struct obd_export *exp, u32 keylen,
452 void *key, u32 vallen, void *val,
453 struct ptlrpc_request_set *set)
457 EXP_CHECK_DT_OP(exp, set_info_async);
458 EXP_COUNTER_INCREMENT(exp, set_info_async);
460 rc = OBP(exp->exp_obd, set_info_async)(env, exp, keylen, key, vallen,
466 * obd-lu integration.
468 * Functionality is being moved into new lu_device-based layering, but some
469 * pieces of configuration process are still based on obd devices.
471 * Specifically, lu_device_type_operations::ldto_device_alloc() methods fully
472 * subsume ->o_setup() methods of obd devices they replace. The same for
473 * lu_device_operations::ldo_process_config() and ->o_process_config(). As a
474 * result, obd_setup() and obd_process_config() branch and call one XOR
477 * Yet neither lu_device_type_operations::ldto_device_fini() nor
478 * lu_device_type_operations::ldto_device_free() fully implement the
479 * functionality of ->o_precleanup() and ->o_cleanup() they override. Hence,
480 * obd_precleanup() and obd_cleanup() call both lu_device and obd operations.
483 #define DECLARE_LU_VARS(ldt, d) \
484 struct lu_device_type *ldt; \
487 static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg)
490 DECLARE_LU_VARS(ldt, d);
492 ldt = obd->obd_type->typ_lu;
494 struct lu_context session_ctx;
497 lu_context_init(&session_ctx, LCT_SESSION | LCT_SERVER_SESSION);
498 session_ctx.lc_thread = NULL;
499 lu_context_enter(&session_ctx);
501 rc = lu_env_init(&env, ldt->ldt_ctx_tags);
503 env.le_ses = &session_ctx;
504 d = ldt->ldt_ops->ldto_device_alloc(&env, ldt, cfg);
514 lu_context_exit(&session_ctx);
515 lu_context_fini(&session_ctx);
518 OBD_CHECK_DT_OP(obd, setup, -EOPNOTSUPP);
519 OBD_COUNTER_INCREMENT(obd, setup);
520 rc = OBP(obd, setup)(obd, cfg);
525 static inline int obd_precleanup(struct obd_device *obd)
528 DECLARE_LU_VARS(ldt, d);
530 rc = obd_check_dev(obd);
533 ldt = obd->obd_type->typ_lu;
538 rc = lu_env_init(&env, ldt->ldt_ctx_tags);
540 ldt->ldt_ops->ldto_device_fini(&env, d);
544 OBD_CHECK_DT_OP(obd, precleanup, 0);
545 OBD_COUNTER_INCREMENT(obd, precleanup);
547 rc = OBP(obd, precleanup)(obd);
551 static inline int obd_cleanup(struct obd_device *obd)
554 DECLARE_LU_VARS(ldt, d);
556 rc = obd_check_dev(obd);
560 ldt = obd->obd_type->typ_lu;
565 rc = lu_env_init(&env, ldt->ldt_ctx_tags);
567 ldt->ldt_ops->ldto_device_free(&env, d);
569 obd->obd_lu_dev = NULL;
572 OBD_CHECK_DT_OP(obd, cleanup, 0);
573 OBD_COUNTER_INCREMENT(obd, cleanup);
575 rc = OBP(obd, cleanup)(obd);
579 static inline void obd_cleanup_client_import(struct obd_device *obd)
581 /* If we set up but never connected, the
582 * client import will not have been cleaned.
584 down_write(&obd->u.cli.cl_sem);
585 if (obd->u.cli.cl_import) {
586 struct obd_import *imp;
588 imp = obd->u.cli.cl_import;
589 CDEBUG(D_CONFIG, "%s: client import never connected\n",
591 ptlrpc_invalidate_import(imp);
592 client_destroy_import(imp);
593 obd->u.cli.cl_import = NULL;
595 up_write(&obd->u.cli.cl_sem);
599 obd_process_config(struct obd_device *obd, int datalen, void *data)
602 DECLARE_LU_VARS(ldt, d);
604 rc = obd_check_dev(obd);
608 obd->obd_process_conf = 1;
609 ldt = obd->obd_type->typ_lu;
614 rc = lu_env_init(&env, ldt->ldt_ctx_tags);
616 rc = d->ld_ops->ldo_process_config(&env, d, data);
620 OBD_CHECK_DT_OP(obd, process_config, -EOPNOTSUPP);
621 rc = OBP(obd, process_config)(obd, datalen, data);
623 OBD_COUNTER_INCREMENT(obd, process_config);
624 obd->obd_process_conf = 0;
629 static inline int obd_create(const struct lu_env *env, struct obd_export *exp,
634 EXP_CHECK_DT_OP(exp, create);
635 EXP_COUNTER_INCREMENT(exp, create);
637 rc = OBP(exp->exp_obd, create)(env, exp, obdo);
641 static inline int obd_destroy(const struct lu_env *env, struct obd_export *exp,
646 EXP_CHECK_DT_OP(exp, destroy);
647 EXP_COUNTER_INCREMENT(exp, destroy);
649 rc = OBP(exp->exp_obd, destroy)(env, exp, obdo);
653 static inline int obd_getattr(const struct lu_env *env, struct obd_export *exp,
658 EXP_CHECK_DT_OP(exp, getattr);
659 EXP_COUNTER_INCREMENT(exp, getattr);
661 rc = OBP(exp->exp_obd, getattr)(env, exp, oa);
665 static inline int obd_setattr(const struct lu_env *env, struct obd_export *exp,
670 EXP_CHECK_DT_OP(exp, setattr);
671 EXP_COUNTER_INCREMENT(exp, setattr);
673 rc = OBP(exp->exp_obd, setattr)(env, exp, oa);
677 static inline int obd_add_conn(struct obd_import *imp, struct obd_uuid *uuid,
680 struct obd_device *obd = imp->imp_obd;
683 rc = obd_check_dev_active(obd);
686 OBD_CHECK_DT_OP(obd, add_conn, -EOPNOTSUPP);
687 OBD_COUNTER_INCREMENT(obd, add_conn);
689 rc = OBP(obd, add_conn)(imp, uuid, priority);
693 static inline int obd_del_conn(struct obd_import *imp, struct obd_uuid *uuid)
695 struct obd_device *obd = imp->imp_obd;
698 rc = obd_check_dev_active(obd);
701 OBD_CHECK_DT_OP(obd, del_conn, -EOPNOTSUPP);
702 OBD_COUNTER_INCREMENT(obd, del_conn);
704 rc = OBP(obd, del_conn)(imp, uuid);
708 static inline struct obd_uuid *obd_get_uuid(struct obd_export *exp)
710 struct obd_uuid *uuid;
712 OBD_CHECK_DT_OP(exp->exp_obd, get_uuid, NULL);
713 EXP_COUNTER_INCREMENT(exp, get_uuid);
715 uuid = OBP(exp->exp_obd, get_uuid)(exp);
719 /** Create a new /a exp on device /a obd for the uuid /a cluuid
720 * @param exp New export handle
721 * @param d Connect data, supported flags are set, flags also understood
722 * by obd are returned.
724 static inline int obd_connect(const struct lu_env *env,
725 struct obd_export **exp, struct obd_device *obd,
726 struct obd_uuid *cluuid,
727 struct obd_connect_data *data,
731 __u64 ocf = data ? data->ocd_connect_flags : 0; /* for post-condition
735 rc = obd_check_dev_active(obd);
738 OBD_CHECK_DT_OP(obd, connect, -EOPNOTSUPP);
739 OBD_COUNTER_INCREMENT(obd, connect);
741 rc = OBP(obd, connect)(env, exp, obd, cluuid, data, localdata);
742 /* check that only subset is granted */
743 LASSERT(ergo(data, (data->ocd_connect_flags & ocf) ==
744 data->ocd_connect_flags));
748 static inline int obd_reconnect(const struct lu_env *env,
749 struct obd_export *exp,
750 struct obd_device *obd,
751 struct obd_uuid *cluuid,
752 struct obd_connect_data *d,
756 __u64 ocf = d ? d->ocd_connect_flags : 0; /* for post-condition check */
758 rc = obd_check_dev_active(obd);
761 OBD_CHECK_DT_OP(obd, reconnect, 0);
762 OBD_COUNTER_INCREMENT(obd, reconnect);
764 rc = OBP(obd, reconnect)(env, exp, obd, cluuid, d, localdata);
765 /* check that only subset is granted */
766 LASSERT(ergo(d, (d->ocd_connect_flags & ocf) == d->ocd_connect_flags));
770 static inline int obd_disconnect(struct obd_export *exp)
774 EXP_CHECK_DT_OP(exp, disconnect);
775 EXP_COUNTER_INCREMENT(exp, disconnect);
777 rc = OBP(exp->exp_obd, disconnect)(exp);
781 static inline int obd_fid_init(struct obd_device *obd, struct obd_export *exp,
782 enum lu_cli_type type)
786 OBD_CHECK_DT_OP(obd, fid_init, 0);
787 OBD_COUNTER_INCREMENT(obd, fid_init);
789 rc = OBP(obd, fid_init)(obd, exp, type);
793 static inline int obd_fid_fini(struct obd_device *obd)
797 OBD_CHECK_DT_OP(obd, fid_fini, 0);
798 OBD_COUNTER_INCREMENT(obd, fid_fini);
800 rc = OBP(obd, fid_fini)(obd);
804 static inline int obd_fid_alloc(const struct lu_env *env,
805 struct obd_export *exp,
807 struct md_op_data *op_data)
811 EXP_CHECK_DT_OP(exp, fid_alloc);
812 EXP_COUNTER_INCREMENT(exp, fid_alloc);
814 rc = OBP(exp->exp_obd, fid_alloc)(env, exp, fid, op_data);
818 static inline int obd_pool_new(struct obd_device *obd, char *poolname)
822 OBD_CHECK_DT_OP(obd, pool_new, -EOPNOTSUPP);
823 OBD_COUNTER_INCREMENT(obd, pool_new);
825 rc = OBP(obd, pool_new)(obd, poolname);
829 static inline int obd_pool_del(struct obd_device *obd, char *poolname)
833 OBD_CHECK_DT_OP(obd, pool_del, -EOPNOTSUPP);
834 OBD_COUNTER_INCREMENT(obd, pool_del);
836 rc = OBP(obd, pool_del)(obd, poolname);
840 static inline int obd_pool_add(struct obd_device *obd, char *poolname, char *ostname)
844 OBD_CHECK_DT_OP(obd, pool_add, -EOPNOTSUPP);
845 OBD_COUNTER_INCREMENT(obd, pool_add);
847 rc = OBP(obd, pool_add)(obd, poolname, ostname);
851 static inline int obd_pool_rem(struct obd_device *obd, char *poolname, char *ostname)
855 OBD_CHECK_DT_OP(obd, pool_rem, -EOPNOTSUPP);
856 OBD_COUNTER_INCREMENT(obd, pool_rem);
858 rc = OBP(obd, pool_rem)(obd, poolname, ostname);
862 static inline void obd_getref(struct obd_device *obd)
864 if (OBT(obd) && OBP(obd, getref)) {
865 OBD_COUNTER_INCREMENT(obd, getref);
866 OBP(obd, getref)(obd);
870 static inline void obd_putref(struct obd_device *obd)
872 if (OBT(obd) && OBP(obd, putref)) {
873 OBD_COUNTER_INCREMENT(obd, putref);
874 OBP(obd, putref)(obd);
878 static inline int obd_init_export(struct obd_export *exp)
882 if ((exp)->exp_obd && OBT((exp)->exp_obd) &&
883 OBP((exp)->exp_obd, init_export))
884 rc = OBP(exp->exp_obd, init_export)(exp);
888 static inline int obd_destroy_export(struct obd_export *exp)
890 if ((exp)->exp_obd && OBT((exp)->exp_obd) &&
891 OBP((exp)->exp_obd, destroy_export))
892 OBP(exp->exp_obd, destroy_export)(exp);
896 /* @max_age is the oldest time in jiffies that we accept using a cached data.
897 * If the cache is older than @max_age we will get a new value from the
898 * target. Use a value of "cfs_time_current() + HZ" to guarantee freshness.
900 static inline int obd_statfs_async(struct obd_export *exp,
901 struct obd_info *oinfo,
903 struct ptlrpc_request_set *rqset)
906 struct obd_device *obd;
908 if (!exp || !exp->exp_obd)
912 OBD_CHECK_DT_OP(obd, statfs, -EOPNOTSUPP);
913 OBD_COUNTER_INCREMENT(obd, statfs);
915 CDEBUG(D_SUPER, "%s: osfs %p age %llu, max_age %llu\n",
916 obd->obd_name, &obd->obd_osfs, obd->obd_osfs_age, max_age);
917 if (cfs_time_before_64(obd->obd_osfs_age, max_age)) {
918 rc = OBP(obd, statfs_async)(exp, oinfo, max_age, rqset);
921 "%s: use %p cache blocks %llu/%llu objects %llu/%llu\n",
922 obd->obd_name, &obd->obd_osfs,
923 obd->obd_osfs.os_bavail, obd->obd_osfs.os_blocks,
924 obd->obd_osfs.os_ffree, obd->obd_osfs.os_files);
925 spin_lock(&obd->obd_osfs_lock);
926 memcpy(oinfo->oi_osfs, &obd->obd_osfs, sizeof(*oinfo->oi_osfs));
927 spin_unlock(&obd->obd_osfs_lock);
928 oinfo->oi_flags |= OBD_STATFS_FROM_CACHE;
930 oinfo->oi_cb_up(oinfo, 0);
935 static inline int obd_statfs_rqset(struct obd_export *exp,
936 struct obd_statfs *osfs, __u64 max_age,
939 struct ptlrpc_request_set *set = NULL;
940 struct obd_info oinfo = {
946 set = ptlrpc_prep_set();
950 rc = obd_statfs_async(exp, &oinfo, max_age, set);
952 rc = ptlrpc_set_wait(set);
953 ptlrpc_set_destroy(set);
957 /* @max_age is the oldest time in jiffies that we accept using a cached data.
958 * If the cache is older than @max_age we will get a new value from the
959 * target. Use a value of "cfs_time_current() + HZ" to guarantee freshness.
961 static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp,
962 struct obd_statfs *osfs, __u64 max_age,
966 struct obd_device *obd = exp->exp_obd;
971 OBD_CHECK_DT_OP(obd, statfs, -EOPNOTSUPP);
972 OBD_COUNTER_INCREMENT(obd, statfs);
974 CDEBUG(D_SUPER, "osfs %llu, max_age %llu\n",
975 obd->obd_osfs_age, max_age);
976 if (cfs_time_before_64(obd->obd_osfs_age, max_age)) {
977 rc = OBP(obd, statfs)(env, exp, osfs, max_age, flags);
979 spin_lock(&obd->obd_osfs_lock);
980 memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
981 obd->obd_osfs_age = cfs_time_current_64();
982 spin_unlock(&obd->obd_osfs_lock);
985 CDEBUG(D_SUPER, "%s: use %p cache blocks %llu/%llu objects %llu/%llu\n",
986 obd->obd_name, &obd->obd_osfs,
987 obd->obd_osfs.os_bavail, obd->obd_osfs.os_blocks,
988 obd->obd_osfs.os_ffree, obd->obd_osfs.os_files);
989 spin_lock(&obd->obd_osfs_lock);
990 memcpy(osfs, &obd->obd_osfs, sizeof(*osfs));
991 spin_unlock(&obd->obd_osfs_lock);
996 static inline int obd_preprw(const struct lu_env *env, int cmd,
997 struct obd_export *exp, struct obdo *oa,
998 int objcount, struct obd_ioobj *obj,
999 struct niobuf_remote *remote, int *pages,
1000 struct niobuf_local *local)
1004 EXP_CHECK_DT_OP(exp, preprw);
1005 EXP_COUNTER_INCREMENT(exp, preprw);
1007 rc = OBP(exp->exp_obd, preprw)(env, cmd, exp, oa, objcount, obj, remote,
1012 static inline int obd_commitrw(const struct lu_env *env, int cmd,
1013 struct obd_export *exp, struct obdo *oa,
1014 int objcount, struct obd_ioobj *obj,
1015 struct niobuf_remote *rnb, int pages,
1016 struct niobuf_local *local, int rc)
1018 EXP_CHECK_DT_OP(exp, commitrw);
1019 EXP_COUNTER_INCREMENT(exp, commitrw);
1021 rc = OBP(exp->exp_obd, commitrw)(env, cmd, exp, oa, objcount, obj,
1022 rnb, pages, local, rc);
1026 static inline int obd_iocontrol(unsigned int cmd, struct obd_export *exp,
1027 int len, void *karg, void __user *uarg)
1031 EXP_CHECK_DT_OP(exp, iocontrol);
1032 EXP_COUNTER_INCREMENT(exp, iocontrol);
1034 rc = OBP(exp->exp_obd, iocontrol)(cmd, exp, len, karg, uarg);
1038 static inline void obd_import_event(struct obd_device *obd,
1039 struct obd_import *imp,
1040 enum obd_import_event event)
1043 CERROR("NULL device\n");
1046 if (obd->obd_set_up && OBP(obd, import_event)) {
1047 OBD_COUNTER_INCREMENT(obd, import_event);
1048 OBP(obd, import_event)(obd, imp, event);
1052 static inline int obd_notify(struct obd_device *obd,
1053 struct obd_device *watched,
1054 enum obd_notify_event ev,
1059 rc = obd_check_dev(obd);
1063 if (!obd->obd_set_up) {
1064 CDEBUG(D_HA, "obd %s not set up\n", obd->obd_name);
1068 if (!OBP(obd, notify)) {
1069 CDEBUG(D_HA, "obd %s has no notify handler\n", obd->obd_name);
1073 OBD_COUNTER_INCREMENT(obd, notify);
1074 rc = OBP(obd, notify)(obd, watched, ev, data);
1078 static inline int obd_notify_observer(struct obd_device *observer,
1079 struct obd_device *observed,
1080 enum obd_notify_event ev,
1086 struct obd_notify_upcall *onu;
1088 if (observer->obd_observer)
1089 rc1 = obd_notify(observer->obd_observer, observed, ev, data);
1093 * Also, call non-obd listener, if any
1095 onu = &observer->obd_upcall;
1096 if (onu->onu_upcall)
1097 rc2 = onu->onu_upcall(observer, observed, ev,
1098 onu->onu_owner, NULL);
1102 return rc1 ? rc1 : rc2;
1105 static inline int obd_quotactl(struct obd_export *exp,
1106 struct obd_quotactl *oqctl)
1110 EXP_CHECK_DT_OP(exp, quotactl);
1111 EXP_COUNTER_INCREMENT(exp, quotactl);
1113 rc = OBP(exp->exp_obd, quotactl)(exp->exp_obd, exp, oqctl);
1117 static inline int obd_health_check(const struct lu_env *env,
1118 struct obd_device *obd)
1120 /* returns: 0 on healthy
1121 * >0 on unhealthy + reason code/flag
1122 * however the only supported reason == 1 right now
1123 * We'll need to define some better reasons
1124 * or flags in the future.
1129 /* don't use EXP_CHECK_DT_OP, because NULL method is normal here */
1130 if (!obd || !OBT(obd)) {
1131 CERROR("cleaned up obd\n");
1134 if (!obd->obd_set_up || obd->obd_stopping)
1136 if (!OBP(obd, health_check))
1139 rc = OBP(obd, health_check)(env, obd);
1143 static inline int obd_register_observer(struct obd_device *obd,
1144 struct obd_device *observer)
1148 rc = obd_check_dev(obd);
1151 down_write(&obd->obd_observer_link_sem);
1152 if (obd->obd_observer && observer) {
1153 up_write(&obd->obd_observer_link_sem);
1156 obd->obd_observer = observer;
1157 up_write(&obd->obd_observer_link_sem);
1161 /* metadata helpers */
1162 static inline int md_getstatus(struct obd_export *exp, struct lu_fid *fid)
1166 EXP_CHECK_MD_OP(exp, getstatus);
1167 EXP_MD_COUNTER_INCREMENT(exp, getstatus);
1168 rc = MDP(exp->exp_obd, getstatus)(exp, fid);
1172 static inline int md_getattr(struct obd_export *exp, struct md_op_data *op_data,
1173 struct ptlrpc_request **request)
1177 EXP_CHECK_MD_OP(exp, getattr);
1178 EXP_MD_COUNTER_INCREMENT(exp, getattr);
1179 rc = MDP(exp->exp_obd, getattr)(exp, op_data, request);
1183 static inline int md_null_inode(struct obd_export *exp,
1184 const struct lu_fid *fid)
1188 EXP_CHECK_MD_OP(exp, null_inode);
1189 EXP_MD_COUNTER_INCREMENT(exp, null_inode);
1190 rc = MDP(exp->exp_obd, null_inode)(exp, fid);
1194 static inline int md_close(struct obd_export *exp, struct md_op_data *op_data,
1195 struct md_open_data *mod,
1196 struct ptlrpc_request **request)
1200 EXP_CHECK_MD_OP(exp, close);
1201 EXP_MD_COUNTER_INCREMENT(exp, close);
1202 rc = MDP(exp->exp_obd, close)(exp, op_data, mod, request);
1206 static inline int md_create(struct obd_export *exp, struct md_op_data *op_data,
1207 const void *data, size_t datalen, umode_t mode,
1208 uid_t uid, gid_t gid, cfs_cap_t cap_effective,
1209 __u64 rdev, struct ptlrpc_request **request)
1213 EXP_CHECK_MD_OP(exp, create);
1214 EXP_MD_COUNTER_INCREMENT(exp, create);
1215 rc = MDP(exp->exp_obd, create)(exp, op_data, data, datalen, mode,
1216 uid, gid, cap_effective, rdev, request);
1220 static inline int md_enqueue(struct obd_export *exp,
1221 struct ldlm_enqueue_info *einfo,
1222 const union ldlm_policy_data *policy,
1223 struct lookup_intent *it,
1224 struct md_op_data *op_data,
1225 struct lustre_handle *lockh,
1226 __u64 extra_lock_flags)
1230 EXP_CHECK_MD_OP(exp, enqueue);
1231 EXP_MD_COUNTER_INCREMENT(exp, enqueue);
1232 rc = MDP(exp->exp_obd, enqueue)(exp, einfo, policy, it, op_data, lockh,
1237 static inline int md_getattr_name(struct obd_export *exp,
1238 struct md_op_data *op_data,
1239 struct ptlrpc_request **request)
1243 EXP_CHECK_MD_OP(exp, getattr_name);
1244 EXP_MD_COUNTER_INCREMENT(exp, getattr_name);
1245 rc = MDP(exp->exp_obd, getattr_name)(exp, op_data, request);
1249 static inline int md_intent_lock(struct obd_export *exp,
1250 struct md_op_data *op_data,
1251 struct lookup_intent *it,
1252 struct ptlrpc_request **reqp,
1253 ldlm_blocking_callback cb_blocking,
1254 __u64 extra_lock_flags)
1258 EXP_CHECK_MD_OP(exp, intent_lock);
1259 EXP_MD_COUNTER_INCREMENT(exp, intent_lock);
1260 rc = MDP(exp->exp_obd, intent_lock)(exp, op_data, it, reqp,
1261 cb_blocking, extra_lock_flags);
1265 static inline int md_link(struct obd_export *exp, struct md_op_data *op_data,
1266 struct ptlrpc_request **request)
1270 EXP_CHECK_MD_OP(exp, link);
1271 EXP_MD_COUNTER_INCREMENT(exp, link);
1272 rc = MDP(exp->exp_obd, link)(exp, op_data, request);
1276 static inline int md_rename(struct obd_export *exp, struct md_op_data *op_data,
1277 const char *old, size_t oldlen, const char *new,
1278 size_t newlen, struct ptlrpc_request **request)
1282 EXP_CHECK_MD_OP(exp, rename);
1283 EXP_MD_COUNTER_INCREMENT(exp, rename);
1284 rc = MDP(exp->exp_obd, rename)(exp, op_data, old, oldlen, new,
1289 static inline int md_setattr(struct obd_export *exp, struct md_op_data *op_data,
1290 void *ea, size_t ealen,
1291 struct ptlrpc_request **request)
1295 EXP_CHECK_MD_OP(exp, setattr);
1296 EXP_MD_COUNTER_INCREMENT(exp, setattr);
1297 rc = MDP(exp->exp_obd, setattr)(exp, op_data, ea, ealen, request);
1301 static inline int md_sync(struct obd_export *exp, const struct lu_fid *fid,
1302 struct ptlrpc_request **request)
1306 EXP_CHECK_MD_OP(exp, sync);
1307 EXP_MD_COUNTER_INCREMENT(exp, sync);
1308 rc = MDP(exp->exp_obd, sync)(exp, fid, request);
1312 static inline int md_read_page(struct obd_export *exp,
1313 struct md_op_data *op_data,
1314 struct md_callback *cb_op,
1316 struct page **ppage)
1320 EXP_CHECK_MD_OP(exp, read_page);
1321 EXP_MD_COUNTER_INCREMENT(exp, read_page);
1322 rc = MDP(exp->exp_obd, read_page)(exp, op_data, cb_op, hash_offset,
1327 static inline int md_unlink(struct obd_export *exp, struct md_op_data *op_data,
1328 struct ptlrpc_request **request)
1332 EXP_CHECK_MD_OP(exp, unlink);
1333 EXP_MD_COUNTER_INCREMENT(exp, unlink);
1334 rc = MDP(exp->exp_obd, unlink)(exp, op_data, request);
1338 static inline int md_get_lustre_md(struct obd_export *exp,
1339 struct ptlrpc_request *req,
1340 struct obd_export *dt_exp,
1341 struct obd_export *md_exp,
1342 struct lustre_md *md)
1344 EXP_CHECK_MD_OP(exp, get_lustre_md);
1345 EXP_MD_COUNTER_INCREMENT(exp, get_lustre_md);
1346 return MDP(exp->exp_obd, get_lustre_md)(exp, req, dt_exp, md_exp, md);
1349 static inline int md_free_lustre_md(struct obd_export *exp,
1350 struct lustre_md *md)
1352 EXP_CHECK_MD_OP(exp, free_lustre_md);
1353 EXP_MD_COUNTER_INCREMENT(exp, free_lustre_md);
1354 return MDP(exp->exp_obd, free_lustre_md)(exp, md);
1357 static inline int md_merge_attr(struct obd_export *exp,
1358 const struct lmv_stripe_md *lsm,
1359 struct cl_attr *attr,
1360 ldlm_blocking_callback cb)
1362 EXP_CHECK_MD_OP(exp, merge_attr);
1363 EXP_MD_COUNTER_INCREMENT(exp, merge_attr);
1364 return MDP(exp->exp_obd, merge_attr)(exp, lsm, attr, cb);
1367 static inline int md_setxattr(struct obd_export *exp, const struct lu_fid *fid,
1368 u64 valid, const char *name,
1369 const char *input, int input_size,
1370 int output_size, int flags, __u32 suppgid,
1371 struct ptlrpc_request **request)
1373 EXP_CHECK_MD_OP(exp, setxattr);
1374 EXP_MD_COUNTER_INCREMENT(exp, setxattr);
1375 return MDP(exp->exp_obd, setxattr)(exp, fid, valid, name, input,
1376 input_size, output_size, flags,
1380 static inline int md_getxattr(struct obd_export *exp, const struct lu_fid *fid,
1381 u64 valid, const char *name,
1382 const char *input, int input_size,
1383 int output_size, int flags,
1384 struct ptlrpc_request **request)
1386 EXP_CHECK_MD_OP(exp, getxattr);
1387 EXP_MD_COUNTER_INCREMENT(exp, getxattr);
1388 return MDP(exp->exp_obd, getxattr)(exp, fid, valid, name, input,
1389 input_size, output_size, flags,
1393 static inline int md_set_open_replay_data(struct obd_export *exp,
1394 struct obd_client_handle *och,
1395 struct lookup_intent *it)
1397 EXP_CHECK_MD_OP(exp, set_open_replay_data);
1398 EXP_MD_COUNTER_INCREMENT(exp, set_open_replay_data);
1399 return MDP(exp->exp_obd, set_open_replay_data)(exp, och, it);
1402 static inline int md_clear_open_replay_data(struct obd_export *exp,
1403 struct obd_client_handle *och)
1405 EXP_CHECK_MD_OP(exp, clear_open_replay_data);
1406 EXP_MD_COUNTER_INCREMENT(exp, clear_open_replay_data);
1407 return MDP(exp->exp_obd, clear_open_replay_data)(exp, och);
1410 static inline int md_set_lock_data(struct obd_export *exp,
1411 const struct lustre_handle *lockh,
1412 void *data, __u64 *bits)
1414 EXP_CHECK_MD_OP(exp, set_lock_data);
1415 EXP_MD_COUNTER_INCREMENT(exp, set_lock_data);
1416 return MDP(exp->exp_obd, set_lock_data)(exp, lockh, data, bits);
1419 static inline int md_cancel_unused(struct obd_export *exp,
1420 const struct lu_fid *fid,
1421 union ldlm_policy_data *policy,
1422 enum ldlm_mode mode,
1423 enum ldlm_cancel_flags flags,
1428 EXP_CHECK_MD_OP(exp, cancel_unused);
1429 EXP_MD_COUNTER_INCREMENT(exp, cancel_unused);
1431 rc = MDP(exp->exp_obd, cancel_unused)(exp, fid, policy, mode,
1436 static inline enum ldlm_mode md_lock_match(struct obd_export *exp, __u64 flags,
1437 const struct lu_fid *fid,
1438 enum ldlm_type type,
1439 union ldlm_policy_data *policy,
1440 enum ldlm_mode mode,
1441 struct lustre_handle *lockh)
1443 EXP_CHECK_MD_OP(exp, lock_match);
1444 EXP_MD_COUNTER_INCREMENT(exp, lock_match);
1445 return MDP(exp->exp_obd, lock_match)(exp, flags, fid, type,
1446 policy, mode, lockh);
1449 static inline int md_init_ea_size(struct obd_export *exp, u32 easize,
1452 EXP_CHECK_MD_OP(exp, init_ea_size);
1453 EXP_MD_COUNTER_INCREMENT(exp, init_ea_size);
1454 return MDP(exp->exp_obd, init_ea_size)(exp, easize, def_asize);
1457 static inline int md_intent_getattr_async(struct obd_export *exp,
1458 struct md_enqueue_info *minfo)
1462 EXP_CHECK_MD_OP(exp, intent_getattr_async);
1463 EXP_MD_COUNTER_INCREMENT(exp, intent_getattr_async);
1464 rc = MDP(exp->exp_obd, intent_getattr_async)(exp, minfo);
1468 static inline int md_revalidate_lock(struct obd_export *exp,
1469 struct lookup_intent *it,
1470 struct lu_fid *fid, __u64 *bits)
1474 EXP_CHECK_MD_OP(exp, revalidate_lock);
1475 EXP_MD_COUNTER_INCREMENT(exp, revalidate_lock);
1476 rc = MDP(exp->exp_obd, revalidate_lock)(exp, it, fid, bits);
1480 static inline int md_get_fid_from_lsm(struct obd_export *exp,
1481 const struct lmv_stripe_md *lsm,
1482 const char *name, int namelen,
1487 EXP_CHECK_MD_OP(exp, get_fid_from_lsm);
1488 EXP_MD_COUNTER_INCREMENT(exp, get_fid_from_lsm);
1489 rc = MDP(exp->exp_obd, get_fid_from_lsm)(exp, lsm, name, namelen, fid);
1493 /* Unpack an MD struct from disk to in-memory format.
1494 * Returns +ve size of unpacked MD (0 for free), or -ve error.
1496 * If *plsm != NULL and lmm == NULL then *lsm will be freed.
1497 * If *plsm == NULL then it will be allocated.
1499 static inline int md_unpackmd(struct obd_export *exp,
1500 struct lmv_stripe_md **plsm,
1501 const union lmv_mds_md *lmm, size_t lmm_size)
1505 EXP_CHECK_MD_OP(exp, unpackmd);
1506 EXP_MD_COUNTER_INCREMENT(exp, unpackmd);
1507 rc = MDP(exp->exp_obd, unpackmd)(exp, plsm, lmm, lmm_size);
1511 /* OBD Metadata Support */
1513 int obd_init_caches(void);
1514 void obd_cleanup_caches(void);
1516 /* support routines */
1517 extern struct kmem_cache *obdo_cachep;
1519 typedef int (*register_lwp_cb)(void *data);
1521 struct lwp_register_item {
1522 struct obd_export **lri_exp;
1523 register_lwp_cb lri_cb_func;
1525 struct list_head lri_list;
1526 char lri_name[MTI_NAME_MAXLEN];
1529 /* I'm as embarrassed about this as you are.
1531 * <shaver> // XXX do not look into _superhack with remaining eye
1532 * <shaver> // XXX if this were any uglier, I'd get my own show on MTV
1534 extern int (*ptlrpc_put_connection_superhack)(struct ptlrpc_connection *c);
1537 int lustre_unregister_fs(void);
1538 int lustre_register_fs(void);
1539 int lustre_check_exclusion(struct super_block *sb, char *svname);
1542 int obd_sysctl_init(void);
1545 typedef __u8 class_uuid_t[16];
1546 void class_uuid_unparse(class_uuid_t in, struct obd_uuid *out);
1549 int lustre_uuid_to_peer(const char *uuid, lnet_nid_t *peer_nid, int index);
1550 int class_add_uuid(const char *uuid, __u64 nid);
1551 int class_del_uuid(const char *uuid);
1552 int class_check_uuid(struct obd_uuid *uuid, __u64 nid);
1553 void class_init_uuidlist(void);
1554 void class_exit_uuidlist(void);
1557 extern char obd_jobid_node[];
1558 extern struct miscdevice obd_psdev;
1559 extern spinlock_t obd_types_lock;
1560 int class_procfs_init(void);
1561 int class_procfs_clean(void);
1564 #define ll_generate_random_uuid(uuid_out) cfs_get_random_bytes(uuid_out, sizeof(class_uuid_t))
1568 void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs);
1569 void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs);
1571 /* root squash info */
1572 struct rw_semaphore;
1573 struct root_squash_info {
1576 struct list_head rsi_nosquash_nids;
1577 struct rw_semaphore rsi_sem;
1580 /* linux-module.c */
1581 int obd_ioctl_getdata(char **buf, int *len, void __user *arg);
1583 #endif /* __LINUX_OBD_CLASS_H */