Whamcloud - gitweb
mdt: test usage of req-layout in mdt_getstatus()
authornikita <nikita>
Thu, 18 May 2006 22:21:11 +0000 (22:21 +0000)
committernikita <nikita>
Thu, 18 May 2006 22:21:11 +0000 (22:21 +0000)
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_internal.h

index eb5bcb6..21ae60d 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
- *  lustre/mds/handler.c
+ *  lustre/mdt/mdt_handler.c
  *  Lustre Metadata Target (mdt) request handler
  *
  *  Copyright (c) 2006 Cluster File Systems, Inc.
@@ -56,7 +56,6 @@
 /*LUSTRE_POSIX_ACL_MAX_SIZE*/
 #include <linux/lustre_acl.h>
 
-
 /* struct mds_client_data */
 #include "../mds/mds_internal.h"
 #include "mdt_internal.h"
@@ -81,16 +80,15 @@ static int mdt_getstatus(struct mdt_thread_info *info,
 
         ENTRY;
 
-        info->mti_rep_buf_size[0] = sizeof (struct mdt_body);
-        result = lustre_pack_reply(req, 1, info->mti_rep_buf_size, NULL);
+        result = req_capsule_start(&info->mti_pill, &RQF_MDS_GETSTATUS,
+                                   info->mti_rep_buf_size);
         if (result)
-                CERROR(LUSTRE_MDT0_NAME" out of memory for message: size=%d\n",
-                       sizeof (struct mdt_body));
+                ;
         else if (OBD_FAIL_CHECK(OBD_FAIL_MDS_GETSTATUS_PACK))
                 result = -ENOMEM;
         else {
-                info->mti_body = lustre_msg_buf(req->rq_repmsg, 0,
-                                                sizeof (struct mdt_body));
+                info->mti_body = req_capsule_server_get(&info->mti_pill,
+                                                        &RMF_MDT_BODY);
                 result = next->md_ops->mdo_root_get(info->mti_ctxt,
                                                     next,
                                                     &info->mti_body->fid1);
@@ -668,6 +666,7 @@ static int mdt_req_handle(struct mdt_thread_info *info,
 
         result = 0;
         flags = h->mh_flags;
+        req_capsule_init(&info->mti_pill, req, RCL_SERVER);
         if (flags & HABEO_CORPUS) {
                 struct mdt_body   *body;
                 struct lu_context *ctx;
@@ -740,6 +739,7 @@ static int mdt_req_handle(struct mdt_thread_info *info,
                 req->rq_reqmsg->last_xid = le64_to_cpu(req_exp_last_xid(req));
                 target_committed_to_req(req);
         }
+        req_capsule_fini(&info->mti_pill);
         RETURN(result);
 }
 
index 47e34fa..8546082 100644 (file)
@@ -45,6 +45,9 @@
  * struct lustre_handle
  */
 #include <linux/lustre_idl.h>
+/* req_layout things */
+#include <linux/lustre_req_layout.h>
+
 #include <linux/md_object.h>
 #include <linux/lustre_fid.h>
 
@@ -174,7 +177,10 @@ struct mdt_thread_info {
          * A couple of lock handles.
          */
         struct mdt_lock_handle mti_lh[MDT_LH_NR];
-
+        /*
+         * for req-layout interface.
+         */
+        struct req_capsule     mti_pill;
 };
 
 int fid_lock(struct ldlm_namespace *, const struct lu_fid *,
@@ -197,8 +203,8 @@ void mdt_object_unlock(struct ldlm_namespace *, struct mdt_object *,
 struct mdt_object *mdt_object_find_lock(struct lu_context *, struct mdt_device *,
                                         struct lu_fid *,
                                         struct mdt_lock_handle *, __u64);
-int mdt_reint_unpack(struct mdt_thread_info *, 
-                     struct ptlrpc_request *, 
+int mdt_reint_unpack(struct mdt_thread_info *,
+                     struct ptlrpc_request *,
                      int);
 
 int mdt_reint_rec(struct mdt_thread_info *);