Whamcloud - gitweb
LU-2675 obd: decruft md_enqueue() and md_intent_lock()
[fs/lustre-release.git] / lustre / include / obd_class.h
index 5e5a4cd..2692599 100644 (file)
@@ -86,13 +86,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 +128,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;
@@ -340,9 +343,6 @@ 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);
-
 #define OBT(dev)        (dev)->obd_type
 #define OBP(dev, op)    (dev)->obd_type->typ_dt_ops->o_ ## op
 #define MDP(dev, op)    (dev)->obd_type->typ_md_ops->m_ ## op
@@ -728,15 +728,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)
 {
@@ -798,18 +789,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,
@@ -1064,18 +1043,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)
@@ -1178,17 +1158,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. */
@@ -1290,97 +1259,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,
@@ -1417,34 +1295,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)
 {
@@ -1458,43 +1308,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)
@@ -1523,35 +1336,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)
@@ -1897,19 +1681,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);
 }
 
@@ -1926,20 +1709,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,
@@ -2174,13 +1956,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,
@@ -2317,6 +2100,15 @@ void class_exit_uuidlist(void);
 /* 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