Whamcloud - gitweb
LU-1303 osp: code to update per-OST last_id in OSP
[fs/lustre-release.git] / lustre / osp / osp_internal.h
index f22e1b2..e572552 100644 (file)
@@ -52,6 +52,11 @@ struct osp_device {
        /* device used to store persistent state (llogs, last ids) */
        struct obd_export               *opd_storage_exp;
        struct dt_device                *opd_storage;
+       struct dt_object                *opd_last_used_file;
+       /* protected by opd_pre_lock */
+       volatile obd_id                  opd_last_used_id;
+       obd_id                           opd_gap_start;
+       int                              opd_gap_count;
        /* connection to OST */
        struct obd_device               *opd_obd;
        struct obd_export               *opd_exp;
@@ -86,9 +91,21 @@ struct osp_object {
 extern struct lu_object_operations osp_lu_obj_ops;
 
 struct osp_thread_info {
+       struct lu_buf            osi_lb;
+       struct lu_fid            osi_fid;
        struct lu_attr           osi_attr;
+       obd_id                   osi_id;
+       loff_t                   osi_off;
 };
 
+static inline void osp_objid_buf_prep(struct osp_thread_info *osi,
+                                     struct osp_device *d, int index)
+{
+       osi->osi_lb.lb_buf = (void *)&d->opd_last_used_id;
+       osi->osi_lb.lb_len = sizeof(d->opd_last_used_id);
+       osi->osi_off = sizeof(d->opd_last_used_id) * index;
+}
+
 extern struct lu_context_key osp_thread_key;
 
 static inline struct osp_thread_info *osp_env_info(const struct lu_env *env)
@@ -170,6 +187,9 @@ static inline struct dt_object *osp_object_child(struct osp_object *o)
                              struct dt_object, do_lu);
 }
 
+/* osp_dev.c */
+void osp_update_last_id(struct osp_device *d, obd_id objid);
+
 /* lproc_osp.c */
 void lprocfs_osp_init_vars(struct lprocfs_static_vars *lvars);