From 76b65c13c9aa1d50b107e39af67d1559c2e7f6d8 Mon Sep 17 00:00:00 2001 From: yury Date: Mon, 23 Oct 2006 16:56:16 +0000 Subject: [PATCH] - more cleanups in pdo --- lustre/cmm/cmm_object.c | 37 ++++++++++++++++++------------------- lustre/mdt/mdt_handler.c | 10 ++++++++-- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index ad9818d..2a91f1b 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -375,30 +375,29 @@ static int cml_lookup(const struct lu_env *env, struct md_object *mo_p, static mdl_mode_t cml_lock_mode(const struct lu_env *env, struct md_object *mo, mdl_mode_t lm) { +#if defined(HAVE_SPLIT_SUPPORT) && defined(CONFIG_PDIROPS) + struct md_attr *ma = &cmm_env_info(env)->cmi_ma; + int rc, split; ENTRY; -#ifdef HAVE_SPLIT_SUPPORT - { - struct md_attr *ma = &cmm_env_info(env)->cmi_ma; - int rc, split; - memset(ma, 0, sizeof(*ma)); + memset(ma, 0, sizeof(*ma)); - /* - * Check only if we need protection from split. If not - mdt - * handles other cases. - */ - rc = cmm_expect_splitting(env, mo, ma, &split); - if (rc) { - CERROR("Can't check for possible split, error %d\n", - rc); - RETURN(MDL_MINMODE); - } - - if (lm == MDL_PW && split == CMM_EXPECT_SPLIT) - RETURN(MDL_EX); + /* + * Check only if we need protection from split. If not - mdt + * handles other cases. + */ + rc = cmm_expect_splitting(env, mo, ma, &split); + if (rc) { + CERROR("Can't check for possible split, error %d\n", + rc); + RETURN(MDL_MINMODE); } -#endif + + if (lm == MDL_PW && split == CMM_EXPECT_SPLIT) + RETURN(MDL_EX); RETURN(MDL_MINMODE); +#endif + return MDL_MINMODE; } static int cml_create(const struct lu_env *env, diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 96d0704..362bc20 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -211,8 +211,14 @@ void mdt_lock_pdo_init(struct mdt_lock_handle *lh, ldlm_mode_t lm, { lh->mlh_reg_mode = lm; lh->mlh_type = MDT_PDO_LOCK; - lh->mlh_pdo_hash = (name != NULL && namelen > 0 ? - full_name_hash(name, namelen - 1) : 0); + + if (name != NULL) { + LASSERT(namelen > 0); + lh->mlh_pdo_hash = full_name_hash(name, namelen - 1); + } else { + LASSERT(namelen == 0); + lh->mlh_pdo_hash = 0ull; + } } #ifdef CONFIG_PDIROPS -- 1.8.3.1