Whamcloud - gitweb
- land b_hd_ver_recov
[fs/lustre-release.git] / lustre / include / dt_object.h
index 4d33e83..160f47a 100644 (file)
@@ -242,6 +242,9 @@ struct dt_object_format {
 
 enum dt_format_type dt_mode_to_dft(__u32 mode);
 
+/** Version type. May differ in DMU and ldiskfs */
+typedef __u64 dt_obj_version_t;
+
 /**
  * Per-dt-object operations.
  */
@@ -371,6 +374,10 @@ struct dt_object_operations {
                                         struct lustre_capa *old,
                                         __u64 opc);
         int (*do_object_sync)(const struct lu_env *, struct dt_object *);
+        dt_obj_version_t (*do_version_get)(const struct lu_env *env,
+                                           struct dt_object *dt);
+        void (*do_version_set)(const struct lu_env *env, struct dt_object *dt,
+                               dt_obj_version_t new_version);
         /**
          * Get object info of next level. Currently, only get inode from osd.
          * This is only used by quota b=16542
@@ -572,6 +579,7 @@ struct dt_txn_callback {
         int (*dtc_txn_commit)(const struct lu_env *env,
                               struct thandle *txn, void *cookie);
         void            *dtc_cookie;
+        __u32            dtc_tag;
         struct list_head dtc_linkage;
 };
 
@@ -609,5 +617,40 @@ struct dt_object *dt_locate(const struct lu_env *env,
                             struct dt_device *dev,
                             const struct lu_fid *fid);
 
+static inline dt_obj_version_t do_version_get(const struct lu_env *env,
+                                              struct dt_object *o)
+{
+        LASSERT(o->do_ops->do_version_get);
+        return o->do_ops->do_version_get(env, o);
+}
+
+static inline void do_version_set(const struct lu_env *env,
+                                  struct dt_object *o, dt_obj_version_t v)
+{
+        LASSERT(o->do_ops->do_version_set);
+        return o->do_ops->do_version_set(env, o, v);
+}
+
+int dt_record_read(const struct lu_env *env, struct dt_object *dt,
+                   struct lu_buf *buf, loff_t *pos);
+int dt_record_write(const struct lu_env *env, struct dt_object *dt,
+                    const struct lu_buf *buf, loff_t *pos, struct thandle *th);
+
+
+static inline struct thandle *dt_trans_start(const struct lu_env *env,
+                                             struct dt_device *d,
+                                             struct txn_param *p)
+{
+        LASSERT(d->dd_ops->dt_trans_start);
+        return d->dd_ops->dt_trans_start(env, d, p);
+}
+
+static inline void dt_trans_stop(const struct lu_env *env,
+                                 struct dt_device *d,
+                                 struct thandle *th)
+{
+        LASSERT(d->dd_ops->dt_trans_stop);
+        return d->dd_ops->dt_trans_stop(env, th);
+}
 /** @} dt */
 #endif /* __LUSTRE_DT_OBJECT_H */