+ LLT_EMPTY, /** empty file without body (mknod + truncate) */
+ LLT_RELEASED, /** file with no objects (data in HSM) */
+ LLT_COMP, /** support composite layout */
+ LLT_NR
+};
+
+static inline char *llt2str(enum lov_layout_type llt)
+{
+ switch (llt) {
+ case LLT_EMPTY:
+ return "EMPTY";
+ case LLT_RELEASED:
+ return "RELEASED";
+ case LLT_COMP:
+ return "COMPOSITE";
+ case LLT_NR:
+ LBUG();
+ }
+ LBUG();
+ return "";
+}
+
+/**
+ * Return lov_layout_entry_type associated with a given composite layout
+ * entry.
+ */
+static inline __u32 lov_entry_type(struct lov_stripe_md_entry *lsme)
+{
+ if ((lov_pattern(lsme->lsme_pattern) == LOV_PATTERN_RAID0) ||
+ (lov_pattern(lsme->lsme_pattern) == LOV_PATTERN_MDT))
+ return lov_pattern(lsme->lsme_pattern);
+ return 0;
+}
+
+struct lov_layout_entry;
+struct lov_object;
+struct lov_lock_sub;
+
+struct lov_comp_layout_entry_ops {
+ int (*lco_init)(const struct lu_env *env, struct lov_device *dev,
+ struct lov_object *lov, unsigned int index,
+ const struct cl_object_conf *conf,
+ struct lov_layout_entry *lle);
+ void (*lco_fini)(const struct lu_env *env,
+ struct lov_layout_entry *lle);
+ int (*lco_getattr)(const struct lu_env *env, struct lov_object *obj,
+ unsigned int index, struct lov_layout_entry *lle,
+ struct cl_attr **attr);
+};
+
+struct lov_layout_raid0 {
+ unsigned lo_nr;
+ /**
+ * When this is true, lov_object::lo_attr contains
+ * valid up to date attributes for a top-level
+ * object. This field is reset to 0 when attributes of
+ * any sub-object change.
+ */
+ int lo_attr_valid;
+ /**
+ * Array of sub-objects. Allocated when top-object is
+ * created (lov_init_raid0()).
+ *
+ * Top-object is a strict master of its sub-objects:
+ * it is created before them, and outlives its
+ * children (this later is necessary so that basic
+ * functions like cl_object_top() always
+ * work). Top-object keeps a reference on every
+ * sub-object.
+ *
+ * When top-object is destroyed (lov_delete_raid0())
+ * it releases its reference to a sub-object and waits
+ * until the latter is finally destroyed.
+ */
+ struct lovsub_object **lo_sub;
+ /**
+ * protect lo_sub
+ */
+ spinlock_t lo_sub_lock;
+ /**
+ * Cached object attribute, built from sub-object
+ * attributes.
+ */
+ struct cl_attr lo_attr;
+};
+
+struct lov_layout_dom {
+ /* keep this always at first place so DOM layout entry
+ * can be addressed also as RAID0 after initialization.
+ */
+ struct lov_layout_raid0 lo_dom_r0;
+ struct lovsub_object *lo_dom;
+ struct lov_oinfo *lo_loi;
+};
+
+struct lov_layout_entry {
+ __u32 lle_type;
+ struct lu_extent lle_extent;
+ struct lov_comp_layout_entry_ops *lle_comp_ops;
+ union {
+ struct lov_layout_raid0 lle_raid0;
+ struct lov_layout_dom lle_dom;
+ };