1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001-2003 Cluster File Systems, Inc.
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifndef __LINUX_CLASS_OBD_H
24 #define __LINUX_CLASS_OBD_H
27 #include <sys/types.h>
28 #include <portals/list.h>
30 #include <asm/segment.h>
31 #include <asm/uaccess.h>
32 #include <linux/types.h>
34 #include <linux/time.h>
35 #include <linux/timer.h>
38 #include <linux/obd_support.h>
39 #include <linux/lustre_import.h>
40 #include <linux/lustre_net.h>
41 #include <linux/obd.h>
42 #include <linux/lustre_lib.h>
43 #include <linux/lustre_idl.h>
44 #include <linux/lprocfs_status.h>
45 #include <linux/lustre_log.h>
47 /* OBD Device Declarations */
48 #define MAX_OBD_DEVICES 256
49 extern struct obd_device obd_dev[MAX_OBD_DEVICES];
50 extern spinlock_t obd_dev_lock;
52 /* OBD Operations Declarations */
53 extern struct obd_device *class_conn2obd(struct lustre_handle *);
54 extern struct obd_device *class_exp2obd(struct obd_export *);
57 struct obd_export *class_conn2export(struct lustre_handle *);
58 int class_register_type(struct obd_ops *ops, struct md_ops *md_ops,
59 struct lprocfs_vars *, char *nm);
60 int class_unregister_type(char *nm);
62 struct obd_device *class_newdev(struct obd_type *type);
63 void class_release_dev(struct obd_device *obd);
65 int class_name2dev(char *name);
66 struct obd_device *class_name2obd(char *name);
67 int class_uuid2dev(struct obd_uuid *uuid);
68 struct obd_device *class_uuid2obd(struct obd_uuid *uuid);
69 struct obd_device * class_find_client_obd(struct obd_uuid *tgt_uuid,
71 struct obd_uuid *grp_uuid);
72 struct obd_device * class_devices_in_group(struct obd_uuid *grp_uuid,
75 int oig_init(struct obd_io_group **oig);
76 void oig_add_one(struct obd_io_group *oig,
77 struct oig_callback_context *occ);
78 void oig_complete_one(struct obd_io_group *oig,
79 struct oig_callback_context *occ, int rc);
80 void oig_release(struct obd_io_group *oig);
81 int oig_wait(struct obd_io_group *oig);
84 int class_process_config(struct lustre_cfg *lcfg);
86 /* Passed as data param to class_config_parse_handler() */
87 struct config_llog_instance {
89 struct obd_uuid cfg_uuid;
90 ptl_nid_t cfg_local_nid;
92 int class_config_parse_llog(struct llog_ctxt *ctxt, char *name,
93 struct config_llog_instance *cfg);
95 int class_config_process_llog(struct llog_ctxt *ctxt, char *name,
96 struct config_llog_instance *cfg);
97 int class_config_dump_llog(struct llog_ctxt *ctxt, char *name,
98 struct config_llog_instance *cfg);
100 struct lustre_profile {
101 struct list_head lp_list;
107 struct lustre_profile *class_get_profile(char * prof);
108 void class_del_profile(char *prof);
110 #define class_export_rpc_get(exp) \
112 atomic_inc(&(exp)->exp_rpc_count); \
113 CDEBUG(D_INFO, "RPC GETting export %p : new rpc_count %d\n", \
114 (exp), atomic_read(&(exp)->exp_rpc_count)); \
115 class_export_get(exp); \
118 #define class_export_rpc_put(exp) \
120 atomic_dec(&(exp)->exp_rpc_count); \
121 CDEBUG(D_INFO, "RPC PUTting export %p : new rpc_count %d\n", \
122 (exp), atomic_read(&(exp)->exp_rpc_count)); \
123 class_export_put(exp); \
126 #define class_export_get(exp) \
128 struct obd_export *exp_ = exp; \
129 atomic_inc(&exp_->exp_refcount); \
130 CDEBUG(D_INFO, "GETting export %p : new refcount %d\n", exp_, \
131 atomic_read(&exp_->exp_refcount)); \
135 #define class_export_put(exp) \
137 LASSERT((exp) != NULL); \
138 CDEBUG(D_INFO, "PUTting export %p : new refcount %d\n", (exp), \
139 atomic_read(&(exp)->exp_refcount) - 1); \
140 LASSERT(atomic_read(&(exp)->exp_refcount) > 0); \
141 LASSERT(atomic_read(&(exp)->exp_refcount) < 0x5a5a5a); \
142 __class_export_put(exp); \
145 void __class_export_put(struct obd_export *);
146 struct obd_export *class_new_export(struct obd_device *obddev);
147 void class_unlink_export(struct obd_export *exp);
149 struct obd_import *class_import_get(struct obd_import *);
150 void class_import_put(struct obd_import *);
151 struct obd_import *class_new_import(void);
152 void class_destroy_import(struct obd_import *exp);
154 struct obd_type *class_get_type(char *name);
155 void class_put_type(struct obd_type *type);
156 int class_connect(struct lustre_handle *conn, struct obd_device *obd,
157 struct obd_uuid *cluuid);
158 int class_disconnect(struct obd_export *exp, unsigned long flags);
159 void class_disconnect_exports(struct obd_device *obddev, unsigned long flags);
160 void class_disconnect_stale_exports(struct obd_device *obddev, unsigned long flags);
162 /* generic operations shared by various OBD types */
163 int class_multi_setup(struct obd_device *obddev, uint32_t len, void *data);
164 int class_multi_cleanup(struct obd_device *obddev);
168 void obdo_from_iattr(struct obdo *oa, struct iattr *attr, unsigned ia_valid);
169 void iattr_from_obdo(struct iattr *attr, struct obdo *oa, obd_valid valid);
170 void obdo_from_inode(struct obdo *dst, struct inode *src, obd_valid valid);
171 void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_valid valid);
172 void obdo_to_inode(struct inode *dst, struct obdo *src, obd_valid valid);
174 void obdo_cpy_md(struct obdo *dst, struct obdo *src, obd_valid valid);
175 int obdo_cmp_md(struct obdo *dst, struct obdo *src, obd_valid compare);
176 void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj);
178 static inline int obd_check_conn(struct lustre_handle *conn)
180 struct obd_device *obd;
182 CERROR("NULL conn\n");
186 obd = class_conn2obd(conn);
188 CERROR("NULL obd\n");
192 if (!obd->obd_attached) {
193 CERROR("obd %d not attached\n", obd->obd_minor);
197 if (!obd->obd_set_up) {
198 CERROR("obd %d not setup\n", obd->obd_minor);
202 if (!obd->obd_type) {
203 CERROR("obd %d not typed\n", obd->obd_minor);
207 if (!obd->obd_type->typ_ops) {
208 CERROR("obd_check_conn: obd %d no operations\n",
216 #define OBT(dev) (dev)->obd_type
217 #define OBP(dev, op) (dev)->obd_type->typ_ops->o_ ## op
218 #define MDP(dev, op) (dev)->obd_type->typ_md_ops->m_ ## op
219 #define CTXTP(ctxt, op) (ctxt)->loc_logops->lop_##op
221 /* Ensure obd_setup: used for disconnect which might be called while
222 an obd is stopping. */
223 #define OBD_CHECK_SETUP(conn, exp) \
226 CERROR("NULL connection\n"); \
230 exp = class_conn2export(conn); \
232 CERROR("No export for conn "LPX64"\n", (conn)->cookie); \
236 if (!(exp)->exp_obd->obd_set_up) { \
237 CERROR("Device %d not setup\n", \
238 (exp)->exp_obd->obd_minor); \
239 class_export_put(exp); \
244 /* Ensure obd_setup and !obd_stopping. */
245 #define OBD_CHECK_ACTIVE(conn, exp) \
248 CERROR("NULL connection\n"); \
252 exp = class_conn2export(conn); \
254 CERROR("No export for conn "LPX64"\n", (conn)->cookie); \
258 if (!(exp)->exp_obd->obd_set_up || (exp)->exp_obd->obd_stopping) { \
259 CERROR("Device %d not setup\n", \
260 (exp)->exp_obd->obd_minor); \
261 class_export_put(exp); \
266 /* Ensure obd_setup: used for cleanup which must be called
267 while obd is stopping */
268 #define OBD_CHECK_DEV_STOPPING(obd) \
271 CERROR("NULL device\n"); \
275 if (!(obd)->obd_set_up) { \
276 CERROR("Device %d not setup\n", \
281 if (!(obd)->obd_stopping) { \
282 CERROR("Device %d not stopping\n", \
288 /* ensure obd_setup and !obd_stopping */
289 #define OBD_CHECK_DEV_ACTIVE(obd) \
292 CERROR("NULL device\n"); \
296 if (!(obd)->obd_set_up || (obd)->obd_stopping) { \
297 CERROR("Device %d not setup\n", \
305 #define OBD_COUNTER_OFFSET(op) \
306 ((offsetof(struct obd_ops, o_ ## op) - \
307 offsetof(struct obd_ops, o_iocontrol)) \
308 / sizeof(((struct obd_ops *)(0))->o_iocontrol))
310 #define OBD_COUNTER_INCREMENT(obd, op) \
311 if ((obd)->obd_stats != NULL) { \
312 unsigned int coffset; \
313 coffset = (unsigned int)(obd)->obd_cntr_base + \
314 OBD_COUNTER_OFFSET(op); \
315 LASSERT(coffset < (obd)->obd_stats->ls_num); \
316 lprocfs_counter_incr((obd)->obd_stats, coffset); \
319 #define MD_COUNTER_OFFSET(op) \
320 ((offsetof(struct md_ops, m_ ## op) - \
321 offsetof(struct md_ops, m_getstatus)) \
322 / sizeof(((struct md_ops *)(0))->m_getstatus))
324 #define MD_COUNTER_INCREMENT(obd, op) \
325 if ((obd)->md_stats != NULL) { \
326 unsigned int coffset; \
327 coffset = (unsigned int)(obd)->md_cntr_base + \
328 MD_COUNTER_OFFSET(op); \
329 LASSERT(coffset < (obd)->md_stats->ls_num); \
330 lprocfs_counter_incr((obd)->md_stats, coffset); \
334 #define OBD_COUNTER_OFFSET(op)
335 #define OBD_COUNTER_INCREMENT(obd, op)
336 #define MD_COUNTER_INCREMENT(obd, op)
339 #define OBD_CHECK_MD_OP(obd, op, err) \
341 if (!OBT(obd) || !MDP((obd), op)) {\
343 CERROR("obd_md" #op ": dev %d no operation\n", \
349 #define EXP_CHECK_MD_OP(exp, op) \
351 if ((exp) == NULL) { \
352 CERROR("obd_" #op ": NULL export\n"); \
353 portals_debug_dumplog(); \
356 if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \
357 CERROR("obd_" #op ": cleaned up obd\n"); \
358 RETURN(-EOPNOTSUPP); \
360 if (!OBT((exp)->exp_obd) || !MDP((exp)->exp_obd, op)) { \
361 CERROR("obd_" #op ": dev %d no operation\n", \
362 (exp)->exp_obd->obd_minor); \
363 RETURN(-EOPNOTSUPP); \
367 #define OBD_CHECK_OP(obd, op, err) \
369 if (!OBT(obd) || !OBP((obd), op)) {\
371 CERROR("obd_" #op ": dev %d no operation\n", \
377 #define EXP_CHECK_OP(exp, op) \
379 if ((exp) == NULL) { \
380 CERROR("obd_" #op ": NULL export\n"); \
381 portals_debug_dumplog(); \
384 if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \
385 CERROR("obd_" #op ": cleaned up obd\n"); \
386 RETURN(-EOPNOTSUPP); \
388 if (!OBT((exp)->exp_obd) || !OBP((exp)->exp_obd, op)) { \
389 CERROR("obd_" #op ": dev %d no operation\n", \
390 (exp)->exp_obd->obd_minor); \
391 RETURN(-EOPNOTSUPP); \
395 #define CTXT_CHECK_OP(ctxt, op, err) \
397 if (!OBT(ctxt->loc_obd) || !CTXTP((ctxt), op)) { \
399 CERROR("lop_" #op ": dev %d no operation\n", \
400 ctxt->loc_obd->obd_minor); \
405 static inline int obd_get_info(struct obd_export *exp, __u32 keylen,
406 void *key, __u32 *vallen, void *val)
411 EXP_CHECK_OP(exp, get_info);
412 OBD_COUNTER_INCREMENT(exp->exp_obd, get_info);
414 rc = OBP(exp->exp_obd, get_info)(exp, keylen, key, vallen, val);
418 static inline int obd_set_info(struct obd_export *exp, obd_count keylen,
419 void *key, obd_count vallen, void *val)
424 EXP_CHECK_OP(exp, set_info);
425 OBD_COUNTER_INCREMENT(exp->exp_obd, set_info);
427 rc = OBP(exp->exp_obd, set_info)(exp, keylen, key, vallen, val);
431 static inline int obd_setup(struct obd_device *obd, int datalen, void *data)
436 OBD_CHECK_OP(obd, setup, -EOPNOTSUPP);
437 OBD_COUNTER_INCREMENT(obd, setup);
439 rc = OBP(obd, setup)(obd, datalen, data);
443 static inline int obd_precleanup(struct obd_device *obd, int flags)
448 OBD_CHECK_OP(obd, precleanup, 0);
449 OBD_COUNTER_INCREMENT(obd, precleanup);
451 rc = OBP(obd, precleanup)(obd, flags);
455 static inline int obd_cleanup(struct obd_device *obd, int flags)
460 OBD_CHECK_DEV_STOPPING(obd);
461 OBD_CHECK_OP(obd, cleanup, 0);
462 OBD_COUNTER_INCREMENT(obd, cleanup);
464 rc = OBP(obd, cleanup)(obd, flags);
469 obd_process_config(struct obd_device *obd, int datalen, void *data)
474 OBD_CHECK_OP(obd, process_config, -EOPNOTSUPP);
475 OBD_COUNTER_INCREMENT(obd, process_config);
477 rc = OBP(obd, process_config)(obd, datalen, data);
481 /* Pack an in-memory MD struct for storage on disk.
482 * Returns +ve size of packed MD (0 for free), or -ve error.
484 * If @disk_tgt == NULL, MD size is returned (max size if @mem_src == NULL).
485 * If @*disk_tgt != NULL and @mem_src == NULL, @*disk_tgt will be freed.
486 * If @*disk_tgt == NULL, it will be allocated
488 static inline int obd_packmd(struct obd_export *exp,
489 struct lov_mds_md **disk_tgt,
490 struct lov_stripe_md *mem_src)
495 EXP_CHECK_OP(exp, packmd);
496 OBD_COUNTER_INCREMENT(exp->exp_obd, packmd);
498 rc = OBP(exp->exp_obd, packmd)(exp, disk_tgt, mem_src);
502 static inline int obd_size_diskmd(struct obd_export *exp,
503 struct lov_stripe_md *mem_src)
505 return obd_packmd(exp, NULL, mem_src);
508 /* helper functions */
509 static inline int obd_alloc_diskmd(struct obd_export *exp,
510 struct lov_mds_md **disk_tgt)
513 LASSERT(*disk_tgt == NULL);
514 return obd_packmd(exp, disk_tgt, NULL);
517 static inline int obd_free_diskmd(struct obd_export *exp,
518 struct lov_mds_md **disk_tgt)
522 return obd_packmd(exp, disk_tgt, NULL);
525 /* Unpack an MD struct from disk to in-memory format.
526 * Returns +ve size of unpacked MD (0 for free), or -ve error.
528 * If @mem_tgt == NULL, MD size is returned (max size if @disk_src == NULL).
529 * If @*mem_tgt != NULL and @disk_src == NULL, @*mem_tgt will be freed.
530 * If @*mem_tgt == NULL, it will be allocated
532 static inline int obd_unpackmd(struct obd_export *exp,
533 struct lov_stripe_md **mem_tgt,
534 struct lov_mds_md *disk_src,
540 EXP_CHECK_OP(exp, unpackmd);
541 OBD_COUNTER_INCREMENT(exp->exp_obd, unpackmd);
543 rc = OBP(exp->exp_obd, unpackmd)(exp, mem_tgt, disk_src, disk_len);
547 /* helper functions */
548 static inline int obd_alloc_memmd(struct obd_export *exp,
549 struct lov_stripe_md **mem_tgt)
552 LASSERT(*mem_tgt == NULL);
553 return obd_unpackmd(exp, mem_tgt, NULL, 0);
556 static inline int obd_free_memmd(struct obd_export *exp,
557 struct lov_stripe_md **mem_tgt)
561 return obd_unpackmd(exp, mem_tgt, NULL, 0);
564 static inline int obd_revalidate_md(struct obd_export *exp, struct obdo *obdo,
565 struct lov_stripe_md *ea,
566 struct obd_trans_info *oti)
571 EXP_CHECK_OP(exp, revalidate_md);
572 OBD_COUNTER_INCREMENT(exp->exp_obd, revalidate_md);
574 rc = OBP(exp->exp_obd, revalidate_md)(exp, obdo, ea, oti);
578 static inline int obd_create(struct obd_export *exp, struct obdo *obdo,
579 struct lov_stripe_md **ea,
580 struct obd_trans_info *oti)
585 EXP_CHECK_OP(exp, create);
586 OBD_COUNTER_INCREMENT(exp->exp_obd, create);
588 rc = OBP(exp->exp_obd, create)(exp, obdo, ea, oti);
592 static inline int obd_destroy(struct obd_export *exp, struct obdo *obdo,
593 struct lov_stripe_md *ea,
594 struct obd_trans_info *oti)
599 EXP_CHECK_OP(exp, destroy);
600 OBD_COUNTER_INCREMENT(exp->exp_obd, destroy);
602 rc = OBP(exp->exp_obd, destroy)(exp, obdo, ea, oti);
606 static inline int obd_getattr(struct obd_export *exp, struct obdo *obdo,
607 struct lov_stripe_md *ea)
612 EXP_CHECK_OP(exp, getattr);
613 OBD_COUNTER_INCREMENT(exp->exp_obd, getattr);
615 rc = OBP(exp->exp_obd, getattr)(exp, obdo, ea);
619 static inline int obd_getattr_async(struct obd_export *exp,
620 struct obdo *obdo, struct lov_stripe_md *ea,
621 struct ptlrpc_request_set *set)
626 EXP_CHECK_OP(exp, getattr);
627 OBD_COUNTER_INCREMENT(exp->exp_obd, getattr);
629 rc = OBP(exp->exp_obd, getattr_async)(exp, obdo, ea, set);
633 static inline int obd_setattr(struct obd_export *exp, struct obdo *obdo,
634 struct lov_stripe_md *ea,
635 struct obd_trans_info *oti)
640 EXP_CHECK_OP(exp, setattr);
641 OBD_COUNTER_INCREMENT(exp->exp_obd, setattr);
643 rc = OBP(exp->exp_obd, setattr)(exp, obdo, ea, oti);
646 static inline int obd_add_conn(struct obd_import *imp, struct obd_uuid *uuid,
649 struct obd_device *obd = imp->imp_obd;
653 OBD_CHECK_DEV_ACTIVE(obd);
654 OBD_CHECK_OP(obd, add_conn, -EOPNOTSUPP);
655 OBD_COUNTER_INCREMENT(obd, add_conn);
657 rc = OBP(obd, add_conn)(imp, uuid, priority);
661 static inline int obd_del_conn(struct obd_import *imp,
662 struct obd_uuid *uuid)
664 struct obd_device *obd = imp->imp_obd;
668 OBD_CHECK_DEV_ACTIVE(obd);
669 OBD_CHECK_OP(obd, del_conn, -EOPNOTSUPP);
670 OBD_COUNTER_INCREMENT(obd, del_conn);
672 rc = OBP(obd, del_conn)(imp, uuid);
677 static inline int obd_connect(struct lustre_handle *conn,
678 struct obd_device *obd,
679 struct obd_uuid *cluuid,
685 OBD_CHECK_DEV_ACTIVE(obd);
686 OBD_CHECK_OP(obd, connect, -EOPNOTSUPP);
687 OBD_COUNTER_INCREMENT(obd, connect);
689 rc = OBP(obd, connect)(conn, obd, cluuid, flags);
693 static inline int obd_connect_post(struct obd_export *exp,
699 OBD_CHECK_DEV_ACTIVE(exp->exp_obd);
700 if (!OBT(exp->exp_obd) || !OBP((exp->exp_obd), connect_post))
702 OBD_COUNTER_INCREMENT(exp->exp_obd, connect_post);
703 rc = OBP(exp->exp_obd, connect_post)(exp, flags);
707 static inline int obd_disconnect(struct obd_export *exp,
713 EXP_CHECK_OP(exp, disconnect);
714 OBD_COUNTER_INCREMENT(exp->exp_obd, disconnect);
716 rc = OBP(exp->exp_obd, disconnect)(exp, flags);
720 static inline int obd_getready(struct obd_export *exp)
725 if (!OBP(exp->exp_obd, getready))
727 rc = OBP(exp->exp_obd, getready)(exp);
731 static inline int obd_init_export(struct obd_export *exp)
736 if ((exp)->exp_obd != NULL && OBT((exp)->exp_obd) &&
737 OBP((exp)->exp_obd, init_export))
738 rc = OBP(exp->exp_obd, init_export)(exp);
742 static inline int obd_destroy_export(struct obd_export *exp)
745 if ((exp)->exp_obd != NULL && OBT((exp)->exp_obd) &&
746 OBP((exp)->exp_obd, destroy_export))
747 OBP(exp->exp_obd, destroy_export)(exp);
751 static inline struct dentry *
752 obd_lvfs_id2dentry(struct obd_export *exp, __u64 ino,
755 LASSERT(exp->exp_obd);
757 return lvfs_id2dentry(&exp->exp_obd->obd_lvfs_ctxt,
758 ino, gen, gr, exp->exp_obd);
762 #define time_before(t1, t2) ((long)t2 - (long)t1 > 0)
765 /* @max_age is the oldest time in jiffies that we accept using a cached data.
766 * If the cache is older than @max_age we will get a new value from the
767 * target. Use a value of "jiffies + HZ" to guarantee freshness. */
768 static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
769 unsigned long max_age)
777 OBD_CHECK_OP(obd, statfs, -EOPNOTSUPP);
778 OBD_COUNTER_INCREMENT(obd, statfs);
780 CDEBUG(D_SUPER, "osfs %lu, max_age %lu\n", obd->obd_osfs_age, max_age);
781 if (time_before(obd->obd_osfs_age, max_age)) {
782 rc = OBP(obd, statfs)(obd, osfs, max_age);
784 spin_lock(&obd->obd_osfs_lock);
785 memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
786 obd->obd_osfs_age = jiffies;
787 spin_unlock(&obd->obd_osfs_lock);
790 CDEBUG(D_SUPER, "using cached obd_statfs data\n");
791 spin_lock(&obd->obd_osfs_lock);
792 memcpy(osfs, &obd->obd_osfs, sizeof(*osfs));
793 spin_unlock(&obd->obd_osfs_lock);
798 static inline int obd_sync(struct obd_export *exp, struct obdo *oa,
799 struct lov_stripe_md *ea, obd_size start,
805 OBD_CHECK_OP(exp->exp_obd, sync, -EOPNOTSUPP);
806 OBD_COUNTER_INCREMENT(exp->exp_obd, sync);
808 rc = OBP(exp->exp_obd, sync)(exp, oa, ea, start, end);
812 static inline int obd_punch(struct obd_export *exp, struct obdo *oa,
813 struct lov_stripe_md *ea, obd_size start,
814 obd_size end, struct obd_trans_info *oti)
819 EXP_CHECK_OP(exp, punch);
820 OBD_COUNTER_INCREMENT(exp->exp_obd, punch);
822 rc = OBP(exp->exp_obd, punch)(exp, oa, ea, start, end, oti);
826 static inline int obd_brw(int cmd, struct obd_export *exp, struct obdo *oa,
827 struct lov_stripe_md *ea, obd_count oa_bufs,
828 struct brw_page *pg, struct obd_trans_info *oti)
833 EXP_CHECK_OP(exp, brw);
834 OBD_COUNTER_INCREMENT(exp->exp_obd, brw);
836 if (!(cmd & (OBD_BRW_RWMASK | OBD_BRW_CHECK))) {
837 CERROR("obd_brw: cmd must be OBD_BRW_READ, OBD_BRW_WRITE, "
838 "or OBD_BRW_CHECK\n");
842 rc = OBP(exp->exp_obd, brw)(cmd, exp, oa, ea, oa_bufs, pg, oti);
846 static inline int obd_brw_async(int cmd, struct obd_export *exp,
847 struct obdo *oa, struct lov_stripe_md *ea,
848 obd_count oa_bufs, struct brw_page *pg,
849 struct ptlrpc_request_set *set,
850 struct obd_trans_info *oti)
855 EXP_CHECK_OP(exp, brw_async);
856 OBD_COUNTER_INCREMENT(exp->exp_obd, brw_async);
858 if (!(cmd & OBD_BRW_RWMASK)) {
859 CERROR("obd_brw: cmd must be OBD_BRW_READ or OBD_BRW_WRITE\n");
863 rc = OBP(exp->exp_obd, brw_async)(cmd, exp, oa, ea, oa_bufs, pg, set,
868 static inline int obd_prep_async_page(struct obd_export *exp,
869 struct lov_stripe_md *lsm,
870 struct lov_oinfo *loi,
871 struct page *page, obd_off offset,
872 struct obd_async_page_ops *ops,
873 void *data, void **res)
878 OBD_CHECK_OP(exp->exp_obd, prep_async_page, -EOPNOTSUPP);
879 OBD_COUNTER_INCREMENT(exp->exp_obd, prep_async_page);
881 ret = OBP(exp->exp_obd, prep_async_page)(exp, lsm, loi, page, offset,
886 static inline int obd_queue_async_io(struct obd_export *exp,
887 struct lov_stripe_md *lsm,
888 struct lov_oinfo *loi, void *cookie,
889 int cmd, obd_off off, int count,
890 obd_flags brw_flags, obd_flags async_flags)
895 OBD_CHECK_OP(exp->exp_obd, queue_async_io, -EOPNOTSUPP);
896 OBD_COUNTER_INCREMENT(exp->exp_obd, queue_async_io);
897 LASSERT(cmd & OBD_BRW_RWMASK);
899 rc = OBP(exp->exp_obd, queue_async_io)(exp, lsm, loi, cookie, cmd, off,
900 count, brw_flags, async_flags);
904 static inline int obd_set_async_flags(struct obd_export *exp,
905 struct lov_stripe_md *lsm,
906 struct lov_oinfo *loi, void *cookie,
907 obd_flags async_flags)
912 OBD_CHECK_OP(exp->exp_obd, set_async_flags, -EOPNOTSUPP);
913 OBD_COUNTER_INCREMENT(exp->exp_obd, set_async_flags);
915 rc = OBP(exp->exp_obd, set_async_flags)(exp, lsm, loi, cookie,
920 static inline int obd_queue_group_io(struct obd_export *exp,
921 struct lov_stripe_md *lsm,
922 struct lov_oinfo *loi,
923 struct obd_io_group *oig,
924 void *cookie, int cmd, obd_off off,
925 int count, obd_flags brw_flags,
926 obd_flags async_flags)
931 OBD_CHECK_OP(exp->exp_obd, queue_group_io, -EOPNOTSUPP);
932 OBD_COUNTER_INCREMENT(exp->exp_obd, queue_group_io);
933 LASSERT(cmd & OBD_BRW_RWMASK);
935 rc = OBP(exp->exp_obd, queue_group_io)(exp, lsm, loi, oig, cookie,
936 cmd, off, count, brw_flags,
941 static inline int obd_trigger_group_io(struct obd_export *exp,
942 struct lov_stripe_md *lsm,
943 struct lov_oinfo *loi,
944 struct obd_io_group *oig)
949 OBD_CHECK_OP(exp->exp_obd, trigger_group_io, -EOPNOTSUPP);
950 OBD_COUNTER_INCREMENT(exp->exp_obd, trigger_group_io);
952 rc = OBP(exp->exp_obd, trigger_group_io)(exp, lsm, loi, oig);
956 static inline int obd_teardown_async_page(struct obd_export *exp,
957 struct lov_stripe_md *lsm,
958 struct lov_oinfo *loi, void *cookie)
963 OBD_CHECK_OP(exp->exp_obd, teardown_async_page, -EOPNOTSUPP);
964 OBD_COUNTER_INCREMENT(exp->exp_obd, teardown_async_page);
966 rc = OBP(exp->exp_obd, teardown_async_page)(exp, lsm, loi, cookie);
970 static inline int obd_preprw(int cmd, struct obd_export *exp, struct obdo *oa,
971 int objcount, struct obd_ioobj *obj,
972 int niocount, struct niobuf_remote *remote,
973 struct niobuf_local *local,
974 struct obd_trans_info *oti)
979 OBD_CHECK_OP(exp->exp_obd, preprw, -EOPNOTSUPP);
980 OBD_COUNTER_INCREMENT(exp->exp_obd, preprw);
982 rc = OBP(exp->exp_obd, preprw)(cmd, exp, oa, objcount, obj, niocount,
987 static inline int obd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
988 int objcount, struct obd_ioobj *obj,
989 int niocount, struct niobuf_local *local,
990 struct obd_trans_info *oti, int rc)
994 OBD_CHECK_OP(exp->exp_obd, commitrw, -EOPNOTSUPP);
995 OBD_COUNTER_INCREMENT(exp->exp_obd, commitrw);
997 rc = OBP(exp->exp_obd, commitrw)(cmd, exp, oa, objcount, obj, niocount,
1002 static inline int obd_do_cow(struct obd_export *exp, struct obd_ioobj *obj,
1003 int objcount,struct niobuf_remote *rnb)
1008 /* there are cases when write_extents is not implemented. */
1009 if (!OBP(exp->exp_obd, do_cow))
1012 OBD_COUNTER_INCREMENT(exp->exp_obd, do_cow);
1014 rc = OBP(exp->exp_obd, do_cow)(exp, obj, objcount, rnb);
1019 static inline int obd_write_extents(struct obd_export *exp,
1020 struct obd_ioobj *obj,
1021 int objcount, int niocount,
1022 struct niobuf_local *local,
1027 /* there are cases when write_extents is not implemented. */
1028 if (!OBP(exp->exp_obd, write_extents))
1031 OBD_COUNTER_INCREMENT(exp->exp_obd, write_extents);
1033 rc = OBP(exp->exp_obd, write_extents)(exp, obj, objcount, niocount,
1038 static inline int obd_iocontrol(unsigned int cmd, struct obd_export *exp,
1039 int len, void *karg, void *uarg)
1044 EXP_CHECK_OP(exp, iocontrol);
1045 OBD_COUNTER_INCREMENT(exp->exp_obd, iocontrol);
1047 rc = OBP(exp->exp_obd, iocontrol)(cmd, exp, len, karg, uarg);
1051 static inline int obd_enqueue(struct obd_export *exp, struct lov_stripe_md *ea,
1052 __u32 type, ldlm_policy_data_t *policy,
1053 __u32 mode, int *flags, void *bl_cb, void *cp_cb,
1054 void *gl_cb, void *data, __u32 lvb_len,
1055 void *lvb_swabber, struct lustre_handle *lockh)
1060 EXP_CHECK_OP(exp, enqueue);
1061 OBD_COUNTER_INCREMENT(exp->exp_obd, enqueue);
1063 rc = OBP(exp->exp_obd, enqueue)(exp, ea, type, policy, mode, flags,
1064 bl_cb, cp_cb, gl_cb, data, lvb_len,
1065 lvb_swabber, lockh);
1069 static inline int obd_match(struct obd_export *exp, struct lov_stripe_md *ea,
1070 __u32 type, ldlm_policy_data_t *policy, __u32 mode,
1071 int *flags, void *data, struct lustre_handle *lockh)
1076 EXP_CHECK_OP(exp, match);
1077 OBD_COUNTER_INCREMENT(exp->exp_obd, match);
1079 rc = OBP(exp->exp_obd, match)(exp, ea, type, policy, mode, flags, data,
1084 static inline int obd_change_cbdata(struct obd_export *exp,
1085 struct lov_stripe_md *lsm,
1086 ldlm_iterator_t it, void *data)
1091 EXP_CHECK_OP(exp, change_cbdata);
1092 OBD_COUNTER_INCREMENT(exp->exp_obd, change_cbdata);
1094 rc = OBP(exp->exp_obd, change_cbdata)(exp, lsm, it, data);
1098 static inline int obd_cancel(struct obd_export *exp,
1099 struct lov_stripe_md *ea, __u32 mode,
1100 struct lustre_handle *lockh)
1105 EXP_CHECK_OP(exp, cancel);
1106 OBD_COUNTER_INCREMENT(exp->exp_obd, cancel);
1108 rc = OBP(exp->exp_obd, cancel)(exp, ea, mode, lockh);
1112 static inline int obd_cancel_unused(struct obd_export *exp,
1113 struct lov_stripe_md *ea, int flags,
1119 EXP_CHECK_OP(exp, cancel_unused);
1120 OBD_COUNTER_INCREMENT(exp->exp_obd, cancel_unused);
1122 rc = OBP(exp->exp_obd, cancel_unused)(exp, ea, flags, opaque);
1127 static inline int obd_san_preprw(int cmd, struct obd_export *exp,
1129 int objcount, struct obd_ioobj *obj,
1130 int niocount, struct niobuf_remote *remote)
1134 EXP_CHECK_OP(exp, preprw);
1135 OBD_COUNTER_INCREMENT(exp->exp_obd, preprw);
1137 rc = OBP(exp->exp_obd, san_preprw)(cmd, exp, oa, objcount, obj,
1139 class_export_put(exp);
1143 static inline int obd_pin(struct obd_export *exp, obd_id ino, __u32 gen,
1144 int type, struct obd_client_handle *handle, int flag)
1148 EXP_CHECK_OP(exp, pin);
1149 OBD_COUNTER_INCREMENT(exp->exp_obd, pin);
1151 rc = OBP(exp->exp_obd, pin)(exp, ino, gen, type, handle, flag);
1155 static inline int obd_unpin(struct obd_export *exp,
1156 struct obd_client_handle *handle, int flag)
1160 EXP_CHECK_OP(exp, unpin);
1161 OBD_COUNTER_INCREMENT(exp->exp_obd, unpin);
1163 rc = OBP(exp->exp_obd, unpin)(exp, handle, flag);
1168 static inline void obd_import_event(struct obd_device *obd,
1169 struct obd_import *imp,
1170 enum obd_import_event event)
1172 if (obd->obd_set_up && OBP(obd, import_event)) {
1173 OBD_COUNTER_INCREMENT(obd, import_event);
1174 OBP(obd, import_event)(obd, imp, event);
1178 static inline int obd_llog_connect(struct obd_export *exp,
1179 struct llogd_conn_body *body)
1182 EXP_CHECK_OP(exp, llog_connect);
1183 return OBP(exp->exp_obd, llog_connect)(exp, body);
1186 static inline int obd_notify(struct obd_device *obd, struct obd_device *watched,
1187 int active, void *data)
1189 if (!obd->obd_set_up) {
1190 CERROR("obd %s not set up\n", obd->obd_name);
1194 if (!OBP(obd, notify)) {
1195 CERROR("obd %s has no notify handler\n", obd->obd_name);
1199 OBD_COUNTER_INCREMENT(obd, notify);
1200 return OBP(obd, notify)(obd, watched, active, data);
1203 static inline int obd_register_observer(struct obd_device *obd,
1204 struct obd_device *observer)
1207 if (obd->obd_observer && observer)
1209 obd->obd_observer = observer;
1213 static inline int obd_init_ea_size(struct obd_export *exp, int size, int size2)
1217 LASSERT(OBP(exp->exp_obd, init_ea_size) != NULL);
1218 OBD_COUNTER_INCREMENT(exp->exp_obd, init_ea_size);
1219 rc = OBP(exp->exp_obd, init_ea_size)(exp, size, size2);
1223 static inline int md_getstatus(struct obd_export *exp, struct lustre_id *id)
1227 EXP_CHECK_MD_OP(exp, getstatus);
1228 MD_COUNTER_INCREMENT(exp->exp_obd, getstatus);
1229 rc = MDP(exp->exp_obd, getstatus)(exp, id);
1233 static inline int md_delete_inode(struct obd_export *exp,
1234 struct lustre_id *id)
1239 if (MDP(exp->exp_obd, delete_inode) == NULL)
1242 MD_COUNTER_INCREMENT(exp->exp_obd, delete_inode);
1243 rc = MDP(exp->exp_obd, delete_inode)(exp, id);
1247 static inline int md_getattr(struct obd_export *exp, struct lustre_id *id,
1248 __u64 valid, unsigned int ea_size,
1249 struct ptlrpc_request **request)
1253 EXP_CHECK_MD_OP(exp, getattr);
1254 MD_COUNTER_INCREMENT(exp->exp_obd, getattr);
1255 rc = MDP(exp->exp_obd, getattr)(exp, id, valid, ea_size, request);
1259 static inline int md_change_cbdata(struct obd_export *exp, struct lustre_id *id,
1260 ldlm_iterator_t it, void *data)
1264 EXP_CHECK_MD_OP(exp, change_cbdata);
1265 MD_COUNTER_INCREMENT(exp->exp_obd, change_cbdata);
1266 rc = MDP(exp->exp_obd, change_cbdata)(exp, id, it, data);
1270 static inline int md_change_cbdata_name(struct obd_export *exp,
1271 struct lustre_id *id, char *name,
1272 int namelen, struct lustre_id *id2,
1273 ldlm_iterator_t it, void *data)
1277 /* this seem to be needed only for lmv. */
1278 if (!MDP(exp->exp_obd, change_cbdata_name))
1283 MD_COUNTER_INCREMENT(exp->exp_obd, change_cbdata_name);
1284 rc = MDP(exp->exp_obd, change_cbdata_name)(exp, id, name, namelen,
1289 static inline int md_close(struct obd_export *exp, struct obdo *obdo,
1290 struct obd_client_handle *och,
1291 struct ptlrpc_request **request)
1295 EXP_CHECK_MD_OP(exp, close);
1296 MD_COUNTER_INCREMENT(exp->exp_obd, close);
1297 rc = MDP(exp->exp_obd, close)(exp, obdo, och, request);
1301 static inline int md_create(struct obd_export *exp, struct mdc_op_data *op_data,
1302 const void *data, int datalen, int mode,
1303 __u32 uid, __u32 gid, __u64 rdev,
1304 struct ptlrpc_request **request)
1308 EXP_CHECK_MD_OP(exp, create);
1309 MD_COUNTER_INCREMENT(exp->exp_obd, create);
1310 rc = MDP(exp->exp_obd, create)(exp, op_data, data, datalen, mode,
1311 uid, gid, rdev, request);
1315 static inline int md_done_writing(struct obd_export *exp, struct obdo *obdo)
1319 EXP_CHECK_MD_OP(exp, done_writing);
1320 MD_COUNTER_INCREMENT(exp->exp_obd, done_writing);
1321 rc = MDP(exp->exp_obd, done_writing)(exp, obdo);
1325 static inline int md_enqueue(struct obd_export *exp, int lock_type,
1326 struct lookup_intent *it, int lock_mode,
1327 struct mdc_op_data *data,
1328 struct lustre_handle *lockh,
1329 void *lmm, int lmmsize,
1330 ldlm_completion_callback cb_completion,
1331 ldlm_blocking_callback cb_blocking,
1336 EXP_CHECK_MD_OP(exp, enqueue);
1337 MD_COUNTER_INCREMENT(exp->exp_obd, enqueue);
1338 rc = MDP(exp->exp_obd, enqueue)(exp, lock_type, it, lock_mode,
1339 data, lockh, lmm, lmmsize,
1340 cb_completion, cb_blocking,
1345 static inline int md_getattr_lock(struct obd_export *exp, struct lustre_id *id,
1346 char *filename, int namelen,
1347 __u64 valid, unsigned int ea_size,
1348 struct ptlrpc_request **request)
1352 EXP_CHECK_MD_OP(exp, getattr_lock);
1353 MD_COUNTER_INCREMENT(exp->exp_obd, getattr_lock);
1354 rc = MDP(exp->exp_obd, getattr_lock)(exp, id, filename, namelen,
1355 valid, ea_size, request);
1359 static inline int md_intent_lock(struct obd_export *exp,
1360 struct lustre_id *pid, const char *name,
1361 int len, void *lmm, int lmmsize,
1362 struct lustre_id *cid, struct lookup_intent *it,
1363 int flags, struct ptlrpc_request **reqp,
1364 ldlm_blocking_callback cb_blocking)
1368 EXP_CHECK_MD_OP(exp, intent_lock);
1369 MD_COUNTER_INCREMENT(exp->exp_obd, intent_lock);
1370 rc = MDP(exp->exp_obd, intent_lock)(exp, pid, name, len,
1371 lmm, lmmsize, cid, it, flags,
1376 static inline int md_link(struct obd_export *exp, struct mdc_op_data *data,
1377 struct ptlrpc_request **request)
1381 EXP_CHECK_MD_OP(exp, link);
1382 MD_COUNTER_INCREMENT(exp->exp_obd, link);
1383 rc = MDP(exp->exp_obd, link)(exp, data, request);
1387 static inline int md_rename(struct obd_export *exp, struct mdc_op_data *data,
1388 const char *old, int oldlen,
1389 const char *new, int newlen,
1390 struct ptlrpc_request **request)
1394 EXP_CHECK_MD_OP(exp, rename);
1395 MD_COUNTER_INCREMENT(exp->exp_obd, rename);
1396 rc = MDP(exp->exp_obd, rename)(exp, data, old, oldlen, new,
1401 static inline int md_setattr(struct obd_export *exp, struct mdc_op_data *data,
1402 struct iattr *iattr, void *ea, int ealen,
1403 void *ea2, int ea2len,
1404 struct ptlrpc_request **request)
1408 EXP_CHECK_MD_OP(exp, setattr);
1409 MD_COUNTER_INCREMENT(exp->exp_obd, setattr);
1410 rc = MDP(exp->exp_obd, setattr)(exp, data, iattr, ea, ealen,
1411 ea2, ea2len, request);
1415 static inline int md_sync(struct obd_export *exp, struct lustre_id *id,
1416 struct ptlrpc_request **request)
1420 EXP_CHECK_MD_OP(exp, sync);
1421 MD_COUNTER_INCREMENT(exp->exp_obd, sync);
1422 rc = MDP(exp->exp_obd, sync)(exp, id, request);
1426 static inline int md_readpage(struct obd_export *exp, struct lustre_id *id,
1427 __u64 offset, struct page *page,
1428 struct ptlrpc_request **request)
1432 EXP_CHECK_MD_OP(exp, readpage);
1433 MD_COUNTER_INCREMENT(exp->exp_obd, readpage);
1434 rc = MDP(exp->exp_obd, readpage)(exp, id, offset, page, request);
1438 static inline int md_unlink(struct obd_export *exp, struct mdc_op_data *data,
1439 struct ptlrpc_request **request)
1443 EXP_CHECK_MD_OP(exp, unlink);
1444 MD_COUNTER_INCREMENT(exp->exp_obd, unlink);
1445 rc = MDP(exp->exp_obd, unlink)(exp, data, request);
1449 static inline struct obd_device *md_get_real_obd(struct obd_export *exp,
1450 char *name, int len)
1453 if (MDP(exp->exp_obd, get_real_obd) == NULL)
1454 return exp->exp_obd;
1455 MD_COUNTER_INCREMENT(exp->exp_obd, get_real_obd);
1456 return MDP(exp->exp_obd, get_real_obd)(exp, name, len);
1459 static inline int md_valid_attrs(struct obd_export *exp,
1460 struct lustre_id *id)
1463 EXP_CHECK_MD_OP(exp, valid_attrs);
1464 MD_COUNTER_INCREMENT(exp->exp_obd, valid_attrs);
1465 return MDP(exp->exp_obd, valid_attrs)(exp, id);
1468 static inline int md_req2lustre_md(struct obd_export *exp,
1469 struct ptlrpc_request *req,
1470 unsigned int offset,
1471 struct obd_export *osc_exp,
1472 struct lustre_md *md)
1475 EXP_CHECK_MD_OP(exp, req2lustre_md);
1476 MD_COUNTER_INCREMENT(exp->exp_obd, req2lustre_md);
1477 return MDP(exp->exp_obd, req2lustre_md)(exp, req, offset, osc_exp, md);
1480 static inline int md_set_open_replay_data(struct obd_export *exp,
1481 struct obd_client_handle *och,
1482 struct ptlrpc_request *open_req)
1485 EXP_CHECK_MD_OP(exp, set_open_replay_data);
1486 MD_COUNTER_INCREMENT(exp->exp_obd, set_open_replay_data);
1487 return MDP(exp->exp_obd, set_open_replay_data)(exp, och, open_req);
1490 static inline int md_clear_open_replay_data(struct obd_export *exp,
1491 struct obd_client_handle *och)
1494 EXP_CHECK_MD_OP(exp, clear_open_replay_data);
1495 MD_COUNTER_INCREMENT(exp->exp_obd, clear_open_replay_data);
1496 return MDP(exp->exp_obd, clear_open_replay_data)(exp, och);
1499 static inline int md_store_inode_generation(struct obd_export *exp,
1500 struct ptlrpc_request *req,
1501 int reqoff, int repoff)
1504 EXP_CHECK_MD_OP(exp, store_inode_generation);
1505 MD_COUNTER_INCREMENT(exp->exp_obd, store_inode_generation);
1506 return MDP(exp->exp_obd, store_inode_generation)(exp, req,
1510 static inline int md_set_lock_data(struct obd_export *exp, __u64 *l,
1514 EXP_CHECK_MD_OP(exp, set_lock_data);
1515 MD_COUNTER_INCREMENT(exp->exp_obd, set_lock_data);
1516 return MDP(exp->exp_obd, set_lock_data)(exp, l, data);
1519 /* OBD Metadata Support */
1521 extern int obd_init_caches(void);
1522 extern void obd_cleanup_caches(void);
1524 /* support routines */
1525 extern kmem_cache_t *obdo_cachep;
1526 static inline struct obdo *obdo_alloc(void)
1530 OBD_SLAB_ALLOC(oa, obdo_cachep, GFP_KERNEL,
1535 static inline void obdo_free(struct obdo *oa)
1539 OBD_SLAB_FREE(oa, obdo_cachep, sizeof(*oa));
1542 static inline void obdo2id(struct lustre_id *id,
1546 id_ino(id) = oa->o_id;
1547 id_fid(id) = oa->o_fid;
1548 id_group(id) = oa->o_mds;
1549 id_gen(id) = oa->o_generation;
1552 static inline void id2obdo(struct obdo *oa,
1553 struct lustre_id *id)
1556 oa->o_id = id_ino(id);
1557 oa->o_fid = id_fid(id);
1558 oa->o_mds = id_group(id);
1559 oa->o_generation = id_gen(id);
1562 #if !defined(__KERNEL__) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
1563 #define to_kdev_t(dev) dev
1564 #define kdev_t_to_nr(dev) dev
1567 /* I'm as embarrassed about this as you are.
1569 * <shaver> // XXX do not look into _superhack with remaining eye
1570 * <shaver> // XXX if this were any uglier, I'd get my own show on MTV */
1571 extern int (*ptlrpc_put_connection_superhack)(struct ptlrpc_connection *c);
1572 extern void (*ptlrpc_abort_inflight_superhack)(struct obd_import *imp);
1575 extern void obd_sysctl_init (void);
1576 extern void obd_sysctl_clean (void);
1579 typedef __u8 class_uuid_t[16];
1580 //int class_uuid_parse(struct obd_uuid in, class_uuid_t out);
1581 void class_uuid_unparse(class_uuid_t in, struct obd_uuid *out);
1584 int lustre_uuid_to_peer(char *uuid, __u32 *peer_nal, ptl_nid_t *peer_nid);
1585 int class_add_uuid(char *uuid, __u64 nid, __u32 nal);
1586 int class_del_uuid (char *uuid);
1587 void class_init_uuidlist(void);
1588 void class_exit_uuidlist(void);
1591 int mea_name2idx(struct mea *mea, char *name, int namelen);
1592 int raw_name2idx(int hashtype, int count, const char *name, int namelen);
1594 #endif /* __LINUX_OBD_CLASS_H */