Whamcloud - gitweb
- cleanups about ENTRY, EXIT, etc. in mds and lmv stuff.
authoryury <yury>
Thu, 11 Nov 2004 16:44:33 +0000 (16:44 +0000)
committeryury <yury>
Thu, 11 Nov 2004 16:44:33 +0000 (16:44 +0000)
lustre/lmv/lmv_intent.c
lustre/lmv/lmv_obd.c
lustre/mds/handler.c
lustre/mds/mds_lmv.c
lustre/mds/mds_lov.c
lustre/mds/mds_reint.c

index cfb99f4..61b9c0b 100644 (file)
@@ -425,10 +425,12 @@ release_lock:
                 if (it.d.lustre.it_lock_mode)
                         ldlm_lock_decref(lockh, it.d.lustre.it_lock_mode);
         }
+
+        EXIT;
 cleanup:
         lmv_unlock_obj(obj);
         lmv_put_obj(obj);
-        RETURN(rc);
+        return rc;
 }
 
 int lmv_intent_lookup(struct obd_export *exp, struct lustre_id *pid,
@@ -746,8 +748,10 @@ release_lock:
                         oit->d.lustre.it_lock_mode = master_lock_mode;
                 rc = 1;
         }
+
+        EXIT;
 cleanup:
         lmv_unlock_obj(obj);
         lmv_put_obj(obj);
-        RETURN(rc);
+        return rc;
 }
index 7c3989f..c56184d 100644 (file)
@@ -1630,7 +1630,8 @@ int lmv_obd_create(struct obd_export *exp, struct obdo *oa,
         }
 
         rc = 0;
-        
+
+        LASSERT(oa->o_id != 0);
         id_ino(&mid) = oa->o_id;
         id_fid(&mid) = oa->o_fid;
         id_gen(&mid) = oa->o_generation;
index 978b00d..4eb26f4 100644 (file)
@@ -412,7 +412,6 @@ out:
                 class_disconnect(exp, 0);
         }
         class_export_put(exp);
-
         return rc;
 }
 
@@ -436,13 +435,14 @@ static int mds_connect_post(struct obd_export *exp, unsigned long connect_flags)
         }
         RETURN(rc);
 }
+
 static int mds_init_export(struct obd_export *exp)
 {
         struct mds_export_data *med = &exp->exp_mds_data;
 
         INIT_LIST_HEAD(&med->med_open_head);
         spin_lock_init(&med->med_open_lock);
-        RETURN(0);
+        return 0;
 }
 
 static int mds_destroy_export(struct obd_export *export)
@@ -493,10 +493,10 @@ static int mds_destroy_export(struct obd_export *export)
         spin_unlock(&med->med_open_lock);
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
+        EXIT;
 out:
         mds_client_free(export, !(export->exp_flags & OBD_OPT_FAILOVER));
-
-        RETURN(rc);
+        return rc;
 }
 
 static int mds_disconnect(struct obd_export *exp, int flags)
@@ -640,8 +640,9 @@ int mds_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
 int mds_get_md(struct obd_device *obd, struct inode *inode, void *md,
                int *size, int lock)
 {
-        int rc = 0;
         int lmm_size;
+        int rc = 0;
+        ENTRY;
 
         if (lock)
                 down(&inode->i_sem);
@@ -814,17 +815,19 @@ static int mds_getattr_pack_msg_cf(struct ptlrpc_request *req,
         if (OBD_FAIL_CHECK(OBD_FAIL_MDS_GETATTR_PACK)) {
                 CERROR("failed MDS_GETATTR_PACK test\n");
                 req->rq_status = -ENOMEM;
-                GOTO(out, rc = -ENOMEM);
+                RETURN(-ENOMEM);
         }
 
         rc = lustre_pack_reply(req, 1, size, NULL);
         if (rc) {
+                req->rq_status = rc;
                 CERROR("lustre_pack_reply failed: rc %d\n", rc);
                 GOTO(out, req->rq_status = rc);
         }
 
- out:
-        RETURN(rc);
+        EXIT;
+out:
+        return rc;
 }
 
 static int mds_getattr_pack_msg(struct ptlrpc_request *req, struct inode *inode,
@@ -1186,11 +1189,12 @@ static int mds_getattr(struct ptlrpc_request *req, int offset)
         req->rq_status = mds_getattr_internal(obd, de, req, body, 0);
 
         l_dput(de);
-        GOTO(out_pop, rc);
+
+        EXIT;
 out_pop:
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
         mds_exit_ucred(&uc);
-        RETURN(rc);
+        return rc;
 }
 
 static int mds_obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
@@ -1230,9 +1234,10 @@ static int mds_statfs(struct ptlrpc_request *req)
                 GOTO(out, rc);
         }
 
+        EXIT;
 out:
         req->rq_status = rc;
-        RETURN(0);
+        return 0;
 }
 
 static int mds_sync(struct ptlrpc_request *req, int offset)
@@ -1275,9 +1280,11 @@ static int mds_sync(struct ptlrpc_request *req, int offset)
                 mds_pack_inode2body(obd, body, de->d_inode, 0);
                 l_dput(de);
         }
+
+        EXIT;
 out:
         req->rq_status = rc;
-        RETURN(0);
+        return 0;
 }
 
 /* mds_readpage does not take a DLM lock on the inode, because the client must
@@ -1361,6 +1368,7 @@ static int mds_readpage(struct ptlrpc_request *req, int offset)
         /* body->size is actually the offset -eeb */
         rc = mds_sendpage(req, file, body->size, body->nlink);
 
+        EXIT;
 out_file:
         filp_close(file, 0);
 out_pop:
@@ -1368,7 +1376,7 @@ out_pop:
         mds_exit_ucred(&uc);
 out:
         req->rq_status = rc;
-        RETURN(0);
+        return 0;
 }
 
 /* update master MDS ID, which is stored in local inode EA. */
@@ -1407,13 +1415,14 @@ int mds_update_mid(struct obd_device *obd, struct lustre_id *id,
                 GOTO(out_commit, rc);
         }
 
+        EXIT;
 out_commit:
         fsfilt_commit(obd, mds->mds_sb, dentry->d_inode,
                       handle, 0);
 out_dentry:
         l_dput(dentry);
 out:
-        RETURN(rc);
+        return rc;
 }
 EXPORT_SYMBOL(mds_update_mid);
 
@@ -1448,10 +1457,11 @@ int mds_read_mid(struct obd_device *obd, struct lustre_id *id,
                 GOTO(out_dentry, rc);
         }
 
+        EXIT;
 out_dentry:
         l_dput(dentry);
 out:
-        RETURN(rc);
+        return rc;
 }
 EXPORT_SYMBOL(mds_read_mid);
 
@@ -1490,9 +1500,10 @@ int mds_reint(struct ptlrpc_request *req, int offset,
         /* rc will be used to interrupt a for loop over multiple records */
         rc = mds_reint_rec(rec, offset, req, lockh);
         mds_exit_ucred(&rec->ur_uc);
+        EXIT;
  out:
         OBD_FREE(rec, sizeof(*rec));
-        RETURN(rc);
+        return rc;
 }
 
 static int mds_filter_recovery_request(struct ptlrpc_request *req,
@@ -1843,6 +1854,7 @@ repeat:
                 }
         }
 
+        EXIT;
 cleanup:
         switch (cleanup_phase) {
         case 2: /* object has been created, but we'll may want to replay it later */
@@ -1856,7 +1868,7 @@ cleanup:
         l_dput(new);
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
         mds_put_group_entry(mds, uc.luc_ghash);
-        RETURN(rc);
+        return rc;
 }
 
 static int mdt_get_info(struct ptlrpc_request *req)
@@ -2834,13 +2846,12 @@ static int mds_postsetup(struct obd_device *obd)
         }
 
         RETURN(rc);
-
 err_cleanup:
         mds_lov_clean(obd);
 err_llog:
         obd_llog_cleanup(llog_get_context(&obd->obd_llogs,
                                           LLOG_CONFIG_ORIG_CTXT));
-        RETURN(rc);
+        return rc;
 }
 
 int mds_postrecov(struct obd_device *obd)
@@ -2904,6 +2915,7 @@ err_llog:
 int mds_lov_clean(struct obd_device *obd)
 {
         struct mds_obd *mds = &obd->u.mds;
+        ENTRY;
 
         if (mds->mds_profile) {
                 char * cln_prof;
@@ -2934,6 +2946,7 @@ int mds_lov_clean(struct obd_device *obd)
 int mds_lmv_clean(struct obd_device *obd)
 {
         struct mds_obd *mds = &obd->u.mds;
+        ENTRY;
 
         if (mds->mds_lmv_name) {
                 OBD_FREE(mds->mds_lmv_name, strlen(mds->mds_lmv_name) + 1);
index f1f618a..a1ba735 100644 (file)
@@ -124,7 +124,7 @@ err_discon:
         mds->mds_lmv_obd = ERR_PTR(rc);
 err_last:
         up(&mds->mds_lmv_sem);
-        RETURN(rc);
+        return rc;
 }
 
 int mds_lmv_postsetup(struct obd_device *obd)
@@ -522,6 +522,7 @@ int scan_and_distribute(struct obd_device *obd, struct dentry *dentry,
                         GOTO(cleanup, err);
         }
 
+        EXIT;
 cleanup:
         for (i = 0; i < mea->mea_count; i++) {
                 struct list_head *cur, *tmp;
@@ -537,7 +538,7 @@ cleanup:
         OBD_FREE(dc.cache, sizeof(struct dir_cache) * mea->mea_count);
         OBD_FREE(file_name, nlen);
 
-        RETURN(err);
+        return err;
 }
 
 #define MAX_DIR_SIZE      (64 * 1024)
@@ -726,7 +727,7 @@ int mds_try_to_split_dir(struct obd_device *obd, struct dentry *dentry,
 
 err_oa:
        obdo_free(oa);
-        RETURN(rc);
+        return rc;
 }
 
 static int filter_start_page_write(struct inode *inode,
@@ -735,12 +736,11 @@ static int filter_start_page_write(struct inode *inode,
         struct page *page = alloc_pages(GFP_HIGHUSER, 0);
         if (page == NULL) {
                 CERROR("no memory for a temp page\n");
-                RETURN(lnb->rc = -ENOMEM);
+                return lnb->rc = -ENOMEM;
         }
         POISON_PAGE(page, 0xf1);
         page->index = lnb->offset >> PAGE_SHIFT;
         lnb->page = page;
-
         return 0;
 }
 
@@ -761,6 +761,7 @@ int mds_preprw(int cmd, struct obd_export *exp, struct obdo *oa,
         struct dentry *dentry;
         struct lustre_id id;
         ENTRY;
+
         LASSERT(objcount == 1);
         LASSERT(obj->ioo_bufcnt > 0);
 
@@ -987,7 +988,6 @@ void mds_unlock_slave_objs(struct obd_device *obd, struct dentry *dentry,
 
         OBD_FREE(lockh, sizeof(struct lustre_handle) * mea->mea_count);
         OBD_FREE(mea, mea_size);
-        return;
 }
 
 int mds_unlink_slave_objs(struct obd_device *obd, struct dentry *dentry)
@@ -997,10 +997,11 @@ int mds_unlink_slave_objs(struct obd_device *obd, struct dentry *dentry)
         struct mdc_op_data op_data;
         struct mea *mea = NULL;
         int mea_size, rc;
+        ENTRY;
 
        /* clustered MD ? */
        if (!mds->mds_lmv_obd)
-               return 0;
+               RETURN(0);
 
         /* a dir can be splitted only */
         if (!S_ISDIR(dentry->d_inode->i_mode))
@@ -1011,7 +1012,8 @@ int mds_unlink_slave_objs(struct obd_device *obd, struct dentry *dentry)
                 RETURN(rc);
 
         if (mea == NULL)
-                return 0;
+                RETURN(0);
+                       
         if (mea->mea_count == 0)
                 GOTO(cleanup, rc = 0);
 
@@ -1023,9 +1025,10 @@ int mds_unlink_slave_objs(struct obd_device *obd, struct dentry *dentry)
         op_data.mea1 = mea;
         rc = md_unlink(mds->mds_lmv_exp, &op_data, &req);
         LASSERT(req == NULL);
+        EXIT;
 cleanup:
         OBD_FREE(mea, mea_size);
-        RETURN(rc);
+        return rc;
 }
 
 struct ide_tracking {
@@ -1147,6 +1150,7 @@ int mds_lock_and_check_slave(int offset, struct ptlrpc_request *req,
         if (!mds_is_dir_empty(obd, dentry))
                 rc = -ENOTEMPTY;
 
+        EXIT;
 cleanup:
         switch(cleanup_phase) {
         case 1:
@@ -1158,7 +1162,7 @@ cleanup:
         default:
                 break;
         }
-        RETURN(rc);
+        return rc;
 }
 
 int mds_convert_mea_ea(struct obd_device *obd, struct inode *inode,
@@ -1220,7 +1224,7 @@ int mds_convert_mea_ea(struct obd_device *obd, struct inode *inode,
         err = fsfilt_commit(obd, obd->u.mds.mds_sb, inode, handle, 0);
         if (!rc)
                 rc = err ? err : size;
-        GOTO(conv_free, rc);
+        EXIT;
 conv_free:
         OBD_FREE(new, size);
         return rc;
index e616677..3bddfd7 100644 (file)
@@ -304,7 +304,7 @@ err_discon:
         obd_disconnect(mds->mds_lov_exp, 0);
         mds->mds_lov_exp = NULL;
         mds->mds_lov_obd = ERR_PTR(rc);
-        RETURN(rc);
+        return rc;
 }
 
 int mds_lov_disconnect(struct obd_device *obd, int flags)
@@ -914,9 +914,11 @@ int mds_revalidate_lov_ea(struct obd_device *obd, struct inode *inode,
         err = fsfilt_commit(obd, inode->i_sb, inode, handle, 0);
         if (!rc)
                 rc = err;
+
+        EXIT;
 out_oa:
         obdo_free(oa);
 out_lsm:
         obd_free_memmd(osc_exp, &lsm);
-        RETURN(rc);
+        return rc;
 }
index 10e1ea8..2baa1c8 100644 (file)
@@ -173,6 +173,7 @@ int mds_finish_transno(struct mds_obd *mds, struct inode *inode, void *handle,
         }
         CDEBUG(log_pri, "wrote objids: err = %d\n", err);
 
+        EXIT;
 out_commit:
         err = fsfilt_commit(obd, mds->mds_sb, inode, handle, 0);
         if (err) {
@@ -181,7 +182,7 @@ out_commit:
                         rc = err;
         }
 
-        RETURN(rc);
+        return rc;
 }
 
 /* this gives the same functionality as the code between
@@ -989,8 +990,8 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
                 body = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*body));
                 mds_pack_inode2body(obd, body, inode, 1);
         }
-        EXIT;
 
+        EXIT;
 cleanup:
         err = mds_finish_transno(mds, dir, handle, req, rc, 0);
 
@@ -1354,6 +1355,7 @@ changed:
                 memset(child_res_id, 0, sizeof(*child_res_id));
         }
 
+        EXIT;
 cleanup:
         if (rc) {
                 switch(cleanup_phase) {
@@ -1364,7 +1366,7 @@ cleanup:
                         ldlm_lock_decref(parent_lockh, parent_mode);
                 }
         }
-        RETURN(rc);
+        return rc;
 }
 
 int mds_get_parent_child_locked(struct obd_device *obd, struct mds_obd *mds,
@@ -1510,6 +1512,7 @@ retry_locks:
                 GOTO(cleanup, rc);
         }
 
+        EXIT;
 cleanup:
         if (rc) {
                 switch (cleanup_phase) {
@@ -1527,15 +1530,15 @@ cleanup:
                         l_dput(*dparentp);
                 }
         }
-        RETURN(rc);
+        return rc;
 }
 
 void mds_reconstruct_generic(struct ptlrpc_request *req)
 {
         struct mds_export_data *med = &req->rq_export->exp_mds_data;
-
         mds_req_from_mcd(req, med->med_mcd);
 }
+
 /* If we are unlinking an open file/dir (i.e. creating an orphan) then
  * we instead link the inode into the PENDING directory until it is
  * finally released.  We can't simply call mds_reint_rename() or some
@@ -1611,10 +1614,10 @@ static int mds_orphan_add_link(struct mds_update_record *rec,
                 mark_inode_dirty(pending_dir);
         }
 
-        GOTO(out_dput, rc = 1);
+        EXIT;
 out_dput:
         l_dput(pending_child);
-        RETURN(rc);
+        return rc;
 }
 
 int mds_create_local_dentry(struct mds_update_record *rec,
@@ -1719,6 +1722,8 @@ int mds_create_local_dentry(struct mds_update_record *rec,
 
         id_fid(rec->ur_id1) = id_fid(&sid);
         id_group(rec->ur_id1) = id_group(&sid);
+
+        EXIT;
 cleanup:
         switch(cleanup_phase) {
                 case 2:
@@ -1730,7 +1735,7 @@ cleanup:
                 case 0:
                        break; 
         }
-        RETURN(rc);
+        return rc;
 }
 
 static int mds_copy_unlink_reply(struct ptlrpc_request *master,
@@ -2989,9 +2994,8 @@ static int mds_reint_rename_create_name(struct mds_update_record *rec,
         rc = mds_add_local_dentry(rec, offset, req, rec->ur_id1,
                                   de_tgtdir, de_new, 0);
 
-        GOTO(cleanup, rc);
-cleanup:
         EXIT;
+cleanup:
         
         if (cleanup_phase == 1) {
 #ifdef S_PDIROPS
@@ -3006,7 +3010,7 @@ cleanup:
         }
 
         req->rq_status = rc;
-        RETURN(0);
+        return 0;
 }
 
 static int mds_reint_rename_to_remote(struct mds_update_record *rec, int offset,
@@ -3083,6 +3087,8 @@ static int mds_reint_rename_to_remote(struct mds_update_record *rec, int offset,
         
         rc = mds_del_local_dentry(rec, offset, req, de_srcdir,
                                   de_old);
+
+        EXIT;
 cleanup:
         if (req2)
                 ptlrpc_req_finished(req2);
@@ -3099,7 +3105,7 @@ cleanup:
         l_dput(de_srcdir);
 
         req->rq_status = rc;
-        RETURN(0);
+        return 0;
 }
 
 static int mds_reint_rename(struct mds_update_record *rec, int offset,
@@ -3305,9 +3311,8 @@ static int mds_reint_rename(struct mds_update_record *rec, int offset,
                 }
         }
 
-        GOTO(cleanup, rc);
-cleanup:
         EXIT;
+cleanup:
         rc = mds_finish_transno(mds, (de_tgtdir ? de_tgtdir->d_inode : NULL),
                                 handle, req, rc, 0);