Whamcloud - gitweb
LU-3963 obdclass: convert to linux list api
[fs/lustre-release.git] / lustre / include / obd_class.h
index 11917f3..f9ba3d8 100644 (file)
                                          * by the request interpret routine */
 #define OBD_STATFS_FOR_MDT0    0x0008  /* The statfs is only for retrieving
                                         * information from MDT0. */
-#define OBD_FL_PUNCH    0x00000001      /* To indicate it is punch operation */
 
 /* OBD Device Declarations */
 extern struct obd_device *obd_devs[MAX_OBD_DEVICES];
+extern struct list_head obd_types;
+extern spinlock_t obd_types_lock;
 extern rwlock_t obd_dev_lock;
 
 /* OBD Operations Declarations */
@@ -86,13 +87,12 @@ struct lu_device_type;
 
 /* genops.c */
 struct obd_export *class_conn2export(struct lustre_handle *);
-int class_register_type(struct obd_ops *, struct md_ops *,
+int class_register_type(struct obd_ops *, struct md_ops *, bool enable_proc,
                        struct lprocfs_seq_vars *module_vars,
 #ifndef HAVE_ONLY_PROCFS_SEQ
                        struct lprocfs_vars *,
 #endif
-                       const char *nm,
-                       struct lu_device_type *ldt);
+                       const char *nm, struct lu_device_type *ldt);
 int class_unregister_type(const char *nm);
 
 struct obd_device *class_newdev(const char *type_name, const char *name);
@@ -129,6 +129,10 @@ struct kuc_hdr * kuc_ptr(void *p);
 int kuc_ispayload(void *p);
 void *kuc_alloc(int payload_len, int transport, int type);
 void kuc_free(void *p, int payload_len);
+int obd_get_request_slot(struct client_obd *cli);
+void obd_put_request_slot(struct client_obd *cli);
+__u32 obd_get_max_rpcs_in_flight(struct client_obd *cli);
+int obd_set_max_rpcs_in_flight(struct client_obd *cli, __u32 max);
 
 struct llog_handle;
 struct llog_rec_hdr;
@@ -167,13 +171,14 @@ int class_add_uuid(const char *uuid, __u64 nid);
 
 /* Passed as data param to class_config_parse_llog */
 struct config_llog_instance {
-        char               *cfg_obdname;
-        void               *cfg_instance;
-        struct super_block *cfg_sb;
-        struct obd_uuid     cfg_uuid;
-       llog_cb_t           cfg_callback;
-        int                 cfg_last_idx; /* for partial llog processing */
-        int                 cfg_flags;
+       char                    *cfg_obdname;
+       void                    *cfg_instance;
+       struct super_block      *cfg_sb;
+       struct obd_uuid          cfg_uuid;
+       llog_cb_t                cfg_callback;
+       int                      cfg_last_idx; /* for partial llog processing */
+       int                      cfg_flags;
+       __u32                    cfg_lwp_idx;
 };
 int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt,
                            char *name, struct config_llog_instance *cfg);
@@ -195,7 +200,7 @@ enum {
 struct config_llog_data {
         struct ldlm_res_id          cld_resid;
         struct config_llog_instance cld_cfg;
-        cfs_list_t                  cld_list_chain;
+       struct list_head            cld_list_chain;
        atomic_t                    cld_refcount;
        struct config_llog_data    *cld_sptlrpc;/* depended sptlrpc log */
        struct config_llog_data    *cld_params; /* common parameters log */
@@ -210,10 +215,10 @@ struct config_llog_data {
 };
 
 struct lustre_profile {
-        cfs_list_t       lp_list;
-        char            *lp_profile;
-        char            *lp_dt;
-        char            *lp_md;
+       struct list_head         lp_list;
+       char                    *lp_profile;
+       char                    *lp_dt;
+       char                    *lp_md;
 };
 
 struct lustre_profile *class_get_profile(const char * prof);
@@ -330,17 +335,10 @@ static inline struct lr_server_data *class_server_data(struct obd_device *obd)
 }
 #endif
 
-void obdo_cpy_md(struct obdo *dst, struct obdo *src, obd_flag valid);
-void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj);
-void obdo_from_iattr(struct obdo *oa, struct iattr *attr,
-                     unsigned int ia_valid);
-void iattr_from_obdo(struct iattr *attr, struct obdo *oa, obd_flag valid);
-void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, obd_flag valid);
-void obdo_from_md(struct obdo *oa, struct md_op_data *op_data,
-                  unsigned int valid);
-
-void obdo_cpu_to_le(struct obdo *dobdo, struct obdo *sobdo);
-void obdo_le_to_cpu(struct obdo *dobdo, struct obdo *sobdo);
+void obdo_cpy_md(struct obdo *dst, const struct obdo *src, obd_flag valid);
+void obdo_to_ioobj(const struct obdo *oa, struct obd_ioobj *ioobj);
+void md_from_obdo(struct md_op_data *op_data, const struct obdo *oa,
+                 obd_flag valid);
 
 #define OBT(dev)        (dev)->obd_type
 #define OBP(dev, op)    (dev)->obd_type->typ_dt_ops->o_ ## op
@@ -727,15 +725,6 @@ static inline int obd_size_diskmd(struct obd_export *exp,
         return obd_packmd(exp, NULL, mem_src);
 }
 
-/* helper functions */
-static inline int obd_alloc_diskmd(struct obd_export *exp,
-                                   struct lov_mds_md **disk_tgt)
-{
-        LASSERT(disk_tgt);
-        LASSERT(*disk_tgt == NULL);
-        return obd_packmd(exp, disk_tgt, NULL);
-}
-
 static inline int obd_free_diskmd(struct obd_export *exp,
                                  struct lov_mds_md **disk_tgt)
 {
@@ -797,33 +786,6 @@ static inline int obd_free_memmd(struct obd_export *exp,
         return rc;
 }
 
-static inline int obd_precreate(struct obd_export *exp)
-{
-        int rc;
-        ENTRY;
-
-        EXP_CHECK_DT_OP(exp, precreate);
-        OBD_COUNTER_INCREMENT(exp->exp_obd, precreate);
-
-        rc = OBP(exp->exp_obd, precreate)(exp);
-        RETURN(rc);
-}
-
-static inline int obd_create_async(struct obd_export *exp,
-                                   struct obd_info *oinfo,
-                                   struct lov_stripe_md **ea,
-                                   struct obd_trans_info *oti)
-{
-        int rc;
-        ENTRY;
-
-        EXP_CHECK_DT_OP(exp, create_async);
-        EXP_COUNTER_INCREMENT(exp, create_async);
-
-        rc = OBP(exp->exp_obd, create_async)(exp, oinfo, ea, oti);
-        RETURN(rc);
-}
-
 static inline int obd_create(const struct lu_env *env, struct obd_export *exp,
                              struct obdo *obdo, struct lov_stripe_md **ea,
                              struct obd_trans_info *oti)
@@ -1063,18 +1025,19 @@ static inline int obd_fid_fini(struct obd_device *obd)
        RETURN(rc);
 }
 
-static inline int obd_fid_alloc(struct obd_export *exp,
+static inline int obd_fid_alloc(const struct lu_env *env,
+                               struct obd_export *exp,
                                 struct lu_fid *fid,
                                 struct md_op_data *op_data)
 {
-        int rc;
-        ENTRY;
+       int rc;
+       ENTRY;
 
-        EXP_CHECK_DT_OP(exp, fid_alloc);
-        EXP_COUNTER_INCREMENT(exp, fid_alloc);
+       EXP_CHECK_DT_OP(exp, fid_alloc);
+       EXP_COUNTER_INCREMENT(exp, fid_alloc);
 
-        rc = OBP(exp->exp_obd, fid_alloc)(exp, fid, op_data);
-        RETURN(rc);
+       rc = OBP(exp->exp_obd, fid_alloc)(env, exp, fid, op_data);
+       RETURN(rc);
 }
 
 static inline int obd_ping(const struct lu_env *env, struct obd_export *exp)
@@ -1177,17 +1140,6 @@ static inline int obd_destroy_export(struct obd_export *exp)
         RETURN(0);
 }
 
-static inline int obd_extent_calc(struct obd_export *exp,
-                                  struct lov_stripe_md *md,
-                                  int cmd, obd_off *offset)
-{
-        int rc;
-        ENTRY;
-        EXP_CHECK_DT_OP(exp, extent_calc);
-        rc = OBP(exp->exp_obd, extent_calc)(exp, md, cmd, offset);
-        RETURN(rc);
-}
-
 /* @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 "cfs_time_current() + HZ" to guarantee freshness. */
@@ -1289,97 +1241,6 @@ static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp,
        RETURN(rc);
 }
 
-static inline int obd_sync_rqset(struct obd_export *exp, struct obd_info *oinfo,
-                                 obd_size start, obd_size end)
-{
-        struct ptlrpc_request_set *set = NULL;
-        int rc;
-        ENTRY;
-
-        OBD_CHECK_DT_OP(exp->exp_obd, sync, -EOPNOTSUPP);
-        EXP_COUNTER_INCREMENT(exp, sync);
-
-        set =  ptlrpc_prep_set();
-        if (set == NULL)
-                RETURN(-ENOMEM);
-
-        rc = OBP(exp->exp_obd, sync)(NULL, exp, oinfo, start, end, set);
-        if (rc == 0)
-                rc = ptlrpc_set_wait(set);
-        ptlrpc_set_destroy(set);
-        RETURN(rc);
-}
-
-static inline int obd_sync(const struct lu_env *env, struct obd_export *exp,
-                           struct obd_info *oinfo, obd_size start, obd_size end,
-                           struct ptlrpc_request_set *set)
-{
-        int rc;
-        ENTRY;
-
-        OBD_CHECK_DT_OP(exp->exp_obd, sync, -EOPNOTSUPP);
-        EXP_COUNTER_INCREMENT(exp, sync);
-
-        rc = OBP(exp->exp_obd, sync)(env, exp, oinfo, start, end, set);
-        RETURN(rc);
-}
-
-static inline int obd_punch_rqset(struct obd_export *exp,
-                                  struct obd_info *oinfo,
-                                  struct obd_trans_info *oti)
-{
-        struct ptlrpc_request_set *set = NULL;
-        int rc;
-        ENTRY;
-
-        EXP_CHECK_DT_OP(exp, punch);
-        EXP_COUNTER_INCREMENT(exp, punch);
-
-        set =  ptlrpc_prep_set();
-        if (set == NULL)
-                RETURN(-ENOMEM);
-
-        rc = OBP(exp->exp_obd, punch)(NULL, exp, oinfo, oti, set);
-        if (rc == 0)
-                rc = ptlrpc_set_wait(set);
-        ptlrpc_set_destroy(set);
-        RETURN(rc);
-}
-
-static inline int obd_punch(const struct lu_env *env, struct obd_export *exp,
-                            struct obd_info *oinfo, struct obd_trans_info *oti,
-                            struct ptlrpc_request_set *rqset)
-{
-        int rc;
-        ENTRY;
-
-        EXP_CHECK_DT_OP(exp, punch);
-        EXP_COUNTER_INCREMENT(exp, punch);
-
-        rc = OBP(exp->exp_obd, punch)(env, exp, oinfo, oti, rqset);
-        RETURN(rc);
-}
-
-static inline int obd_brw(int cmd, struct obd_export *exp,
-                          struct obd_info *oinfo, obd_count oa_bufs,
-                          struct brw_page *pg, struct obd_trans_info *oti)
-{
-        int rc;
-        ENTRY;
-
-        EXP_CHECK_DT_OP(exp, brw);
-        EXP_COUNTER_INCREMENT(exp, brw);
-
-        if (!(cmd & (OBD_BRW_RWMASK | OBD_BRW_CHECK))) {
-                CERROR("obd_brw: cmd must be OBD_BRW_READ, OBD_BRW_WRITE, "
-                       "or OBD_BRW_CHECK\n");
-                LBUG();
-        }
-
-        rc = OBP(exp->exp_obd, brw)(cmd, exp, oinfo, oa_bufs, pg, oti);
-        RETURN(rc);
-}
-
 static inline int obd_preprw(const struct lu_env *env, int cmd,
                              struct obd_export *exp, struct obdo *oa,
                              int objcount, struct obd_ioobj *obj,
@@ -1416,34 +1277,6 @@ static inline int obd_commitrw(const struct lu_env *env, int cmd,
         RETURN(rc);
 }
 
-static inline int obd_merge_lvb(struct obd_export *exp,
-                                struct lov_stripe_md *lsm,
-                                struct ost_lvb *lvb, int kms_only)
-{
-        int rc;
-        ENTRY;
-
-        EXP_CHECK_DT_OP(exp, merge_lvb);
-        EXP_COUNTER_INCREMENT(exp, merge_lvb);
-
-        rc = OBP(exp->exp_obd, merge_lvb)(exp, lsm, lvb, kms_only);
-        RETURN(rc);
-}
-
-static inline int obd_adjust_kms(struct obd_export *exp,
-                                 struct lov_stripe_md *lsm, obd_off size,
-                                 int shrink)
-{
-        int rc;
-        ENTRY;
-
-        EXP_CHECK_DT_OP(exp, adjust_kms);
-        EXP_COUNTER_INCREMENT(exp, adjust_kms);
-
-        rc = OBP(exp->exp_obd, adjust_kms)(exp, lsm, size, shrink);
-        RETURN(rc);
-}
-
 static inline int obd_iocontrol(unsigned int cmd, struct obd_export *exp,
                                 int len, void *karg, void *uarg)
 {
@@ -1457,43 +1290,6 @@ static inline int obd_iocontrol(unsigned int cmd, struct obd_export *exp,
         RETURN(rc);
 }
 
-static inline int obd_enqueue_rqset(struct obd_export *exp,
-                                    struct obd_info *oinfo,
-                                    struct ldlm_enqueue_info *einfo)
-{
-        struct ptlrpc_request_set *set = NULL;
-        int rc;
-        ENTRY;
-
-        EXP_CHECK_DT_OP(exp, enqueue);
-        EXP_COUNTER_INCREMENT(exp, enqueue);
-
-        set =  ptlrpc_prep_set();
-        if (set == NULL)
-                RETURN(-ENOMEM);
-
-        rc = OBP(exp->exp_obd, enqueue)(exp, oinfo, einfo, set);
-        if (rc == 0)
-                rc = ptlrpc_set_wait(set);
-        ptlrpc_set_destroy(set);
-        RETURN(rc);
-}
-
-static inline int obd_enqueue(struct obd_export *exp,
-                              struct obd_info *oinfo,
-                              struct ldlm_enqueue_info *einfo,
-                              struct ptlrpc_request_set *set)
-{
-        int rc;
-        ENTRY;
-
-        EXP_CHECK_DT_OP(exp, enqueue);
-        EXP_COUNTER_INCREMENT(exp, enqueue);
-
-        rc = OBP(exp->exp_obd, enqueue)(exp, oinfo, einfo, set);
-        RETURN(rc);
-}
-
 static inline int obd_change_cbdata(struct obd_export *exp,
                                     struct lov_stripe_md *lsm,
                                     ldlm_iterator_t it, void *data)
@@ -1522,63 +1318,6 @@ static inline int obd_find_cbdata(struct obd_export *exp,
         RETURN(rc);
 }
 
-static inline int obd_cancel(struct obd_export *exp,
-                             struct lov_stripe_md *ea, __u32 mode,
-                             struct lustre_handle *lockh)
-{
-        int rc;
-        ENTRY;
-
-        EXP_CHECK_DT_OP(exp, cancel);
-        EXP_COUNTER_INCREMENT(exp, cancel);
-
-        rc = OBP(exp->exp_obd, cancel)(exp, ea, mode, lockh);
-        RETURN(rc);
-}
-
-static inline int obd_cancel_unused(struct obd_export *exp,
-                                    struct lov_stripe_md *ea,
-                                    ldlm_cancel_flags_t flags,
-                                    void *opaque)
-{
-        int rc;
-        ENTRY;
-
-        EXP_CHECK_DT_OP(exp, cancel_unused);
-        EXP_COUNTER_INCREMENT(exp, cancel_unused);
-
-        rc = OBP(exp->exp_obd, cancel_unused)(exp, ea, flags, opaque);
-        RETURN(rc);
-}
-
-static inline int obd_pin(struct obd_export *exp, const struct lu_fid *fid,
-                          struct obd_capa *oc, struct obd_client_handle *handle,
-                          int flag)
-{
-        int rc;
-        ENTRY;
-
-        EXP_CHECK_DT_OP(exp, pin);
-        EXP_COUNTER_INCREMENT(exp, pin);
-
-        rc = OBP(exp->exp_obd, pin)(exp, fid, oc, handle, flag);
-        RETURN(rc);
-}
-
-static inline int obd_unpin(struct obd_export *exp,
-                            struct obd_client_handle *handle, int flag)
-{
-        int rc;
-        ENTRY;
-
-        EXP_CHECK_DT_OP(exp, unpin);
-        EXP_COUNTER_INCREMENT(exp, unpin);
-
-        rc = OBP(exp->exp_obd, unpin)(exp, handle, flag);
-        RETURN(rc);
-}
-
-
 static inline void obd_import_event(struct obd_device *obd,
                                     struct obd_import *imp,
                                     enum obd_import_event event)
@@ -1596,20 +1335,6 @@ static inline void obd_import_event(struct obd_device *obd,
         EXIT;
 }
 
-static inline int obd_llog_connect(struct obd_export *exp,
-                                   struct llogd_conn_body *body)
-{
-        int rc;
-        ENTRY;
-
-        OBD_CHECK_DT_OP(exp->exp_obd, llog_connect, 0);
-        EXP_COUNTER_INCREMENT(exp, llog_connect);
-
-        rc = OBP(exp->exp_obd, llog_connect)(exp, body);
-        RETURN(rc);
-}
-
-
 static inline int obd_notify(struct obd_device *obd,
                              struct obd_device *watched,
                              enum obd_notify_event ev,
@@ -1619,11 +1344,7 @@ static inline int obd_notify(struct obd_device *obd,
         ENTRY;
         OBD_CHECK_DEV(obd);
 
-        /* the check for async_recov is a complete hack - I'm hereby
-           overloading the meaning to also mean "this was called from
-           mds_postsetup".  I know that my mds is able to handle notifies
-           by this point, and it needs to get them to execute mds_postrecov. */
-        if (!obd->obd_set_up && !obd->obd_async_recov) {
+       if (!obd->obd_set_up) {
                 CDEBUG(D_HA, "obd %s not set up\n", obd->obd_name);
                 RETURN(-EINVAL);
         }
@@ -1733,82 +1454,6 @@ static inline int obd_register_observer(struct obd_device *obd,
         RETURN(0);
 }
 
-static inline int obd_pin_observer(struct obd_device *obd,
-                                   struct obd_device **observer)
-{
-        ENTRY;
-       down_read(&obd->obd_observer_link_sem);
-        if (!obd->obd_observer) {
-                *observer = NULL;
-               up_read(&obd->obd_observer_link_sem);
-                RETURN(-ENOENT);
-        }
-        *observer = obd->obd_observer;
-        RETURN(0);
-}
-
-static inline int obd_unpin_observer(struct obd_device *obd)
-{
-        ENTRY;
-       up_read(&obd->obd_observer_link_sem);
-        RETURN(0);
-}
-
-#if 0
-static inline int obd_register_page_removal_cb(struct obd_export *exp,
-                                               obd_page_removal_cb_t cb,
-                                               obd_pin_extent_cb pin_cb)
-{
-        int rc;
-        ENTRY;
-
-        OBD_CHECK_DT_OP(exp->exp_obd, register_page_removal_cb, 0);
-        OBD_COUNTER_INCREMENT(exp->exp_obd, register_page_removal_cb);
-
-        rc = OBP(exp->exp_obd, register_page_removal_cb)(exp, cb, pin_cb);
-        RETURN(rc);
-}
-
-static inline int obd_unregister_page_removal_cb(struct obd_export *exp,
-                                                 obd_page_removal_cb_t cb)
-{
-        int rc;
-        ENTRY;
-
-        OBD_CHECK_DT_OP(exp->exp_obd, unregister_page_removal_cb, 0);
-        OBD_COUNTER_INCREMENT(exp->exp_obd, unregister_page_removal_cb);
-
-        rc = OBP(exp->exp_obd, unregister_page_removal_cb)(exp, cb);
-        RETURN(rc);
-}
-
-static inline int obd_register_lock_cancel_cb(struct obd_export *exp,
-                                              obd_lock_cancel_cb cb)
-{
-        int rc;
-        ENTRY;
-
-        OBD_CHECK_DT_OP(exp->exp_obd, register_lock_cancel_cb, 0);
-        OBD_COUNTER_INCREMENT(exp->exp_obd, register_lock_cancel_cb);
-
-        rc = OBP(exp->exp_obd, register_lock_cancel_cb)(exp, cb);
-        RETURN(rc);
-}
-
-static inline int obd_unregister_lock_cancel_cb(struct obd_export *exp,
-                                                 obd_lock_cancel_cb cb)
-{
-        int rc;
-        ENTRY;
-
-        OBD_CHECK_DT_OP(exp->exp_obd, unregister_lock_cancel_cb, 0);
-        OBD_COUNTER_INCREMENT(exp->exp_obd, unregister_lock_cancel_cb);
-
-        rc = OBP(exp->exp_obd, unregister_lock_cancel_cb)(exp, cb);
-        RETURN(rc);
-}
-#endif
-
 /* metadata helpers */
 static inline int md_getstatus(struct obd_export *exp,
                                struct lu_fid *fid, struct obd_capa **pc)
@@ -1896,19 +1541,18 @@ static inline int md_done_writing(struct obd_export *exp,
 
 static inline int md_enqueue(struct obd_export *exp,
                             struct ldlm_enqueue_info *einfo,
+                            const union ldlm_policy_data *policy,
                             struct lookup_intent *it,
                             struct md_op_data *op_data,
                             struct lustre_handle *lockh,
-                            void *lmm, int lmmsize,
-                            struct ptlrpc_request **req,
                             __u64 extra_lock_flags)
 {
-        int rc;
-        ENTRY;
-        EXP_CHECK_MD_OP(exp, enqueue);
-        EXP_MD_COUNTER_INCREMENT(exp, enqueue);
-        rc = MDP(exp->exp_obd, enqueue)(exp, einfo, it, op_data, lockh,
-                                        lmm, lmmsize, req, extra_lock_flags);
+       int rc;
+       ENTRY;
+       EXP_CHECK_MD_OP(exp, enqueue);
+       EXP_MD_COUNTER_INCREMENT(exp, enqueue);
+       rc = MDP(exp->exp_obd, enqueue)(exp, einfo, policy, it, op_data, lockh,
+                                       extra_lock_flags);
         RETURN(rc);
 }
 
@@ -1925,20 +1569,19 @@ static inline int md_getattr_name(struct obd_export *exp,
 }
 
 static inline int md_intent_lock(struct obd_export *exp,
-                                struct md_op_data *op_data, void *lmm,
-                                int lmmsize, struct lookup_intent *it,
-                                int lookup_flags, struct ptlrpc_request **reqp,
+                                struct md_op_data *op_data,
+                                struct lookup_intent *it,
+                                struct ptlrpc_request **reqp,
                                 ldlm_blocking_callback cb_blocking,
                                 __u64 extra_lock_flags)
 {
-        int rc;
-        ENTRY;
-        EXP_CHECK_MD_OP(exp, intent_lock);
-        EXP_MD_COUNTER_INCREMENT(exp, intent_lock);
-        rc = MDP(exp->exp_obd, intent_lock)(exp, op_data, lmm, lmmsize,
-                                            it, lookup_flags, reqp, cb_blocking,
-                                            extra_lock_flags);
-        RETURN(rc);
+       int rc;
+       ENTRY;
+       EXP_CHECK_MD_OP(exp, intent_lock);
+       EXP_MD_COUNTER_INCREMENT(exp, intent_lock);
+       rc = MDP(exp->exp_obd, intent_lock)(exp, op_data, it, reqp, cb_blocking,
+                                           extra_lock_flags);
+       RETURN(rc);
 }
 
 static inline int md_link(struct obd_export *exp, struct md_op_data *op_data,
@@ -1965,19 +1608,6 @@ static inline int md_rename(struct obd_export *exp, struct md_op_data *op_data,
         RETURN(rc);
 }
 
-static inline int md_is_subdir(struct obd_export *exp,
-                               const struct lu_fid *pfid,
-                               const struct lu_fid *cfid,
-                               struct ptlrpc_request **request)
-{
-        int rc;
-        ENTRY;
-        EXP_CHECK_MD_OP(exp, is_subdir);
-        EXP_MD_COUNTER_INCREMENT(exp, is_subdir);
-        rc = MDP(exp->exp_obd, is_subdir)(exp, pfid, cfid, request);
-        RETURN(rc);
-}
-
 static inline int md_setattr(struct obd_export *exp, struct md_op_data *op_data,
                              void *ea, int ealen, void *ea2, int ea2len,
                              struct ptlrpc_request **request,
@@ -2003,29 +1633,18 @@ static inline int md_fsync(struct obd_export *exp, const struct lu_fid *fid,
        RETURN(rc);
 }
 
-static inline int md_readpage(struct obd_export *exp, struct md_op_data *opdata,
-                              struct page **pages,
-                              struct ptlrpc_request **request)
-{
-        int rc;
-        ENTRY;
-        EXP_CHECK_MD_OP(exp, readpage);
-        EXP_MD_COUNTER_INCREMENT(exp, readpage);
-        rc = MDP(exp->exp_obd, readpage)(exp, opdata, pages, request);
-        RETURN(rc);
-}
-
-static inline int md_read_entry(struct obd_export *exp,
-                               struct md_op_data *op_data,
-                               struct md_callback *cb_op,
-                               struct lu_dirent **ld,
-                               struct page **ppage)
+static inline int md_read_page(struct obd_export *exp,
+                              struct md_op_data *op_data,
+                              struct md_callback *cb_op,
+                              __u64  hash_offset,
+                              struct page **ppage)
 {
        int rc;
        ENTRY;
-       EXP_CHECK_MD_OP(exp, read_entry);
-       EXP_MD_COUNTER_INCREMENT(exp, read_entry);
-       rc = MDP(exp->exp_obd, read_entry)(exp, op_data, cb_op, ld, ppage);
+       EXP_CHECK_MD_OP(exp, read_page);
+       EXP_MD_COUNTER_INCREMENT(exp, read_page);
+       rc = MDP(exp->exp_obd, read_page)(exp, op_data, cb_op, hash_offset,
+                                         ppage);
        RETURN(rc);
 }
 
@@ -2061,6 +1680,27 @@ static inline int md_free_lustre_md(struct obd_export *exp,
         RETURN(MDP(exp->exp_obd, free_lustre_md)(exp, md));
 }
 
+static inline int md_update_lsm_md(struct obd_export *exp,
+                                  struct lmv_stripe_md *lsm,
+                                  struct mdt_body *body,
+                                  ldlm_blocking_callback cb)
+{
+       ENTRY;
+       EXP_CHECK_MD_OP(exp, update_lsm_md);
+       EXP_MD_COUNTER_INCREMENT(exp, update_lsm_md);
+       RETURN(MDP(exp->exp_obd, update_lsm_md)(exp, lsm, body, cb));
+}
+
+static inline int md_merge_attr(struct obd_export *exp,
+                               const struct lmv_stripe_md *lsm,
+                               struct cl_attr *attr)
+{
+       ENTRY;
+       EXP_CHECK_MD_OP(exp, merge_attr);
+       EXP_MD_COUNTER_INCREMENT(exp, merge_attr);
+       RETURN(MDP(exp->exp_obd, merge_attr)(exp, lsm, attr));
+}
+
 static inline int md_setxattr(struct obd_export *exp,
                               const struct lu_fid *fid, struct obd_capa *oc,
                               obd_valid valid, const char *name,
@@ -2152,13 +1792,14 @@ static inline ldlm_mode_t md_lock_match(struct obd_export *exp, __u64 flags,
 }
 
 static inline int md_init_ea_size(struct obd_export *exp, int easize,
-                                  int def_asize, int cookiesize)
+                                 int def_asize, int cookiesize,
+                                 int def_cookiesize)
 {
-        ENTRY;
-        EXP_CHECK_MD_OP(exp, init_ea_size);
-        EXP_MD_COUNTER_INCREMENT(exp, init_ea_size);
-        RETURN(MDP(exp->exp_obd, init_ea_size)(exp, easize, def_asize,
-                                               cookiesize));
+       ENTRY;
+       EXP_CHECK_MD_OP(exp, init_ea_size);
+       EXP_MD_COUNTER_INCREMENT(exp, init_ea_size);
+       RETURN(MDP(exp->exp_obd, init_ea_size)(exp, easize, def_asize,
+                                              cookiesize, def_cookiesize));
 }
 
 static inline int md_get_remote_perm(struct obd_export *exp,
@@ -2221,6 +1862,18 @@ static inline int md_revalidate_lock(struct obd_export *exp,
         RETURN(rc);
 }
 
+static inline int md_get_fid_from_lsm(struct obd_export *exp,
+                                     const struct lmv_stripe_md *lsm,
+                                     const char *name, int namelen,
+                                     struct lu_fid *fid)
+{
+       int rc;
+       ENTRY;
+       EXP_CHECK_MD_OP(exp, get_fid_from_lsm);
+       EXP_MD_COUNTER_INCREMENT(exp, get_fid_from_lsm);
+       rc = MDP(exp->exp_obd, get_fid_from_lsm)(exp, lsm, name, namelen, fid);
+       RETURN(rc);
+}
 
 /* OBD Metadata Support */
 
@@ -2232,7 +1885,7 @@ extern struct kmem_cache *obdo_cachep;
 
 #define OBDO_ALLOC(ptr)                                                       \
 do {                                                                          \
-       OBD_SLAB_ALLOC_PTR_GFP((ptr), obdo_cachep, __GFP_IO);             \
+       OBD_SLAB_ALLOC_PTR_GFP((ptr), obdo_cachep, GFP_NOFS);             \
 } while(0)
 
 #define OBDO_FREE(ptr)                                                        \
@@ -2241,23 +1894,13 @@ do {                                                                          \
 } while(0)
 
 
-static inline void obdo2fid(struct obdo *oa, struct lu_fid *fid)
-{
-        /* something here */
-}
-
-static inline void fid2obdo(struct lu_fid *fid, struct obdo *oa)
-{
-        /* something here */
-}
-
 typedef int (*register_lwp_cb)(void *data);
 
 struct lwp_register_item {
        struct obd_export **lri_exp;
        register_lwp_cb     lri_cb_func;
        void               *lri_cb_data;
-       cfs_list_t          lri_list;
+       struct list_head            lri_list;
        char                lri_name[MTI_NAME_MAXLEN];
 };
 
@@ -2272,7 +1915,8 @@ extern int (*ptlrpc_put_connection_superhack)(struct ptlrpc_connection *c);
 int lustre_register_lwp_item(const char *lwpname, struct obd_export **exp,
                             register_lwp_cb cb_func, void *cb_data);
 void lustre_deregister_lwp_item(struct obd_export **exp);
-int tgt_name2lwpname(const char *tgt_name, char *lwp_name);
+struct obd_export *lustre_find_lwp_by_index(const char *dev, __u32 idx);
+int tgt_name2lwp_name(const char *tgt_name, char *lwp_name, int len, __u32 idx);
 #endif /* HAVE_SERVER_SUPPORT */
 
 /* sysctl.c */
@@ -2291,11 +1935,22 @@ int class_check_uuid(struct obd_uuid *uuid, __u64 nid);
 void class_init_uuidlist(void);
 void class_exit_uuidlist(void);
 
-/* mea.c */
-int mea_name2idx(struct lmv_stripe_md *mea, const char *name, int namelen);
-int raw_name2idx(int hashtype, int count, const char *name, int namelen);
-
 /* prng.c */
 #define ll_generate_random_uuid(uuid_out) cfs_get_random_bytes(uuid_out, sizeof(class_uuid_t))
 
+/* root squash info */
+struct rw_semaphore;
+struct root_squash_info {
+       uid_t                   rsi_uid;
+       gid_t                   rsi_gid;
+       struct list_head        rsi_nosquash_nids;
+       struct rw_semaphore     rsi_sem;
+};
+
+#ifdef __KERNEL__
+int server_name2index(const char *svname, __u32 *idx, const char **endptr);
+#else
+# define server_name2index(name, idx, ptr)     do {} while (0)
+#endif
+
 #endif /* __LINUX_OBD_CLASS_H */