+static inline struct seq_server_site *osp_seq_site(struct osp_device *osp)
+{
+ return osp->opd_dt_dev.dd_lu_dev.ld_site->ld_seq_site;
+}
+
+#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;
+}
+
+typedef int (*osp_async_update_interpterer_t)(const struct lu_env *env,
+ struct update_reply *reply,
+ struct osp_object *obj,
+ void *data, int index, int rc);
+