Whamcloud - gitweb
LU-13974 llog: check stale osp object
[fs/lustre-release.git] / lustre / osp / osp_internal.h
index c78694d..7a4418e 100644 (file)
@@ -142,6 +142,10 @@ struct osp_updates {
         * those stale RPC(with older generation) will not be sent, otherwise it
         * will cause update lllog corruption */
        __u64                   ou_generation;
+
+       /* dedicate update thread */
+       struct task_struct      *ou_update_task;
+       struct lu_env           ou_env;
 };
 
 struct osp_rpc_lock {
@@ -194,15 +198,13 @@ struct osp_device {
        /* precreate structure for OSP */
        struct osp_precreate            *opd_pre;
        /* dedicate precreate thread */
-       struct ptlrpc_thread             opd_pre_thread;
+       struct task_struct              *opd_pre_task;
        spinlock_t                       opd_pre_lock;
        /* thread waits for signals about pool going empty */
        wait_queue_head_t                opd_pre_waitq;
 
        /* send update thread */
        struct osp_updates              *opd_update;
-       /* dedicate update thread */
-       struct ptlrpc_thread             opd_update_thread;
 
        /*
         * OST synchronization thread
@@ -215,7 +217,7 @@ struct osp_device {
        /* processing of changes from previous mount is done? */
        int                              opd_sync_prev_done;
        /* found records */
-       struct ptlrpc_thread             opd_sync_thread;
+       struct task_struct              *opd_sync_task;
        wait_queue_head_t                opd_sync_waitq;
        /* list of in flight rpcs */
        struct list_head                 opd_sync_in_flight_list;
@@ -458,7 +460,7 @@ static inline int lu_device_is_osp(struct lu_device *d)
 static inline struct osp_device *lu2osp_dev(struct lu_device *d)
 {
        LASSERT(lu_device_is_osp(d));
-       return container_of0(d, struct osp_device, opd_dt_dev.dd_lu_dev);
+       return container_of_safe(d, struct osp_device, opd_dt_dev.dd_lu_dev);
 }
 
 static inline struct lu_device *osp2lu_dev(struct osp_device *d)
@@ -469,13 +471,13 @@ static inline struct lu_device *osp2lu_dev(struct osp_device *d)
 static inline struct osp_device *dt2osp_dev(struct dt_device *d)
 {
        LASSERT(lu_device_is_osp(&d->dd_lu_dev));
-       return container_of0(d, struct osp_device, opd_dt_dev);
+       return container_of_safe(d, struct osp_device, opd_dt_dev);
 }
 
 static inline struct osp_object *lu2osp_obj(struct lu_object *o)
 {
        LASSERT(ergo(o != NULL, lu_device_is_osp(o->lo_dev)));
-       return container_of0(o, struct osp_object, opo_obj.do_lu);
+       return container_of_safe(o, struct osp_object, opo_obj.do_lu);
 }
 
 static inline struct lu_object *osp2lu_obj(struct osp_object *obj)
@@ -486,7 +488,7 @@ static inline struct lu_object *osp2lu_obj(struct osp_object *obj)
 static inline struct osp_object *osp_obj(const struct lu_object *o)
 {
        LASSERT(lu_device_is_osp(o->lo_dev));
-       return container_of0(o, struct osp_object, opo_obj.do_lu);
+       return container_of_safe(o, struct osp_object, opo_obj.do_lu);
 }
 
 static inline struct osp_object *dt2osp_obj(const struct dt_object *d)
@@ -496,8 +498,8 @@ static inline struct osp_object *dt2osp_obj(const struct dt_object *d)
 
 static inline struct dt_object *osp_object_child(struct osp_object *o)
 {
-       return container_of0(lu_object_next(osp2lu_obj(o)),
-                             struct dt_object, do_lu);
+       return container_of(lu_object_next(osp2lu_obj(o)),
+                           struct dt_object, do_lu);
 }
 
 static inline struct seq_server_site *osp_seq_site(struct osp_device *osp)
@@ -738,16 +740,6 @@ int osp_object_update_request_create(struct osp_update_request *our,
        ret;                                                            \
 })
 
-static inline bool osp_send_update_thread_running(struct osp_device *osp)
-{
-       return osp->opd_update_thread.t_flags & SVC_RUNNING;
-}
-
-static inline bool osp_send_update_thread_stopped(struct osp_device *osp)
-{
-       return osp->opd_update_thread.t_flags & SVC_STOPPED;
-}
-
 typedef int (*osp_update_interpreter_t)(const struct lu_env *env,
                                        struct object_update_reply *rep,
                                        struct ptlrpc_request *req,
@@ -826,6 +818,7 @@ int osp_declare_xattr_del(const struct lu_env *env, struct dt_object *dt,
 int osp_xattr_del(const struct lu_env *env, struct dt_object *dt,
                  const char *name, struct thandle *th);
 int osp_invalidate(const struct lu_env *env, struct dt_object *dt);
+bool osp_check_stale(struct dt_object *dt);
 void osp_obj_invalidate_cache(struct osp_object *obj);
 
 int osp_trans_stop(const struct lu_env *env, struct dt_device *dt,