Whamcloud - gitweb
LU-5431 lmv: release locks if lmv_intent_lock() fails
[fs/lustre-release.git] / lustre / lmv / lmv_internal.h
index daf6a7b..b6245b3 100644 (file)
@@ -73,6 +73,11 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct mdt_body *mbody,
                          ldlm_blocking_callback cb_blocking,
                          int extra_lock_flags);
 
+static inline struct obd_device *lmv2obd_dev(struct lmv_obd *lmv)
+{
+       return container_of0(lmv, struct obd_device, u.lmv);
+}
+
 static inline struct lmv_tgt_desc *
 lmv_get_target(struct lmv_obd *lmv, mdsno_t mdt_idx, int *index)
 {
@@ -156,6 +161,18 @@ lsm_name_to_stripe_info(const struct lmv_stripe_md *lsm, const char *name,
        return &lsm->lsm_md_oinfo[stripe_index];
 }
 
+static inline bool lmv_is_known_hash_type(const struct lmv_stripe_md *lsm)
+{
+       return lsm->lsm_md_hash_type == LMV_HASH_TYPE_FNV_1A_64 ||
+              lsm->lsm_md_hash_type == LMV_HASH_TYPE_ALL_CHARS;
+}
+
+static inline bool lmv_need_try_all_stripes(const struct lmv_stripe_md *lsm)
+{
+       return !lmv_is_known_hash_type(lsm) ||
+              lsm->lsm_md_hash_type & LMV_HASH_FLAG_MIGRATION;
+}
+
 struct lmv_tgt_desc
 *lmv_locate_mds(struct lmv_obd *lmv, struct md_op_data *op_data,
                struct lu_fid *fid);