Whamcloud - gitweb
- more cleanups in pdo
authoryury <yury>
Mon, 23 Oct 2006 16:56:16 +0000 (16:56 +0000)
committeryury <yury>
Mon, 23 Oct 2006 16:56:16 +0000 (16:56 +0000)
lustre/cmm/cmm_object.c
lustre/mdt/mdt_handler.c

index ad9818d..2a91f1b 100644 (file)
@@ -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,
index 96d0704..362bc20 100644 (file)
@@ -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