Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / lmv / lmv_internal.h
index c8b28b4..76f4053 100644 (file)
@@ -147,25 +147,28 @@ int lmv_alloc_slave_fids(struct obd_device *obd, struct lu_fid *pid,
                          struct md_op_data *op, struct lu_fid *fid);
 
 static inline struct lmv_stripe_md * 
-lmv_get_mea(struct ptlrpc_request *req, int offset)
+lmv_get_mea(struct ptlrpc_request *req)
 {
        struct mdt_body *body;
        struct lmv_stripe_md *mea;
 
        LASSERT(req);
 
-        body = lustre_msg_buf(req->rq_repmsg, offset, sizeof(*body));
-        LASSERT(lustre_rep_swabbed(req, offset));
+        body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
 
        if (!body || !S_ISDIR(body->mode) || !body->eadatasize)
                return NULL;
 
-        mea = lustre_msg_buf(req->rq_repmsg, offset + 1,
-                            body->eadatasize);
+        mea = req_capsule_server_sized_get(&req->rq_pill, &RMF_MDT_MD,
+                                           body->eadatasize);
        LASSERT(mea != NULL);
 
        if (mea->mea_count == 0)
                return NULL;
+        if( mea->mea_magic != MEA_MAGIC_LAST_CHAR &&
+                mea->mea_magic != MEA_MAGIC_ALL_CHARS &&
+                mea->mea_magic != MEA_MAGIC_HASH_SEGMENT)
+                return NULL;
        
        return mea;
 }
@@ -219,6 +222,14 @@ static inline void lmv_update_body(struct mdt_body *body,
 }
 
 /* lproc_lmv.c */
+#ifdef LPROCFS
+void lprocfs_lmv_init_vars(struct lprocfs_static_vars *lvars);
+#else
+static inline void lprocfs_lmv_init_vars(struct lprocfs_static_vars *lvars)
+{
+        memset(lvars, 0, sizeof(*lvars));
+}
+#endif
 extern struct file_operations lmv_proc_target_fops;
 
 #endif