Whamcloud - gitweb
LU-231 sanity test_170: FAIL: expected 248 bad lines, but got 249
[fs/lustre-release.git] / lustre / mdt / mdt_internal.h
index aab9bd3..7210e57 100644 (file)
@@ -26,7 +26,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -75,7 +75,7 @@
 /* check if request's xid is equal to last one or not*/
 static inline int req_xid_is_last(struct ptlrpc_request *req)
 {
-        struct lsd_client_data *lcd = req->rq_export->exp_mdt_data.med_lcd;
+        struct lsd_client_data *lcd = req->rq_export->exp_target_data.ted_lcd;
         return (req->rq_xid == lcd->lcd_last_xid ||
                 req->rq_xid == lcd->lcd_last_close_xid);
 }
@@ -91,6 +91,10 @@ struct mdt_file_data {
         struct mdt_object    *mfd_object; /* point to opened object */
 };
 
+/* mdt state flag bits */
+#define MDT_FL_CFGLOG 0
+#define MDT_FL_SYNCED 1
+
 struct mdt_device {
         /* super-class */
         struct md_device           mdt_md_dev;
@@ -123,8 +127,7 @@ struct mdt_device {
                                    mo_cos        :1;
         } mdt_opts;
         /* mdt state flags */
-        __u32                      mdt_fl_cfglog:1,
-                                   mdt_fl_synced:1;
+        unsigned long              mdt_state;
         /* lock to protect IOepoch */
         cfs_spinlock_t             mdt_ioepoch_lock;
         __u64                      mdt_ioepoch;
@@ -168,19 +171,11 @@ struct mdt_device {
         int                        mdt_sec_level;
 };
 
-#define mdt_transno_lock        mdt_lut.lut_translock
-#define mdt_last_transno        mdt_lut.lut_last_transno
-#define mdt_last_rcvd           mdt_lut.lut_last_rcvd
-#define mdt_mount_count         mdt_lut.lut_mount_count
-#define mdt_lsd                 mdt_lut.lut_lsd
-#define mdt_client_bitmap_lock  mdt_lut.lut_client_bitmap_lock
-#define mdt_client_bitmap       mdt_lut.lut_client_bitmap
-
 #define MDT_SERVICE_WATCHDOG_FACTOR     (2)
 #define MDT_ROCOMPAT_SUPP       (OBD_ROCOMPAT_LOVOBJID)
 #define MDT_INCOMPAT_SUPP       (OBD_INCOMPAT_MDT | OBD_INCOMPAT_COMMON_LR | \
                                  OBD_INCOMPAT_FID | OBD_INCOMPAT_IAM_DIR)
-#define MDT_COS_DEFAULT         (1)
+#define MDT_COS_DEFAULT         (0)
 
 struct mdt_object {
         struct lu_object_header mot_header;
@@ -342,8 +337,8 @@ struct mdt_thread_info {
         struct mdt_reint_record    mti_rr;
 
         /** md objects included in operation */
-        struct mdt_object         *mti_mos[PTLRPC_NUM_VERSIONS];
-
+        struct mdt_object         *mti_mos;
+        __u64                      mti_ver[PTLRPC_NUM_VERSIONS];
         /*
          * Operation specification (currently create and lookup)
          */
@@ -398,11 +393,6 @@ struct mdt_thread_info {
         struct md_attr             mti_tmp_attr;
 };
 
-#define mti_parent      mti_mos[0]
-#define mti_child       mti_mos[1]
-#define mti_parent1     mti_mos[2]
-#define mti_child1      mti_mos[3]
-
 typedef void (*mdt_cb_t)(const struct mdt_device *mdt, __u64 transno,
                          void *data, int err);
 struct mdt_commit_cb {
@@ -459,6 +449,12 @@ static inline struct ptlrpc_request *mdt_info_req(struct mdt_thread_info *info)
          return info->mti_pill ? info->mti_pill->rc_req : NULL;
 }
 
+static inline int req_is_replay(struct ptlrpc_request *req)
+{
+        LASSERT(req->rq_reqmsg);
+        return !!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY);
+}
+
 static inline __u64 mdt_conn_flags(struct mdt_thread_info *info)
 {
         LASSERT(info->mti_exp);
@@ -649,7 +645,10 @@ int mdt_check_ucred(struct mdt_thread_info *);
 int mdt_init_ucred(struct mdt_thread_info *, struct mdt_body *);
 int mdt_init_ucred_reint(struct mdt_thread_info *);
 void mdt_exit_ucred(struct mdt_thread_info *);
-int mdt_version_get_check(struct mdt_thread_info *, int);
+int mdt_version_get_check(struct mdt_thread_info *, struct mdt_object *, int);
+void mdt_version_get_save(struct mdt_thread_info *, struct mdt_object *, int);
+int mdt_version_get_check_save(struct mdt_thread_info *, struct mdt_object *,
+                               int);
 
 /* mdt_idmap.c */
 int mdt_init_sec_level(struct mdt_thread_info *);
@@ -691,7 +690,7 @@ static inline void mdt_fail_write(const struct lu_env *env,
                                   struct dt_device *dd, int id)
 {
         if (OBD_FAIL_CHECK_ORSET(id, OBD_FAIL_ONCE)) {
-                CERROR(LUSTRE_MDT_NAME": obd_fail_loc=%x, fail write ops\n",
+                CERROR(LUSTRE_MDT_NAME": cfs_fail_loc=%x, fail write ops\n",
                        id);
                 dd->dd_ops->dt_ro(env, dd);
                 /* We set FAIL_ONCE because we never "un-fail" a device */
@@ -718,7 +717,7 @@ static inline int mdt_check_resent(struct mdt_thread_info *info,
                         RETURN(1);
                 }
                 DEBUG_REQ(D_HA, req, "no reply for RESENT req (have "LPD64")",
-                          req->rq_export->exp_mdt_data.med_lcd->lcd_last_xid);
+                          req->rq_export->exp_target_data.ted_lcd->lcd_last_xid);
         }
         RETURN(0);
 }
@@ -806,6 +805,21 @@ int mdt_cos_is_enabled(struct mdt_device *);
 int mdt_hsm_copytool_send(struct obd_export *exp);
 
 /* lprocfs stuff */
+enum {
+        LPROC_MDT_OPEN = 0,
+        LPROC_MDT_CLOSE,
+        LPROC_MDT_MKNOD,
+        LPROC_MDT_LINK,
+        LPROC_MDT_UNLINK,
+        LPROC_MDT_MKDIR,
+        LPROC_MDT_RMDIR,
+        LPROC_MDT_RENAME,
+        LPROC_MDT_GETXATTR,
+        LPROC_MDT_SETXATTR,
+        LPROC_MDT_LAST,
+};
+void mdt_counter_incr(struct obd_export *exp, int opcode);
+void mdt_stats_counter_init(struct lprocfs_stats *stats);
 void lprocfs_mdt_init_vars(struct lprocfs_static_vars *lvars);
 int mdt_procfs_init(struct mdt_device *mdt, const char *name);
 int mdt_procfs_fini(struct mdt_device *mdt);
@@ -813,10 +827,6 @@ int mdt_procfs_fini(struct mdt_device *mdt);
 void mdt_time_start(const struct mdt_thread_info *info);
 void mdt_time_end(const struct mdt_thread_info *info, int idx);
 
-enum {
-        LPROC_MDT_NR
-};
-
 /* Capability */
 int mdt_ck_thread_start(struct mdt_device *mdt);
 void mdt_ck_thread_stop(struct mdt_device *mdt);