Whamcloud - gitweb
LU-2285 osp: Block new reservations during orphan recoveries
[fs/lustre-release.git] / lustre / osp / osp_internal.h
index 7a82bca..ca2497d 100644 (file)
@@ -42,6 +42,7 @@
 #define _OSP_INTERNAL_H
 
 #include <obd.h>
+#include <obd_class.h>
 #include <dt_object.h>
 #include <lustre_fid.h>
 
@@ -49,7 +50,7 @@
  * Infrastructure to support tracking of last committed llog record
  */
 struct osp_id_tracker {
-       cfs_spinlock_t           otr_lock;
+       spinlock_t               otr_lock;
        __u32                    otr_next_id;
        __u32                    otr_committed_id;
        /* callback is register once per diskfs -- that's the whole point */
@@ -101,9 +102,9 @@ struct osp_device {
        /*
         * Precreation pool
         */
-       cfs_spinlock_t                   opd_pre_lock;
-       /* next id to assign in creation */
-       __u64                            opd_pre_next;
+       spinlock_t                       opd_pre_lock;
+       /* last id assigned in creation */
+       __u64                            opd_pre_used_id;
        /* last created id OST reported, next-created - available id's */
        __u64                            opd_pre_last_created;
        /* how many ids are reserved in declare, we shouldn't block in create */
@@ -122,11 +123,13 @@ struct osp_device {
        int                              opd_pre_max_grow_count;
        /* whether to grow precreation window next time or not */
        int                              opd_pre_grow_slow;
+       /* cleaning up orphans or recreating missing objects */
+       int                              opd_pre_recovering;
 
        /*
         * OST synchronization
         */
-       cfs_spinlock_t                   opd_syn_lock;
+       spinlock_t                       opd_syn_lock;
        /* unique generation, to recognize start of new records in the llog */
        struct llog_gen                  opd_syn_generation;
        /* number of changes to sync, used to wake up sync thread */
@@ -182,6 +185,7 @@ struct osp_object {
 };
 
 extern struct lu_object_operations osp_lu_obj_ops;
+extern const struct dt_device_operations osp_dt_ops;
 
 struct osp_thread_info {
        struct lu_buf            osi_lb;
@@ -303,6 +307,7 @@ void osp_statfs_need_now(struct osp_device *d);
 
 /* lproc_osp.c */
 void lprocfs_osp_init_vars(struct lprocfs_static_vars *lvars);
+void osp_lprocfs_init(struct osp_device *osp);
 
 /* osp_sync.c */
 int osp_sync_declare_add(const struct lu_env *env, struct osp_object *o,
@@ -314,4 +319,10 @@ int osp_sync_init(const struct lu_env *env, struct osp_device *d);
 int osp_sync_fini(struct osp_device *d);
 void __osp_sync_check_for_work(struct osp_device *d);
 
+/* osp_ost.c */
+int osp_init_for_ost(const struct lu_env *env, struct osp_device *m,
+                    struct lu_device_type *ldt, struct lustre_cfg *cfg);
+int osp_disconnect(struct osp_device *d);
+int osp_fini_for_ost(struct osp_device *osp);
+
 #endif