struct mdd_object *mdd_lpf;
};
+struct mdd_generic_thread {
+ struct completion mgt_started;
+ struct completion mgt_finished;
+ void *mgt_data;
+ bool mgt_abort;
+ bool mgt_init;
+};
+
struct mdd_device {
struct md_device mdd_md_dev;
struct obd_export *mdd_child_exp;
unsigned int mdd_sync_permission;
int mdd_connects;
struct local_oid_storage *mdd_los;
+ struct mdd_generic_thread mdd_orph_cleanup_thread;
};
enum mod_flags {
struct dt_object_format mti_dof;
struct linkea_data mti_link_data;
struct md_op_spec mti_spec;
+ struct dt_insert_rec mti_dt_rec;
};
extern const char orph_index_name[];
const struct lu_fid *fid, struct lu_fid *sfid);
int mdd_may_create(const struct lu_env *env, struct mdd_object *pobj,
const struct lu_attr *pattr, struct mdd_object *cobj,
- int check_perm, int check_nlink);
+ bool check_perm);
int mdd_may_unlink(const struct lu_env *env, struct mdd_object *pobj,
const struct lu_attr *pattr, const struct lu_attr *attr);
int mdd_may_delete(const struct lu_env *env, struct mdd_object *tpobj,
const struct lu_buf *mdd_buf_get_const(const struct lu_env *env,
const void *area, ssize_t len);
-int __mdd_orphan_cleanup(const struct lu_env *env, struct mdd_device *d);
+int mdd_orphan_cleanup(const struct lu_env *env, struct mdd_device *d);
int __mdd_orphan_add(const struct lu_env *, struct mdd_object *,
struct thandle *);
int __mdd_orphan_del(const struct lu_env *, struct mdd_object *,
struct thandle *);
/* mdd_lproc.c */
-void lprocfs_mdd_init_vars(struct lprocfs_static_vars *lvars);
int mdd_procfs_init(struct mdd_device *mdd, const char *name);
-int mdd_procfs_fini(struct mdd_device *mdd);
+void mdd_procfs_fini(struct mdd_device *mdd);
/* mdd_object.c */
extern struct kmem_cache *mdd_object_kmem;
struct md_attr *ma, int mask);
int mdd_capa_get(const struct lu_env *env, struct md_object *obj,
struct lustre_capa *capa, int renewal);
+int mdd_generic_thread_start(struct mdd_generic_thread *thread,
+ int (*func)(void *), void *data, char *name);
+void mdd_generic_thread_stop(struct mdd_generic_thread *thread);
/* mdd_prepare.c */
int mdd_compat_fixes(const struct lu_env *env, struct mdd_device *mdd);
static inline
int mdo_declare_index_insert(const struct lu_env *env, struct mdd_object *obj,
- const struct lu_fid *fid, const char *name,
- struct thandle *handle)
+ const struct lu_fid *fid, __u32 type,
+ const char *name, struct thandle *handle)
{
- struct dt_object *next = mdd_object_child(obj);
- int rc = 0;
+ struct dt_object *next = mdd_object_child(obj);
+ int rc = 0;
+
+ /*
+ * if the object doesn't exist yet, then it's supposed to be created
+ * and declaration of the creation should be enough to insert ./..
+ */
- /*
- * if the object doesn't exist yet, then it's supposed to be created
- * and declaration of the creation should be enough to insert ./..
- */
/* FIXME: remote object should not be awared by MDD layer, but local
* creation does not declare insert ./.. (comments above), which
* is required by remote directory creation.
* This remote check should be removed when mdd_object_exists check is
* removed.
*/
- if (mdd_object_exists(obj) || mdd_object_remote(obj)) {
- rc = -ENOTDIR;
- if (dt_try_as_dir(env, next))
- rc = dt_declare_insert(env, next,
- (struct dt_rec *)fid,
- (const struct dt_key *)name,
- handle);
- }
-
- return rc;
+ if (mdd_object_exists(obj) || mdd_object_remote(obj)) {
+ rc = -ENOTDIR;
+ if (dt_try_as_dir(env, next)) {
+ struct dt_insert_rec *rec =
+ &mdd_env_info(env)->mti_dt_rec;
+
+ rec->rec_fid = fid;
+ rec->rec_type = type;
+ rc = dt_declare_insert(env, next,
+ (const struct dt_rec *)rec,
+ (const struct dt_key *)name,
+ handle);
+ }
+ }
+
+ return rc;
}
static inline