+static inline int obd_punch(struct lustre_handle *conn, struct obdo *oa,
+ struct lov_stripe_md *ea,
+ obd_size count, obd_off offset)
+{
+ struct obd_export *exp;
+ int rc;
+
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, punch);
+
+ rc = OBP(exp->exp_obd, punch)(conn, oa, ea, count, offset);
+ RETURN(rc);
+}
+
+static inline int obd_brw(int cmd, struct lustre_handle *conn,
+ struct lov_stripe_md *ea, obd_count oa_bufs,
+ struct brw_page *pg,
+ brw_callback_t callback, void *data)
+{
+ struct obd_export *exp;
+ int rc;
+
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, brw);
+
+ if (!(cmd & OBD_BRW_RWMASK)) {
+ CERROR("obd_brw: cmd must be OBD_BRW_READ or OBD_BRW_WRITE\n");
+ LBUG();
+ }
+
+ rc = OBP(exp->exp_obd, brw)(cmd, conn, ea, oa_bufs, pg, callback, data);
+ RETURN(rc);
+}
+
+static inline int obd_preprw(int cmd, struct lustre_handle *conn,
+ int objcount, struct obd_ioobj *obj,
+ int niocount, struct niobuf_remote *remote,
+ struct niobuf_local *local, void **desc_private)
+{
+ struct obd_export *exp;
+ int rc;
+
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, preprw);
+
+ rc = OBP(exp->exp_obd, preprw)(cmd, conn, objcount, obj, niocount,
+ remote, local, desc_private);
+ RETURN(rc);
+}
+
+static inline int obd_commitrw(int cmd, struct lustre_handle *conn,
+ int objcount, struct obd_ioobj *obj,
+ int niocount, struct niobuf_local *local,
+ void *desc_private)
+{
+ struct obd_export *exp;
+ int rc;
+
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, commitrw);
+
+ rc = OBP(exp->exp_obd, commitrw)(cmd, conn, objcount, obj, niocount,
+ local, desc_private);
+ RETURN(rc);
+}
+
+static inline int obd_iocontrol(int cmd, struct lustre_handle *conn,
+ int len, void *karg, void *uarg)
+{
+ struct obd_export *exp;
+ int rc;
+
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, iocontrol);
+
+ rc = OBP(exp->exp_obd, iocontrol)(cmd, conn, len, karg, uarg);
+ RETURN(rc);
+}
+
+static inline int obd_enqueue(struct lustre_handle *conn,
+ struct lov_stripe_md *ea,
+ struct lustre_handle *parent_lock,
+ __u32 type, void *cookie, int cookielen,
+ __u32 mode, int *flags, void *cb, void *data,
+ int datalen, struct lustre_handle *lockh)
+{
+ struct obd_export *exp;
+ int rc;
+
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, enqueue);
+
+ rc = OBP(exp->exp_obd, enqueue)(conn, ea, parent_lock, type,
+ cookie, cookielen, mode, flags, cb,
+ data, datalen, lockh);
+ RETURN(rc);
+}
+
+static inline int obd_cancel(struct lustre_handle *conn,
+ struct lov_stripe_md *ea, __u32 mode,
+ struct lustre_handle *lockh)
+{
+ struct obd_export *exp;
+ int rc;
+
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, cancel);
+
+ rc = OBP(exp->exp_obd, cancel)(conn, ea, mode, lockh);
+ RETURN(rc);
+}
+
+static inline int obd_cancel_unused(struct lustre_handle *conn,
+ struct lov_stripe_md *ea, int local)
+{
+ struct obd_export *exp;
+ int rc;
+
+ OBD_CHECK_SETUP(conn, exp);
+ OBD_CHECK_OP(exp->exp_obd, cancel_unused);
+
+ rc = OBP(exp->exp_obd, cancel_unused)(conn, ea, local);
+ RETURN(rc);
+}
+
+#endif
+
+/*
+ * ======== OBD Metadata Support ===========
+ */
+
+extern int obd_init_caches(void);
+extern void obd_cleanup_caches(void);
+
+static inline int obdo_has_inline(struct obdo *obdo)
+{
+ return (obdo->o_valid & OBD_MD_FLINLINE &&
+ obdo->o_obdflags & OBD_FL_INLINEDATA);
+};
+
+#ifdef __KERNEL__