#include <linux/lustre_lib.h>
#include <linux/lustre_idl.h>
#include <linux/lprocfs_status.h>
+#include <linux/lustre_log.h>
/* OBD Device Declarations */
-#define MAX_OBD_DEVICES 128
+#define MAX_OBD_DEVICES 256
extern struct obd_device obd_dev[MAX_OBD_DEVICES];
/* OBD Operations Declarations */
/* genops.c */
struct obd_export *class_conn2export(struct lustre_handle *);
-int class_register_type(struct obd_ops *ops, struct lprocfs_vars *, char *nm);
+int class_register_type(struct obd_ops *ops, struct md_ops *md_ops,
+ struct lprocfs_vars *, char *nm);
int class_unregister_type(char *nm);
struct obd_device *class_newdev(int *dev);
struct obd_device *class_name2obd(char *name);
int class_uuid2dev(struct obd_uuid *uuid);
struct obd_device *class_uuid2obd(struct obd_uuid *uuid);
-struct obd_device * class_find_client_obd(struct obd_uuid *tgt_uuid,
+struct obd_device * class_find_client_obd(struct obd_uuid *tgt_uuid,
char * typ_name,
struct obd_uuid *grp_uuid);
-
-void osic_init(struct obd_sync_io_container **osic);
-void osic_add_one(struct obd_sync_io_container *osic);
-void osic_complete_one(struct obd_sync_io_container *osic, int rc);
-void osic_release(struct obd_sync_io_container *osic);
-int osic_wait(struct obd_sync_io_container *osic);
-
-/* config.c */
+struct obd_device * class_devices_in_group(struct obd_uuid *grp_uuid,
+ int *next);
+
+int oig_init(struct obd_io_group **oig);
+void oig_add_one(struct obd_io_group *oig,
+ struct oig_callback_context *occ);
+void oig_complete_one(struct obd_io_group *oig,
+ struct oig_callback_context *occ, int rc);
+void oig_release(struct obd_io_group *oig);
+int oig_wait(struct obd_io_group *oig);
+
+/* obd_config.c */
int class_process_config(struct lustre_cfg *lcfg);
-int class_attach(struct lustre_cfg *lcfg);
-int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg);
-int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg);
-int class_detach(struct obd_device *obd, struct lustre_cfg *lcfg);
-/* Passed as data param to class_config_parse_llog */
+/* Passed as data param to class_config_parse_handler() */
struct config_llog_instance {
char * cfg_instance;
struct obd_uuid cfg_uuid;
- ptl_nid_t cfg_local_nid;
+ ptl_nid_t cfg_local_nid;
};
-int class_config_parse_llog(struct llog_ctxt *ctxt, char *name,
- struct config_llog_instance *cfg);
-int class_config_dump_llog(struct llog_ctxt *ctxt, char *name,
+
+int class_config_process_llog(struct llog_ctxt *ctxt, char *name,
+ struct config_llog_instance *cfg);
+int class_config_dump_llog(struct llog_ctxt *ctxt, char *name,
struct config_llog_instance *cfg);
struct lustre_profile {
};
struct lustre_profile *class_get_profile(char * prof);
+void class_del_profile(char *prof);
+
+#define class_export_rpc_get(exp) \
+({ \
+ atomic_inc(&(exp)->exp_rpc_count); \
+ CDEBUG(D_INFO, "RPC GETting export %p : new rpc_count %d\n", \
+ (exp), atomic_read(&(exp)->exp_rpc_count)); \
+ class_export_get(exp); \
+})
+
+#define class_export_rpc_put(exp) \
+({ \
+ atomic_dec(&(exp)->exp_rpc_count); \
+ CDEBUG(D_INFO, "RPC PUTting export %p : new rpc_count %d\n", \
+ (exp), atomic_read(&(exp)->exp_rpc_count)); \
+ class_export_put(exp); \
+})
#define class_export_get(exp) \
({ \
#define OBT(dev) (dev)->obd_type
#define OBP(dev, op) (dev)->obd_type->typ_ops->o_ ## op
+#define MDP(dev, op) (dev)->obd_type->typ_md_ops->m_ ## op
#define CTXTP(ctxt, op) (ctxt)->loc_logops->lop_##op
/* Ensure obd_setup: used for disconnect which might be called while
LASSERT(coffset < obd->obd_stats->ls_num); \
lprocfs_counter_incr(obd->obd_stats, coffset); \
}
+/* FIXME: real accounting here */
+#define MD_COUNTER_INCREMENT(obd, op)
#else
#define OBD_COUNTER_OFFSET(op)
#define OBD_COUNTER_INCREMENT(obd, op)
+#define MD_COUNTER_INCREMENT(obd, op)
#endif
+#define OBD_CHECK_MD_OP(obd, op, err) \
+do { \
+ if (!OBT(obd) || !MDP((obd), op)) {\
+ if (err) \
+ CERROR("obd_md" #op ": dev %d no operation\n", \
+ obd->obd_minor); \
+ RETURN(err); \
+ } \
+} while (0)
+
+#define EXP_CHECK_MD_OP(exp, op) \
+do { \
+ if ((exp) == NULL) { \
+ CERROR("obd_" #op ": NULL export\n"); \
+ RETURN(-ENODEV); \
+ } \
+ if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \
+ CERROR("obd_" #op ": cleaned up obd\n"); \
+ RETURN(-EOPNOTSUPP); \
+ } \
+ if (!OBT((exp)->exp_obd) || !MDP((exp)->exp_obd, op)) { \
+ CERROR("obd_" #op ": dev %d no operation\n", \
+ (exp)->exp_obd->obd_minor); \
+ RETURN(-EOPNOTSUPP); \
+ } \
+} while (0)
+
#define OBD_CHECK_OP(obd, op, err) \
do { \
if (!OBT(obd) || !OBP((obd), op)) {\
RETURN(rc);
}
-static inline int obd_postsetup(struct obd_device *obd)
-{
- int rc;
- ENTRY;
-
- OBD_CHECK_DEV_ACTIVE(obd);
- OBD_CHECK_OP(obd, postsetup, 0);
- OBD_COUNTER_INCREMENT(obd, postsetup);
-
- rc = OBP(obd, postsetup)(obd);
- RETURN(rc);
-}
-
static inline int obd_precleanup(struct obd_device *obd, int flags)
{
int rc;
RETURN(rc);
}
+static inline int
+obd_process_config(struct obd_device *obd, int datalen, void *data)
+{
+ int rc;
+ ENTRY;
+
+ OBD_CHECK_OP(obd, process_config, -EOPNOTSUPP);
+ OBD_COUNTER_INCREMENT(obd, process_config);
+
+ rc = OBP(obd, process_config)(obd, datalen, data);
+ RETURN(rc);
+}
+
/* Pack an in-memory MD struct for storage on disk.
* Returns +ve size of packed MD (0 for free), or -ve error.
*
return obd_unpackmd(exp, mem_tgt, NULL, 0);
}
+static inline int obd_revalidate_md(struct obd_export *exp, struct obdo *obdo,
+ struct lov_stripe_md *ea,
+ struct obd_trans_info *oti)
+{
+ int rc;
+ ENTRY;
+
+ EXP_CHECK_OP(exp, revalidate_md);
+ OBD_COUNTER_INCREMENT(exp->exp_obd, revalidate_md);
+
+ rc = OBP(exp->exp_obd, revalidate_md)(exp, obdo, ea, oti);
+ RETURN(rc);
+}
+
static inline int obd_create(struct obd_export *exp, struct obdo *obdo,
struct lov_stripe_md **ea,
struct obd_trans_info *oti)
{
LASSERT(exp->exp_obd);
- return lvfs_fid2dentry(&exp->exp_obd->obd_ctxt, id_ino, gen, gr,
+ return lvfs_fid2dentry(&exp->exp_obd->obd_lvfs_ctxt, id_ino, gen, gr,
exp->exp_obd);
}
#define time_before(t1, t2) ((long)t2 - (long)t1 > 0)
#endif
+/* @max_age is the oldest time in jiffies that we accept using a cached data.
+ * If the cache is older than @max_age we will get a new value from the
+ * target. Use a value of "jiffies + HZ" to guarantee freshness. */
static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
unsigned long max_age)
{
CDEBUG(D_SUPER, "osfs %lu, max_age %lu\n", obd->obd_osfs_age, max_age);
if (time_before(obd->obd_osfs_age, max_age)) {
rc = OBP(obd, statfs)(obd, osfs, max_age);
- spin_lock(&obd->obd_osfs_lock);
- memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
- obd->obd_osfs_age = jiffies;
- spin_unlock(&obd->obd_osfs_lock);
+ if (rc == 0) {
+ spin_lock(&obd->obd_osfs_lock);
+ memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
+ obd->obd_osfs_age = jiffies;
+ spin_unlock(&obd->obd_osfs_lock);
+ }
} else {
CDEBUG(D_SUPER, "using cached obd_statfs data\n");
spin_lock(&obd->obd_osfs_lock);
}
static inline int obd_sync(struct obd_export *exp, struct obdo *oa,
- struct lov_stripe_md *ea, obd_size start,
+ struct lov_stripe_md *ea, obd_size start,
obd_size end)
{
int rc;
RETURN(rc);
}
-static inline int obd_prep_async_page(struct obd_export *exp,
+static inline int obd_prep_async_page(struct obd_export *exp,
struct lov_stripe_md *lsm,
- struct lov_oinfo *loi,
- struct page *page, obd_off offset,
- struct obd_async_page_ops *ops,
+ struct lov_oinfo *loi,
+ struct page *page, obd_off offset,
+ struct obd_async_page_ops *ops,
void *data, void **res)
{
int ret;
RETURN(ret);
}
-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,
+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;
OBD_CHECK_OP(exp->exp_obd, set_async_flags, -EOPNOTSUPP);
OBD_COUNTER_INCREMENT(exp->exp_obd, set_async_flags);
- rc = OBP(exp->exp_obd, set_async_flags)(exp, lsm, loi, cookie,
+ rc = OBP(exp->exp_obd, set_async_flags)(exp, lsm, loi, cookie,
async_flags);
RETURN(rc);
}
-static inline int obd_queue_sync_io(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi,
- struct obd_sync_io_container *osic,
- void *cookie, int cmd, obd_off off,
- int count, obd_flag brw_flags)
+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;
- OBD_CHECK_OP(exp->exp_obd, queue_sync_io, -EOPNOTSUPP);
- OBD_COUNTER_INCREMENT(exp->exp_obd, queue_sync_io);
+ OBD_CHECK_OP(exp->exp_obd, queue_group_io, -EOPNOTSUPP);
+ OBD_COUNTER_INCREMENT(exp->exp_obd, queue_group_io);
LASSERT(cmd & OBD_BRW_RWMASK);
- rc = OBP(exp->exp_obd, queue_sync_io)(exp, lsm, loi, osic, cookie,
- cmd, off, count, brw_flags);
+ 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_sync_io(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi,
- struct obd_sync_io_container *osic)
+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;
- OBD_CHECK_OP(exp->exp_obd, trigger_sync_io, -EOPNOTSUPP);
- OBD_COUNTER_INCREMENT(exp->exp_obd, trigger_sync_io);
+ OBD_CHECK_OP(exp->exp_obd, trigger_group_io, -EOPNOTSUPP);
+ OBD_COUNTER_INCREMENT(exp->exp_obd, trigger_group_io);
- rc = OBP(exp->exp_obd, trigger_sync_io)(exp, lsm, loi, osic);
+ rc = OBP(exp->exp_obd, trigger_group_io)(exp, lsm, loi, oig);
RETURN(rc);
}
static inline int obd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
int objcount, struct obd_ioobj *obj,
int niocount, struct niobuf_local *local,
- struct obd_trans_info *oti)
+ struct obd_trans_info *oti, int rc)
{
- int rc;
ENTRY;
OBD_CHECK_OP(exp->exp_obd, commitrw, -EOPNOTSUPP);
OBD_COUNTER_INCREMENT(exp->exp_obd, commitrw);
rc = OBP(exp->exp_obd, commitrw)(cmd, exp, oa, objcount, obj, niocount,
- local, oti);
+ local, oti, rc);
+ RETURN(rc);
+}
+
+static inline int obd_do_cow(struct obd_export *exp, struct obd_ioobj *obj,
+ int objcount,struct niobuf_remote *rnb)
+{
+ int rc;
+ ENTRY;
+
+ /* there are cases when write_extents is not implemented. */
+ if (!OBP(exp->exp_obd, do_cow))
+ RETURN(0);
+
+ OBD_COUNTER_INCREMENT(exp->exp_obd, do_cow);
+
+ rc = OBP(exp->exp_obd, do_cow)(exp, obj, objcount, rnb);
+
+ RETURN(rc);
+}
+
+static inline int obd_write_extents(struct obd_export *exp,
+ struct obd_ioobj *obj,
+ int objcount, int niocount,
+ struct niobuf_local *local,
+ int rc)
+{
+ ENTRY;
+
+ /* there are cases when write_extents is not implemented. */
+ if (!OBP(exp->exp_obd, write_extents))
+ RETURN(0);
+
+ OBD_COUNTER_INCREMENT(exp->exp_obd, write_extents);
+
+ rc = OBP(exp->exp_obd, write_extents)(exp, obj, objcount, niocount,
+ local, rc);
RETURN(rc);
}
RETURN(rc);
}
-static inline int obd_enqueue(struct obd_export *exp,
- struct lov_stripe_md *ea,
- struct lustre_handle *parent_lock,
- __u32 type, void *cookie, int cookielen,
- __u32 mode, int *flags, void *cb, void *data,
- struct lustre_handle *lockh)
+static inline int obd_enqueue(struct obd_export *exp, struct lov_stripe_md *ea,
+ __u32 type, ldlm_policy_data_t *policy,
+ __u32 mode, int *flags, void *bl_cb, void *cp_cb,
+ void *gl_cb, void *data, __u32 lvb_len,
+ void *lvb_swabber, struct lustre_handle *lockh)
{
int rc;
ENTRY;
EXP_CHECK_OP(exp, enqueue);
OBD_COUNTER_INCREMENT(exp->exp_obd, enqueue);
- rc = OBP(exp->exp_obd, enqueue)(exp, ea, parent_lock, type,
- cookie, cookielen, mode, flags, cb,
- data, lockh);
+ rc = OBP(exp->exp_obd, enqueue)(exp, ea, type, policy, mode, flags,
+ bl_cb, cp_cb, gl_cb, data, lvb_len,
+ lvb_swabber, lockh);
RETURN(rc);
}
-static inline int obd_match(struct obd_export *exp,
- struct lov_stripe_md *ea, __u32 type, void *cookie,
- int cookielen, __u32 mode, int *flags, void *data,
- struct lustre_handle *lockh)
+static inline int obd_match(struct obd_export *exp, struct lov_stripe_md *ea,
+ __u32 type, ldlm_policy_data_t *policy, __u32 mode,
+ int *flags, void *data, struct lustre_handle *lockh)
{
int rc;
ENTRY;
EXP_CHECK_OP(exp, match);
OBD_COUNTER_INCREMENT(exp->exp_obd, match);
- rc = OBP(exp->exp_obd, match)(exp, ea, type, cookie, cookielen, mode,
- flags, data, lockh);
+ rc = OBP(exp->exp_obd, match)(exp, ea, type, policy, mode, flags, data,
+ lockh);
RETURN(rc);
}
-
static inline int obd_change_cbdata(struct obd_export *exp,
- struct lov_stripe_md *lsm,
+ struct lov_stripe_md *lsm,
ldlm_iterator_t it, void *data)
{
int rc;
return(rc);
}
-static inline int obd_lock_contains(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct ldlm_lock *lock, obd_off offset)
-{
- int rc;
- ENTRY;
- EXP_CHECK_OP(exp, lock_contains);
- OBD_COUNTER_INCREMENT(exp->exp_obd, lock_contains);
-
- rc = OBP(exp->exp_obd, lock_contains)(exp, lsm, lock, offset);
- RETURN(rc);
+static inline void obd_import_event(struct obd_device *obd,
+ struct obd_import *imp,
+ enum obd_import_event event)
+{
+ if (obd->obd_set_up && OBP(obd, import_event)) {
+ OBD_COUNTER_INCREMENT(obd, import_event);
+ OBP(obd, import_event)(obd, imp, event);
+ }
}
-static inline void obd_invalidate_import(struct obd_device *obd,
- struct obd_import *imp)
+static inline int obd_llog_connect(struct obd_device *obd,
+ struct llogd_conn_body *body)
{
- if (obd->obd_set_up && OBP(obd, invalidate_import)) {
- OBD_COUNTER_INCREMENT(obd, invalidate_import);
- OBP(obd, invalidate_import)(obd, imp);
+ ENTRY;
+ if (!obd->obd_set_up) {
+ CERROR("obd %s not set up\n", obd->obd_name);
+ return -EINVAL;
}
+
+ if (!OBP(obd, llog_connect)) {
+ CERROR("obd %s has no llog_connect handler\n", obd->obd_name);
+ return -ENOSYS;
+ }
+
+ return OBP(obd, llog_connect)(obd, body);
}
static inline int obd_notify(struct obd_device *obd,
RETURN(0);
}
+static inline int obd_init_ea_size(struct obd_export *exp, int size, int size2)
+{
+ int rc;
+ ENTRY;
+ LASSERT(OBP(exp->exp_obd, init_ea_size) != NULL);
+ OBD_COUNTER_INCREMENT(exp->exp_obd, init_ea_size);
+ rc = OBP(exp->exp_obd, init_ea_size)(exp, size, size2);
+ RETURN(rc);
+}
+
+static inline int md_getstatus(struct obd_export *exp, struct ll_fid *fid)
+{
+ int rc;
+
+ EXP_CHECK_MD_OP(exp, getstatus);
+ MD_COUNTER_INCREMENT(exp->exp_obd, getstatus);
+ rc = MDP(exp->exp_obd, getstatus)(exp, fid);
+ RETURN(rc);
+}
+
+/* this function notifies MDC, that inode described by @fid gets removed from
+ * memory.*/
+static inline int md_delete_object(struct obd_export *exp,
+ struct ll_fid *fid)
+{
+ int rc;
+ ENTRY;
+
+ /* as this method only notifies MDC that inode gets deleted, we can
+ * return zero if method is not implemented, this means, that OBD does
+ * not need such a notification. */
+ if (MDP(exp->exp_obd, delete_object) == NULL)
+ RETURN(0);
+
+ MD_COUNTER_INCREMENT(exp->exp_obd, delete_object);
+ rc = MDP(exp->exp_obd, delete_object)(exp, fid);
+ RETURN(rc);
+}
+
+static inline int md_getattr(struct obd_export *exp, struct ll_fid *fid,
+ unsigned long valid, unsigned int ea_size,
+ struct ptlrpc_request **request)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, getattr);
+ MD_COUNTER_INCREMENT(exp->exp_obd, getattr);
+ rc = MDP(exp->exp_obd, getattr)(exp, fid, valid, ea_size, request);
+ RETURN(rc);
+}
+
+static inline int md_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
+ ldlm_iterator_t it, void *data)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, change_cbdata);
+ MD_COUNTER_INCREMENT(exp->exp_obd, change_cbdata);
+ rc = MDP(exp->exp_obd, change_cbdata)(exp, fid, it, data);
+ RETURN(rc);
+}
+
+static inline int md_change_cbdata_name(struct obd_export *exp,
+ struct ll_fid *fid, char *name,
+ int namelen, struct ll_fid *fid2,
+ ldlm_iterator_t it, void *data)
+{
+ int rc;
+
+ /* this seem to be needed only for lmv. */
+ if (!MDP(exp->exp_obd, change_cbdata_name))
+ return 0;
+
+ ENTRY;
+
+ MD_COUNTER_INCREMENT(exp->exp_obd, change_cbdata_name);
+ rc = MDP(exp->exp_obd, change_cbdata_name)(exp, fid, name, namelen,
+ fid2, it, data);
+ RETURN(rc);
+}
+
+static inline int md_close(struct obd_export *exp, struct obdo *obdo,
+ struct obd_client_handle *och,
+ struct ptlrpc_request **request)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, close);
+ MD_COUNTER_INCREMENT(exp->exp_obd, close);
+ rc = MDP(exp->exp_obd, close)(exp, obdo, och, request);
+ RETURN(rc);
+}
+
+static inline int md_create(struct obd_export *exp, struct mdc_op_data *op_data,
+ const void *data, int datalen, int mode,
+ __u32 uid, __u32 gid, __u64 rdev,
+ struct ptlrpc_request **request)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, create);
+ MD_COUNTER_INCREMENT(exp->exp_obd, create);
+ rc = MDP(exp->exp_obd, create)(exp, op_data, data, datalen, mode,
+ uid, gid, rdev, request);
+ RETURN(rc);
+}
+
+static inline int md_done_writing(struct obd_export *exp, struct obdo *obdo)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, done_writing);
+ MD_COUNTER_INCREMENT(exp->exp_obd, done_writing);
+ rc = MDP(exp->exp_obd, done_writing)(exp, obdo);
+ RETURN(rc);
+}
+
+static inline int md_enqueue(struct obd_export *exp, int lock_type,
+ struct lookup_intent *it, int lock_mode,
+ struct mdc_op_data *data,
+ struct lustre_handle *lockh,
+ void *lmm, int lmmsize,
+ ldlm_completion_callback cb_completion,
+ ldlm_blocking_callback cb_blocking,
+ void *cb_data)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, enqueue);
+ MD_COUNTER_INCREMENT(exp->exp_obd, enqueue);
+ rc = MDP(exp->exp_obd, enqueue)(exp, lock_type, it, lock_mode,
+ data, lockh, lmm, lmmsize,
+ cb_completion, cb_blocking,
+ cb_data);
+ RETURN(rc);
+}
+
+static inline int md_getattr_name(struct obd_export *exp, struct ll_fid *fid,
+ char *filename, int namelen,
+ unsigned long valid, unsigned int ea_size,
+ struct ptlrpc_request **request)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, getattr_name);
+ MD_COUNTER_INCREMENT(exp->exp_obd, getattr_name);
+ rc = MDP(exp->exp_obd, getattr_name)(exp, fid, filename, namelen,
+ valid, ea_size, request);
+ RETURN(rc);
+}
+
+static inline int md_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt,
+ struct ll_fid *pfid, const char *name,
+ int len, void *lmm, int lmmsize,
+ struct ll_fid *cfid, struct lookup_intent *it,
+ int flags, struct ptlrpc_request **reqp,
+ ldlm_blocking_callback cb_blocking)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, intent_lock);
+ MD_COUNTER_INCREMENT(exp->exp_obd, intent_lock);
+ rc = MDP(exp->exp_obd, intent_lock)(exp, uctxt, pfid, name, len,
+ lmm, lmmsize, cfid, it, flags,
+ reqp, cb_blocking);
+ RETURN(rc);
+}
+
+static inline int md_link(struct obd_export *exp, struct mdc_op_data *data,
+ struct ptlrpc_request **request)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, link);
+ MD_COUNTER_INCREMENT(exp->exp_obd, link);
+ rc = MDP(exp->exp_obd, link)(exp, data, request);
+ RETURN(rc);
+}
+
+static inline int md_rename(struct obd_export *exp, struct mdc_op_data *data,
+ const char *old, int oldlen,
+ const char *new, int newlen,
+ struct ptlrpc_request **request)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, rename);
+ MD_COUNTER_INCREMENT(exp->exp_obd, rename);
+ rc = MDP(exp->exp_obd, rename)(exp, data, old, oldlen, new,
+ newlen, request);
+ RETURN(rc);
+}
+
+static inline int md_setattr(struct obd_export *exp, struct mdc_op_data *data,
+ struct iattr *iattr, void *ea, int ealen,
+ void *ea2, int ea2len,
+ struct ptlrpc_request **request)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, setattr);
+ MD_COUNTER_INCREMENT(exp->exp_obd, setattr);
+ rc = MDP(exp->exp_obd, setattr)(exp, data, iattr, ea, ealen,
+ ea2, ea2len, request);
+ RETURN(rc);
+}
+
+static inline int md_sync(struct obd_export *exp, struct ll_fid *fid,
+ struct ptlrpc_request **request)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, sync);
+ MD_COUNTER_INCREMENT(exp->exp_obd, sync);
+ rc = MDP(exp->exp_obd, sync)(exp, fid, request);
+ RETURN(rc);
+}
+
+static inline int md_readpage(struct obd_export *exp, struct ll_fid *fid,
+ __u64 offset, struct page *page,
+ struct ptlrpc_request **request)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, readpage);
+ MD_COUNTER_INCREMENT(exp->exp_obd, readpage);
+ rc = MDP(exp->exp_obd, readpage)(exp, fid, offset, page, request);
+ RETURN(rc);
+}
+
+static inline int md_unlink(struct obd_export *exp, struct mdc_op_data *data,
+ struct ptlrpc_request **request)
+{
+ int rc;
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, unlink);
+ MD_COUNTER_INCREMENT(exp->exp_obd, unlink);
+ rc = MDP(exp->exp_obd, unlink)(exp, data, request);
+ RETURN(rc);
+}
+
+static inline struct obd_device *md_get_real_obd(struct obd_export *exp,
+ char *name, int len)
+{
+ ENTRY;
+ if (MDP(exp->exp_obd, get_real_obd) == NULL)
+ return exp->exp_obd;
+ MD_COUNTER_INCREMENT(exp->exp_obd, get_real_obd);
+ return MDP(exp->exp_obd, get_real_obd)(exp, name, len);
+}
+
+static inline int md_valid_attrs(struct obd_export *exp, struct ll_fid *fid)
+{
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, valid_attrs);
+ MD_COUNTER_INCREMENT(exp->exp_obd, valid_attrs);
+ return MDP(exp->exp_obd, valid_attrs)(exp, fid);
+}
+
+static inline int md_req2lustre_md(struct obd_export *exp,
+ struct ptlrpc_request *req,
+ unsigned int offset,
+ struct obd_export *osc_exp,
+ struct lustre_md *md)
+{
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, req2lustre_md);
+ MD_COUNTER_INCREMENT(exp->exp_obd, req2lustre_md);
+ return MDP(exp->exp_obd, req2lustre_md)(exp, req, offset, osc_exp, md);
+}
+
+static inline int md_set_open_replay_data(struct obd_export *exp,
+ struct obd_client_handle *och,
+ struct ptlrpc_request *open_req)
+{
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, set_open_replay_data);
+ MD_COUNTER_INCREMENT(exp->exp_obd, set_open_replay_data);
+ return MDP(exp->exp_obd, set_open_replay_data)(exp, och, open_req);
+}
+
+static inline int md_clear_open_replay_data(struct obd_export *exp,
+ struct obd_client_handle *och)
+{
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, clear_open_replay_data);
+ MD_COUNTER_INCREMENT(exp->exp_obd, clear_open_replay_data);
+ return MDP(exp->exp_obd, clear_open_replay_data)(exp, och);
+}
+
+static inline int md_store_inode_generation(struct obd_export *exp,
+ struct ptlrpc_request *req,
+ int reqoff, int repoff)
+{
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, store_inode_generation);
+ MD_COUNTER_INCREMENT(exp->exp_obd, store_inode_generation);
+ return MDP(exp->exp_obd, store_inode_generation)(exp, req,
+ reqoff, repoff);
+}
+
+static inline int md_set_lock_data(struct obd_export *exp, __u64 *l, void *data)
+{
+ ENTRY;
+ EXP_CHECK_MD_OP(exp, set_lock_data);
+ MD_COUNTER_INCREMENT(exp->exp_obd, set_lock_data);
+ return MDP(exp->exp_obd, set_lock_data)(exp, l, data);
+}
+
/* OBD Metadata Support */
extern int obd_init_caches(void);
extern void obd_cleanup_caches(void);
-/* async page pushing io helpers */
-struct obd_client_page *ocp_alloc(struct page *page);
-void ocp_free(struct page *page);
-
/* support routines */
extern kmem_cache_t *obdo_cachep;
static inline struct obdo *obdo_alloc(void)
void class_uuid_unparse(class_uuid_t in, struct obd_uuid *out);
/* lustre_peer.c */
-int lustre_uuid_to_peer(char *uuid, struct lustre_peer *peer);
+int lustre_uuid_to_peer(char *uuid, __u32 *peer_nal, ptl_nid_t *peer_nid);
int class_add_uuid(char *uuid, __u64 nid, __u32 nal);
int class_del_uuid (char *uuid);
void class_init_uuidlist(void);
void class_exit_uuidlist(void);
+
+/* mea.c */
+int mea_name2idx(struct mea *mea, char *name, int namelen);
+int raw_name2idx(int count, const char *name, int namelen);
+
#endif /* __LINUX_OBD_CLASS_H */