Whamcloud - gitweb
LU-7428 osd: set device read-only correctly
[fs/lustre-release.git] / lustre / mdt / mdt_internal.h
index 178868f..9ec2f34 100644 (file)
@@ -216,6 +216,12 @@ struct mdt_device {
        struct lu_device          *mdt_qmt_dev;
 
        struct coordinator         mdt_coordinator;
+
+       /* inter-MDT connection count */
+       atomic_t                   mdt_mds_mds_conns;
+
+       /* MDT device async commit count, used for debug and sanity test */
+       atomic_t                   mdt_async_commit_count;
 };
 
 #define MDT_SERVICE_WATCHDOG_FACTOR    (2)
@@ -414,7 +420,7 @@ struct mdt_thread_info {
 
         /* Ops object filename */
         struct lu_name             mti_name;
-       /* per-thread values, can be re-used */
+       /* per-thread values, can be re-used, may be vmalloc'd */
        void                      *mti_big_lmm;
        int                        mti_big_lmmsize;
        /* big_lmm buffer was used and must be used in reply */
@@ -586,9 +592,17 @@ int mdt_check_resent_lock(struct mdt_thread_info *info, struct mdt_object *mo,
 int mdt_object_lock(struct mdt_thread_info *info, struct mdt_object *mo,
                    struct mdt_lock_handle *lh, __u64 ibits);
 
+int mdt_reint_object_lock(struct mdt_thread_info *info, struct mdt_object *o,
+                         struct mdt_lock_handle *lh, __u64 ibits,
+                         bool cos_incompat);
+
 int mdt_object_lock_try(struct mdt_thread_info *info, struct mdt_object *mo,
                        struct mdt_lock_handle *lh, __u64 ibits);
 
+int mdt_reint_object_lock_try(struct mdt_thread_info *info,
+                             struct mdt_object *o, struct mdt_lock_handle *lh,
+                             __u64 ibits, bool cos_incompat);
+
 void mdt_object_unlock(struct mdt_thread_info *info, struct mdt_object *mo,
                       struct mdt_lock_handle *lh, int decref);
 
@@ -793,9 +807,6 @@ int mdt_agent_record_add(const struct lu_env *env, struct mdt_device *mdt,
 int mdt_agent_record_update(const struct lu_env *env,
                            struct mdt_device *mdt, __u64 *cookies,
                            int cookies_count, enum agent_req_status status);
-int mdt_agent_llog_update_rec(const struct lu_env *env, struct mdt_device *mdt,
-                             struct llog_handle *llh,
-                             struct llog_agent_req_rec *larr);
 
 /* mdt/mdt_hsm_cdt_agent.c */
 extern const struct file_operations mdt_hsm_agent_fops;
@@ -845,6 +856,8 @@ int mdt_cdt_remove_request(struct coordinator *cdt, __u64 cookie);
 /* mdt/mdt_coordinator.c */
 void mdt_hsm_dump_hal(int level, const char *prefix,
                      struct hsm_action_list *hal);
+struct cdt_restore_handle *mdt_hsm_restore_hdl_find(struct coordinator *cdt,
+                                               const struct lu_fid *fid);
 /* coordinator management */
 int mdt_hsm_cdt_init(struct mdt_device *mdt);
 int mdt_hsm_cdt_start(struct mdt_device *mdt);
@@ -853,8 +866,9 @@ int mdt_hsm_cdt_fini(struct mdt_device *mdt);
 int mdt_hsm_cdt_wakeup(struct mdt_device *mdt);
 
 /* coordinator control /proc interface */
-ssize_t mdt_hsm_cdt_control_seq_write(struct file *file, const char *buffer,
-                                       size_t count, loff_t *off);
+ssize_t mdt_hsm_cdt_control_seq_write(struct file *file,
+                                     const char __user *buffer,
+                                     size_t count, loff_t *off);
 int mdt_hsm_cdt_control_seq_show(struct seq_file *m, void *data);
 int hsm_cdt_procfs_init(struct mdt_device *mdt);
 void hsm_cdt_procfs_fini(struct mdt_device *mdt);
@@ -882,14 +896,14 @@ extern struct lu_context_key       mdt_thread_key;
 static inline int 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": cfs_fail_loc=%x, fail write ops\n",
-                       id);
-                return dd->dd_ops->dt_ro(env, dd);
-                /* We set FAIL_ONCE because we never "un-fail" a device */
-        }
-
-        return 0;
+       if (OBD_FAIL_CHECK_ORSET(id, OBD_FAIL_ONCE)) {
+               CERROR(LUSTRE_MDT_NAME": cfs_fail_loc=%x, fail write ops\n",
+                      id);
+               return dt_ro(env, dd);
+               /* We set FAIL_ONCE because we never "un-fail" a device */
+       }
+
+       return 0;
 }
 
 static inline struct mdt_export_data *mdt_req2med(struct ptlrpc_request *req)
@@ -965,6 +979,11 @@ static inline void mdt_fid_unlock(struct lustre_handle *lh, enum ldlm_mode mode)
        ldlm_lock_decref(lh, mode);
 }
 
+static inline bool mdt_slc_is_enabled(struct mdt_device *mdt)
+{
+       return mdt->mdt_lut.lut_sync_lock_cancel == BLOCKING_SYNC_ON_CANCEL;
+}
+
 extern mdl_mode_t mdt_mdl_lock_modes[];
 extern enum ldlm_mode mdt_dlm_lock_modes[];