Whamcloud - gitweb
LU-12930 various: use schedule_timeout_*interruptible
[fs/lustre-release.git] / lustre / osp / osp_internal.h
index f5f44c5..c78694d 100644 (file)
@@ -169,13 +169,14 @@ struct osp_device {
         * and required le64_to_cpu() conversion before use.
         * Protected by opd_pre_lock */
        struct lu_fid                   opd_last_used_fid;
+       /* on disk copy last_used_fid.f_oid or idif */
+       u64                             opd_last_id;
        struct lu_fid                   opd_gap_start_fid;
        int                              opd_gap_count;
        /* connection to OST */
        struct osp_rpc_lock              opd_rpc_lock;
        struct obd_device               *opd_obd;
        struct obd_export               *opd_exp;
-       struct obd_uuid                  opd_cluuid;
        struct obd_connect_data         *opd_connect_data;
        int                              opd_connects;
        /* connection status. */
@@ -318,6 +319,9 @@ struct osp_object {
        struct list_head        opo_invalidate_cb_list;
        /* Protect opo_ooa. */
        spinlock_t              opo_lock;
+       /* to implement in-flight invalidation */
+       atomic_t                opo_invalidate_seq;
+       struct rw_semaphore     opo_invalidate_sem;
 };
 
 extern struct lu_object_operations osp_lu_obj_ops;
@@ -332,7 +336,6 @@ struct osp_thread_info {
        struct lu_attr           osi_attr;
        struct ost_id            osi_oi;
        struct ost_id            osi_oi2;
-       u64                      osi_id;
        loff_t                   osi_off;
        union {
                struct llog_rec_hdr             osi_hdr;
@@ -428,15 +431,7 @@ extern struct lu_context_key osp_thread_key;
 
 static inline struct osp_thread_info *osp_env_info(const struct lu_env *env)
 {
-       struct osp_thread_info *info;
-
-       info = lu_context_key_get(&env->le_ctx, &osp_thread_key);
-       if (info == NULL) {
-               lu_env_refill((struct lu_env *)env);
-               info = lu_context_key_get(&env->le_ctx, &osp_thread_key);
-       }
-       LASSERT(info);
-       return info;
+       return lu_env_info(env, &osp_thread_key);
 }
 
 struct osp_txn_info {
@@ -565,7 +560,7 @@ static inline void osp_get_rpc_lock(struct osp_device *osp)
         */
        if (unlikely(lck->rpcl_fakes)) {
                mutex_unlock(&lck->rpcl_mutex);
-               schedule_timeout(cfs_time_seconds(1) / 4);
+               schedule_timeout_uninterruptible(cfs_time_seconds(1) / 4);
 
                goto again;
        }
@@ -603,17 +598,26 @@ static inline int osp_fid_diff(const struct lu_fid *fid1,
                       fid_idif_id(fid2->f_seq, fid2->f_oid, 0);
        }
 
-       LASSERTF(fid_seq(fid1) == fid_seq(fid2), "fid1:"DFID
-                ", fid2:"DFID"\n", PFID(fid1), PFID(fid2));
+       LASSERTF(fid_seq(fid1) == fid_seq(fid2), "fid1:"DFID", fid2:"DFID"\n",
+                PFID(fid1), PFID(fid2));
 
        return fid_oid(fid1) - fid_oid(fid2);
 }
 
+static inline void osp_fid_to_obdid(struct lu_fid *last_fid, u64 *osi_id)
+{
+       if (fid_is_idif((last_fid)))
+               *osi_id = fid_idif_id(fid_seq(last_fid), fid_oid(last_fid),
+                                     fid_ver(last_fid));
+       else
+               *osi_id = fid_oid(last_fid);
+}
 
 static inline void osp_update_last_fid(struct osp_device *d, struct lu_fid *fid)
 {
        int diff = osp_fid_diff(fid, &d->opd_last_used_fid);
        struct lu_fid *gap_start = &d->opd_gap_start_fid;
+
        /*
         * we might have lost precreated objects due to VBR and precreate
         * orphans, the gap in objid can be calculated properly only here
@@ -633,6 +637,7 @@ static inline void osp_update_last_fid(struct osp_device *d, struct lu_fid *fid)
                               PFID(&d->opd_gap_start_fid), d->opd_gap_count);
                }
                d->opd_last_used_fid = *fid;
+               osp_fid_to_obdid(fid, &d->opd_last_id);
        }
 }
 
@@ -886,7 +891,7 @@ int osp_sync_add_commit_cb_1s(const struct lu_env *env, struct osp_device *d,
                              struct thandle *th);
 
 /* lwp_dev.c */
-extern struct obd_ops lwp_obd_device_ops;
+extern const struct obd_ops lwp_obd_device_ops;
 extern struct lu_device_type lwp_device_type;
 
 static inline struct lu_device *osp2top(const struct osp_device *osp)