Whamcloud - gitweb
LU-13602 pcc: add LCM_FL_PCC_RDONLY layout flag
[fs/lustre-release.git] / lustre / lod / lod_internal.h
index 7a913a0..ad0bfbe 100644 (file)
@@ -182,6 +182,8 @@ struct lod_default_striping {
        __u32                           lds_dir_def_stripe_count;
        __u32                           lds_dir_def_stripe_offset;
        __u32                           lds_dir_def_hash_type;
+       __u8                            lds_dir_def_max_inherit;
+       __u8                            lds_dir_def_max_inherit_rr;
                                        /* default file striping flags (LOV) */
        __u32                           lds_def_striping_set:1,
                                        lds_def_striping_is_composite:1,
@@ -189,9 +191,30 @@ struct lod_default_striping {
                                        lds_dir_def_striping_set:1;
 };
 
+static inline __u8 lmv_inherit_next(__u8 inherit)
+{
+       if (inherit == LMV_INHERIT_END || inherit == LMV_INHERIT_NONE)
+               return LMV_INHERIT_NONE;
+
+       if (inherit == LMV_INHERIT_UNLIMITED || inherit > LMV_INHERIT_MAX)
+               return inherit;
+
+       return inherit - 1;
+}
+
+static inline __u8 lmv_inherit_rr_next(__u8 inherit_rr)
+{
+       if (inherit_rr == LMV_INHERIT_RR_NONE ||
+           inherit_rr == LMV_INHERIT_RR_UNLIMITED ||
+           inherit_rr > LMV_INHERIT_RR_MAX)
+               return inherit_rr;
+
+       return inherit_rr - 1;
+}
+
 struct lod_mirror_entry {
        __u16   lme_stale:1,
-               lme_primary:1;
+               lme_prefer:1;
        /* mirror id */
        __u16   lme_id;
        /* start,end index of this mirror in ldo_comp_entries */
@@ -215,7 +238,7 @@ struct lod_object {
                        __u16           ldo_mirror_count;
                        struct lod_mirror_entry *ldo_mirrors;
                        __u32           ldo_is_composite:1,
-                                       ldo_flr_state:2,
+                                       ldo_flr_state:4,
                                        ldo_comp_cached:1,
                                        ldo_is_foreign:1;
                };
@@ -461,23 +484,29 @@ static inline bool lod_obj_is_striped(struct dt_object *dt)
 {
        struct lod_object *lo = lod_dt_obj(dt);
        int i;
+       bool rc = false;
 
        if (!dt_object_exists(dt_object_child(dt)))
                return false;
 
-       if (S_ISDIR(dt->do_lu.lo_header->loh_attr))
-               return lo->ldo_dir_stripe_count != 0;
-
-       if (lo->ldo_is_foreign)
-               return false;
-
-       for (i = 0; i < lo->ldo_comp_cnt; i++) {
-               if (lo->ldo_comp_entries[i].llc_stripe == NULL)
-                       continue;
-               LASSERT(lo->ldo_comp_entries[i].llc_stripe_count > 0);
-               return true;
+       mutex_lock(&lo->ldo_layout_mutex);
+
+       if (S_ISDIR(dt->do_lu.lo_header->loh_attr)) {
+               rc = lo->ldo_dir_stripe_count != 0;
+       } else if (lo->ldo_is_foreign) {
+               rc = false;
+       } else {
+               for (i = 0; i < lo->ldo_comp_cnt; i++) {
+                       if (lo->ldo_comp_entries[i].llc_stripe == NULL)
+                               continue;
+                       LASSERT(lo->ldo_comp_entries[i].llc_stripe_count > 0);
+                       rc = true;
+                       break;
+               }
        }
-       return false;
+
+       mutex_unlock(&lo->ldo_layout_mutex);
+       return rc;
 }
 
 extern struct lu_context_key lod_thread_key;