X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Flod%2Flod_internal.h;h=ad0bfbe6ae58323ccec874a776f1441f51e124d8;hb=adc1bbbf20e0a8a53274aa4590ed0935f954d1bc;hp=68d890d5240ab5f8d26061e108558abce154104a;hpb=dd15646cc557357af7f8751dd136293b12588ce4;p=fs%2Flustre-release.git diff --git a/lustre/lod/lod_internal.h b/lustre/lod/lod_internal.h index 68d890d..ad0bfbe 100644 --- a/lustre/lod/lod_internal.h +++ b/lustre/lod/lod_internal.h @@ -27,7 +27,6 @@ */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. * * lustre/lod/lod_internal.h * @@ -183,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, @@ -190,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 */ @@ -216,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; }; @@ -393,6 +415,7 @@ struct lod_thread_info { /* object allocation avoid guide info */ struct lod_avoid_guide lti_avoid; union lmv_mds_md lti_lmv; + struct dt_allocation_hint lti_ah; }; extern const struct lu_device_operations lod_lu_ops; @@ -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; @@ -547,6 +576,7 @@ int lod_add_device(const struct lu_env *env, struct lod_device *lod, int lod_del_device(const struct lu_env *env, struct lod_device *lod, struct lod_tgt_descs *ltd, char *osp, unsigned int idx, unsigned int gen); +int validate_lod_and_idx(struct lod_device *lod, __u32 idx); int lod_fini_tgt(const struct lu_env *env, struct lod_device *lod, struct lod_tgt_descs *ltd); int lod_striping_load(const struct lu_env *env, struct lod_object *lo); @@ -700,8 +730,8 @@ int lod_procfs_init(struct lod_device *lod); void lod_procfs_fini(struct lod_device *lod); /* lod_object.c */ -extern struct dt_object_operations lod_obj_ops; -extern struct lu_object_operations lod_lu_obj_ops; +extern const struct dt_object_operations lod_obj_ops; +extern const struct lu_object_operations lod_lu_obj_ops; int lod_load_lmv_shards(const struct lu_env *env, struct lod_object *lo, struct lu_buf *buf, bool resize);