-static inline int obd_brw_async(int cmd, struct obd_export *exp,
- struct obd_info *oinfo, obd_count oa_bufs,
- struct brw_page *pg, struct obd_trans_info *oti,
- struct ptlrpc_request_set *set)
-{
- int rc;
- ENTRY;
-
- EXP_CHECK_DT_OP(exp, brw_async);
- EXP_COUNTER_INCREMENT(exp, brw_async);
-
- 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_async)(cmd, exp, oinfo, oa_bufs, pg,oti,set);
- RETURN(rc);
-}
-
-static inline int obd_brw_rqset(int cmd, struct obd_export *exp,
- struct obdo *oa, struct lov_stripe_md *lsm,
- obd_count oa_bufs, struct brw_page *pg,
- struct obd_trans_info *oti,
- struct obd_capa *ocapa)
-{
- struct ptlrpc_request_set *set = NULL;
- struct obd_info oinfo = { { { 0 } } };
- int rc = 0;
- ENTRY;
-
- set = ptlrpc_prep_set();
- if (set == NULL)
- RETURN(-ENOMEM);
-
- oinfo.oi_oa = oa;
- oinfo.oi_md = lsm;
- oinfo.oi_capa = ocapa;
- rc = obd_brw_async(cmd, exp, &oinfo, oa_bufs, pg, oti, set);
- if (rc == 0) {
- rc = ptlrpc_set_wait(set);
- if (rc)
- CERROR("error from callback: rc = %d\n", rc);
- } else {
- CDEBUG(rc == -ENOSPC ? D_INODE : D_ERROR,
- "error from obd_brw_async: rc = %d\n", rc);
- }
- ptlrpc_set_destroy(set);
- RETURN(rc);
-}
-
-static inline int obd_prep_async_page(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi,
- cfs_page_t *page, obd_off offset,
- struct obd_async_page_ops *ops,
- void *data, void **res, int nocache,
- struct lustre_handle *lockh)
-{
- int ret;
- ENTRY;
-
- EXP_CHECK_DT_OP(exp, prep_async_page);
- EXP_COUNTER_INCREMENT(exp, prep_async_page);
-
- ret = OBP(exp->exp_obd, prep_async_page)(exp, lsm, loi, page, offset,
- ops, data, res, nocache,
- lockh);
- RETURN(ret);
-}
-
-/**
- * Checks if requested extent lock is compatible with a lock under the page.
- *
- * Checks if the lock under \a page is compatible with a read or write lock
- * (specified by \a rw) for an extent [\a start , \a end].
- *
- * \param exp obd export (lov or osc)
- * \param lsm striping information for the file
- * \param res async_page placeholder
- * \param rw OBD_BRW_READ if requested for reading,
- * OBD_BRW_WRITE if requested for writing
- * \param start start of the requested extent
- * \param end end of the requested extent
- * \param cookie transparent parameter for passing locking context
- *
- * \post result == 1, *cookie == context, appropriate lock is referenced or
- *
- * \retval 1 owned lock is reused for the request
- * \retval 0 no lock reused for the request
- * \retval -ENOTSUPP reget_short_lock is not exported at this layer
- *
- * \see obd_release_short_lock
- */
-static inline int obd_reget_short_lock(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- void **res, int rw,
- obd_off start, obd_off end,
- void **cookie)
-{
- ENTRY;
-
- EXP_CHECK_DT_OP(exp, reget_short_lock);
- EXP_COUNTER_INCREMENT(exp, reget_short_lock);
-
- RETURN(OBP(exp->exp_obd, reget_short_lock)(exp, lsm, res, rw,
- start, end, cookie));
-}
-
-
-/**
- * Releases a reference to a lock taken in a "fast" way.
- *
- * Releases a read or write (specified by \a rw) lock
- * referenced by \a cookie.
- *
- * \param exp obd export (lov or osc)
- * \param lsm striping information for the file
- * \param end end of the locked extent
- * \param rw OBD_BRW_READ if requested for reading,
- * OBD_BRW_WRITE if requested for writing
- * \param cookie transparent parameter for passing locking context
- *
- * \post appropriate lock is dereferenced
- *
- * \see obd_reget_short_lock
- */
-static inline int obd_release_short_lock(struct obd_export *exp,
- struct lov_stripe_md *lsm, obd_off end,
- void *cookie, int rw)
-{
- ENTRY;
-
- EXP_CHECK_DT_OP(exp, release_short_lock);
- EXP_COUNTER_INCREMENT(exp, release_short_lock);
-
- RETURN(OBP(exp->exp_obd, release_short_lock)(exp, lsm, end,
- cookie, rw));
-}
-
-static inline int obd_queue_async_io(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi, void *cookie,
- int cmd, obd_off off, int count,
- obd_flag brw_flags, obd_flag async_flags)
-{
- int rc;
- ENTRY;
-
- EXP_CHECK_DT_OP(exp, queue_async_io);
- EXP_COUNTER_INCREMENT(exp, queue_async_io);
- LASSERT(cmd & OBD_BRW_RWMASK);
-
- rc = OBP(exp->exp_obd, queue_async_io)(exp, lsm, loi, cookie, cmd, off,
- count, brw_flags, async_flags);
- RETURN(rc);
-}
-
-static inline int obd_set_async_flags(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi, void *cookie,
- obd_flag async_flags)
-{
- int rc;
- ENTRY;
-
- EXP_CHECK_DT_OP(exp, set_async_flags);
- EXP_COUNTER_INCREMENT(exp, set_async_flags);
-
- rc = OBP(exp->exp_obd, set_async_flags)(exp, lsm, loi, cookie,
- async_flags);
- RETURN(rc);
-}
-
-static inline int obd_queue_group_io(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi,
- struct obd_io_group *oig,
- void *cookie, int cmd, obd_off off,
- int count, obd_flag brw_flags,
- obd_flag async_flags)
-{
- int rc;
- ENTRY;
-
- EXP_CHECK_DT_OP(exp, queue_group_io);
- EXP_COUNTER_INCREMENT(exp, queue_group_io);
- LASSERT(cmd & OBD_BRW_RWMASK);
-
- rc = OBP(exp->exp_obd, queue_group_io)(exp, lsm, loi, oig, cookie,
- cmd, off, count, brw_flags,
- async_flags);
- RETURN(rc);
-}
-
-static inline int obd_trigger_group_io(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi,
- struct obd_io_group *oig)
-{
- int rc;
- ENTRY;
-
- EXP_CHECK_DT_OP(exp, trigger_group_io);
- EXP_COUNTER_INCREMENT(exp, trigger_group_io);
-
- rc = OBP(exp->exp_obd, trigger_group_io)(exp, lsm, loi, oig);
- RETURN(rc);
-}
-
-static inline int obd_teardown_async_page(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi, void *cookie)
-{
- int rc;
- ENTRY;
-
- EXP_CHECK_DT_OP(exp, teardown_async_page);
- EXP_COUNTER_INCREMENT(exp, teardown_async_page);
-
- rc = OBP(exp->exp_obd, teardown_async_page)(exp, lsm, loi, cookie);
- RETURN(rc);
-}
-