-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
UCRED_NEW = 2
};
-struct md_ucred {
- __u32 mu_valid;
- __u32 mu_o_uid;
- __u32 mu_o_gid;
- __u32 mu_o_fsuid;
- __u32 mu_o_fsgid;
- __u32 mu_uid;
- __u32 mu_gid;
- __u32 mu_fsuid;
- __u32 mu_fsgid;
- __u32 mu_suppgids[2];
- cfs_cap_t mu_cap;
- __u32 mu_umask;
- cfs_group_info_t *mu_ginfo;
- struct md_identity *mu_identity;
-};
-
enum {
MD_CAPAINFO_MAX = 5
};
* XXX should be moved into separate .h/.c together with all md security
* related definitions.
*/
-struct md_ucred *md_ucred(const struct lu_env *env);
struct md_capainfo *md_capainfo(const struct lu_env *env);
struct md_quota *md_quota(const struct lu_env *env);
} mdl_type_t;
struct md_hsm {
- __u32 mh_flags;
- __u32 mh_archive_number;
+ __u32 mh_compat;
+ __u32 mh_flags;
+ __u64 mh_arch_id;
+ __u64 mh_arch_ver;
};
#define IOEPOCH_INVAL 0
struct md_som_data {
- __u64 msd_ioepoch;
- __u64 msd_size;
- __u64 msd_blocks;
- __u64 msd_mountid;
+ __u32 msd_compat;
+ __u32 msd_incompat;
+ __u64 msd_ioepoch;
+ __u64 msd_size;
+ __u64 msd_blocks;
+ __u64 msd_mountid;
};
struct md_attr {
/** Current lock mode for parent dir where create is performing. */
mdl_mode_t sp_cr_mode;
- /** Check for split */
- int sp_ck_split;
-
/** to create directory */
const struct dt_index_features *sp_feat;
};
int (*moo_xattr_del)(const struct lu_env *env, struct md_object *obj,
const char *name);
+ /** This method is used to swap the layouts between 2 objects */
+ int (*moo_swap_layouts)(const struct lu_env *env,
+ struct md_object *obj1, struct md_object *obj2,
+ __u64 flags);
+
/** \retval number of bytes actually read upon success */
int (*moo_readpage)(const struct lu_env *env, struct md_object *obj,
const struct lu_rdpg *rdpg);
int (*mdo_iocontrol)(const struct lu_env *env, struct md_device *m,
unsigned int cmd, int len, void *data);
-
-#ifdef HAVE_QUOTA_SUPPORT
- struct md_quota_operations {
- int (*mqo_notify)(const struct lu_env *env,
- struct md_device *m);
-
- int (*mqo_setup)(const struct lu_env *env,
- struct md_device *m,
- void *data);
-
- int (*mqo_cleanup)(const struct lu_env *env,
- struct md_device *m);
-
- int (*mqo_recovery)(const struct lu_env *env,
- struct md_device *m);
-
- int (*mqo_check)(const struct lu_env *env,
- struct md_device *m,
- __u32 type);
-
- int (*mqo_on)(const struct lu_env *env,
- struct md_device *m,
- __u32 type);
-
- int (*mqo_off)(const struct lu_env *env,
- struct md_device *m,
- __u32 type);
-
- int (*mqo_setinfo)(const struct lu_env *env,
- struct md_device *m,
- __u32 type,
- __u32 id,
- struct obd_dqinfo *dqinfo);
-
- int (*mqo_getinfo)(const struct lu_env *env,
- const struct md_device *m,
- __u32 type,
- __u32 id,
- struct obd_dqinfo *dqinfo);
-
- int (*mqo_setquota)(const struct lu_env *env,
- struct md_device *m,
- __u32 type,
- __u32 id,
- struct obd_dqblk *dqblk);
-
- int (*mqo_getquota)(const struct lu_env *env,
- const struct md_device *m,
- __u32 type,
- __u32 id,
- struct obd_dqblk *dqblk);
-
- int (*mqo_getoinfo)(const struct lu_env *env,
- const struct md_device *m,
- __u32 type,
- __u32 id,
- struct obd_dqinfo *dqinfo);
-
- int (*mqo_getoquota)(const struct lu_env *env,
- const struct md_device *m,
- __u32 type,
- __u32 id,
- struct obd_dqblk *dqblk);
-
- int (*mqo_invalidate)(const struct lu_env *env,
- struct md_device *m,
- __u32 type);
-
- int (*mqo_finvalidate)(const struct lu_env *env,
- struct md_device *m,
- __u32 type);
- } mdo_quota;
-#endif
};
enum md_upcall_event {
struct md_upcall {
/** this lock protects upcall using against its removal
* read lock is for usage the upcall, write - for init/fini */
- cfs_rw_semaphore_t mu_upcall_sem;
+ struct rw_semaphore mu_upcall_sem;
/** device to call, upper layer normally */
struct md_device *mu_upcall_dev;
/** upcall function */
static inline void md_upcall_init(struct md_device *m, void *upcl)
{
- cfs_init_rwsem(&m->md_upcall.mu_upcall_sem);
- m->md_upcall.mu_upcall_dev = NULL;
- m->md_upcall.mu_upcall = upcl;
+ init_rwsem(&m->md_upcall.mu_upcall_sem);
+ m->md_upcall.mu_upcall_dev = NULL;
+ m->md_upcall.mu_upcall = upcl;
}
static inline void md_upcall_dev_set(struct md_device *m, struct md_device *up)
{
- cfs_down_write(&m->md_upcall.mu_upcall_sem);
- m->md_upcall.mu_upcall_dev = up;
- cfs_up_write(&m->md_upcall.mu_upcall_sem);
+ down_write(&m->md_upcall.mu_upcall_sem);
+ m->md_upcall.mu_upcall_dev = up;
+ up_write(&m->md_upcall.mu_upcall_sem);
}
static inline void md_upcall_fini(struct md_device *m)
{
- cfs_down_write(&m->md_upcall.mu_upcall_sem);
- m->md_upcall.mu_upcall_dev = NULL;
- m->md_upcall.mu_upcall = NULL;
- cfs_up_write(&m->md_upcall.mu_upcall_sem);
+ down_write(&m->md_upcall.mu_upcall_sem);
+ m->md_upcall.mu_upcall_dev = NULL;
+ m->md_upcall.mu_upcall = NULL;
+ up_write(&m->md_upcall.mu_upcall_sem);
}
static inline int md_do_upcall(const struct lu_env *env, struct md_device *m,
- enum md_upcall_event ev, void *data)
-{
- int rc = 0;
- cfs_down_read(&m->md_upcall.mu_upcall_sem);
- if (m->md_upcall.mu_upcall_dev != NULL &&
- m->md_upcall.mu_upcall_dev->md_upcall.mu_upcall != NULL) {
- rc = m->md_upcall.mu_upcall_dev->md_upcall.mu_upcall(env,
- m->md_upcall.mu_upcall_dev,
- ev, data);
- }
- cfs_up_read(&m->md_upcall.mu_upcall_sem);
- return rc;
+ enum md_upcall_event ev, void *data)
+{
+ int rc = 0;
+ down_read(&m->md_upcall.mu_upcall_sem);
+ if (m->md_upcall.mu_upcall_dev != NULL &&
+ m->md_upcall.mu_upcall_dev->md_upcall.mu_upcall != NULL) {
+ rc = m->md_upcall.mu_upcall_dev->md_upcall.mu_upcall(env,
+ m->md_upcall.mu_upcall_dev,
+ ev, data);
+ }
+ up_read(&m->md_upcall.mu_upcall_sem);
+ return rc;
}
struct md_object {
* md-server site.
*/
struct md_site {
- struct lu_site ms_lu;
+ struct lu_site *ms_lu;
/**
* mds number of this site.
*/
static inline struct md_site *lu_site2md(const struct lu_site *s)
{
- return container_of0(s, struct md_site, ms_lu);
+ return s->ld_md_site;
}
static inline int md_device_init(struct md_device *md, struct lu_device_type *t)
return m->mo_ops->moo_xattr_list(env, m, buf);
}
+static inline int mo_swap_layouts(const struct lu_env *env,
+ struct md_object *o1,
+ struct md_object *o2, __u64 flags)
+{
+ LASSERT(o1->mo_ops->moo_swap_layouts);
+ LASSERT(o2->mo_ops->moo_swap_layouts);
+ if (o1->mo_ops->moo_swap_layouts != o2->mo_ops->moo_swap_layouts)
+ return -EPERM;
+ return o1->mo_ops->moo_swap_layouts(env, o1, o2, flags);
+}
+
static inline int mo_open(const struct lu_env *env,
struct md_object *m,
int flags)
struct md_op_spec *spc,
struct md_attr *at)
{
- LASSERT(c->mo_dir_ops->mdo_create);
- return c->mo_dir_ops->mdo_create(env, p, lchild_name, c, spc, at);
+ LASSERT(p->mo_dir_ops->mdo_create);
+ return p->mo_dir_ops->mdo_create(env, p, lchild_name, c, spc, at);
}
static inline int mdo_create_data(const struct lu_env *env,
struct md_device * md,
struct dt_device * dt);
+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);
/** @} md */
#endif /* _LINUX_MD_OBJECT_H */