/** Create flag from client: such as MDS_OPEN_CREAT, and others. */
__u64 sp_cr_flags;
- /** don't create lov objects or llog cookie - this replay */
+ /** don't create lov objects or llog cookie - this replay */
unsigned int no_create:1,
- /** Should mdd do lookup sanity check or not. */
- sp_cr_lookup:1;
+ sp_cr_lookup:1, /* do lookup sanity check or not. */
+ sp_rm_entry:1; /* only remove name entry */
- /** Current lock mode for parent dir where create is performing. */
+ /** Current lock mode for parent dir where create is performing. */
mdl_mode_t sp_cr_mode;
/** to create directory */
int (*moo_file_unlock)(const struct lu_env *env, struct md_object *obj,
struct lov_mds_md *lmm,
struct lustre_handle *lockh);
+ int (*moo_object_lock)(const struct lu_env *env, struct md_object *obj,
+ struct lustre_handle *lh,
+ struct ldlm_enqueue_info *einfo,
+ void *policy);
};
/**
return m->mo_ops->moo_file_unlock(env, m, lmm, lockh);
}
+static inline int mo_object_lock(const struct lu_env *env,
+ struct md_object *m,
+ struct lustre_handle *lh,
+ struct ldlm_enqueue_info *einfo,
+ void *policy)
+{
+ LASSERT(m->mo_ops->moo_object_lock);
+ return m->mo_ops->moo_object_lock(env, m, lh, einfo, policy);
+}
+
static inline int mdo_lookup(const struct lu_env *env,
struct md_object *p,
const struct lu_name *lname,
const struct lu_name *lname,
struct md_attr *ma)
{
- LASSERT(c->mo_dir_ops->mdo_unlink);
- return c->mo_dir_ops->mdo_unlink(env, p, c, lname, ma);
+ LASSERT(p->mo_dir_ops->mdo_unlink);
+ return p->mo_dir_ops->mdo_unlink(env, p, c, lname, ma);
}
static inline int mdo_lum_lmm_cmp(const struct lu_env *env,
int lustre_buf2som(void *buf, int rc, struct md_som_data *msd);
int lustre_buf2hsm(void *buf, int rc, struct md_hsm *mh);
void lustre_hsm2buf(void *buf, struct md_hsm *mh);
+
+#define md_cap_t(x) (x)
+
+#define MD_CAP_TO_MASK(x) (1 << (x))
+
+#define md_cap_raised(c, flag) (md_cap_t(c) & MD_CAP_TO_MASK(flag))
+
+/* capable() is copied from linux kernel! */
+static inline int md_capable(struct lu_ucred *uc, cfs_cap_t cap)
+{
+ if (md_cap_raised(uc->uc_cap, cap))
+ return 1;
+ return 0;
+}
+
/** @} md */
#endif /* _LINUX_MD_OBJECT_H */