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, 2012, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/include/md_object.h
38 * Extention of lu_object.h for metadata objects
41 #ifndef _LUSTRE_MD_OBJECT_H
42 #define _LUSTRE_MD_OBJECT_H
45 * Sub-class of lu_object with methods common for "meta-data" objects in MDT
48 * Meta-data objects implement namespace operations: you can link, unlink
49 * them, and treat them as directories.
51 * Examples: mdt, cmm, and mdt are implementations of md interface.
57 * super-class definitions.
59 #include <dt_object.h>
62 /* LU-1051, temperary solution to reduce llog credits */
63 #define DECLARE_LLOG_REWRITE 0
64 #define DECLARE_LLOG_WRITE INT_MAX
67 struct md_device_operations;
82 /** there are at most 5 fids in one operation, see rename, NOTE the last one
83 * is a temporary one used for is_subdir() */
87 struct lu_fid mc_fid[MD_CAPAINFO_MAX];
88 struct lustre_capa *mc_capa[MD_CAPAINFO_MAX];
92 struct obd_export *mq_exp;
96 * Implemented in mdd/mdd_handler.c.
98 * XXX should be moved into separate .h/.c together with all md security
99 * related definitions.
101 struct md_capainfo *md_capainfo(const struct lu_env *env);
102 struct md_quota *md_quota(const struct lu_env *env);
104 /** metadata attributes */
108 MA_COOKIE = (1 << 2),
111 MA_ACL_DEF = (1 << 5),
112 MA_LOV_DEF = (1 << 6),
113 MA_LAY_GEN = (1 << 7),
133 MDT_REG_LOCK = (1 << 0),
134 MDT_PDO_LOCK = (1 << 1)
137 /* memory structure for hsm attributes
138 * for fields description see the on disk structure hsm_attrs
139 * which is defined in lustre_idl.h
148 #define IOEPOCH_INVAL 0
150 /* memory structure for som attributes
151 * for fields description see the on disk structure som_attrs
152 * which is defined in lustre_idl.h
167 struct lu_attr ma_attr;
168 struct lu_fid ma_pfid;
169 struct md_hsm ma_hsm;
170 struct lov_mds_md *ma_lmm;
171 struct lmv_stripe_md *ma_lmv;
173 struct llog_cookie *ma_cookie;
174 struct lustre_capa *ma_capa;
175 struct md_som_data *ma_som;
183 /** Additional parameters for create */
186 /** symlink target */
187 const char *sp_symname;
188 /** parent FID for cross-ref mkdir */
189 const struct lu_fid *sp_pfid;
190 /** eadata for regular files */
192 /** lov objs exist already */
193 const struct lu_fid *fid;
199 /** Create flag from client: such as MDS_OPEN_CREAT, and others. */
202 /** don't create lov objects or llog cookie - this replay */
203 unsigned int no_create:1,
204 sp_cr_lookup:1, /* do lookup sanity check or not. */
205 sp_rm_entry:1; /* only remove name entry */
207 /** Current lock mode for parent dir where create is performing. */
208 mdl_mode_t sp_cr_mode;
210 /** to create directory */
211 const struct dt_index_features *sp_feat;
215 * Operations implemented for each md object (both directory and leaf).
217 struct md_object_operations {
218 int (*moo_permission)(const struct lu_env *env,
219 struct md_object *pobj, struct md_object *cobj,
220 struct md_attr *attr, int mask);
222 int (*moo_attr_get)(const struct lu_env *env, struct md_object *obj,
223 struct md_attr *attr);
225 int (*moo_attr_set)(const struct lu_env *env, struct md_object *obj,
226 const struct md_attr *attr);
228 int (*moo_xattr_get)(const struct lu_env *env, struct md_object *obj,
229 struct lu_buf *buf, const char *name);
231 int (*moo_xattr_list)(const struct lu_env *env, struct md_object *obj,
234 int (*moo_xattr_set)(const struct lu_env *env, struct md_object *obj,
235 const struct lu_buf *buf, const char *name,
238 int (*moo_xattr_del)(const struct lu_env *env, struct md_object *obj,
241 /** This method is used to swap the layouts between 2 objects */
242 int (*moo_swap_layouts)(const struct lu_env *env,
243 struct md_object *obj1, struct md_object *obj2,
246 /** \retval number of bytes actually read upon success */
247 int (*moo_readpage)(const struct lu_env *env, struct md_object *obj,
248 const struct lu_rdpg *rdpg);
250 int (*moo_readlink)(const struct lu_env *env, struct md_object *obj,
252 int (*moo_changelog)(const struct lu_env *env,
253 enum changelog_rec_type type, int flags,
254 struct md_object *obj);
255 /** part of cross-ref operation */
256 int (*moo_object_create)(const struct lu_env *env,
257 struct md_object *obj,
258 const struct md_op_spec *spec,
261 int (*moo_ref_add)(const struct lu_env *env,
262 struct md_object *obj,
263 const struct md_attr *ma);
265 int (*moo_ref_del)(const struct lu_env *env,
266 struct md_object *obj,
269 int (*moo_open)(const struct lu_env *env,
270 struct md_object *obj, int flag);
272 int (*moo_close)(const struct lu_env *env, struct md_object *obj,
273 struct md_attr *ma, int mode);
275 int (*moo_capa_get)(const struct lu_env *, struct md_object *,
276 struct lustre_capa *, int renewal);
278 int (*moo_object_sync)(const struct lu_env *, struct md_object *);
279 int (*moo_path)(const struct lu_env *env, struct md_object *obj,
280 char *path, int pathlen, __u64 *recno, int *linkno);
281 int (*moo_file_lock)(const struct lu_env *env, struct md_object *obj,
282 struct lov_mds_md *lmm, struct ldlm_extent *extent,
283 struct lustre_handle *lockh);
284 int (*moo_file_unlock)(const struct lu_env *env, struct md_object *obj,
285 struct lov_mds_md *lmm,
286 struct lustre_handle *lockh);
287 int (*moo_object_lock)(const struct lu_env *env, struct md_object *obj,
288 struct lustre_handle *lh,
289 struct ldlm_enqueue_info *einfo,
294 * Operations implemented for each directory object.
296 struct md_dir_operations {
297 int (*mdo_is_subdir) (const struct lu_env *env, struct md_object *obj,
298 const struct lu_fid *fid, struct lu_fid *sfid);
300 int (*mdo_lookup)(const struct lu_env *env, struct md_object *obj,
301 const struct lu_name *lname, struct lu_fid *fid,
302 struct md_op_spec *spec);
304 mdl_mode_t (*mdo_lock_mode)(const struct lu_env *env,
305 struct md_object *obj,
308 int (*mdo_create)(const struct lu_env *env, struct md_object *pobj,
309 const struct lu_name *lname, struct md_object *child,
310 struct md_op_spec *spec,
313 /** This method is used for creating data object for this meta object*/
314 int (*mdo_create_data)(const struct lu_env *env, struct md_object *p,
316 const struct md_op_spec *spec,
319 int (*mdo_rename)(const struct lu_env *env, struct md_object *spobj,
320 struct md_object *tpobj, const struct lu_fid *lf,
321 const struct lu_name *lsname, struct md_object *tobj,
322 const struct lu_name *ltname, struct md_attr *ma);
324 int (*mdo_link)(const struct lu_env *env, struct md_object *tgt_obj,
325 struct md_object *src_obj, const struct lu_name *lname,
328 int (*mdo_unlink)(const struct lu_env *env, struct md_object *pobj,
329 struct md_object *cobj, const struct lu_name *lname,
332 /** This method is used to compare a requested layout to an existing
333 * layout (struct lov_mds_md_v1/3 vs struct lov_mds_md_v1/3) */
334 int (*mdo_lum_lmm_cmp)(const struct lu_env *env,
335 struct md_object *cobj,
336 const struct md_op_spec *spec,
339 /** partial ops for cross-ref case */
340 int (*mdo_name_insert)(const struct lu_env *env,
341 struct md_object *obj,
342 const struct lu_name *lname,
343 const struct lu_fid *fid,
344 const struct md_attr *ma);
346 int (*mdo_name_remove)(const struct lu_env *env,
347 struct md_object *obj,
348 const struct lu_name *lname,
349 const struct md_attr *ma);
351 int (*mdo_rename_tgt)(const struct lu_env *env, struct md_object *pobj,
352 struct md_object *tobj, const struct lu_fid *fid,
353 const struct lu_name *lname, struct md_attr *ma);
356 struct md_device_operations {
357 /** meta-data device related handlers. */
358 int (*mdo_root_get)(const struct lu_env *env, struct md_device *m,
361 int (*mdo_maxsize_get)(const struct lu_env *env, struct md_device *m,
362 int *md_size, int *cookie_size);
364 int (*mdo_statfs)(const struct lu_env *env, struct md_device *m,
365 struct obd_statfs *sfs);
367 int (*mdo_init_capa_ctxt)(const struct lu_env *env, struct md_device *m,
368 int mode, unsigned long timeout, __u32 alg,
369 struct lustre_capa_key *keys);
371 int (*mdo_update_capa_key)(const struct lu_env *env,
373 struct lustre_capa_key *key);
375 int (*mdo_llog_ctxt_get)(const struct lu_env *env,
376 struct md_device *m, int idx, void **h);
378 int (*mdo_iocontrol)(const struct lu_env *env, struct md_device *m,
379 unsigned int cmd, int len, void *data);
382 enum md_upcall_event {
383 /** Sync the md layer*/
384 MD_LOV_SYNC = (1 << 0),
385 /** Just for split, no need trans, for replay */
386 MD_NO_TRANS = (1 << 1),
387 MD_LOV_CONFIG = (1 << 2),
388 /** Trigger quota recovery */
389 MD_LOV_QUOTA = (1 << 3)
393 /** this lock protects upcall using against its removal
394 * read lock is for usage the upcall, write - for init/fini */
395 struct rw_semaphore mu_upcall_sem;
396 /** device to call, upper layer normally */
397 struct md_device *mu_upcall_dev;
398 /** upcall function */
399 int (*mu_upcall)(const struct lu_env *env, struct md_device *md,
400 enum md_upcall_event ev, void *data);
404 struct lu_device md_lu_dev;
405 const struct md_device_operations *md_ops;
406 struct md_upcall md_upcall;
409 static inline void md_upcall_init(struct md_device *m, void *upcl)
411 init_rwsem(&m->md_upcall.mu_upcall_sem);
412 m->md_upcall.mu_upcall_dev = NULL;
413 m->md_upcall.mu_upcall = upcl;
416 static inline void md_upcall_dev_set(struct md_device *m, struct md_device *up)
418 down_write(&m->md_upcall.mu_upcall_sem);
419 m->md_upcall.mu_upcall_dev = up;
420 up_write(&m->md_upcall.mu_upcall_sem);
423 static inline void md_upcall_fini(struct md_device *m)
425 down_write(&m->md_upcall.mu_upcall_sem);
426 m->md_upcall.mu_upcall_dev = NULL;
427 m->md_upcall.mu_upcall = NULL;
428 up_write(&m->md_upcall.mu_upcall_sem);
431 static inline int md_do_upcall(const struct lu_env *env, struct md_device *m,
432 enum md_upcall_event ev, void *data)
435 down_read(&m->md_upcall.mu_upcall_sem);
436 if (m->md_upcall.mu_upcall_dev != NULL &&
437 m->md_upcall.mu_upcall_dev->md_upcall.mu_upcall != NULL) {
438 rc = m->md_upcall.mu_upcall_dev->md_upcall.mu_upcall(env,
439 m->md_upcall.mu_upcall_dev,
442 up_read(&m->md_upcall.mu_upcall_sem);
447 struct lu_object mo_lu;
448 const struct md_object_operations *mo_ops;
449 const struct md_dir_operations *mo_dir_ops;
455 struct seq_server_site {
456 struct lu_site *ss_lu;
458 * mds number of this site.
462 * Fid location database
464 struct lu_server_fld *ss_server_fld;
465 struct lu_client_fld *ss_client_fld;
470 struct lu_server_seq *ss_server_seq;
473 * Controller Seq Manager
475 struct lu_server_seq *ss_control_seq;
476 struct obd_export *ss_control_exp;
481 struct lu_client_seq *ss_client_seq;
484 static inline int lu_device_is_md(const struct lu_device *d)
486 return ergo(d != NULL, d->ld_type->ldt_tags & LU_DEVICE_MD);
489 static inline struct md_device *lu2md_dev(const struct lu_device *d)
491 LASSERT(IS_ERR(d) || lu_device_is_md(d));
492 return container_of0(d, struct md_device, md_lu_dev);
495 static inline struct lu_device *md2lu_dev(struct md_device *d)
497 return &d->md_lu_dev;
500 static inline struct md_object *lu2md(const struct lu_object *o)
502 LASSERT(o == NULL || IS_ERR(o) || lu_device_is_md(o->lo_dev));
503 return container_of0(o, struct md_object, mo_lu);
506 static inline struct md_object *md_object_next(const struct md_object *obj)
508 return (obj ? lu2md(lu_object_next(&obj->mo_lu)) : NULL);
511 static inline struct md_device *md_obj2dev(const struct md_object *o)
513 LASSERT(o == NULL || IS_ERR(o) || lu_device_is_md(o->mo_lu.lo_dev));
514 return container_of0(o->mo_lu.lo_dev, struct md_device, md_lu_dev);
517 static inline struct seq_server_site *lu_site2seq(const struct lu_site *s)
519 return s->ld_seq_site;
522 static inline int md_device_init(struct md_device *md, struct lu_device_type *t)
524 return lu_device_init(&md->md_lu_dev, t);
527 static inline void md_device_fini(struct md_device *md)
529 lu_device_fini(&md->md_lu_dev);
532 static inline struct md_object *md_object_find_slice(const struct lu_env *env,
533 struct md_device *md,
534 const struct lu_fid *f)
536 return lu2md(lu_object_find_slice(env, md2lu_dev(md), f, NULL));
541 static inline int mo_permission(const struct lu_env *env,
547 LASSERT(c->mo_ops->moo_permission);
548 return c->mo_ops->moo_permission(env, p, c, at, mask);
551 static inline int mo_attr_get(const struct lu_env *env,
555 LASSERT(m->mo_ops->moo_attr_get);
556 return m->mo_ops->moo_attr_get(env, m, at);
559 static inline int mo_readlink(const struct lu_env *env,
563 LASSERT(m->mo_ops->moo_readlink);
564 return m->mo_ops->moo_readlink(env, m, buf);
567 static inline int mo_changelog(const struct lu_env *env,
568 enum changelog_rec_type type,
569 int flags, struct md_object *m)
571 LASSERT(m->mo_ops->moo_changelog);
572 return m->mo_ops->moo_changelog(env, type, flags, m);
575 static inline int mo_attr_set(const struct lu_env *env,
577 const struct md_attr *at)
579 LASSERT(m->mo_ops->moo_attr_set);
580 return m->mo_ops->moo_attr_set(env, m, at);
583 static inline int mo_xattr_get(const struct lu_env *env,
588 LASSERT(m->mo_ops->moo_xattr_get);
589 return m->mo_ops->moo_xattr_get(env, m, buf, name);
592 static inline int mo_xattr_del(const struct lu_env *env,
596 LASSERT(m->mo_ops->moo_xattr_del);
597 return m->mo_ops->moo_xattr_del(env, m, name);
600 static inline int mo_xattr_set(const struct lu_env *env,
602 const struct lu_buf *buf,
606 LASSERT(m->mo_ops->moo_xattr_set);
607 return m->mo_ops->moo_xattr_set(env, m, buf, name, flags);
610 static inline int mo_xattr_list(const struct lu_env *env,
614 LASSERT(m->mo_ops->moo_xattr_list);
615 return m->mo_ops->moo_xattr_list(env, m, buf);
618 static inline int mo_swap_layouts(const struct lu_env *env,
619 struct md_object *o1,
620 struct md_object *o2, __u64 flags)
622 LASSERT(o1->mo_ops->moo_swap_layouts);
623 LASSERT(o2->mo_ops->moo_swap_layouts);
624 if (o1->mo_ops->moo_swap_layouts != o2->mo_ops->moo_swap_layouts)
626 return o1->mo_ops->moo_swap_layouts(env, o1, o2, flags);
629 static inline int mo_open(const struct lu_env *env,
633 LASSERT(m->mo_ops->moo_open);
634 return m->mo_ops->moo_open(env, m, flags);
637 static inline int mo_close(const struct lu_env *env,
642 LASSERT(m->mo_ops->moo_close);
643 return m->mo_ops->moo_close(env, m, ma, mode);
646 static inline int mo_readpage(const struct lu_env *env,
648 const struct lu_rdpg *rdpg)
650 LASSERT(m->mo_ops->moo_readpage);
651 return m->mo_ops->moo_readpage(env, m, rdpg);
654 static inline int mo_object_create(const struct lu_env *env,
656 const struct md_op_spec *spc,
659 LASSERT(m->mo_ops->moo_object_create);
660 return m->mo_ops->moo_object_create(env, m, spc, at);
663 static inline int mo_ref_add(const struct lu_env *env,
665 const struct md_attr *ma)
667 LASSERT(m->mo_ops->moo_ref_add);
668 return m->mo_ops->moo_ref_add(env, m, ma);
671 static inline int mo_ref_del(const struct lu_env *env,
675 LASSERT(m->mo_ops->moo_ref_del);
676 return m->mo_ops->moo_ref_del(env, m, ma);
679 static inline int mo_capa_get(const struct lu_env *env,
681 struct lustre_capa *c,
684 LASSERT(m->mo_ops->moo_capa_get);
685 return m->mo_ops->moo_capa_get(env, m, c, renewal);
688 static inline int mo_path(const struct lu_env *env, struct md_object *m,
689 char *path, int pathlen, __u64 *recno, int *linkno)
691 if (m->mo_ops->moo_path == NULL)
693 return m->mo_ops->moo_path(env, m, path, pathlen, recno, linkno);
696 static inline int mo_object_sync(const struct lu_env *env, struct md_object *m)
698 LASSERT(m->mo_ops->moo_object_sync);
699 return m->mo_ops->moo_object_sync(env, m);
702 static inline int mo_file_lock(const struct lu_env *env, struct md_object *m,
703 struct lov_mds_md *lmm,
704 struct ldlm_extent *extent,
705 struct lustre_handle *lockh)
707 LASSERT(m->mo_ops->moo_file_lock);
708 return m->mo_ops->moo_file_lock(env, m, lmm, extent, lockh);
711 static inline int mo_file_unlock(const struct lu_env *env, struct md_object *m,
712 struct lov_mds_md *lmm,
713 struct lustre_handle *lockh)
715 LASSERT(m->mo_ops->moo_file_unlock);
716 return m->mo_ops->moo_file_unlock(env, m, lmm, lockh);
719 static inline int mo_object_lock(const struct lu_env *env,
721 struct lustre_handle *lh,
722 struct ldlm_enqueue_info *einfo,
725 LASSERT(m->mo_ops->moo_object_lock);
726 return m->mo_ops->moo_object_lock(env, m, lh, einfo, policy);
729 static inline int mdo_lookup(const struct lu_env *env,
731 const struct lu_name *lname,
733 struct md_op_spec *spec)
735 LASSERT(p->mo_dir_ops->mdo_lookup);
736 return p->mo_dir_ops->mdo_lookup(env, p, lname, f, spec);
739 static inline mdl_mode_t mdo_lock_mode(const struct lu_env *env,
740 struct md_object *mo,
743 if (mo->mo_dir_ops->mdo_lock_mode == NULL)
745 return mo->mo_dir_ops->mdo_lock_mode(env, mo, lm);
748 static inline int mdo_create(const struct lu_env *env,
750 const struct lu_name *lchild_name,
752 struct md_op_spec *spc,
755 LASSERT(p->mo_dir_ops->mdo_create);
756 return p->mo_dir_ops->mdo_create(env, p, lchild_name, c, spc, at);
759 static inline int mdo_create_data(const struct lu_env *env,
762 const struct md_op_spec *spec,
765 LASSERT(c->mo_dir_ops->mdo_create_data);
766 return c->mo_dir_ops->mdo_create_data(env, p, c, spec, ma);
769 static inline int mdo_rename(const struct lu_env *env,
770 struct md_object *sp,
771 struct md_object *tp,
772 const struct lu_fid *lf,
773 const struct lu_name *lsname,
775 const struct lu_name *ltname,
778 LASSERT(tp->mo_dir_ops->mdo_rename);
779 return tp->mo_dir_ops->mdo_rename(env, sp, tp, lf, lsname, t, ltname,
783 static inline int mdo_is_subdir(const struct lu_env *env,
784 struct md_object *mo,
785 const struct lu_fid *fid,
788 LASSERT(mo->mo_dir_ops->mdo_is_subdir);
789 return mo->mo_dir_ops->mdo_is_subdir(env, mo, fid, sfid);
792 static inline int mdo_link(const struct lu_env *env,
795 const struct lu_name *lname,
798 LASSERT(s->mo_dir_ops->mdo_link);
799 return s->mo_dir_ops->mdo_link(env, p, s, lname, ma);
802 static inline int mdo_unlink(const struct lu_env *env,
805 const struct lu_name *lname,
808 LASSERT(p->mo_dir_ops->mdo_unlink);
809 return p->mo_dir_ops->mdo_unlink(env, p, c, lname, ma);
812 static inline int mdo_lum_lmm_cmp(const struct lu_env *env,
814 const struct md_op_spec *spec,
817 LASSERT(c->mo_dir_ops->mdo_lum_lmm_cmp);
818 return c->mo_dir_ops->mdo_lum_lmm_cmp(env, c, spec, ma);
821 static inline int mdo_name_insert(const struct lu_env *env,
823 const struct lu_name *lname,
824 const struct lu_fid *f,
825 const struct md_attr *ma)
827 LASSERT(p->mo_dir_ops->mdo_name_insert);
828 return p->mo_dir_ops->mdo_name_insert(env, p, lname, f, ma);
831 static inline int mdo_name_remove(const struct lu_env *env,
833 const struct lu_name *lname,
834 const struct md_attr *ma)
836 LASSERT(p->mo_dir_ops->mdo_name_remove);
837 return p->mo_dir_ops->mdo_name_remove(env, p, lname, ma);
840 static inline int mdo_rename_tgt(const struct lu_env *env,
843 const struct lu_fid *lf,
844 const struct lu_name *lname,
848 LASSERT(t->mo_dir_ops->mdo_rename_tgt);
849 return t->mo_dir_ops->mdo_rename_tgt(env, p, t, lf, lname, ma);
851 LASSERT(p->mo_dir_ops->mdo_rename_tgt);
852 return p->mo_dir_ops->mdo_rename_tgt(env, p, t, lf, lname, ma);
857 * Used in MDD/OUT layer for object lock rule
859 enum mdd_object_role {
869 * Structure to hold object information. This is used to create object
870 * \pre llod_dir exist
872 struct lu_local_obj_desc {
873 const char *llod_dir;
874 const char *llod_name;
877 const struct dt_index_features *llod_feat;
878 cfs_list_t llod_linkage;
881 struct md_object *llo_store_resolve(const struct lu_env *env,
882 struct md_device *md,
883 struct dt_device *dt,
887 struct md_object *llo_store_open(const struct lu_env *env,
888 struct md_device *md,
889 struct dt_device *dt,
894 struct md_object *llo_store_create_index(const struct lu_env *env,
895 struct md_device *md,
896 struct dt_device *dt,
899 const struct lu_fid *fid,
900 const struct dt_index_features *feat);
902 struct md_object *llo_store_create(const struct lu_env *env,
903 struct md_device *md,
904 struct dt_device *dt,
907 const struct lu_fid *fid);
909 void llo_local_obj_register(struct lu_local_obj_desc *);
910 void llo_local_obj_unregister(struct lu_local_obj_desc *);
912 int llo_local_objects_setup(const struct lu_env *env,
913 struct md_device * md,
914 struct dt_device * dt);
916 int lustre_buf2som(void *buf, int rc, struct md_som_data *msd);
917 int lustre_buf2hsm(void *buf, int rc, struct md_hsm *mh);
918 void lustre_hsm2buf(void *buf, struct md_hsm *mh);
920 #define md_cap_t(x) (x)
922 #define MD_CAP_TO_MASK(x) (1 << (x))
924 #define md_cap_raised(c, flag) (md_cap_t(c) & MD_CAP_TO_MASK(flag))
926 /* capable() is copied from linux kernel! */
927 static inline int md_capable(struct lu_ucred *uc, cfs_cap_t cap)
929 if (md_cap_raised(uc->uc_cap, cap))
935 #endif /* _LINUX_MD_OBJECT_H */