From: yury Date: Thu, 19 Oct 2006 09:59:09 +0000 (+0000) Subject: - more fixes in pdirops. Cmm has not to decide what to do in case split is not going... X-Git-Tag: v1_8_0_110~486^2~442 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7d7a6509e4da976c2af21698e170f7cf0d1b9944;p=fs%2Flustre-release.git - more fixes in pdirops. Cmm has not to decide what to do in case split is not going to happen, better mdt does it. --- diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index 1e2da83..f6ed7ea 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -379,27 +379,14 @@ static lu_mode_t cml_lock_mode(const struct lu_env *env, #ifdef HAVE_SPLIT_SUPPORT { struct md_attr *ma = &cmm_env_info(env)->cmi_ma; - int split; - - memset(ma, 0, sizeof(*ma)); - split = cmm_expect_splitting(env, mo, ma); - - if (split == CMM_NOT_SPLITTABLE) { - if (lm == LU_PW) - RETURN(LU_CW); - } else { - if (lm == LU_EX) { - RETURN(LU_EX); - } else if (lm == LU_PR) { - RETURN(LU_CR); - } else if (lm == LU_PW) { - if (split == CMM_EXPECT_SPLIT) { - RETURN(LU_EX); - } else { - RETURN(LU_CW); - } - } - } + + /* + * Check only if need protection from split. If not mdt handles + * other cases. + */ + if (lm == LU_PW && + cmm_expect_splitting(env, mo, ma) == CMM_EXPECT_SPLIT) + RETURN(LU_EX); } #endif RETURN(LU_MINMODE); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index ec7b35a..6a1771f 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1409,54 +1409,6 @@ struct mdt_object *mdt_object_find(const struct lu_env *env, RETURN(m); } -static inline lu_mode_t mdt_ldlm_mode2lu_mode(ldlm_mode_t mode) -{ - switch (mode) { - case LCK_MINMODE: - return LU_MINMODE; - case LCK_EX: - return LU_EX; - case LCK_PW: - return LU_PW; - case LCK_PR: - return LU_PR; - case LCK_CW: - return LU_CW; - case LCK_CR: - return LU_CR; - case LCK_NL: - return LU_NL; - case LCK_GROUP: - return LU_GROUP; - default: - return 0; - } -} - -static inline ldlm_mode_t mdt_lu_mode2ldlm_mode(lu_mode_t mode) -{ - switch (mode) { - case LU_MINMODE: - return LCK_MINMODE; - case LU_EX: - return LCK_EX; - case LU_PW: - return LCK_PW; - case LU_PR: - return LCK_PR; - case LU_CW: - return LCK_CW; - case LU_CR: - return LCK_CR; - case LU_NL: - return LCK_NL; - case LU_GROUP: - return LCK_GROUP; - default: - return 0; - } -} - int mdt_object_lock_mode(struct mdt_thread_info *info, struct mdt_object *o, struct mdt_lock_handle *lh, diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 3250a7c..559fa35 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -632,6 +632,54 @@ static inline int is_identity_get_disabled(struct upcall_cache *cache) return cache ? (strcmp(cache->uc_upcall, "NONE") == 0) : 1; } +static inline lu_mode_t mdt_ldlm_mode2lu_mode(ldlm_mode_t mode) +{ + switch (mode) { + case LCK_MINMODE: + return LU_MINMODE; + case LCK_EX: + return LU_EX; + case LCK_PW: + return LU_PW; + case LCK_PR: + return LU_PR; + case LCK_CW: + return LU_CW; + case LCK_CR: + return LU_CR; + case LCK_NL: + return LU_NL; + case LCK_GROUP: + return LU_GROUP; + default: + return 0; + } +} + +static inline ldlm_mode_t mdt_lu_mode2ldlm_mode(lu_mode_t mode) +{ + switch (mode) { + case LU_MINMODE: + return LCK_MINMODE; + case LU_EX: + return LCK_EX; + case LU_PW: + return LCK_PW; + case LU_PR: + return LCK_PR; + case LU_CW: + return LCK_CW; + case LU_CR: + return LCK_CR; + case LU_NL: + return LCK_NL; + case LU_GROUP: + return LCK_GROUP; + default: + return 0; + } +} + /* * Capability */