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.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, Whamcloud, Inc.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
40 # include <liblustre.h>
43 #include <obd_support.h>
44 #include <lustre_import.h>
45 #include <lustre_net.h>
47 #include <lustre_lib.h>
48 #include <lustre/lustre_idl.h>
49 #include <lprocfs_status.h>
51 #if defined(__linux__)
52 #include <linux/obd_class.h>
53 #elif defined(__APPLE__)
54 #include <darwin/obd_class.h>
55 #elif defined(__WINNT__)
56 #include <winnt/obd_class.h>
58 #error Unsupported operating system.
61 #define OBD_STATFS_NODELAY 0x0001 /* requests should be send without delay
62 * and resends for avoid deadlocks */
63 #define OBD_STATFS_FROM_CACHE 0x0002 /* the statfs callback should not update
65 #define OBD_STATFS_PTLRPCD 0x0004 /* requests will be sent via ptlrpcd
66 * instead of a specific set. This
67 * means that we cannot rely on the set
68 * interpret routine to be called.
69 * lov_statfs_fini() must thus be called
70 * by the request interpret routine */
72 #define OBD_FL_PUNCH 0x00000001 /* To indicate it is punch operation */
74 /* OBD Device Declarations */
75 extern struct obd_device *obd_devs[MAX_OBD_DEVICES];
76 extern cfs_rwlock_t obd_dev_lock;
78 /* OBD Operations Declarations */
79 extern struct obd_device *class_conn2obd(struct lustre_handle *);
80 extern struct obd_device *class_exp2obd(struct obd_export *);
81 extern int class_handle_ioctl(unsigned int cmd, unsigned long arg);
83 struct lu_device_type;
86 struct obd_export *class_conn2export(struct lustre_handle *);
87 int class_register_type(struct obd_ops *, struct md_ops *,
88 struct lprocfs_vars *, const char *nm,
89 struct lu_device_type *ldt);
90 int class_unregister_type(const char *nm);
92 struct obd_device *class_newdev(const char *type_name, const char *name);
93 void class_release_dev(struct obd_device *obd);
95 int class_name2dev(const char *name);
96 struct obd_device *class_name2obd(const char *name);
97 int class_uuid2dev(struct obd_uuid *uuid);
98 struct obd_device *class_uuid2obd(struct obd_uuid *uuid);
99 void class_obd_list(void);
100 struct obd_device * class_find_client_obd(struct obd_uuid *tgt_uuid,
101 const char * typ_name,
102 struct obd_uuid *grp_uuid);
103 struct obd_device * class_devices_in_group(struct obd_uuid *grp_uuid,
105 struct obd_device * class_num2obd(int num);
107 int class_notify_sptlrpc_conf(const char *fsname, int namelen);
109 char *obd_export_nid2str(struct obd_export *exp);
111 int obd_export_evict_by_nid(struct obd_device *obd, const char *nid);
112 int obd_export_evict_by_uuid(struct obd_device *obd, const char *uuid);
113 int obd_connect_flags2str(char *page, int count, __u64 flags, char *sep);
115 int obd_zombie_impexp_init(void);
116 void obd_zombie_impexp_stop(void);
117 void obd_zombie_impexp_cull(void);
118 void obd_zombie_barrier(void);
119 void obd_exports_barrier(struct obd_device *obd);
120 int kuc_len(int payload_len);
121 struct kuc_hdr * kuc_ptr(void *p);
122 int kuc_ispayload(void *p);
123 void *kuc_alloc(int payload_len, int transport, int type);
124 void kuc_free(void *p, int payload_len);
127 int class_process_config(struct lustre_cfg *lcfg);
128 int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
129 struct lustre_cfg *lcfg, void *data);
130 int class_attach(struct lustre_cfg *lcfg);
131 int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg);
132 int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg);
133 int class_detach(struct obd_device *obd, struct lustre_cfg *lcfg);
134 struct obd_device *class_incref(struct obd_device *obd,
135 const char *scope, const void *source);
136 void class_decref(struct obd_device *obd,
137 const char *scope, const void *source);
138 void dump_exports(struct obd_device *obd, int locks);
142 extern void lprocfs_echo_init_vars(struct lprocfs_static_vars *lvars);
144 static inline void lprocfs_echo_init_vars(struct lprocfs_static_vars *lvars)
146 memset(lvars, 0, sizeof(*lvars));
150 #define CFG_F_START 0x01 /* Set when we start updating from a log */
151 #define CFG_F_MARKER 0x02 /* We are within a maker */
152 #define CFG_F_SKIP 0x04 /* We should ignore this cfg command */
153 #define CFG_F_COMPAT146 0x08 /* Allow old-style logs */
154 #define CFG_F_EXCLUDE 0x10 /* OST exclusion list */
156 /* Passed as data param to class_config_parse_llog */
157 struct config_llog_instance {
160 struct super_block *cfg_sb;
161 struct obd_uuid cfg_uuid;
162 int cfg_last_idx; /* for partial llog processing */
165 int class_config_parse_llog(struct llog_ctxt *ctxt, char *name,
166 struct config_llog_instance *cfg);
167 int class_config_dump_llog(struct llog_ctxt *ctxt, char *name,
168 struct config_llog_instance *cfg);
172 CONFIG_T_SPTLRPC = 1,
173 CONFIG_T_RECOVER = 2,
177 /* list of active configuration logs */
178 struct config_llog_data {
179 struct ldlm_res_id cld_resid;
180 struct config_llog_instance cld_cfg;
181 cfs_list_t cld_list_chain;
182 cfs_atomic_t cld_refcount;
183 struct config_llog_data *cld_sptlrpc;/* depended sptlrpc log */
184 struct config_llog_data *cld_recover; /* imperative recover log */
185 struct obd_export *cld_mgcexp;
186 cfs_mutex_t cld_lock;
188 unsigned int cld_stopping:1, /* we were told to stop
190 cld_lostlock:1; /* lock not requeued */
194 struct lustre_profile {
201 struct lustre_profile *class_get_profile(const char * prof);
202 void class_del_profile(const char *prof);
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)
218 #define class_export_rpc_get(exp) \
220 cfs_atomic_inc(&(exp)->exp_rpc_count); \
221 CDEBUG(D_INFO, "RPC GETting export %p : new rpc_count %d\n", \
222 (exp), cfs_atomic_read(&(exp)->exp_rpc_count)); \
223 class_export_get(exp); \
226 #define class_export_rpc_put(exp) \
228 LASSERT_ATOMIC_POS(&exp->exp_rpc_count); \
229 cfs_atomic_dec(&(exp)->exp_rpc_count); \
230 CDEBUG(D_INFO, "RPC PUTting export %p : new rpc_count %d\n", \
231 (exp), cfs_atomic_read(&(exp)->exp_rpc_count)); \
232 class_export_put(exp); \
235 #define class_export_lock_get(exp, lock) \
237 cfs_atomic_inc(&(exp)->exp_locks_count); \
238 __class_export_add_lock_ref(exp, lock); \
239 CDEBUG(D_INFO, "lock GETting export %p : new locks_count %d\n", \
240 (exp), cfs_atomic_read(&(exp)->exp_locks_count)); \
241 class_export_get(exp); \
244 #define class_export_lock_put(exp, lock) \
246 LASSERT_ATOMIC_POS(&exp->exp_locks_count); \
247 cfs_atomic_dec(&(exp)->exp_locks_count); \
248 __class_export_del_lock_ref(exp, lock); \
249 CDEBUG(D_INFO, "lock PUTting export %p : new locks_count %d\n", \
250 (exp), cfs_atomic_read(&(exp)->exp_locks_count)); \
251 class_export_put(exp); \
254 #define class_export_cb_get(exp) \
256 cfs_atomic_inc(&(exp)->exp_cb_count); \
257 CDEBUG(D_INFO, "callback GETting export %p : new cb_count %d\n",\
258 (exp), cfs_atomic_read(&(exp)->exp_cb_count)); \
259 class_export_get(exp); \
262 #define class_export_cb_put(exp) \
264 LASSERT_ATOMIC_POS(&exp->exp_cb_count); \
265 cfs_atomic_dec(&(exp)->exp_cb_count); \
266 CDEBUG(D_INFO, "callback PUTting export %p : new cb_count %d\n",\
267 (exp), cfs_atomic_read(&(exp)->exp_cb_count)); \
268 class_export_put(exp); \
272 struct obd_export *class_export_get(struct obd_export *exp);
273 void class_export_put(struct obd_export *exp);
274 struct obd_export *class_new_export(struct obd_device *obddev,
275 struct obd_uuid *cluuid);
276 void class_unlink_export(struct obd_export *exp);
278 struct obd_import *class_import_get(struct obd_import *);
279 void class_import_put(struct obd_import *);
280 struct obd_import *class_new_import(struct obd_device *obd);
281 void class_destroy_import(struct obd_import *exp);
283 struct obd_type *class_search_type(const char *name);
284 struct obd_type *class_get_type(const char *name);
285 void class_put_type(struct obd_type *type);
286 int class_connect(struct lustre_handle *conn, struct obd_device *obd,
287 struct obd_uuid *cluuid);
288 int class_disconnect(struct obd_export *exp);
289 void class_fail_export(struct obd_export *exp);
290 int class_connected_export(struct obd_export *exp);
291 void class_disconnect_exports(struct obd_device *obddev);
292 int class_manual_cleanup(struct obd_device *obd);
293 void class_disconnect_stale_exports(struct obd_device *,
294 int (*test_export)(struct obd_export *));
295 static inline enum obd_option exp_flags_from_obd(struct obd_device *obd)
297 return ((obd->obd_fail ? OBD_OPT_FAILOVER : 0) |
298 (obd->obd_force ? OBD_OPT_FORCE : 0) |
299 (obd->obd_abort_recovery ? OBD_OPT_ABORT_RECOV : 0) |
303 #ifdef HAVE_SERVER_SUPPORT
304 static inline struct lu_target *class_exp2tgt(struct obd_export *exp)
306 LASSERT(exp->exp_obd);
307 return exp->exp_obd->u.obt.obt_lut;
310 static inline struct lr_server_data *class_server_data(struct obd_device *obd)
312 LASSERT(obd->u.obt.obt_lut);
313 return &obd->u.obt.obt_lut->lut_lsd;
317 void obdo_cpy_md(struct obdo *dst, struct obdo *src, obd_flag valid);
318 void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj);
319 void obdo_from_iattr(struct obdo *oa, struct iattr *attr,
320 unsigned int ia_valid);
321 void iattr_from_obdo(struct iattr *attr, struct obdo *oa, obd_flag valid);
322 void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, obd_flag valid);
323 void obdo_from_md(struct obdo *oa, struct md_op_data *op_data,
326 #define OBT(dev) (dev)->obd_type
327 #define OBP(dev, op) (dev)->obd_type->typ_dt_ops->o_ ## op
328 #define MDP(dev, op) (dev)->obd_type->typ_md_ops->m_ ## op
329 #define CTXTP(ctxt, op) (ctxt)->loc_logops->lop_##op
331 /* Ensure obd_setup: used for cleanup which must be called
332 while obd is stopping */
333 #define OBD_CHECK_DEV(obd) \
336 CERROR("NULL device\n"); \
341 /* ensure obd_setup and !obd_stopping */
342 #define OBD_CHECK_DEV_ACTIVE(obd) \
344 OBD_CHECK_DEV(obd); \
345 if (!(obd)->obd_set_up || (obd)->obd_stopping) { \
346 CERROR("Device %d not setup\n", \
354 #define OBD_COUNTER_OFFSET(op) \
355 ((offsetof(struct obd_ops, o_ ## op) - \
356 offsetof(struct obd_ops, o_iocontrol)) \
357 / sizeof(((struct obd_ops *)(0))->o_iocontrol))
359 #define OBD_COUNTER_INCREMENT(obdx, op) \
360 if ((obdx)->obd_stats != NULL) { \
361 unsigned int coffset; \
362 coffset = (unsigned int)((obdx)->obd_cntr_base) + \
363 OBD_COUNTER_OFFSET(op); \
364 LASSERT(coffset < (obdx)->obd_stats->ls_num); \
365 lprocfs_counter_incr((obdx)->obd_stats, coffset); \
368 #define EXP_COUNTER_INCREMENT(export, op) \
369 if ((export)->exp_obd->obd_stats != NULL) { \
370 unsigned int coffset; \
371 coffset = (unsigned int)((export)->exp_obd->obd_cntr_base) + \
372 OBD_COUNTER_OFFSET(op); \
373 LASSERT(coffset < (export)->exp_obd->obd_stats->ls_num); \
374 lprocfs_counter_incr((export)->exp_obd->obd_stats, coffset); \
375 if ((export)->exp_nid_stats != NULL && \
376 (export)->exp_nid_stats->nid_stats != NULL) \
377 lprocfs_counter_incr( \
378 (export)->exp_nid_stats->nid_stats, coffset);\
381 #define MD_COUNTER_OFFSET(op) \
382 ((offsetof(struct md_ops, m_ ## op) - \
383 offsetof(struct md_ops, m_getstatus)) \
384 / sizeof(((struct md_ops *)(0))->m_getstatus))
386 #define MD_COUNTER_INCREMENT(obdx, op) \
387 if ((obd)->md_stats != NULL) { \
388 unsigned int coffset; \
389 coffset = (unsigned int)((obdx)->md_cntr_base) + \
390 MD_COUNTER_OFFSET(op); \
391 LASSERT(coffset < (obdx)->md_stats->ls_num); \
392 lprocfs_counter_incr((obdx)->md_stats, coffset); \
395 #define EXP_MD_COUNTER_INCREMENT(export, op) \
396 if ((export)->exp_obd->obd_stats != NULL) { \
397 unsigned int coffset; \
398 coffset = (unsigned int)((export)->exp_obd->md_cntr_base) + \
399 MD_COUNTER_OFFSET(op); \
400 LASSERT(coffset < (export)->exp_obd->md_stats->ls_num); \
401 lprocfs_counter_incr((export)->exp_obd->md_stats, coffset); \
402 if ((export)->exp_md_stats != NULL) \
403 lprocfs_counter_incr( \
404 (export)->exp_md_stats, coffset); \
408 #define OBD_COUNTER_OFFSET(op)
409 #define OBD_COUNTER_INCREMENT(obd, op)
410 #define EXP_COUNTER_INCREMENT(exp, op)
411 #define MD_COUNTER_INCREMENT(obd, op)
412 #define EXP_MD_COUNTER_INCREMENT(exp, op)
415 static inline int lprocfs_nid_ldlm_stats_init(struct nid_stat* tmp)
417 /* Always add in ldlm_stats */
418 tmp->nid_ldlm_stats = lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC
419 ,LPROCFS_STATS_FLAG_NOPERCPU);
420 if (tmp->nid_ldlm_stats == NULL)
423 lprocfs_init_ldlm_stats(tmp->nid_ldlm_stats);
425 return lprocfs_register_stats(tmp->nid_proc, "ldlm_stats",
426 tmp->nid_ldlm_stats);
429 #define OBD_CHECK_MD_OP(obd, op, err) \
431 if (!OBT(obd) || !MDP((obd), op)) { \
433 CERROR("md_" #op ": dev %s/%d no operation\n", \
434 obd->obd_name, obd->obd_minor); \
439 #define EXP_CHECK_MD_OP(exp, op) \
441 if ((exp) == NULL) { \
442 CERROR("obd_" #op ": NULL export\n"); \
445 if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \
446 CERROR("obd_" #op ": cleaned up obd\n"); \
447 RETURN(-EOPNOTSUPP); \
449 if (!OBT((exp)->exp_obd) || !MDP((exp)->exp_obd, op)) { \
450 CERROR("obd_" #op ": dev %s/%d no operation\n", \
451 (exp)->exp_obd->obd_name, \
452 (exp)->exp_obd->obd_minor); \
453 RETURN(-EOPNOTSUPP); \
458 #define OBD_CHECK_DT_OP(obd, op, err) \
460 if (!OBT(obd) || !OBP((obd), op)) { \
462 CERROR("obd_" #op ": dev %d no operation\n", \
468 #define EXP_CHECK_DT_OP(exp, op) \
470 if ((exp) == NULL) { \
471 CERROR("obd_" #op ": NULL export\n"); \
474 if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \
475 CERROR("obd_" #op ": cleaned up obd\n"); \
476 RETURN(-EOPNOTSUPP); \
478 if (!OBT((exp)->exp_obd) || !OBP((exp)->exp_obd, op)) { \
479 CERROR("obd_" #op ": dev %d no operation\n", \
480 (exp)->exp_obd->obd_minor); \
481 RETURN(-EOPNOTSUPP); \
485 #define CTXT_CHECK_OP(ctxt, op, err) \
487 if (!OBT(ctxt->loc_obd) || !CTXTP((ctxt), op)) { \
489 CERROR("lop_" #op ": dev %d no operation\n", \
490 ctxt->loc_obd->obd_minor); \
495 static inline int class_devno_max(void)
497 return MAX_OBD_DEVICES;
500 static inline int obd_get_info(const struct lu_env *env,
501 struct obd_export *exp, __u32 keylen,
502 void *key, __u32 *vallen, void *val,
503 struct lov_stripe_md *lsm)
508 EXP_CHECK_DT_OP(exp, get_info);
509 EXP_COUNTER_INCREMENT(exp, get_info);
511 rc = OBP(exp->exp_obd, get_info)(env, exp, keylen, key, vallen, val,
516 static inline int obd_set_info_async(const struct lu_env *env,
517 struct obd_export *exp, obd_count keylen,
518 void *key, obd_count vallen, void *val,
519 struct ptlrpc_request_set *set)
524 EXP_CHECK_DT_OP(exp, set_info_async);
525 EXP_COUNTER_INCREMENT(exp, set_info_async);
527 rc = OBP(exp->exp_obd, set_info_async)(env, exp, keylen, key, vallen,
533 * obd-lu integration.
535 * Functionality is being moved into new lu_device-based layering, but some
536 * pieces of configuration process are still based on obd devices.
538 * Specifically, lu_device_type_operations::ldto_device_alloc() methods fully
539 * subsume ->o_setup() methods of obd devices they replace. The same for
540 * lu_device_operations::ldo_process_config() and ->o_process_config(). As a
541 * result, obd_setup() and obd_process_config() branch and call one XOR
544 * Yet neither lu_device_type_operations::ldto_device_fini() nor
545 * lu_device_type_operations::ldto_device_free() fully implement the
546 * functionality of ->o_precleanup() and ->o_cleanup() they override. Hence,
547 * obd_precleanup() and obd_cleanup() call both lu_device and obd operations.
550 #define DECLARE_LU_VARS(ldt, d) \
551 struct lu_device_type *ldt; \
554 static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg)
557 DECLARE_LU_VARS(ldt, d);
560 ldt = obd->obd_type->typ_lu;
562 struct lu_context session_ctx;
564 lu_context_init(&session_ctx, LCT_SESSION);
565 session_ctx.lc_thread = NULL;
566 lu_context_enter(&session_ctx);
568 rc = lu_env_init(&env, ldt->ldt_ctx_tags);
570 env.le_ses = &session_ctx;
571 d = ldt->ldt_ops->ldto_device_alloc(&env, ldt, cfg);
580 lu_context_exit(&session_ctx);
581 lu_context_fini(&session_ctx);
584 OBD_CHECK_DT_OP(obd, setup, -EOPNOTSUPP);
585 OBD_COUNTER_INCREMENT(obd, setup);
586 rc = OBP(obd, setup)(obd, cfg);
591 static inline int obd_precleanup(struct obd_device *obd,
592 enum obd_cleanup_stage cleanup_stage)
595 DECLARE_LU_VARS(ldt, d);
599 ldt = obd->obd_type->typ_lu;
601 if (ldt != NULL && d != NULL) {
602 if (cleanup_stage == OBD_CLEANUP_EXPORTS) {
605 rc = lu_env_init(&env, ldt->ldt_ctx_tags);
607 ldt->ldt_ops->ldto_device_fini(&env, d);
612 OBD_CHECK_DT_OP(obd, precleanup, 0);
613 OBD_COUNTER_INCREMENT(obd, precleanup);
615 rc = OBP(obd, precleanup)(obd, cleanup_stage);
619 static inline int obd_cleanup(struct obd_device *obd)
622 DECLARE_LU_VARS(ldt, d);
627 ldt = obd->obd_type->typ_lu;
629 if (ldt != NULL && d != NULL) {
632 rc = lu_env_init(&env, ldt->ldt_ctx_tags);
634 ldt->ldt_ops->ldto_device_free(&env, d);
636 obd->obd_lu_dev = NULL;
639 OBD_CHECK_DT_OP(obd, cleanup, 0);
640 OBD_COUNTER_INCREMENT(obd, cleanup);
642 rc = OBP(obd, cleanup)(obd);
646 static inline void obd_cleanup_client_import(struct obd_device *obd)
650 /* If we set up but never connected, the
651 client import will not have been cleaned. */
652 cfs_down_write(&obd->u.cli.cl_sem);
653 if (obd->u.cli.cl_import) {
654 struct obd_import *imp;
655 imp = obd->u.cli.cl_import;
656 CDEBUG(D_CONFIG, "%s: client import never connected\n",
658 ptlrpc_invalidate_import(imp);
659 if (imp->imp_rq_pool) {
660 ptlrpc_free_rq_pool(imp->imp_rq_pool);
661 imp->imp_rq_pool = NULL;
663 client_destroy_import(imp);
664 obd->u.cli.cl_import = NULL;
666 cfs_up_write(&obd->u.cli.cl_sem);
672 obd_process_config(struct obd_device *obd, int datalen, void *data)
675 DECLARE_LU_VARS(ldt, d);
680 obd->obd_process_conf = 1;
681 ldt = obd->obd_type->typ_lu;
683 if (ldt != NULL && d != NULL) {
686 rc = lu_env_init(&env, ldt->ldt_ctx_tags);
688 rc = d->ld_ops->ldo_process_config(&env, d, data);
692 OBD_CHECK_DT_OP(obd, process_config, -EOPNOTSUPP);
693 rc = OBP(obd, process_config)(obd, datalen, data);
695 OBD_COUNTER_INCREMENT(obd, process_config);
696 obd->obd_process_conf = 0;
701 /* Pack an in-memory MD struct for storage on disk.
702 * Returns +ve size of packed MD (0 for free), or -ve error.
704 * If @disk_tgt == NULL, MD size is returned (max size if @mem_src == NULL).
705 * If @*disk_tgt != NULL and @mem_src == NULL, @*disk_tgt will be freed.
706 * If @*disk_tgt == NULL, it will be allocated
708 static inline int obd_packmd(struct obd_export *exp,
709 struct lov_mds_md **disk_tgt,
710 struct lov_stripe_md *mem_src)
715 EXP_CHECK_DT_OP(exp, packmd);
716 EXP_COUNTER_INCREMENT(exp, packmd);
718 rc = OBP(exp->exp_obd, packmd)(exp, disk_tgt, mem_src);
722 static inline int obd_size_diskmd(struct obd_export *exp,
723 struct lov_stripe_md *mem_src)
725 return obd_packmd(exp, NULL, mem_src);
728 /* helper functions */
729 static inline int obd_alloc_diskmd(struct obd_export *exp,
730 struct lov_mds_md **disk_tgt)
733 LASSERT(*disk_tgt == NULL);
734 return obd_packmd(exp, disk_tgt, NULL);
737 static inline int obd_free_diskmd(struct obd_export *exp,
738 struct lov_mds_md **disk_tgt)
742 return obd_packmd(exp, disk_tgt, NULL);
745 /* Unpack an MD struct from disk to in-memory format.
746 * Returns +ve size of unpacked MD (0 for free), or -ve error.
748 * If @mem_tgt == NULL, MD size is returned (max size if @disk_src == NULL).
749 * If @*mem_tgt != NULL and @disk_src == NULL, @*mem_tgt will be freed.
750 * If @*mem_tgt == NULL, it will be allocated
752 static inline int obd_unpackmd(struct obd_export *exp,
753 struct lov_stripe_md **mem_tgt,
754 struct lov_mds_md *disk_src,
760 EXP_CHECK_DT_OP(exp, unpackmd);
761 EXP_COUNTER_INCREMENT(exp, unpackmd);
763 rc = OBP(exp->exp_obd, unpackmd)(exp, mem_tgt, disk_src, disk_len);
767 /* helper functions */
768 static inline int obd_alloc_memmd(struct obd_export *exp,
769 struct lov_stripe_md **mem_tgt)
772 LASSERT(*mem_tgt == NULL);
773 return obd_unpackmd(exp, mem_tgt, NULL, 0);
776 static inline int obd_free_memmd(struct obd_export *exp,
777 struct lov_stripe_md **mem_tgt)
783 rc = obd_unpackmd(exp, mem_tgt, NULL, 0);
788 static inline int obd_precreate(struct obd_export *exp)
793 EXP_CHECK_DT_OP(exp, precreate);
794 OBD_COUNTER_INCREMENT(exp->exp_obd, precreate);
796 rc = OBP(exp->exp_obd, precreate)(exp);
800 static inline int obd_create_async(struct obd_export *exp,
801 struct obd_info *oinfo,
802 struct lov_stripe_md **ea,
803 struct obd_trans_info *oti)
808 EXP_CHECK_DT_OP(exp, create_async);
809 EXP_COUNTER_INCREMENT(exp, create_async);
811 rc = OBP(exp->exp_obd, create_async)(exp, oinfo, ea, oti);
815 static inline int obd_create(const struct lu_env *env, struct obd_export *exp,
816 struct obdo *obdo, struct lov_stripe_md **ea,
817 struct obd_trans_info *oti)
822 EXP_CHECK_DT_OP(exp, create);
823 EXP_COUNTER_INCREMENT(exp, create);
825 rc = OBP(exp->exp_obd, create)(env, exp, obdo, ea, oti);
829 static inline int obd_destroy(const struct lu_env *env, struct obd_export *exp,
830 struct obdo *obdo, struct lov_stripe_md *ea,
831 struct obd_trans_info *oti,
832 struct obd_export *md_exp, void *capa)
837 EXP_CHECK_DT_OP(exp, destroy);
838 EXP_COUNTER_INCREMENT(exp, destroy);
840 rc = OBP(exp->exp_obd, destroy)(env, exp, obdo, ea, oti, md_exp, capa);
844 static inline int obd_getattr(const struct lu_env *env, struct obd_export *exp,
845 struct obd_info *oinfo)
850 EXP_CHECK_DT_OP(exp, getattr);
851 EXP_COUNTER_INCREMENT(exp, getattr);
853 rc = OBP(exp->exp_obd, getattr)(env, exp, oinfo);
857 static inline int obd_getattr_async(struct obd_export *exp,
858 struct obd_info *oinfo,
859 struct ptlrpc_request_set *set)
864 EXP_CHECK_DT_OP(exp, getattr_async);
865 EXP_COUNTER_INCREMENT(exp, getattr_async);
867 rc = OBP(exp->exp_obd, getattr_async)(exp, oinfo, set);
871 static inline int obd_setattr(const struct lu_env *env, struct obd_export *exp,
872 struct obd_info *oinfo,
873 struct obd_trans_info *oti)
878 EXP_CHECK_DT_OP(exp, setattr);
879 EXP_COUNTER_INCREMENT(exp, setattr);
881 rc = OBP(exp->exp_obd, setattr)(env, exp, oinfo, oti);
885 /* This performs all the requests set init/wait/destroy actions. */
886 static inline int obd_setattr_rqset(struct obd_export *exp,
887 struct obd_info *oinfo,
888 struct obd_trans_info *oti)
890 struct ptlrpc_request_set *set = NULL;
894 EXP_CHECK_DT_OP(exp, setattr_async);
895 EXP_COUNTER_INCREMENT(exp, setattr_async);
897 set = ptlrpc_prep_set();
901 rc = OBP(exp->exp_obd, setattr_async)(exp, oinfo, oti, set);
903 rc = ptlrpc_set_wait(set);
904 ptlrpc_set_destroy(set);
908 /* This adds all the requests into @set if @set != NULL, otherwise
909 all requests are sent asynchronously without waiting for response. */
910 static inline int obd_setattr_async(struct obd_export *exp,
911 struct obd_info *oinfo,
912 struct obd_trans_info *oti,
913 struct ptlrpc_request_set *set)
918 EXP_CHECK_DT_OP(exp, setattr_async);
919 EXP_COUNTER_INCREMENT(exp, setattr_async);
921 rc = OBP(exp->exp_obd, setattr_async)(exp, oinfo, oti, set);
925 static inline int obd_add_conn(struct obd_import *imp, struct obd_uuid *uuid,
928 struct obd_device *obd = imp->imp_obd;
932 OBD_CHECK_DEV_ACTIVE(obd);
933 OBD_CHECK_DT_OP(obd, add_conn, -EOPNOTSUPP);
934 OBD_COUNTER_INCREMENT(obd, add_conn);
936 rc = OBP(obd, add_conn)(imp, uuid, priority);
940 static inline int obd_del_conn(struct obd_import *imp, struct obd_uuid *uuid)
942 struct obd_device *obd = imp->imp_obd;
946 OBD_CHECK_DEV_ACTIVE(obd);
947 OBD_CHECK_DT_OP(obd, del_conn, -EOPNOTSUPP);
948 OBD_COUNTER_INCREMENT(obd, del_conn);
950 rc = OBP(obd, del_conn)(imp, uuid);
954 static inline struct obd_uuid *obd_get_uuid(struct obd_export *exp)
956 struct obd_uuid *uuid;
959 OBD_CHECK_DT_OP(exp->exp_obd, get_uuid, NULL);
960 EXP_COUNTER_INCREMENT(exp, get_uuid);
962 uuid = OBP(exp->exp_obd, get_uuid)(exp);
966 /** Create a new /a exp on device /a obd for the uuid /a cluuid
967 * @param exp New export handle
968 * @param d Connect data, supported flags are set, flags also understood
969 * by obd are returned.
971 static inline int obd_connect(const struct lu_env *env,
972 struct obd_export **exp,struct obd_device *obd,
973 struct obd_uuid *cluuid,
974 struct obd_connect_data *data,
978 __u64 ocf = data ? data->ocd_connect_flags : 0; /* for post-condition
982 OBD_CHECK_DEV_ACTIVE(obd);
983 OBD_CHECK_DT_OP(obd, connect, -EOPNOTSUPP);
984 OBD_COUNTER_INCREMENT(obd, connect);
986 rc = OBP(obd, connect)(env, exp, obd, cluuid, data, localdata);
987 /* check that only subset is granted */
988 LASSERT(ergo(data != NULL, (data->ocd_connect_flags & ocf) ==
989 data->ocd_connect_flags));
993 static inline int obd_reconnect(const struct lu_env *env,
994 struct obd_export *exp,
995 struct obd_device *obd,
996 struct obd_uuid *cluuid,
997 struct obd_connect_data *d,
1001 __u64 ocf = d ? d->ocd_connect_flags : 0; /* for post-condition
1006 OBD_CHECK_DEV_ACTIVE(obd);
1007 OBD_CHECK_DT_OP(obd, reconnect, 0);
1008 OBD_COUNTER_INCREMENT(obd, reconnect);
1010 rc = OBP(obd, reconnect)(env, exp, obd, cluuid, d, localdata);
1011 /* check that only subset is granted */
1012 LASSERT(ergo(d != NULL,
1013 (d->ocd_connect_flags & ocf) == d->ocd_connect_flags));
1017 static inline int obd_disconnect(struct obd_export *exp)
1022 EXP_CHECK_DT_OP(exp, disconnect);
1023 EXP_COUNTER_INCREMENT(exp, disconnect);
1025 rc = OBP(exp->exp_obd, disconnect)(exp);
1029 static inline int obd_fid_init(struct obd_export *exp)
1034 OBD_CHECK_DT_OP(exp->exp_obd, fid_init, 0);
1035 EXP_COUNTER_INCREMENT(exp, fid_init);
1037 rc = OBP(exp->exp_obd, fid_init)(exp);
1041 static inline int obd_fid_fini(struct obd_export *exp)
1046 OBD_CHECK_DT_OP(exp->exp_obd, fid_fini, 0);
1047 EXP_COUNTER_INCREMENT(exp, fid_fini);
1049 rc = OBP(exp->exp_obd, fid_fini)(exp);
1053 static inline int obd_fid_alloc(struct obd_export *exp,
1055 struct md_op_data *op_data)
1060 EXP_CHECK_DT_OP(exp, fid_alloc);
1061 EXP_COUNTER_INCREMENT(exp, fid_alloc);
1063 rc = OBP(exp->exp_obd, fid_alloc)(exp, fid, op_data);
1067 static inline int obd_fid_delete(struct obd_export *exp,
1068 const struct lu_fid *fid)
1073 EXP_CHECK_DT_OP(exp, fid_delete);
1074 EXP_COUNTER_INCREMENT(exp, fid_delete);
1076 rc = OBP(exp->exp_obd, fid_delete)(exp, fid);
1080 static inline int obd_ping(const struct lu_env *env, struct obd_export *exp)
1085 OBD_CHECK_DT_OP(exp->exp_obd, ping, 0);
1086 EXP_COUNTER_INCREMENT(exp, ping);
1088 rc = OBP(exp->exp_obd, ping)(env, exp);
1092 static inline int obd_pool_new(struct obd_device *obd, char *poolname)
1097 OBD_CHECK_DT_OP(obd, pool_new, -EOPNOTSUPP);
1098 OBD_COUNTER_INCREMENT(obd, pool_new);
1100 rc = OBP(obd, pool_new)(obd, poolname);
1104 static inline int obd_pool_del(struct obd_device *obd, char *poolname)
1109 OBD_CHECK_DT_OP(obd, pool_del, -EOPNOTSUPP);
1110 OBD_COUNTER_INCREMENT(obd, pool_del);
1112 rc = OBP(obd, pool_del)(obd, poolname);
1116 static inline int obd_pool_add(struct obd_device *obd, char *poolname, char *ostname)
1121 OBD_CHECK_DT_OP(obd, pool_add, -EOPNOTSUPP);
1122 OBD_COUNTER_INCREMENT(obd, pool_add);
1124 rc = OBP(obd, pool_add)(obd, poolname, ostname);
1128 static inline int obd_pool_rem(struct obd_device *obd, char *poolname, char *ostname)
1133 OBD_CHECK_DT_OP(obd, pool_rem, -EOPNOTSUPP);
1134 OBD_COUNTER_INCREMENT(obd, pool_rem);
1136 rc = OBP(obd, pool_rem)(obd, poolname, ostname);
1140 static inline void obd_getref(struct obd_device *obd)
1143 if (OBT(obd) && OBP(obd, getref)) {
1144 OBD_COUNTER_INCREMENT(obd, getref);
1145 OBP(obd, getref)(obd);
1150 static inline void obd_putref(struct obd_device *obd)
1153 if (OBT(obd) && OBP(obd, putref)) {
1154 OBD_COUNTER_INCREMENT(obd, putref);
1155 OBP(obd, putref)(obd);
1160 static inline int obd_init_export(struct obd_export *exp)
1165 if ((exp)->exp_obd != NULL && OBT((exp)->exp_obd) &&
1166 OBP((exp)->exp_obd, init_export))
1167 rc = OBP(exp->exp_obd, init_export)(exp);
1171 static inline int obd_destroy_export(struct obd_export *exp)
1174 if ((exp)->exp_obd != NULL && OBT((exp)->exp_obd) &&
1175 OBP((exp)->exp_obd, destroy_export))
1176 OBP(exp->exp_obd, destroy_export)(exp);
1180 static inline int obd_extent_calc(struct obd_export *exp,
1181 struct lov_stripe_md *md,
1182 int cmd, obd_off *offset)
1186 EXP_CHECK_DT_OP(exp, extent_calc);
1187 rc = OBP(exp->exp_obd, extent_calc)(exp, md, cmd, offset);
1191 static inline struct dentry *
1192 obd_lvfs_fid2dentry(struct obd_export *exp, __u64 id_ino, __u32 gen, __u64 gr)
1194 LASSERT(exp->exp_obd);
1196 return lvfs_fid2dentry(&exp->exp_obd->obd_lvfs_ctxt, id_ino, gen, gr,
1201 obd_lvfs_open_llog(struct obd_export *exp, __u64 id_ino, struct dentry *dentry)
1203 LASSERT(exp->exp_obd);
1204 CERROR("FIXME what's the story here? This needs to be an obd fn?\n");
1206 return lvfs_open_llog(&exp->exp_obd->obd_lvfs_ctxt, id_ino,
1207 dentry, exp->exp_obd);
1212 /* @max_age is the oldest time in jiffies that we accept using a cached data.
1213 * If the cache is older than @max_age we will get a new value from the
1214 * target. Use a value of "cfs_time_current() + HZ" to guarantee freshness. */
1215 static inline int obd_statfs_async(struct obd_export *exp,
1216 struct obd_info *oinfo,
1218 struct ptlrpc_request_set *rqset)
1221 struct obd_device *obd;
1224 if (exp == NULL || exp->exp_obd == NULL)
1228 OBD_CHECK_DT_OP(obd, statfs, -EOPNOTSUPP);
1229 OBD_COUNTER_INCREMENT(obd, statfs);
1231 CDEBUG(D_SUPER, "%s: osfs %p age "LPU64", max_age "LPU64"\n",
1232 obd->obd_name, &obd->obd_osfs, obd->obd_osfs_age, max_age);
1233 if (cfs_time_before_64(obd->obd_osfs_age, max_age)) {
1234 rc = OBP(obd, statfs_async)(exp, oinfo, max_age, rqset);
1236 CDEBUG(D_SUPER,"%s: use %p cache blocks "LPU64"/"LPU64
1237 " objects "LPU64"/"LPU64"\n",
1238 obd->obd_name, &obd->obd_osfs,
1239 obd->obd_osfs.os_bavail, obd->obd_osfs.os_blocks,
1240 obd->obd_osfs.os_ffree, obd->obd_osfs.os_files);
1241 cfs_spin_lock(&obd->obd_osfs_lock);
1242 memcpy(oinfo->oi_osfs, &obd->obd_osfs, sizeof(*oinfo->oi_osfs));
1243 cfs_spin_unlock(&obd->obd_osfs_lock);
1244 oinfo->oi_flags |= OBD_STATFS_FROM_CACHE;
1245 if (oinfo->oi_cb_up)
1246 oinfo->oi_cb_up(oinfo, 0);
1251 static inline int obd_statfs_rqset(struct obd_export *exp,
1252 struct obd_statfs *osfs, __u64 max_age,
1255 struct ptlrpc_request_set *set = NULL;
1256 struct obd_info oinfo = { { { 0 } } };
1260 set = ptlrpc_prep_set();
1264 oinfo.oi_osfs = osfs;
1265 oinfo.oi_flags = flags;
1266 rc = obd_statfs_async(exp, &oinfo, max_age, set);
1268 rc = ptlrpc_set_wait(set);
1269 ptlrpc_set_destroy(set);
1273 /* @max_age is the oldest time in jiffies that we accept using a cached data.
1274 * If the cache is older than @max_age we will get a new value from the
1275 * target. Use a value of "cfs_time_current() + HZ" to guarantee freshness. */
1276 static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp,
1277 struct obd_statfs *osfs, __u64 max_age,
1281 struct obd_device *obd = exp->exp_obd;
1287 OBD_CHECK_DT_OP(obd, statfs, -EOPNOTSUPP);
1288 OBD_COUNTER_INCREMENT(obd, statfs);
1290 CDEBUG(D_SUPER, "osfs "LPU64", max_age "LPU64"\n",
1291 obd->obd_osfs_age, max_age);
1292 if (cfs_time_before_64(obd->obd_osfs_age, max_age)) {
1293 rc = OBP(obd, statfs)(env, exp, osfs, max_age, flags);
1295 cfs_spin_lock(&obd->obd_osfs_lock);
1296 memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
1297 obd->obd_osfs_age = cfs_time_current_64();
1298 cfs_spin_unlock(&obd->obd_osfs_lock);
1301 CDEBUG(D_SUPER,"%s: use %p cache blocks "LPU64"/"LPU64
1302 " objects "LPU64"/"LPU64"\n",
1303 obd->obd_name, &obd->obd_osfs,
1304 obd->obd_osfs.os_bavail, obd->obd_osfs.os_blocks,
1305 obd->obd_osfs.os_ffree, obd->obd_osfs.os_files);
1306 cfs_spin_lock(&obd->obd_osfs_lock);
1307 memcpy(osfs, &obd->obd_osfs, sizeof(*osfs));
1308 cfs_spin_unlock(&obd->obd_osfs_lock);
1313 static inline int obd_sync_rqset(struct obd_export *exp, struct obd_info *oinfo,
1314 obd_size start, obd_size end)
1316 struct ptlrpc_request_set *set = NULL;
1320 OBD_CHECK_DT_OP(exp->exp_obd, sync, -EOPNOTSUPP);
1321 EXP_COUNTER_INCREMENT(exp, sync);
1323 set = ptlrpc_prep_set();
1327 rc = OBP(exp->exp_obd, sync)(NULL, exp, oinfo, start, end, set);
1329 rc = ptlrpc_set_wait(set);
1330 ptlrpc_set_destroy(set);
1334 static inline int obd_sync(const struct lu_env *env, struct obd_export *exp,
1335 struct obd_info *oinfo, obd_size start, obd_size end,
1336 struct ptlrpc_request_set *set)
1341 OBD_CHECK_DT_OP(exp->exp_obd, sync, -EOPNOTSUPP);
1342 EXP_COUNTER_INCREMENT(exp, sync);
1344 rc = OBP(exp->exp_obd, sync)(env, exp, oinfo, start, end, set);
1348 static inline int obd_punch_rqset(struct obd_export *exp,
1349 struct obd_info *oinfo,
1350 struct obd_trans_info *oti)
1352 struct ptlrpc_request_set *set = NULL;
1356 EXP_CHECK_DT_OP(exp, punch);
1357 EXP_COUNTER_INCREMENT(exp, punch);
1359 set = ptlrpc_prep_set();
1363 rc = OBP(exp->exp_obd, punch)(NULL, exp, oinfo, oti, set);
1365 rc = ptlrpc_set_wait(set);
1366 ptlrpc_set_destroy(set);
1370 static inline int obd_punch(const struct lu_env *env, struct obd_export *exp,
1371 struct obd_info *oinfo, struct obd_trans_info *oti,
1372 struct ptlrpc_request_set *rqset)
1377 EXP_CHECK_DT_OP(exp, punch);
1378 EXP_COUNTER_INCREMENT(exp, punch);
1380 rc = OBP(exp->exp_obd, punch)(env, exp, oinfo, oti, rqset);
1384 static inline int obd_brw(int cmd, struct obd_export *exp,
1385 struct obd_info *oinfo, obd_count oa_bufs,
1386 struct brw_page *pg, struct obd_trans_info *oti)
1391 EXP_CHECK_DT_OP(exp, brw);
1392 EXP_COUNTER_INCREMENT(exp, brw);
1394 if (!(cmd & (OBD_BRW_RWMASK | OBD_BRW_CHECK))) {
1395 CERROR("obd_brw: cmd must be OBD_BRW_READ, OBD_BRW_WRITE, "
1396 "or OBD_BRW_CHECK\n");
1400 rc = OBP(exp->exp_obd, brw)(cmd, exp, oinfo, oa_bufs, pg, oti);
1404 static inline int obd_preprw(const struct lu_env *env, int cmd,
1405 struct obd_export *exp, struct obdo *oa,
1406 int objcount, struct obd_ioobj *obj,
1407 struct niobuf_remote *remote, int *pages,
1408 struct niobuf_local *local,
1409 struct obd_trans_info *oti,
1410 struct lustre_capa *capa)
1415 EXP_CHECK_DT_OP(exp, preprw);
1416 EXP_COUNTER_INCREMENT(exp, preprw);
1418 rc = OBP(exp->exp_obd, preprw)(env, cmd, exp, oa, objcount, obj, remote,
1419 pages, local, oti, capa);
1423 static inline int obd_commitrw(const struct lu_env *env, int cmd,
1424 struct obd_export *exp, struct obdo *oa,
1425 int objcount, struct obd_ioobj *obj,
1426 struct niobuf_remote *rnb, int pages,
1427 struct niobuf_local *local,
1428 struct obd_trans_info *oti, int rc)
1432 EXP_CHECK_DT_OP(exp, commitrw);
1433 EXP_COUNTER_INCREMENT(exp, commitrw);
1435 rc = OBP(exp->exp_obd, commitrw)(env, cmd, exp, oa, objcount, obj,
1436 rnb, pages, local, oti, rc);
1440 static inline int obd_merge_lvb(struct obd_export *exp,
1441 struct lov_stripe_md *lsm,
1442 struct ost_lvb *lvb, int kms_only)
1447 EXP_CHECK_DT_OP(exp, merge_lvb);
1448 EXP_COUNTER_INCREMENT(exp, merge_lvb);
1450 rc = OBP(exp->exp_obd, merge_lvb)(exp, lsm, lvb, kms_only);
1454 static inline int obd_adjust_kms(struct obd_export *exp,
1455 struct lov_stripe_md *lsm, obd_off size,
1461 EXP_CHECK_DT_OP(exp, adjust_kms);
1462 EXP_COUNTER_INCREMENT(exp, adjust_kms);
1464 rc = OBP(exp->exp_obd, adjust_kms)(exp, lsm, size, shrink);
1468 static inline int obd_iocontrol(unsigned int cmd, struct obd_export *exp,
1469 int len, void *karg, void *uarg)
1474 EXP_CHECK_DT_OP(exp, iocontrol);
1475 EXP_COUNTER_INCREMENT(exp, iocontrol);
1477 rc = OBP(exp->exp_obd, iocontrol)(cmd, exp, len, karg, uarg);
1481 static inline int obd_enqueue_rqset(struct obd_export *exp,
1482 struct obd_info *oinfo,
1483 struct ldlm_enqueue_info *einfo)
1485 struct ptlrpc_request_set *set = NULL;
1489 EXP_CHECK_DT_OP(exp, enqueue);
1490 EXP_COUNTER_INCREMENT(exp, enqueue);
1492 set = ptlrpc_prep_set();
1496 rc = OBP(exp->exp_obd, enqueue)(exp, oinfo, einfo, set);
1498 rc = ptlrpc_set_wait(set);
1499 ptlrpc_set_destroy(set);
1503 static inline int obd_enqueue(struct obd_export *exp,
1504 struct obd_info *oinfo,
1505 struct ldlm_enqueue_info *einfo,
1506 struct ptlrpc_request_set *set)
1511 EXP_CHECK_DT_OP(exp, enqueue);
1512 EXP_COUNTER_INCREMENT(exp, enqueue);
1514 rc = OBP(exp->exp_obd, enqueue)(exp, oinfo, einfo, set);
1518 static inline int obd_change_cbdata(struct obd_export *exp,
1519 struct lov_stripe_md *lsm,
1520 ldlm_iterator_t it, void *data)
1525 EXP_CHECK_DT_OP(exp, change_cbdata);
1526 EXP_COUNTER_INCREMENT(exp, change_cbdata);
1528 rc = OBP(exp->exp_obd, change_cbdata)(exp, lsm, it, data);
1532 static inline int obd_find_cbdata(struct obd_export *exp,
1533 struct lov_stripe_md *lsm,
1534 ldlm_iterator_t it, void *data)
1539 EXP_CHECK_DT_OP(exp, find_cbdata);
1540 EXP_COUNTER_INCREMENT(exp, find_cbdata);
1542 rc = OBP(exp->exp_obd, find_cbdata)(exp, lsm, it, data);
1546 static inline int obd_cancel(struct obd_export *exp,
1547 struct lov_stripe_md *ea, __u32 mode,
1548 struct lustre_handle *lockh)
1553 EXP_CHECK_DT_OP(exp, cancel);
1554 EXP_COUNTER_INCREMENT(exp, cancel);
1556 rc = OBP(exp->exp_obd, cancel)(exp, ea, mode, lockh);
1560 static inline int obd_cancel_unused(struct obd_export *exp,
1561 struct lov_stripe_md *ea,
1562 ldlm_cancel_flags_t flags,
1568 EXP_CHECK_DT_OP(exp, cancel_unused);
1569 EXP_COUNTER_INCREMENT(exp, cancel_unused);
1571 rc = OBP(exp->exp_obd, cancel_unused)(exp, ea, flags, opaque);
1575 static inline int obd_pin(struct obd_export *exp, const struct lu_fid *fid,
1576 struct obd_capa *oc, struct obd_client_handle *handle,
1582 EXP_CHECK_DT_OP(exp, pin);
1583 EXP_COUNTER_INCREMENT(exp, pin);
1585 rc = OBP(exp->exp_obd, pin)(exp, fid, oc, handle, flag);
1589 static inline int obd_unpin(struct obd_export *exp,
1590 struct obd_client_handle *handle, int flag)
1595 EXP_CHECK_DT_OP(exp, unpin);
1596 EXP_COUNTER_INCREMENT(exp, unpin);
1598 rc = OBP(exp->exp_obd, unpin)(exp, handle, flag);
1603 static inline void obd_import_event(struct obd_device *obd,
1604 struct obd_import *imp,
1605 enum obd_import_event event)
1609 CERROR("NULL device\n");
1613 if (obd->obd_set_up && OBP(obd, import_event)) {
1614 OBD_COUNTER_INCREMENT(obd, import_event);
1615 OBP(obd, import_event)(obd, imp, event);
1620 static inline int obd_llog_connect(struct obd_export *exp,
1621 struct llogd_conn_body *body)
1626 OBD_CHECK_DT_OP(exp->exp_obd, llog_connect, 0);
1627 EXP_COUNTER_INCREMENT(exp, llog_connect);
1629 rc = OBP(exp->exp_obd, llog_connect)(exp, body);
1634 static inline int obd_notify(struct obd_device *obd,
1635 struct obd_device *watched,
1636 enum obd_notify_event ev,
1643 /* the check for async_recov is a complete hack - I'm hereby
1644 overloading the meaning to also mean "this was called from
1645 mds_postsetup". I know that my mds is able to handle notifies
1646 by this point, and it needs to get them to execute mds_postrecov. */
1647 if (!obd->obd_set_up && !obd->obd_async_recov) {
1648 CDEBUG(D_HA, "obd %s not set up\n", obd->obd_name);
1652 if (!OBP(obd, notify)) {
1653 CDEBUG(D_HA, "obd %s has no notify handler\n", obd->obd_name);
1657 OBD_COUNTER_INCREMENT(obd, notify);
1658 rc = OBP(obd, notify)(obd, watched, ev, data);
1662 static inline int obd_notify_observer(struct obd_device *observer,
1663 struct obd_device *observed,
1664 enum obd_notify_event ev,
1670 struct obd_notify_upcall *onu;
1672 if (observer->obd_observer)
1673 rc1 = obd_notify(observer->obd_observer, observed, ev, data);
1677 * Also, call non-obd listener, if any
1679 onu = &observer->obd_upcall;
1680 if (onu->onu_upcall != NULL)
1681 rc2 = onu->onu_upcall(observer, observed, ev,
1682 onu->onu_owner, NULL);
1686 return rc1 ? rc1 : rc2;
1689 static inline int obd_quotacheck(struct obd_export *exp,
1690 struct obd_quotactl *oqctl)
1695 EXP_CHECK_DT_OP(exp, quotacheck);
1696 EXP_COUNTER_INCREMENT(exp, quotacheck);
1698 rc = OBP(exp->exp_obd, quotacheck)(exp->exp_obd, exp, oqctl);
1702 static inline int obd_quotactl(struct obd_export *exp,
1703 struct obd_quotactl *oqctl)
1708 EXP_CHECK_DT_OP(exp, quotactl);
1709 EXP_COUNTER_INCREMENT(exp, quotactl);
1711 rc = OBP(exp->exp_obd, quotactl)(exp->exp_obd, exp, oqctl);
1715 static inline int obd_quota_adjust_qunit(struct obd_export *exp,
1716 struct quota_adjust_qunit *oqaq,
1717 struct lustre_quota_ctxt *qctxt,
1718 struct ptlrpc_request_set *set)
1720 #if defined(LPROCFS) && defined(HAVE_QUOTA_SUPPORT)
1721 struct timeval work_start;
1722 struct timeval work_end;
1728 #if defined(LPROCFS) && defined(HAVE_QUOTA_SUPPORT)
1730 cfs_gettimeofday(&work_start);
1732 EXP_CHECK_DT_OP(exp, quota_adjust_qunit);
1733 EXP_COUNTER_INCREMENT(exp, quota_adjust_qunit);
1735 rc = OBP(exp->exp_obd, quota_adjust_qunit)(exp, oqaq, qctxt, set);
1737 #if defined(LPROCFS) && defined(HAVE_QUOTA_SUPPORT)
1739 cfs_gettimeofday(&work_end);
1740 timediff = cfs_timeval_sub(&work_end, &work_start, NULL);
1741 lprocfs_counter_add(qctxt->lqc_stats, LQUOTA_ADJUST_QUNIT,
1748 static inline int obd_health_check(const struct lu_env *env,
1749 struct obd_device *obd)
1751 /* returns: 0 on healthy
1752 * >0 on unhealthy + reason code/flag
1753 * however the only suppored reason == 1 right now
1754 * We'll need to define some better reasons
1755 * or flags in the future.
1761 /* don't use EXP_CHECK_DT_OP, because NULL method is normal here */
1762 if (obd == NULL || !OBT(obd)) {
1763 CERROR("cleaned up obd\n");
1764 RETURN(-EOPNOTSUPP);
1766 if (!obd->obd_set_up || obd->obd_stopping)
1768 if (!OBP(obd, health_check))
1771 rc = OBP(obd, health_check)(env, obd);
1775 static inline int obd_register_observer(struct obd_device *obd,
1776 struct obd_device *observer)
1780 cfs_down_write(&obd->obd_observer_link_sem);
1781 if (obd->obd_observer && observer) {
1782 cfs_up_write(&obd->obd_observer_link_sem);
1785 obd->obd_observer = observer;
1786 cfs_up_write(&obd->obd_observer_link_sem);
1790 static inline int obd_pin_observer(struct obd_device *obd,
1791 struct obd_device **observer)
1794 cfs_down_read(&obd->obd_observer_link_sem);
1795 if (!obd->obd_observer) {
1797 cfs_up_read(&obd->obd_observer_link_sem);
1800 *observer = obd->obd_observer;
1804 static inline int obd_unpin_observer(struct obd_device *obd)
1807 cfs_up_read(&obd->obd_observer_link_sem);
1812 static inline int obd_register_page_removal_cb(struct obd_export *exp,
1813 obd_page_removal_cb_t cb,
1814 obd_pin_extent_cb pin_cb)
1819 OBD_CHECK_DT_OP(exp->exp_obd, register_page_removal_cb, 0);
1820 OBD_COUNTER_INCREMENT(exp->exp_obd, register_page_removal_cb);
1822 rc = OBP(exp->exp_obd, register_page_removal_cb)(exp, cb, pin_cb);
1826 static inline int obd_unregister_page_removal_cb(struct obd_export *exp,
1827 obd_page_removal_cb_t cb)
1832 OBD_CHECK_DT_OP(exp->exp_obd, unregister_page_removal_cb, 0);
1833 OBD_COUNTER_INCREMENT(exp->exp_obd, unregister_page_removal_cb);
1835 rc = OBP(exp->exp_obd, unregister_page_removal_cb)(exp, cb);
1839 static inline int obd_register_lock_cancel_cb(struct obd_export *exp,
1840 obd_lock_cancel_cb cb)
1845 OBD_CHECK_DT_OP(exp->exp_obd, register_lock_cancel_cb, 0);
1846 OBD_COUNTER_INCREMENT(exp->exp_obd, register_lock_cancel_cb);
1848 rc = OBP(exp->exp_obd, register_lock_cancel_cb)(exp, cb);
1852 static inline int obd_unregister_lock_cancel_cb(struct obd_export *exp,
1853 obd_lock_cancel_cb cb)
1858 OBD_CHECK_DT_OP(exp->exp_obd, unregister_lock_cancel_cb, 0);
1859 OBD_COUNTER_INCREMENT(exp->exp_obd, unregister_lock_cancel_cb);
1861 rc = OBP(exp->exp_obd, unregister_lock_cancel_cb)(exp, cb);
1866 /* metadata helpers */
1867 static inline int md_getstatus(struct obd_export *exp,
1868 struct lu_fid *fid, struct obd_capa **pc)
1873 EXP_CHECK_MD_OP(exp, getstatus);
1874 EXP_MD_COUNTER_INCREMENT(exp, getstatus);
1875 rc = MDP(exp->exp_obd, getstatus)(exp, fid, pc);
1879 static inline int md_getattr(struct obd_export *exp, struct md_op_data *op_data,
1880 struct ptlrpc_request **request)
1884 EXP_CHECK_MD_OP(exp, getattr);
1885 EXP_MD_COUNTER_INCREMENT(exp, getattr);
1886 rc = MDP(exp->exp_obd, getattr)(exp, op_data, request);
1890 static inline int md_change_cbdata(struct obd_export *exp,
1891 const struct lu_fid *fid,
1892 ldlm_iterator_t it, void *data)
1896 EXP_CHECK_MD_OP(exp, change_cbdata);
1897 EXP_MD_COUNTER_INCREMENT(exp, change_cbdata);
1898 rc = MDP(exp->exp_obd, change_cbdata)(exp, fid, it, data);
1902 static inline int md_find_cbdata(struct obd_export *exp,
1903 const struct lu_fid *fid,
1904 ldlm_iterator_t it, void *data)
1908 EXP_CHECK_MD_OP(exp, find_cbdata);
1909 EXP_MD_COUNTER_INCREMENT(exp, find_cbdata);
1910 rc = MDP(exp->exp_obd, find_cbdata)(exp, fid, it, data);
1914 static inline int md_close(struct obd_export *exp, struct md_op_data *op_data,
1915 struct md_open_data *mod,
1916 struct ptlrpc_request **request)
1920 EXP_CHECK_MD_OP(exp, close);
1921 EXP_MD_COUNTER_INCREMENT(exp, close);
1922 rc = MDP(exp->exp_obd, close)(exp, op_data, mod, request);
1926 static inline int md_create(struct obd_export *exp, struct md_op_data *op_data,
1927 const void *data, int datalen, int mode, __u32 uid,
1928 __u32 gid, cfs_cap_t cap_effective, __u64 rdev,
1929 struct ptlrpc_request **request)
1933 EXP_CHECK_MD_OP(exp, create);
1934 EXP_MD_COUNTER_INCREMENT(exp, create);
1935 rc = MDP(exp->exp_obd, create)(exp, op_data, data, datalen, mode,
1936 uid, gid, cap_effective, rdev, request);
1940 static inline int md_done_writing(struct obd_export *exp,
1941 struct md_op_data *op_data,
1942 struct md_open_data *mod)
1946 EXP_CHECK_MD_OP(exp, done_writing);
1947 EXP_MD_COUNTER_INCREMENT(exp, done_writing);
1948 rc = MDP(exp->exp_obd, done_writing)(exp, op_data, mod);
1952 static inline int md_enqueue(struct obd_export *exp,
1953 struct ldlm_enqueue_info *einfo,
1954 struct lookup_intent *it,
1955 struct md_op_data *op_data,
1956 struct lustre_handle *lockh,
1957 void *lmm, int lmmsize,
1958 struct ptlrpc_request **req,
1959 int extra_lock_flags)
1963 EXP_CHECK_MD_OP(exp, enqueue);
1964 EXP_MD_COUNTER_INCREMENT(exp, enqueue);
1965 rc = MDP(exp->exp_obd, enqueue)(exp, einfo, it, op_data, lockh,
1966 lmm, lmmsize, req, extra_lock_flags);
1970 static inline int md_getattr_name(struct obd_export *exp,
1971 struct md_op_data *op_data,
1972 struct ptlrpc_request **request)
1976 EXP_CHECK_MD_OP(exp, getattr_name);
1977 EXP_MD_COUNTER_INCREMENT(exp, getattr_name);
1978 rc = MDP(exp->exp_obd, getattr_name)(exp, op_data, request);
1982 static inline int md_intent_lock(struct obd_export *exp,
1983 struct md_op_data *op_data, void *lmm,
1984 int lmmsize, struct lookup_intent *it,
1985 int flags, struct ptlrpc_request **reqp,
1986 ldlm_blocking_callback cb_blocking,
1987 int extra_lock_flags)
1991 EXP_CHECK_MD_OP(exp, intent_lock);
1992 EXP_MD_COUNTER_INCREMENT(exp, intent_lock);
1993 rc = MDP(exp->exp_obd, intent_lock)(exp, op_data, lmm, lmmsize,
1994 it, flags, reqp, cb_blocking,
1999 static inline int md_link(struct obd_export *exp, struct md_op_data *op_data,
2000 struct ptlrpc_request **request)
2004 EXP_CHECK_MD_OP(exp, link);
2005 EXP_MD_COUNTER_INCREMENT(exp, link);
2006 rc = MDP(exp->exp_obd, link)(exp, op_data, request);
2010 static inline int md_rename(struct obd_export *exp, struct md_op_data *op_data,
2011 const char *old, int oldlen, const char *new,
2012 int newlen, struct ptlrpc_request **request)
2016 EXP_CHECK_MD_OP(exp, rename);
2017 EXP_MD_COUNTER_INCREMENT(exp, rename);
2018 rc = MDP(exp->exp_obd, rename)(exp, op_data, old, oldlen, new,
2023 static inline int md_is_subdir(struct obd_export *exp,
2024 const struct lu_fid *pfid,
2025 const struct lu_fid *cfid,
2026 struct ptlrpc_request **request)
2030 EXP_CHECK_MD_OP(exp, is_subdir);
2031 EXP_MD_COUNTER_INCREMENT(exp, is_subdir);
2032 rc = MDP(exp->exp_obd, is_subdir)(exp, pfid, cfid, request);
2036 static inline int md_setattr(struct obd_export *exp, struct md_op_data *op_data,
2037 void *ea, int ealen, void *ea2, int ea2len,
2038 struct ptlrpc_request **request,
2039 struct md_open_data **mod)
2043 EXP_CHECK_MD_OP(exp, setattr);
2044 EXP_MD_COUNTER_INCREMENT(exp, setattr);
2045 rc = MDP(exp->exp_obd, setattr)(exp, op_data, ea, ealen,
2046 ea2, ea2len, request, mod);
2050 static inline int md_sync(struct obd_export *exp, const struct lu_fid *fid,
2051 struct obd_capa *oc, struct ptlrpc_request **request)
2055 EXP_CHECK_MD_OP(exp, sync);
2056 EXP_MD_COUNTER_INCREMENT(exp, sync);
2057 rc = MDP(exp->exp_obd, sync)(exp, fid, oc, request);
2061 static inline int md_readpage(struct obd_export *exp, struct md_op_data *opdata,
2062 struct page **pages,
2063 struct ptlrpc_request **request)
2067 EXP_CHECK_MD_OP(exp, readpage);
2068 EXP_MD_COUNTER_INCREMENT(exp, readpage);
2069 rc = MDP(exp->exp_obd, readpage)(exp, opdata, pages, request);
2073 static inline int md_unlink(struct obd_export *exp, struct md_op_data *op_data,
2074 struct ptlrpc_request **request)
2078 EXP_CHECK_MD_OP(exp, unlink);
2079 EXP_MD_COUNTER_INCREMENT(exp, unlink);
2080 rc = MDP(exp->exp_obd, unlink)(exp, op_data, request);
2084 static inline int md_get_lustre_md(struct obd_export *exp,
2085 struct ptlrpc_request *req,
2086 struct obd_export *dt_exp,
2087 struct obd_export *md_exp,
2088 struct lustre_md *md)
2091 EXP_CHECK_MD_OP(exp, get_lustre_md);
2092 EXP_MD_COUNTER_INCREMENT(exp, get_lustre_md);
2093 RETURN(MDP(exp->exp_obd, get_lustre_md)(exp, req, dt_exp, md_exp, md));
2096 static inline int md_free_lustre_md(struct obd_export *exp,
2097 struct lustre_md *md)
2100 EXP_CHECK_MD_OP(exp, free_lustre_md);
2101 EXP_MD_COUNTER_INCREMENT(exp, free_lustre_md);
2102 RETURN(MDP(exp->exp_obd, free_lustre_md)(exp, md));
2105 static inline int md_setxattr(struct obd_export *exp,
2106 const struct lu_fid *fid, struct obd_capa *oc,
2107 obd_valid valid, const char *name,
2108 const char *input, int input_size,
2109 int output_size, int flags, __u32 suppgid,
2110 struct ptlrpc_request **request)
2113 EXP_CHECK_MD_OP(exp, setxattr);
2114 EXP_MD_COUNTER_INCREMENT(exp, setxattr);
2115 RETURN(MDP(exp->exp_obd, setxattr)(exp, fid, oc, valid, name, input,
2116 input_size, output_size, flags,
2120 static inline int md_getxattr(struct obd_export *exp,
2121 const struct lu_fid *fid, struct obd_capa *oc,
2122 obd_valid valid, const char *name,
2123 const char *input, int input_size,
2124 int output_size, int flags,
2125 struct ptlrpc_request **request)
2128 EXP_CHECK_MD_OP(exp, getxattr);
2129 EXP_MD_COUNTER_INCREMENT(exp, getxattr);
2130 RETURN(MDP(exp->exp_obd, getxattr)(exp, fid, oc, valid, name, input,
2131 input_size, output_size, flags,
2135 static inline int md_set_open_replay_data(struct obd_export *exp,
2136 struct obd_client_handle *och,
2137 struct ptlrpc_request *open_req)
2140 EXP_CHECK_MD_OP(exp, set_open_replay_data);
2141 EXP_MD_COUNTER_INCREMENT(exp, set_open_replay_data);
2142 RETURN(MDP(exp->exp_obd, set_open_replay_data)(exp, och, open_req));
2145 static inline int md_clear_open_replay_data(struct obd_export *exp,
2146 struct obd_client_handle *och)
2149 EXP_CHECK_MD_OP(exp, clear_open_replay_data);
2150 EXP_MD_COUNTER_INCREMENT(exp, clear_open_replay_data);
2151 RETURN(MDP(exp->exp_obd, clear_open_replay_data)(exp, och));
2154 static inline int md_set_lock_data(struct obd_export *exp,
2155 __u64 *lockh, void *data, __u64 *bits)
2158 EXP_CHECK_MD_OP(exp, set_lock_data);
2159 EXP_MD_COUNTER_INCREMENT(exp, set_lock_data);
2160 RETURN(MDP(exp->exp_obd, set_lock_data)(exp, lockh, data, bits));
2163 static inline int md_cancel_unused(struct obd_export *exp,
2164 const struct lu_fid *fid,
2165 ldlm_policy_data_t *policy,
2167 ldlm_cancel_flags_t flags,
2173 EXP_CHECK_MD_OP(exp, cancel_unused);
2174 EXP_MD_COUNTER_INCREMENT(exp, cancel_unused);
2176 rc = MDP(exp->exp_obd, cancel_unused)(exp, fid, policy, mode,
2181 static inline ldlm_mode_t md_lock_match(struct obd_export *exp, int flags,
2182 const struct lu_fid *fid,
2184 ldlm_policy_data_t *policy,
2186 struct lustre_handle *lockh)
2189 EXP_CHECK_MD_OP(exp, lock_match);
2190 EXP_MD_COUNTER_INCREMENT(exp, lock_match);
2191 RETURN(MDP(exp->exp_obd, lock_match)(exp, flags, fid, type,
2192 policy, mode, lockh));
2195 static inline int md_init_ea_size(struct obd_export *exp, int easize,
2196 int def_asize, int cookiesize)
2199 EXP_CHECK_MD_OP(exp, init_ea_size);
2200 EXP_MD_COUNTER_INCREMENT(exp, init_ea_size);
2201 RETURN(MDP(exp->exp_obd, init_ea_size)(exp, easize, def_asize,
2205 static inline int md_get_remote_perm(struct obd_export *exp,
2206 const struct lu_fid *fid,
2207 struct obd_capa *oc, __u32 suppgid,
2208 struct ptlrpc_request **request)
2211 EXP_CHECK_MD_OP(exp, get_remote_perm);
2212 EXP_MD_COUNTER_INCREMENT(exp, get_remote_perm);
2213 RETURN(MDP(exp->exp_obd, get_remote_perm)(exp, fid, oc, suppgid,
2217 static inline int md_renew_capa(struct obd_export *exp, struct obd_capa *ocapa,
2222 EXP_CHECK_MD_OP(exp, renew_capa);
2223 EXP_MD_COUNTER_INCREMENT(exp, renew_capa);
2224 rc = MDP(exp->exp_obd, renew_capa)(exp, ocapa, cb);
2228 static inline int md_unpack_capa(struct obd_export *exp,
2229 struct ptlrpc_request *req,
2230 const struct req_msg_field *field,
2231 struct obd_capa **oc)
2235 EXP_CHECK_MD_OP(exp, unpack_capa);
2236 EXP_MD_COUNTER_INCREMENT(exp, unpack_capa);
2237 rc = MDP(exp->exp_obd, unpack_capa)(exp, req, field, oc);
2241 static inline int md_intent_getattr_async(struct obd_export *exp,
2242 struct md_enqueue_info *minfo,
2243 struct ldlm_enqueue_info *einfo)
2247 EXP_CHECK_MD_OP(exp, intent_getattr_async);
2248 EXP_MD_COUNTER_INCREMENT(exp, intent_getattr_async);
2249 rc = MDP(exp->exp_obd, intent_getattr_async)(exp, minfo, einfo);
2253 static inline int md_revalidate_lock(struct obd_export *exp,
2254 struct lookup_intent *it,
2255 struct lu_fid *fid, __u64 *bits)
2259 EXP_CHECK_MD_OP(exp, revalidate_lock);
2260 EXP_MD_COUNTER_INCREMENT(exp, revalidate_lock);
2261 rc = MDP(exp->exp_obd, revalidate_lock)(exp, it, fid, bits);
2266 /* OBD Metadata Support */
2268 extern int obd_init_caches(void);
2269 extern void obd_cleanup_caches(void);
2271 /* support routines */
2272 extern cfs_mem_cache_t *obdo_cachep;
2274 #define OBDO_ALLOC(ptr) \
2276 OBD_SLAB_ALLOC_PTR_GFP((ptr), obdo_cachep, CFS_ALLOC_IO); \
2279 #define OBDO_FREE(ptr) \
2281 OBD_SLAB_FREE_PTR((ptr), obdo_cachep); \
2285 static inline void obdo2fid(struct obdo *oa, struct lu_fid *fid)
2287 /* something here */
2290 static inline void fid2obdo(struct lu_fid *fid, struct obdo *oa)
2292 /* something here */
2295 /* I'm as embarrassed about this as you are.
2297 * <shaver> // XXX do not look into _superhack with remaining eye
2298 * <shaver> // XXX if this were any uglier, I'd get my own show on MTV */
2299 extern int (*ptlrpc_put_connection_superhack)(struct ptlrpc_connection *c);
2302 extern void obd_sysctl_init (void);
2303 extern void obd_sysctl_clean (void);
2306 typedef __u8 class_uuid_t[16];
2307 void class_uuid_unparse(class_uuid_t in, struct obd_uuid *out);
2310 int lustre_uuid_to_peer(const char *uuid, lnet_nid_t *peer_nid, int index);
2311 int class_add_uuid(const char *uuid, __u64 nid);
2312 int class_del_uuid (const char *uuid);
2313 int class_check_uuid(struct obd_uuid *uuid, __u64 nid);
2314 void class_init_uuidlist(void);
2315 void class_exit_uuidlist(void);
2318 int mea_name2idx(struct lmv_stripe_md *mea, const char *name, int namelen);
2319 int raw_name2idx(int hashtype, int count, const char *name, int namelen);
2322 #define ll_generate_random_uuid(uuid_out) cfs_get_random_bytes(uuid_out, sizeof(class_uuid_t))
2324 #endif /* __LINUX_OBD_CLASS_H */