Whamcloud - gitweb
- many cleanups with case like foo (). Replaced by foo()
[fs/lustre-release.git] / lustre / mdc / mdc_lib.c
index 7658bc5..5a9e601 100644 (file)
@@ -67,11 +67,13 @@ static __u32 mds_pack_open_flags(__u32 flags)
 
 /* packing of MDS records */
 void mdc_open_pack(struct lustre_msg *msg, int offset,
-                   struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
-                   __u32 flags, const void *lmm, int lmmlen)
+                   struct mdc_op_data *op_data, __u32 mode,
+                   __u64 rdev, __u32 flags, const void *lmm,
+                   int lmmlen)
 {
         struct mds_rec_create *rec;
         char *tmp;
+        
         rec = lustre_msg_buf(msg, offset, sizeof (*rec));
 
         /* XXX do something about time, uid, gid */
@@ -79,10 +81,10 @@ void mdc_open_pack(struct lustre_msg *msg, int offset,
         if (op_data != NULL)
                 rec->cr_id = op_data->id1;
         memset(&rec->cr_replayid, 0, sizeof(rec->cr_replayid));
-        rec->cr_mode = mode;
         rec->cr_flags = mds_pack_open_flags(flags);
-        rec->cr_rdev = rdev;
         rec->cr_time = op_data->mod_time;
+        rec->cr_mode = mode;
+        rec->cr_rdev = rdev;
 
         if (op_data->name) {
                 tmp = lustre_msg_buf(msg, offset + 1,
@@ -97,8 +99,8 @@ void mdc_open_pack(struct lustre_msg *msg, int offset,
         }
 }
 
-void mdc_getattr_pack(struct lustre_msg *msg, int offset, int valid,
-                      int flags, struct mdc_op_data *data)
+void mdc_getattr_pack(struct lustre_msg *msg, int offset,
+                      __u64 valid, int flags, struct mdc_op_data *data)
 {
         struct mds_body *b;
         b = lustre_msg_buf(msg, offset, sizeof (*b));
@@ -117,7 +119,7 @@ void mdc_getattr_pack(struct lustre_msg *msg, int offset, int valid,
 }
 
 void mdc_close_pack(struct ptlrpc_request *req, int offset, struct obdo *oa,
-                    int valid, struct obd_client_handle *och)
+                    __u64 valid, struct obd_client_handle *och)
 {
         struct mds_body *body;
 
@@ -149,4 +151,33 @@ void mdc_close_pack(struct ptlrpc_request *req, int offset, struct obdo *oa,
                 body->flags = oa->o_flags;
                 body->valid |= OBD_MD_FLFLAGS;
         }
+        if (oa->o_valid & OBD_MD_FLEPOCH) {
+                body->io_epoch = oa->o_easize;
+                body->valid |= OBD_MD_FLEPOCH;
+        }
+}
+
+/* 
+ * these methods needed for saying higher levels that MDC does not pack/unpack
+ * any EAs. This is needed to have real abstraction and do not try to recognize
+ * what OBD type is to avoid calling these methods on it, as they may not be
+ * implemented.
+ *
+ * Sometimes pack/unpack calls happen to MDC too. This is for instance default
+ * striping info for directories and our goal here is to skip them with no
+ * errors or any complains.
+ */
+int mdc_packmd(struct obd_export *exp, struct lov_mds_md **lmmp,
+               struct lov_stripe_md *lsm)
+{
+        ENTRY;
+        RETURN(0);
 }
+
+int mdc_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp,
+                 struct lov_mds_md *lmm, int lmm_size)
+{
+        ENTRY;
+        RETURN(0);
+}
+