Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / mdd / mdd_internal.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *  mdd/mdd_internel.c
4  *
5  *  Copyright (C) 2006 Cluster File Systems, Inc.
6  *   Author: Wang Di <wangdi@clusterfs.com>
7  *
8  *   This file is part of the Lustre file system, http://www.lustre.org
9  *   Lustre is a trademark of Cluster File Systems, Inc.
10  *
11  *   You may have signed or agreed to another license before downloading
12  *   this software.  If so, you are bound by the terms and conditions
13  *   of that agreement, and the following does not apply to you.  See the
14  *   LICENSE file included with this distribution for more information.
15  *
16  *   If you did not agree to a different license, then this copy of Lustre
17  *   is open source software; you can redistribute it and/or modify it
18  *   under the terms of version 2 of the GNU General Public License as
19  *   published by the Free Software Foundation.
20  *
21  *   In either case, Lustre is distributed in the hope that it will be
22  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
23  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  *   license text for more details.
25  */
26
27 #ifndef _MDD_INTERNAL_H
28 #define _MDD_INTERNAL_H
29
30 #include <asm/semaphore.h>
31
32 #include <linux/lustre_acl.h>
33 #include <lustre_eacl.h>
34 #include <obd.h>
35 #include <md_object.h>
36 #include <dt_object.h>
37 #include <linux/sched.h>
38 #include <linux/capability.h>
39 #include <linux/dynlocks.h>
40
41 enum mdd_txn_op {
42         MDD_TXN_OBJECT_DESTROY_OP = 0,
43         MDD_TXN_OBJECT_CREATE_OP,
44         MDD_TXN_ATTR_SET_OP,
45         MDD_TXN_XATTR_SET_OP,
46         MDD_TXN_INDEX_INSERT_OP,
47         MDD_TXN_INDEX_DELETE_OP,
48         MDD_TXN_LINK_OP,
49         MDD_TXN_UNLINK_OP,
50         MDD_TXN_RENAME_OP,
51         MDD_TXN_RENAME_TGT_OP,
52         MDD_TXN_CREATE_DATA_OP,
53         MDD_TXN_MKDIR_OP,
54         MDD_TXN_LAST_OP
55 };
56
57 struct mdd_txn_op_descr {
58         enum mdd_txn_op mod_op;
59         unsigned int    mod_credits;
60 };
61
62 struct mdd_device {
63         struct md_device                 mdd_md_dev;
64         struct dt_device                *mdd_child;
65         struct obd_device               *mdd_obd_dev;
66         struct lu_fid                    mdd_root_fid;
67         struct dt_device_param           mdd_dt_conf;
68         struct dt_object                *mdd_orphans;
69         struct dt_txn_callback           mdd_txn_cb;
70         cfs_proc_dir_entry_t            *mdd_proc_entry;
71         struct lprocfs_stats            *mdd_stats;
72         struct mdd_txn_op_descr          mdd_tod[MDD_TXN_LAST_OP];
73         unsigned long                    mdd_atime_diff;
74 };
75
76 enum mod_flags {
77         /* The dir object has been unlinked */
78         DEAD_OBJ   = 1 << 0,
79         APPEND_OBJ = 1 << 1,
80         IMMUTE_OBJ = 1 << 2,
81         ORPHAN_OBJ = 1 << 3,
82         MNLINK_OBJ = 1 << 4
83 };
84
85 #define LUSTRE_APPEND_FL LDISKFS_APPEND_FL
86 #define LUSTRE_IMMUTABLE_FL LDISKFS_IMMUTABLE_FL
87 #define LUSTRE_DIRSYNC_FL LDISKFS_DIRSYNC_FL
88
89 struct mdd_object {
90         struct md_object  mod_obj;
91         /* open count */
92         __u32             mod_count;
93         __u32             mod_valid;
94         unsigned long     mod_flags;
95         struct dynlock    mod_pdlock;
96 };
97
98 struct orph_key {
99         /* fid of the object*/
100         struct lu_fid ok_fid;
101         /* type of operation: unlink, truncate */
102         __u32         ok_op;
103 } __attribute__((packed));
104
105 struct mdd_thread_info {
106         struct txn_param          mti_param;
107         struct lu_fid             mti_fid;
108         struct lu_attr            mti_la;
109         struct md_attr            mti_ma;
110         struct lu_attr            mti_la_for_fix;
111         struct obd_info           mti_oi;
112         struct orph_key           mti_orph_key;
113         struct obd_trans_info     mti_oti;
114         struct lu_buf             mti_buf;
115         struct obdo               mti_oa;
116         char                      mti_xattr_buf[LUSTRE_POSIX_ACL_MAX_SIZE];
117         struct lu_fid             mti_fid2; /* used for be & cpu converting */
118         struct lu_fid_pack        mti_pack;
119         struct dt_allocation_hint mti_hint;
120         struct lov_mds_md        *mti_max_lmm;
121         int                       mti_max_lmm_size;
122         struct llog_cookie       *mti_max_cookie;
123         int                       mti_max_cookie_size;
124 };
125
126 struct lov_mds_md *mdd_max_lmm_get(const struct lu_env *env,
127                                    struct mdd_device *mdd);
128
129 struct llog_cookie *mdd_max_cookie_get(const struct lu_env *env,
130                                        struct mdd_device *mdd);
131
132 int mdd_init_obd(const struct lu_env *env, struct mdd_device *mdd,
133                  struct lustre_cfg *cfg);
134 int mdd_fini_obd(const struct lu_env *env, struct mdd_device *mdd,
135                  struct lustre_cfg *lcfg);
136 int mdd_xattr_set_txn(const struct lu_env *env, struct mdd_object *obj,
137                       const struct lu_buf *buf, const char *name, int fl,
138                       struct thandle *txn);
139 int mdd_lsm_sanity_check(const struct lu_env *env, struct mdd_object *obj);
140 int mdd_lov_set_md(const struct lu_env *env, struct mdd_object *pobj,
141                    struct mdd_object *child, struct lov_mds_md *lmm,
142                    int lmm_size, struct thandle *handle, int set_stripe);
143 int mdd_lov_create(const struct lu_env *env, struct mdd_device *mdd,
144                    struct mdd_object *parent, struct mdd_object *child,
145                    struct lov_mds_md **lmm, int *lmm_size,
146                    const struct md_op_spec *spec, struct lu_attr *la);
147 void mdd_lov_objid_update(struct mdd_device *mdd, struct lov_mds_md *lmm);
148 void mdd_lov_create_finish(const struct lu_env *env, struct mdd_device *mdd,
149                            struct lov_mds_md *lmm, int lmm_size,
150                            const struct md_op_spec *spec);
151 int mdd_get_md(const struct lu_env *env, struct mdd_object *obj,
152                void *md, int *md_size, const char *name);
153 int mdd_get_md_locked(const struct lu_env *env, struct mdd_object *obj,
154                       void *md, int *md_size, const char *name);
155 int mdd_la_get(const struct lu_env *env, struct mdd_object *obj,
156                struct lu_attr *la, struct lustre_capa *capa);
157 int mdd_attr_set_internal(const struct lu_env *env,
158                           struct mdd_object *obj,
159                           struct lu_attr *attr,
160                           struct thandle *handle,
161                           int needacl);
162 int mdd_attr_check_set_internal(const struct lu_env *env,
163                                 struct mdd_object *obj,
164                                 struct lu_attr *attr,
165                                 struct thandle *handle,
166                                 int needacl);
167 int mdd_object_kill(const struct lu_env *env, struct mdd_object *obj,
168                     struct md_attr *ma);
169 int mdd_iattr_get(const struct lu_env *env, struct mdd_object *mdd_obj,
170                   struct md_attr *ma);
171 int mdd_attr_get_internal_locked(const struct lu_env *env,
172                                  struct mdd_object *mdd_obj,
173                                  struct md_attr *ma);
174 int mdd_object_create_internal(const struct lu_env *env, struct mdd_object *p,
175                                struct mdd_object *c, struct md_attr *ma,
176                                struct thandle *handle);
177 int mdd_attr_check_set_internal_locked(const struct lu_env *env,
178                                        struct mdd_object *obj,
179                                        struct lu_attr *attr,
180                                        struct thandle *handle,
181                                        int needacl);
182 int mdd_lmm_get_locked(const struct lu_env *env, struct mdd_object *mdd_obj,
183                        struct md_attr *ma);
184 /* mdd_lock.c */
185 void mdd_write_lock(const struct lu_env *env, struct mdd_object *obj);
186 void mdd_read_lock(const struct lu_env *env, struct mdd_object *obj);
187 void mdd_write_unlock(const struct lu_env *env, struct mdd_object *obj);
188 void mdd_read_unlock(const struct lu_env *env, struct mdd_object *obj);
189
190 void mdd_pdlock_init(struct mdd_object *obj);
191 unsigned long mdd_name2hash(const char *name);
192 struct dynlock_handle *mdd_pdo_write_lock(const struct lu_env *env,
193                                           struct mdd_object *obj,
194                                           const char *name);
195 struct dynlock_handle *mdd_pdo_read_lock(const struct lu_env *env,
196                                          struct mdd_object *obj,
197                                          const char *name);
198 void mdd_pdo_write_unlock(const struct lu_env *env, struct mdd_object *obj,
199                           struct dynlock_handle *dlh);
200 void mdd_pdo_read_unlock(const struct lu_env *env, struct mdd_object *obj,
201                          struct dynlock_handle *dlh);
202 /* mdd_dir.c */
203 void __mdd_ref_add(const struct lu_env *env, struct mdd_object *obj,
204                    struct thandle *handle);
205 void __mdd_ref_del(const struct lu_env *env, struct mdd_object *obj,
206                    struct thandle *handle, int is_dot);
207 int mdd_may_create(const struct lu_env *env, struct mdd_object *pobj,
208                    struct mdd_object *cobj, int check_perm, int check_nlink);
209 int mdd_may_unlink(const struct lu_env *env, struct mdd_object *pobj,
210                    const struct md_attr *ma);
211 int mdd_may_delete(const struct lu_env *env, struct mdd_object *pobj,
212                    struct mdd_object *cobj, struct md_attr *ma,
213                    int check_perm, int check_empty);
214 int mdd_unlink_sanity_check(const struct lu_env *env, struct mdd_object *pobj,
215                             struct mdd_object *cobj, struct md_attr *ma);
216 int mdd_finish_unlink(const struct lu_env *env, struct mdd_object *obj,
217                       struct md_attr *ma, struct thandle *th);
218 int mdd_object_initialize(const struct lu_env *env, const struct lu_fid *pfid,
219                           struct mdd_object *child, struct md_attr *ma,
220                           struct thandle *handle);
221 int mdd_link_sanity_check(const struct lu_env *env, struct mdd_object *tgt_obj,
222                           const struct lu_name *lname, struct mdd_object *src_obj);
223 /* mdd_lov.c */
224 int mdd_unlink_log(const struct lu_env *env, struct mdd_device *mdd,
225                    struct mdd_object *mdd_cobj, struct md_attr *ma);
226
227 int mdd_setattr_log(const struct lu_env *env, struct mdd_device *mdd,
228                     const struct md_attr *ma,
229                     struct lov_mds_md *lmm, int lmm_size,
230                     struct llog_cookie *logcookies, int cookies_size);
231
232 int mdd_get_cookie_size(const struct lu_env *env, struct mdd_device *mdd,
233                         struct lov_mds_md *lmm);
234
235 int mdd_lov_setattr_async(const struct lu_env *env, struct mdd_object *obj,
236                           struct lov_mds_md *lmm, int lmm_size,
237                           struct llog_cookie *logcookies);
238
239 struct mdd_thread_info *mdd_env_info(const struct lu_env *env);
240
241 struct lu_buf *mdd_buf_get(const struct lu_env *env, void *area, ssize_t len);
242 const struct lu_buf *mdd_buf_get_const(const struct lu_env *env,
243                                        const void *area, ssize_t len);
244
245 int __mdd_orphan_cleanup(const struct lu_env *env, struct mdd_device *d);
246 int __mdd_orphan_add(const struct lu_env *, struct mdd_object *,
247                      struct thandle *);
248 int __mdd_orphan_del(const struct lu_env *, struct mdd_object *,
249                      struct thandle *);
250 int orph_index_init(const struct lu_env *env, struct mdd_device *mdd);
251 void orph_index_fini(const struct lu_env *env, struct mdd_device *mdd);
252 int mdd_txn_init_credits(const struct lu_env *env, struct mdd_device *mdd);
253
254 /* mdd_lproc.c */
255 void lprocfs_mdd_init_vars(struct lprocfs_static_vars *lvars);
256 int mdd_procfs_init(struct mdd_device *mdd, const char *name);
257 int mdd_procfs_fini(struct mdd_device *mdd);
258 void mdd_lprocfs_time_start(const struct lu_env *env);
259 void mdd_lprocfs_time_end(const struct lu_env *env,
260                           struct mdd_device *mdd, int op);
261
262 int mdd_get_flags(const struct lu_env *env, struct mdd_object *obj);
263
264 extern struct md_dir_operations    mdd_dir_ops;
265 extern struct md_object_operations mdd_obj_ops;
266
267 /* mdd_trans.c */
268 void mdd_txn_param_build(const struct lu_env *env, struct mdd_device *mdd,
269                          enum mdd_txn_op);
270 int mdd_log_txn_param_build(const struct lu_env *env, struct md_object *obj,
271                             struct md_attr *ma, enum mdd_txn_op);
272
273 static inline void mdd_object_put(const struct lu_env *env,
274                                   struct mdd_object *o)
275 {
276         lu_object_put(env, &o->mod_obj.mo_lu);
277 }
278
279 struct thandle* mdd_trans_start(const struct lu_env *env,
280                                        struct mdd_device *);
281
282 void mdd_trans_stop(const struct lu_env *env, struct mdd_device *mdd,
283                     int rc, struct thandle *handle);
284
285 int mdd_txn_start_cb(const struct lu_env *env, struct txn_param *param,
286                      void *cookie);
287
288 int mdd_txn_stop_cb(const struct lu_env *env, struct thandle *txn,
289                     void *cookie);
290
291 int mdd_txn_commit_cb(const struct lu_env *env, struct thandle *txn,
292                       void *cookie);
293 /* mdd_device.c */
294 struct lu_object *mdd_object_alloc(const struct lu_env *env,
295                                    const struct lu_object_header *hdr,
296                                    struct lu_device *d);
297
298 /* mdd_object.c */
299 int accmode(const struct lu_env *env, struct lu_attr *la, int flags);
300 extern struct lu_context_key mdd_thread_key;
301 extern struct lu_device_operations mdd_lu_ops;
302
303 struct mdd_object *mdd_object_find(const struct lu_env *env,
304                                    struct mdd_device *d,
305                                    const struct lu_fid *f);
306
307 /* mdd_permission.c */
308 #define mdd_cap_t(x) (x)
309
310 #define MDD_CAP_TO_MASK(x) (1 << (x))
311
312 #define mdd_cap_raised(c, flag) (mdd_cap_t(c) & MDD_CAP_TO_MASK(flag))
313
314 /* capable() is copied from linux kernel! */
315 static inline int mdd_capable(struct md_ucred *uc, int cap)
316 {
317         if (mdd_cap_raised(uc->mu_cap, cap))
318                 return 1;
319         return 0;
320 }
321
322 int mdd_acl_def_get(const struct lu_env *env, struct mdd_object *mdd_obj,
323                     struct md_attr *ma);
324 int mdd_acl_chmod(const struct lu_env *env, struct mdd_object *o, __u32 mode,
325                   struct thandle *handle);
326 int __mdd_acl_init(const struct lu_env *env, struct mdd_object *obj,
327                    struct lu_buf *buf, __u32 *mode, struct thandle *handle);
328 int mdd_acl_init(const struct lu_env *env, struct mdd_object *pobj,
329                  struct mdd_object *cobj, __u32 *mode, struct thandle *handle);
330 int __mdd_permission_internal(const struct lu_env *env, struct mdd_object *obj,
331                               struct lu_attr *la, int mask, int needlock);
332 int mdd_permission(const struct lu_env *env,
333                    struct md_object *pobj, struct md_object *cobj,
334                    struct md_attr *ma, int mask);
335 int mdd_capa_get(const struct lu_env *env, struct md_object *obj,
336                  struct lustre_capa *capa, int renewal);
337
338 static inline int lu_device_is_mdd(struct lu_device *d)
339 {
340         return ergo(d != NULL && d->ld_ops != NULL, d->ld_ops == &mdd_lu_ops);
341 }
342
343 static inline struct mdd_device* lu2mdd_dev(struct lu_device *d)
344 {
345         LASSERT(lu_device_is_mdd(d));
346         return container_of0(d, struct mdd_device, mdd_md_dev.md_lu_dev);
347 }
348
349 static inline struct lu_device *mdd2lu_dev(struct mdd_device *d)
350 {
351         return (&d->mdd_md_dev.md_lu_dev);
352 }
353
354 static inline struct mdd_object *lu2mdd_obj(struct lu_object *o)
355 {
356         LASSERT(ergo(o != NULL, lu_device_is_mdd(o->lo_dev)));
357         return container_of0(o, struct mdd_object, mod_obj.mo_lu);
358 }
359
360 static inline struct mdd_device* mdo2mdd(struct md_object *mdo)
361 {
362         return lu2mdd_dev(mdo->mo_lu.lo_dev);
363 }
364
365 static inline struct mdd_object* md2mdd_obj(struct md_object *mdo)
366 {
367         return container_of0(mdo, struct mdd_object, mod_obj);
368 }
369
370 static inline struct dt_device_operations *mdd_child_ops(struct mdd_device *d)
371 {
372         return d->mdd_child->dd_ops;
373 }
374
375 static inline struct lu_object *mdd2lu_obj(struct mdd_object *obj)
376 {
377         return &obj->mod_obj.mo_lu;
378 }
379
380 static inline struct dt_object* mdd_object_child(struct mdd_object *o)
381 {
382         return container_of0(lu_object_next(mdd2lu_obj(o)),
383                              struct dt_object, do_lu);
384 }
385
386 static inline struct obd_device *mdd2obd_dev(struct mdd_device *mdd)
387 {
388         return mdd->mdd_obd_dev;
389 }
390
391 static inline struct mdd_device *mdd_obj2mdd_dev(struct mdd_object *obj)
392 {
393         return mdo2mdd(&obj->mod_obj);
394 }
395
396 static inline const struct lu_fid *mdo2fid(const struct mdd_object *obj)
397 {
398         return lu_object_fid(&obj->mod_obj.mo_lu);
399 }
400
401 static inline umode_t mdd_object_type(const struct mdd_object *obj)
402 {
403         return lu_object_attr(&obj->mod_obj.mo_lu);
404 }
405
406 static inline int mdd_lov_mdsize(const struct lu_env *env,
407                                  struct mdd_device *mdd)
408 {
409         struct obd_device *obd = mdd2obd_dev(mdd);
410         return obd->u.mds.mds_max_mdsize;
411 }
412
413 static inline int mdd_lov_cookiesize(const struct lu_env *env,
414                                      struct mdd_device *mdd)
415 {
416         struct obd_device *obd = mdd2obd_dev(mdd);
417         return obd->u.mds.mds_max_cookiesize;
418 }
419
420 static inline int mdd_is_immutable(struct mdd_object *obj)
421 {
422         return obj->mod_flags & IMMUTE_OBJ;
423 }
424
425 static inline int mdd_is_dead_obj(struct mdd_object *obj)
426 {
427         return obj && obj->mod_flags & DEAD_OBJ;
428 }
429
430 static inline int mdd_is_append(struct mdd_object *obj)
431 {
432         return obj->mod_flags & APPEND_OBJ;
433 }
434
435 static inline int mdd_is_mnlink(struct mdd_object *obj)
436 {
437         return obj->mod_flags & MNLINK_OBJ;
438 }
439
440 static inline int mdd_object_exists(struct mdd_object *obj)
441 {
442         return lu_object_exists(mdd2lu_obj(obj));
443 }
444
445 static inline const struct lu_fid *mdd_object_fid(struct mdd_object *obj)
446 {
447         return lu_object_fid(mdd2lu_obj(obj));
448 }
449
450 static inline struct lustre_capa *mdd_object_capa(const struct lu_env *env,
451                                                   const struct mdd_object *obj)
452 {
453         struct md_capainfo *ci = md_capainfo(env);
454         const struct lu_fid *fid = mdo2fid(obj);
455         int i;
456
457         /* NB: in mdt_init0 */
458         if (!ci)
459                 return BYPASS_CAPA;
460         for (i = 0; i < MD_CAPAINFO_MAX; i++)
461                 if (ci->mc_fid[i] && lu_fid_eq(ci->mc_fid[i], fid))
462                         return ci->mc_capa[i];
463         return NULL;
464 }
465
466 static inline void mdd_set_capainfo(const struct lu_env *env, int offset,
467                                     const struct mdd_object *obj,
468                                     struct lustre_capa *capa)
469 {
470         struct md_capainfo *ci = md_capainfo(env);
471         const struct lu_fid *fid = mdo2fid(obj);
472
473         LASSERT(offset >= 0 && offset <= MD_CAPAINFO_MAX);
474         /* NB: in mdt_init0 */
475         if (!ci)
476                 return;
477         ci->mc_fid[offset]  = fid;
478         ci->mc_capa[offset] = capa;
479 }
480
481 #define MAX_ATIME_DIFF 60
482
483 enum {
484         LPROC_MDD_NR
485 };
486
487 static inline int mdd_permission_internal(const struct lu_env *env,
488                                           struct mdd_object *obj,
489                                           struct lu_attr *la, int mask)
490 {
491         return __mdd_permission_internal(env, obj, la, mask, 0);
492 }
493
494 static inline int mdd_permission_internal_locked(const struct lu_env *env,
495                                                  struct mdd_object *obj,
496                                                  struct lu_attr *la, int mask)
497 {
498         return __mdd_permission_internal(env, obj, la, mask, 1);
499 }
500
501 /* mdd inline func for calling osd_dt_object ops */
502 static inline int mdo_attr_get(const struct lu_env *env, struct mdd_object *obj,
503                                struct lu_attr *la, struct lustre_capa *capa)
504 {
505         struct dt_object *next = mdd_object_child(obj);
506         return next->do_ops->do_attr_get(env, next, la, capa);
507 }
508
509 static inline int mdo_attr_set(const struct lu_env *env, struct mdd_object *obj,
510                                const struct lu_attr *la, struct thandle *handle,
511                                struct lustre_capa *capa)
512 {
513         struct dt_object *next = mdd_object_child(obj);
514         LASSERT(mdd_object_exists(obj));
515         return next->do_ops->do_attr_set(env, next, la, handle, capa);
516 }
517
518 static inline int mdo_xattr_get(const struct lu_env *env,struct mdd_object *obj,
519                                 struct lu_buf *buf, const char *name,
520                                 struct lustre_capa *capa)
521 {
522         struct dt_object *next = mdd_object_child(obj);
523         return next->do_ops->do_xattr_get(env, next, buf, name, capa);
524 }
525
526 static inline int mdo_xattr_set(const struct lu_env *env,struct mdd_object *obj,
527                                 const struct lu_buf *buf, const char *name,
528                                 int fl, struct thandle *handle, 
529                                 struct lustre_capa *capa)
530 {
531         struct dt_object *next = mdd_object_child(obj);
532         LASSERT(mdd_object_exists(obj));
533         return next->do_ops->do_xattr_set(env, next, buf, name, fl, handle,
534                                           capa);
535 }
536
537 static inline int mdo_xattr_del(const struct lu_env *env,struct mdd_object *obj,
538                                 const char *name, struct thandle *handle,
539                                 struct lustre_capa *capa)
540 {
541         struct dt_object *next = mdd_object_child(obj);
542         LASSERT(mdd_object_exists(obj));
543         return next->do_ops->do_xattr_del(env, next, name, handle, capa);
544 }
545
546 static inline 
547 int mdo_xattr_list(const struct lu_env *env, struct mdd_object *obj,
548                    struct lu_buf *buf, struct lustre_capa *capa)
549 {
550         struct dt_object *next = mdd_object_child(obj);
551         LASSERT(mdd_object_exists(obj));
552         return next->do_ops->do_xattr_list(env, next, buf, capa);
553 }
554
555 static inline 
556 int mdo_index_try(const struct lu_env *env, struct mdd_object *obj,
557                                  const struct dt_index_features *feat)
558 {
559         struct dt_object *next = mdd_object_child(obj);
560         return next->do_ops->do_index_try(env, next, feat);
561 }
562
563 static inline void mdo_ref_add(const struct lu_env *env, struct mdd_object *obj,
564                                struct thandle *handle)
565 {
566         struct dt_object *next = mdd_object_child(obj);
567         LASSERT(mdd_object_exists(obj));
568         return next->do_ops->do_ref_add(env, next, handle);
569 }
570
571 static inline void mdo_ref_del(const struct lu_env *env, struct mdd_object *obj,
572                                struct thandle *handle)
573 {
574         struct dt_object *next = mdd_object_child(obj);
575         LASSERT(mdd_object_exists(obj));
576         return next->do_ops->do_ref_del(env, next, handle);
577 }
578
579 static inline 
580 int mdo_create_obj(const struct lu_env *env, struct mdd_object *o, 
581                    struct lu_attr *attr,
582                    struct dt_allocation_hint *hint,
583                    struct thandle *handle)
584 {
585         struct dt_object *next = mdd_object_child(o);
586         return next->do_ops->do_create(env, next, attr, hint, handle);
587 }
588
589 static inline struct obd_capa *mdo_capa_get(const struct lu_env *env,
590                                             struct mdd_object *obj, 
591                                             struct lustre_capa *old,
592                                             __u64 opc)
593 {
594         struct dt_object *next = mdd_object_child(obj);
595         LASSERT(mdd_object_exists(obj));
596         return next->do_ops->do_capa_get(env, next, old, opc);
597 }
598
599 #endif