Whamcloud - gitweb
- added assert in mdt_is_subdir(). It only should be called against local objects;
authoryury <yury>
Mon, 30 Oct 2006 18:24:44 +0000 (18:24 +0000)
committeryury <yury>
Mon, 30 Oct 2006 18:24:44 +0000 (18:24 +0000)
- cleanups in cmr_xxx methods. No need to use RETURN() without ENTRY, just return is ok;
- in mdt_reint_rename() use namelen.

lustre/cmm/cmm_object.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_reint.c

index 31057fc..2137e4f 100644 (file)
@@ -557,7 +557,6 @@ static int cml_name_insert(const struct lu_env *env, struct md_object *p,
         RETURN(rc);
 }
 
-/* Common method for remote and local use. */
 static int cmm_is_subdir(const struct lu_env *env, struct md_object *mo,
                          const struct lu_fid *fid, struct lu_fid *sfid)
 {
@@ -676,90 +675,90 @@ static int cmr_object_create(const struct lu_env *env,
                              const struct md_create_spec *spec,
                              struct md_attr *ma)
 {
-        RETURN(-EFAULT);
+        return -EFAULT;
 }
 
 static int cmr_permission(const struct lu_env *env, struct md_object *mo,
                           int mask)
 {
-        RETURN(-EREMOTE);
+        return -EREMOTE;
 }
 
 static int cmr_attr_get(const struct lu_env *env, struct md_object *mo,
                         struct md_attr *attr)
 {
-        RETURN(-EREMOTE);
+        return -EREMOTE;
 }
 
 static int cmr_attr_set(const struct lu_env *env, struct md_object *mo,
                         const struct md_attr *attr)
 {
-        RETURN(-EFAULT);
+        return -EFAULT;
 }
 
 static int cmr_xattr_get(const struct lu_env *env, struct md_object *mo,
                          struct lu_buf *buf, const char *name)
 {
-        RETURN(-EFAULT);
+        return -EFAULT;
 }
 
 static int cmr_readlink(const struct lu_env *env, struct md_object *mo,
                         struct lu_buf *buf)
 {
-        RETURN(-EFAULT);
+        return -EFAULT;
 }
 
 static int cmr_xattr_list(const struct lu_env *env, struct md_object *mo,
                           struct lu_buf *buf)
 {
-        RETURN(-EFAULT);
+        return -EFAULT;
 }
 
 static int cmr_xattr_set(const struct lu_env *env, struct md_object *mo,
                          const struct lu_buf *buf, const char *name, int fl)
 {
-        RETURN(-EFAULT);
+        return -EFAULT;
 }
 
 static int cmr_xattr_del(const struct lu_env *env, struct md_object *mo,
                          const char *name)
 {
-        RETURN(-EFAULT);
+        return -EFAULT;
 }
 
 static int cmr_ref_add(const struct lu_env *env, struct md_object *mo)
 {
-        RETURN(-EFAULT);
+        return -EFAULT;
 }
 
 static int cmr_ref_del(const struct lu_env *env, struct md_object *mo,
                        struct md_attr *ma)
 {
-        RETURN(-EFAULT);
+        return -EFAULT;
 }
 
 static int cmr_open(const struct lu_env *env, struct md_object *mo,
                     int flags)
 {
-        RETURN(-EREMOTE);
+        return -EREMOTE;
 }
 
 static int cmr_close(const struct lu_env *env, struct md_object *mo,
                      struct md_attr *ma)
 {
-        RETURN(-EFAULT);
+        return -EFAULT;
 }
 
 static int cmr_readpage(const struct lu_env *env, struct md_object *mo,
                         const struct lu_rdpg *rdpg)
 {
-        RETURN(-EREMOTE);
+        return -EREMOTE;
 }
 
 static int cmr_capa_get(const struct lu_env *env, struct md_object *mo,
                         struct lustre_capa *capa, int renewal)
 {
-        RETURN(-EFAULT);
+        return -EFAULT;
 }
 
 static struct md_object_operations cmr_mo_ops = {
@@ -789,13 +788,13 @@ static int cmr_lookup(const struct lu_env *env, struct md_object *mo_p,
          * will happen here.
          */
 
-        RETURN(-EREMOTE);
+        return -EREMOTE;
 }
 
 static mdl_mode_t cmr_lock_mode(const struct lu_env *env,
                                 struct md_object *mo, mdl_mode_t lm)
 {
-        RETURN(MDL_MINMODE);
+        return MDL_MINMODE;
 }
 
 /*
index ed66076..f230864 100644 (file)
@@ -647,17 +647,16 @@ out:
 
 static int mdt_is_subdir(struct mdt_thread_info *info)
 {
-        struct mdt_object   *obj = info->mti_object;
-        struct req_capsule  *pill = &info->mti_pill;
+        struct mdt_object     *o = info->mti_object;
+        struct req_capsule    *pill = &info->mti_pill;
         const struct mdt_body *body = info->mti_body;
-        struct mdt_body     *repbody;
-        int                  rc;
-
-        obj = info->mti_object;
-        LASSERT(obj != NULL);
-        LASSERT(lu_object_assert_exists(&obj->mot_obj.mo_lu));
+        struct mdt_body       *repbody;
+        int                    rc;
         ENTRY;
 
+        LASSERT(o != NULL);
+        LASSERT(lu_object_assert_exists(&o->mot_obj.mo_lu));
+
         repbody = req_capsule_server_get(pill, &RMF_MDT_BODY);
 
         /*
@@ -667,7 +666,9 @@ static int mdt_is_subdir(struct mdt_thread_info *info)
         LASSERT(fid_is_sane(&body->fid2));
         mdt_set_capainfo(info, 0, &body->fid1, BYPASS_CAPA);
         mdt_set_capainfo(info, 1, &body->fid2, BYPASS_CAPA);
-        rc = mdo_is_subdir(info->mti_env, mdt_object_child(obj),
+
+        LASSERT(mdt_object_exists(o) > 0);
+        rc = mdo_is_subdir(info->mti_env, mdt_object_child(o),
                            &body->fid2, &repbody->fid1);
         if (rc < 0)
                 RETURN(rc);
index 06cc96e..9a6c000 100644 (file)
@@ -629,6 +629,7 @@ static int mdt_rename_lock(struct mdt_thread_info *info,
 static void mdt_rename_unlock(struct lustre_handle *lh)
 {
         ENTRY;
+        LASSERT(lustre_handle_is_used(lh));
         ldlm_lock_decref(lh, LCK_EX);
         EXIT;
 }
@@ -669,7 +670,6 @@ static int mdt_reint_rename(struct mdt_thread_info *info,
                             struct mdt_lock_handle *lhc)
 {
         struct mdt_reint_record *rr = &info->mti_rr;
-        struct req_capsule      *pill = &info->mti_pill;
         struct md_attr          *ma = &info->mti_attr;
         struct ptlrpc_request   *req = mdt_info_req(info);
         struct mdt_object       *msrcdir;
@@ -686,9 +686,7 @@ static int mdt_reint_rename(struct mdt_thread_info *info,
         int                      rc;
         ENTRY;
 
-        rc = req_capsule_get_size(pill, &RMF_NAME, RCL_CLIENT);
-        if (rc == 1) {
-        /* if (rr->rr_name[0] == 0) {*/
+        if (rr->rr_namelen == 1) {
                 rc = mdt_reint_rename_tgt(info);
                 RETURN(rc);
         }
@@ -699,7 +697,7 @@ static int mdt_reint_rename(struct mdt_thread_info *info,
 
         rc = mdt_rename_lock(info, &rename_lh);
         if (rc) {
-                CERROR("can't lock FS for rename, rc %d\n", rc);
+                CERROR("Can't lock FS for rename, rc %d\n", rc);
                 GOTO(out, rc);
         }