+#define osp_init_rpc_lock(lck) mdc_init_rpc_lock(lck)
+#define osp_get_rpc_lock(lck, it) mdc_get_rpc_lock(lck, it)
+#define osp_put_rpc_lock(lck, it) mdc_put_rpc_lock(lck, it)
+
+static inline void osp_update_last_fid(struct osp_device *d, struct lu_fid *fid)
+{
+ int diff = lu_fid_diff(fid, &d->opd_last_used_fid);
+ /*
+ * we might have lost precreated objects due to VBR and precreate
+ * orphans, the gap in objid can be calculated properly only here
+ */
+ if (diff > 0) {
+ if (diff > 1) {
+ d->opd_gap_start_fid = d->opd_last_used_fid;
+ d->opd_gap_start_fid.f_oid++;
+ d->opd_gap_count = diff - 1;
+ CDEBUG(D_HA, "Gap in objids: start="DFID", count =%d\n",
+ PFID(&d->opd_gap_start_fid), d->opd_gap_count);
+ }
+ d->opd_last_used_fid = *fid;
+ }
+}
+
+static int osp_fid_end_seq(const struct lu_env *env, struct lu_fid *fid)
+{
+ if (fid_is_idif(fid)) {
+ struct osp_thread_info *info = osp_env_info(env);
+ struct ost_id *oi = &info->osi_oi;
+
+ fid_to_ostid(fid, oi);
+ return ostid_id(oi) == IDIF_MAX_OID;
+ } else {
+ return fid_oid(fid) == LUSTRE_DATA_SEQ_MAX_WIDTH;
+ }
+}
+
+static inline int osp_precreate_end_seq_nolock(const struct lu_env *env,
+ struct osp_device *osp)
+{
+ struct lu_fid *fid = &osp->opd_pre_last_created_fid;
+
+ return osp_fid_end_seq(env, fid);
+}
+
+static inline int osp_precreate_end_seq(const struct lu_env *env,
+ struct osp_device *osp)
+{
+ int rc;
+
+ spin_lock(&osp->opd_pre_lock);
+ rc = osp_precreate_end_seq_nolock(env, osp);
+ spin_unlock(&osp->opd_pre_lock);
+ return rc;
+}
+
+static inline int osp_is_fid_client(struct osp_device *osp)
+{
+ struct obd_import *imp = osp->opd_obd->u.cli.cl_import;
+
+ return imp->imp_connect_data.ocd_connect_flags & OBD_CONNECT_FID;
+}
+
+/* osp_dev.c */
+void osp_update_last_id(struct osp_device *d, obd_id objid);
+extern struct llog_operations osp_mds_ost_orig_logops;
+
+/* osp_md_object.c */
+int osp_trans_start(const struct lu_env *env, struct dt_device *dt,
+ struct thandle *th);
+int osp_trans_stop(const struct lu_env *env, struct thandle *th);
+/* osp_precreate.c */
+int osp_init_precreate(struct osp_device *d);
+int osp_precreate_reserve(const struct lu_env *env, struct osp_device *d);
+__u64 osp_precreate_get_id(struct osp_device *d);
+int osp_precreate_get_fid(const struct lu_env *env, struct osp_device *d,
+ struct lu_fid *fid);
+void osp_precreate_fini(struct osp_device *d);
+int osp_object_truncate(const struct lu_env *env, struct dt_object *dt, __u64);
+void osp_pre_update_status(struct osp_device *d, int rc);
+void osp_statfs_need_now(struct osp_device *d);
+int osp_reset_last_used(const struct lu_env *env, struct osp_device *osp);
+int osp_write_last_oid_seq_files(struct lu_env *env, struct osp_device *osp,
+ struct lu_fid *fid, int sync);
+