Whamcloud - gitweb
LU-9007 lod: improve obj alloc for FLR file
[fs/lustre-release.git] / lustre / lod / lod_internal.h
index c2b9346..cb683f1 100644 (file)
@@ -102,6 +102,7 @@ struct lod_qos_oss {
                                                         every obj*/
        time64_t                 lqo_used;      /* last used time, seconds */
        __u32                    lqo_ost_count; /* number of osts on this oss */
+       __u32                    lqo_id;        /* unique oss id */
 };
 
 struct ltd_qos {
@@ -163,6 +164,19 @@ struct lod_tgt_descs {
        struct rw_semaphore     ltd_rw_sem;
 };
 
+struct lod_avoid_guide {
+       /* ids of OSSs avoid guidance */
+       __u32                   *lag_oss_avoid_array;
+       /* number of filled array items */
+       unsigned int            lag_oaa_count;
+       /* number of allocated array items */
+       unsigned int            lag_oaa_size;
+       /* bitmap of OSTs avoid guidance */
+       struct cfs_bitmap       *lag_ost_avoid_bitmap;
+       /* how many OSTs are available for alloc */
+       __u32                   lag_ost_avail;
+};
+
 struct lod_device {
        struct dt_device      lod_dt_dev;
        struct obd_export    *lod_child_exp;
@@ -244,6 +258,7 @@ struct lod_layout_component {
        /* ost list specified with LOV_USER_MAGIC_SPECIFIC lum */
        struct ost_pool           llc_ostlist;
        struct dt_object        **llc_stripe;
+       __u32                    *llc_ost_indices;
 };
 
 struct lod_default_striping {
@@ -320,6 +335,19 @@ struct lod_object {
        struct dt_object                **ldo_stripe;
 };
 
+#define lod_foreach_mirror_comp(comp, lo, mirror_idx)                      \
+for (comp = &lo->ldo_comp_entries[lo->ldo_mirrors[mirror_idx].lme_start];  \
+     comp <= &lo->ldo_comp_entries[lo->ldo_mirrors[mirror_idx].lme_end];   \
+     comp++)
+
+static inline bool lod_is_flr(const struct lod_object *lo)
+{
+       if (!lo->ldo_is_composite)
+               return false;
+
+       return (lo->ldo_flr_state & LCM_FL_FLR_MASK) != LCM_FL_NONE;
+}
+
 static inline int lod_set_pool(char **pool, const char *new_pool)
 {
        int len;
@@ -413,6 +441,8 @@ struct lod_thread_info {
        size_t                          lti_comp_size;
        size_t                          lti_count;
        struct lu_attr                  lti_layout_attr;
+       /* object allocation avoid guide info */
+       struct lod_avoid_guide          lti_avoid;
 };
 
 extern const struct lu_device_operations lod_lu_ops;