Whamcloud - gitweb
LU-7934 osp: fix tr->otr_next_id overflow
[fs/lustre-release.git] / lustre / osp / osp_internal.h
index 2a32244..3714dc2 100644 (file)
@@ -55,8 +55,8 @@
  */
 struct osp_id_tracker {
        spinlock_t               otr_lock;
-       __u32                    otr_next_id;
-       __u32                    otr_committed_id;
+       __u64                    otr_next_id;
+       __u64                    otr_committed_id;
        /* callback is register once per diskfs -- that's the whole point */
        struct dt_txn_callback   otr_tx_cb;
        /* single node can run many clusters */
@@ -95,15 +95,12 @@ struct osp_precreate {
 };
 
 struct osp_update_request_sub {
-       struct object_update_request    *ours_req;
+       struct object_update_request    *ours_req; /* may be vmalloc'd */
        size_t                          ours_req_size;
        /* Linked to osp_update_request->our_req_list */
        struct list_head                ours_list;
 };
 
-/**
- * Tracking the updates being executed on this dt_device.
- */
 struct osp_update_request {
        int                             our_flags;
        /* update request result */
@@ -118,10 +115,15 @@ struct osp_update_request {
 
        /* points to thandle if this update request belongs to one */
        struct osp_thandle              *our_th;
+
+       __u64                           our_version;
+       /* protect our_list and flag */
+       spinlock_t                      our_list_lock;
        /* linked to the list(ou_list) in osp_updates */
        struct list_head                our_list;
        __u32                           our_batchid;
-       __u32                           our_req_sent:1;
+       __u32                           our_req_ready:1;
+
 };
 
 struct osp_updates {
@@ -213,12 +215,12 @@ struct osp_device {
        /* osd api's commit cb control structure */
        struct dt_txn_callback           opd_syn_txn_cb;
        /* last used change number -- semantically similar to transno */
-       unsigned long                    opd_syn_last_used_id;
+       __u64                            opd_syn_last_used_id;
        /* last committed change number -- semantically similar to
         * last_committed */
-       unsigned long                    opd_syn_last_committed_id;
+       __u64                            opd_syn_last_committed_id;
        /* last processed (taken from llog) id */
-       unsigned long                    opd_syn_last_processed_id;
+       __u64                            opd_syn_last_processed_id;
        struct osp_id_tracker           *opd_syn_tracker;
        struct list_head                 opd_syn_ontrack;
        /* stop processing new requests until barrier=0 */
@@ -288,7 +290,8 @@ struct osp_object {
        struct lu_object_header opo_header;
        struct dt_object        opo_obj;
        unsigned int            opo_reserved:1,
-                               opo_non_exist:1;
+                               opo_non_exist:1,
+                               opo_stale:1;
 
        /* read/write lock for md osp object */
        struct rw_semaphore     opo_sem;
@@ -353,7 +356,6 @@ struct osp_thandle {
        struct list_head         ot_stop_dcb_list;
        struct osp_update_request *ot_our;
        atomic_t                 ot_refcount;
-       __u64                    ot_version;
 };
 
 static inline struct osp_thandle *
@@ -418,7 +420,7 @@ static inline struct osp_thread_info *osp_env_info(const struct lu_env *env)
 }
 
 struct osp_txn_info {
-       __u32   oti_current_id;
+       __u64   oti_current_id;
 };
 
 extern struct lu_context_key osp_txn_key;
@@ -688,7 +690,8 @@ struct osp_update_request *osp_update_request_create(struct dt_device *dt);
 void osp_update_request_destroy(struct osp_update_request *update);
 
 int osp_send_update_thread(void *arg);
-int osp_check_and_set_rpc_version(struct osp_thandle *oth);
+int osp_check_and_set_rpc_version(struct osp_thandle *oth,
+                                 struct osp_object *obj);
 
 void osp_thandle_destroy(struct osp_thandle *oth);
 static inline void osp_thandle_get(struct osp_thandle *oth)
@@ -714,6 +717,7 @@ struct thandle *osp_get_storage_thandle(const struct lu_env *env,
                                        struct osp_device *osp);
 void osp_trans_callback(const struct lu_env *env,
                        struct osp_thandle *oth, int rc);
+void osp_invalidate_request(struct osp_device *osp);
 /* osp_object.c */
 int osp_attr_get(const struct lu_env *env, struct dt_object *dt,
                 struct lu_attr *attr);