Whamcloud - gitweb
some more cleanup and comments about mdt_thread_info initialization.
authorhuanghua <huanghua>
Mon, 16 Oct 2006 10:21:48 +0000 (10:21 +0000)
committerhuanghua <huanghua>
Mon, 16 Oct 2006 10:21:48 +0000 (10:21 +0000)
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_internal.h

index eec1a77..5255e97 100644 (file)
@@ -1342,6 +1342,7 @@ int mdt_object_lock(struct mdt_thread_info *info, struct mdt_object *o,
                 LASSERT(!(ibits & MDS_INODELOCK_UPDATE));
                 LASSERT(ibits & MDS_INODELOCK_LOOKUP);
         }
+        memset(policy, 0, sizeof *policy);
         policy->l_inodebits.bits = ibits;
 
         rc = fid_lock(ns, mdt_object_fid(o), &lh->mlh_lh, lh->mlh_mode,
@@ -1732,35 +1733,34 @@ static void mdt_thread_info_init(struct ptlrpc_request *req,
 
         LASSERT(info->mti_env != req->rq_svc_thread->t_env);
 
+        /* req capsule */
         info->mti_rep_buf_nr = ARRAY_SIZE(info->mti_rep_buf_size);
         for (i = 0; i < ARRAY_SIZE(info->mti_rep_buf_size); i++)
                 info->mti_rep_buf_size[i] = -1;
-
+        req_capsule_init(&info->mti_pill, req, RCL_SERVER,
+                         info->mti_rep_buf_size);
+        
+        /* lock handle */
         for (i = 0; i < ARRAY_SIZE(info->mti_lh); i++)
                 mdt_lock_handle_init(&info->mti_lh[i]);
 
-        info->mti_fail_id = OBD_FAIL_MDS_ALL_REPLY_NET;
-        info->mti_env = req->rq_svc_thread->t_env;
-        info->mti_transno = lustre_msg_get_transno(req->rq_reqmsg);
-
-        /* it can be NULL while CONNECT */
+        /* mdt device: it can be NULL while CONNECT */
         if (req->rq_export)
                 info->mti_mdt = mdt_dev(req->rq_export->exp_obd->obd_lu_dev);
         else
                 info->mti_mdt = NULL;
-        req_capsule_init(&info->mti_pill, req, RCL_SERVER,
-                         info->mti_rep_buf_size);
-        memset(&info->mti_attr, 0, sizeof(info->mti_attr));
-        memset(&info->mti_policy, 0, sizeof(info->mti_policy));
-        memset(&info->mti_capa_key, 0, sizeof(info->mti_capa_key));
+        info->mti_env = req->rq_svc_thread->t_env;
 
-        info->mti_has_trans = 0;
-        info->mti_opdata = 0;
-        info->mti_no_need_trans = 0;
+        info->mti_fail_id = OBD_FAIL_MDS_ALL_REPLY_NET;
+        info->mti_transno = lustre_msg_get_transno(req->rq_reqmsg);
 
+        memset(&info->mti_attr, 0, sizeof(info->mti_attr));
+        info->mti_body = NULL;
         info->mti_object = NULL;
         info->mti_dlm_req = NULL;
-        info->mti_body = NULL;
+        info->mti_has_trans = 0;
+        info->mti_no_need_trans = 0;
+        info->mti_opdata = 0;
 }
 
 static void mdt_thread_info_fini(struct mdt_thread_info *info)
index b5f04f5..ad44c01 100644 (file)
@@ -236,14 +236,17 @@ enum {
  * reduce stack consumption.
  */
 struct mdt_thread_info {
+        /* 
+         * XXX: Part One:
+         * The following members will be filled expilictly
+         * with specific data in mdt_thread_info_init().
+         */
+
         /*
-         * for req-layout interface. This field should be first to compatibility
-         * with seq and fld suff.
+         * for req-layout interface. This field should be first to be compatible
+         * with "struct com_thread_info" in seq and fld.
          */
         struct req_capsule         mti_pill;
-
-        const struct lu_env       *mti_env;
-        struct mdt_device         *mti_mdt;
         /*
          * number of buffers in reply message.
          */
@@ -253,41 +256,47 @@ struct mdt_thread_info {
          */
         int                        mti_rep_buf_size[REQ_MAX_FIELD_NR];
         /*
-         * Body for "habeo corpus" operations.
+         * A couple of lock handles.
          */
-        const struct mdt_body     *mti_body;
+        struct mdt_lock_handle     mti_lh[MDT_LH_NR];
+
+        struct mdt_device         *mti_mdt;
+        const struct lu_env       *mti_env;
+
         /*
-         * Lock request for "habeo clavis" operations.
+         * Additional fail id that can be set by handler. Passed to
+         * target_send_reply().
          */
-        const struct ldlm_request *mti_dlm_req;
-        /*
-         * Host object. This is released at the end of mdt_handler().
+        int                        mti_fail_id;
+
+        /* transaction number of current request */
+        __u64                      mti_transno;
+
+
+        /* 
+         * XXX: Part Two:
+         * The following members will be filled expilictly
+         * with zero in mdt_thread_info_init(). These members may be used
+         * by all requests.
          */
-        struct mdt_object         *mti_object;
+
         /*
          * Object attributes.
          */
         struct md_attr             mti_attr;
         /*
-         * Create specification
-         */
-        struct md_create_spec      mti_spec;
-        /*
-         * reint record. contains information for reint operations.
+         * Body for "habeo corpus" operations.
          */
-        struct mdt_reint_record    mti_rr;
+        const struct mdt_body     *mti_body;
         /*
-         * Additional fail id that can be set by handler. Passed to
-         * target_send_reply().
+         * Host object. This is released at the end of mdt_handler().
          */
-        int                        mti_fail_id;
+        struct mdt_object         *mti_object;
         /*
-         * A couple of lock handles.
+         * Lock request for "habeo clavis" operations.
          */
-        struct mdt_lock_handle     mti_lh[MDT_LH_NR];
+        const struct ldlm_request *mti_dlm_req;
 
-        /* transaction number of current request */
-        __u64                      mti_transno;
         __u32                      mti_has_trans:1, /* has txn already? */
                                    mti_no_need_trans:1;
 
@@ -297,8 +306,31 @@ struct mdt_thread_info {
          */
         __u64                      mti_opdata;
 
-        /* temporary stuff used by thread to save stack consumption.  if
-         * something is in a union, make sure they do not conflict */
+        /* 
+         * XXX: Part Three:
+         * The following members will be filled expilictly
+         * with zero in mdt_reint_unpack(), because they are only used 
+         * by reint requests (including mdt_reint_open()).
+         */
+
+        /*
+         * reint record. contains information for reint operations.
+         */
+        struct mdt_reint_record    mti_rr;
+        /*
+         * Create specification
+         */
+        struct md_create_spec      mti_spec;
+
+
+        /* 
+         * XXX: Part Four:
+         * The following members will _NOT_ be initialized at all.
+         * DO NOT expect them to contain any valid value.
+         * They should be initialized explicitly by the user themselves.
+         */
+
+         /* XXX: If something is in a union, make sure they do not conflict */
 
         struct lu_fid              mti_tmp_fid1;
         struct lu_fid              mti_tmp_fid2;