Whamcloud - gitweb
LU-13004 ptlrpc: Allow BULK_BUF_KIOV to accept a kvec
[fs/lustre-release.git] / lustre / ptlrpc / ptlrpc_internal.h
index dffe43c..19d0487 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2014, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -55,6 +51,7 @@ extern struct ptlrpc_nrs_pol_conf nrs_conf_crrn;
 extern struct ptlrpc_nrs_pol_conf nrs_conf_orr;
 extern struct ptlrpc_nrs_pol_conf nrs_conf_trr;
 extern struct ptlrpc_nrs_pol_conf nrs_conf_tbf;
+extern struct ptlrpc_nrs_pol_conf nrs_conf_delay;
 #endif /* HAVE_SERVER_SUPPORT */
 
 /**
@@ -68,18 +65,30 @@ extern struct mutex pinger_mutex;
 
 int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait);
 /* ptlrpcd.c */
-int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc);
+int ptlrpcd_start(struct ptlrpcd_ctl *pc);
 
 /* client.c */
 void ptlrpc_at_adj_net_latency(struct ptlrpc_request *req,
                               unsigned int service_time);
 struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned npages, unsigned max_brw,
-                                        unsigned type, unsigned portal);
+                                        enum ptlrpc_bulk_op_type type,
+                                        unsigned portal,
+                                        const struct ptlrpc_bulk_frag_ops
+                                               *ops);
 int ptlrpc_request_cache_init(void);
 void ptlrpc_request_cache_fini(void);
 struct ptlrpc_request *ptlrpc_request_cache_alloc(gfp_t flags);
 void ptlrpc_request_cache_free(struct ptlrpc_request *req);
 void ptlrpc_init_xid(void);
+void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc,
+                           struct ptlrpc_request *req);
+int ptlrpc_expired_set(void *data);
+time64_t ptlrpc_set_next_timeout(struct ptlrpc_request_set *);
+void ptlrpc_resend_req(struct ptlrpc_request *request);
+void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req);
+void ptlrpc_assign_next_xid_nolock(struct ptlrpc_request *req);
+__u64 ptlrpc_known_replied_xid(struct obd_import *imp);
+void ptlrpc_add_unreplied(struct ptlrpc_request *req);
 
 /* events.c */
 int ptlrpc_init_portals(void);
@@ -88,7 +97,8 @@ void ptlrpc_exit_portals(void);
 void ptlrpc_request_handle_notconn(struct ptlrpc_request *);
 void lustre_assert_wire_constants(void);
 int ptlrpc_import_in_recovery(struct obd_import *imp);
-int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt);
+int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt,
+                            bool invalid);
 void ptlrpc_handle_failed_import(struct obd_import *imp);
 int ptlrpc_replay_next(struct obd_import *imp, int *inflight);
 void ptlrpc_initiate_recovery(struct obd_import *imp);
@@ -96,19 +106,22 @@ void ptlrpc_initiate_recovery(struct obd_import *imp);
 int lustre_unpack_req_ptlrpc_body(struct ptlrpc_request *req, int offset);
 int lustre_unpack_rep_ptlrpc_body(struct ptlrpc_request *req, int offset);
 
-#ifdef LPROCFS
-void ptlrpc_lprocfs_register_service(struct proc_dir_entry *proc_entry,
-                                     struct ptlrpc_service *svc);
+int ptlrpc_sysfs_register_service(struct kset *parent,
+                                 struct ptlrpc_service *svc);
+void ptlrpc_sysfs_unregister_service(struct ptlrpc_service *svc);
+
+void ptlrpc_ldebugfs_register_service(struct dentry *debugfs_entry,
+                                     struct ptlrpc_service *svc);
+#ifdef CONFIG_PROC_FS
 void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc);
 void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req, long amount);
 void ptlrpc_lprocfs_do_request_stat (struct ptlrpc_request *req,
                                      long q_usec, long work_usec);
 #else
-#define ptlrpc_lprocfs_register_service(params...) do{}while(0)
 #define ptlrpc_lprocfs_unregister_service(params...) do{}while(0)
 #define ptlrpc_lprocfs_rpc_sent(params...) do{}while(0)
 #define ptlrpc_lprocfs_do_request_stat(params...) do{}while(0)
-#endif /* LPROCFS */
+#endif /* CONFIG_PROC_FS */
 
 /* NRS */
 
@@ -249,10 +262,8 @@ struct ptlrpc_nrs_policy *nrs_request_policy(struct ptlrpc_nrs_request *nrq)
 int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink);
 
 /* pers.c */
-void ptlrpc_fill_bulk_md(lnet_md_t *md, struct ptlrpc_bulk_desc *desc,
+void ptlrpc_fill_bulk_md(struct lnet_md *md, struct ptlrpc_bulk_desc *desc,
                         int mdcnt);
-void ptlrpc_add_bulk_page(struct ptlrpc_bulk_desc *desc, struct page *page,
-                         int pageoffset, int len);
 
 /* pack_generic.c */
 struct ptlrpc_reply_state *
@@ -298,15 +309,15 @@ void sptlrpc_conf_choose_flavor(enum lustre_sec_part from,
 int  sptlrpc_conf_init(void);
 void sptlrpc_conf_fini(void);
 
-struct dentry;
-struct vfsmount;
-int lustre_rename(struct dentry *dir, struct vfsmount *mnt, char *old_name,
-                 char *new_name);
-
 /* sec.c */
 int  sptlrpc_init(void);
 void sptlrpc_fini(void);
 
+/* layout.c */
+__u32 __req_capsule_offset(const struct req_capsule *pill,
+                          const struct req_msg_field *field,
+                          enum req_location loc);
+
 static inline bool ptlrpc_recoverable_error(int rc)
 {
        return (rc == -ENOTCONN || rc == -ENODEV);
@@ -349,6 +360,7 @@ static inline void ptlrpc_reqset_put(struct ptlrpc_request_set *set)
 static inline void ptlrpc_req_comm_init(struct ptlrpc_request *req)
 {
        spin_lock_init(&req->rq_lock);
+       spin_lock_init(&req->rq_early_free_lock);
        atomic_set(&req->rq_refcount, 1);
        INIT_LIST_HEAD(&req->rq_list);
        INIT_LIST_HEAD(&req->rq_replay_list);
@@ -366,6 +378,7 @@ static inline void ptlrpc_cli_req_init(struct ptlrpc_request *req)
 
        INIT_LIST_HEAD(&cr->cr_set_chain);
        INIT_LIST_HEAD(&cr->cr_ctx_chain);
+       INIT_LIST_HEAD(&cr->cr_unreplied_list);
        init_waitqueue_head(&cr->cr_reply_waitq);
        init_waitqueue_head(&cr->cr_set_waitq);
 }
@@ -382,4 +395,24 @@ static inline void ptlrpc_srv_req_init(struct ptlrpc_request *req)
        INIT_LIST_HEAD(&sr->sr_hist_list);
 }
 
+static inline bool ptlrpc_req_is_connect(struct ptlrpc_request *req)
+{
+       if (lustre_msg_get_opc(req->rq_reqmsg) == MDS_CONNECT ||
+           lustre_msg_get_opc(req->rq_reqmsg) == OST_CONNECT ||
+           lustre_msg_get_opc(req->rq_reqmsg) == MGS_CONNECT)
+               return true;
+       else
+               return false;
+}
+
+static inline bool ptlrpc_req_is_disconnect(struct ptlrpc_request *req)
+{
+       if (lustre_msg_get_opc(req->rq_reqmsg) == MDS_DISCONNECT ||
+           lustre_msg_get_opc(req->rq_reqmsg) == OST_DISCONNECT ||
+           lustre_msg_get_opc(req->rq_reqmsg) == MGS_DISCONNECT)
+               return true;
+       else
+               return false;
+}
+
 #endif /* PTLRPC_INTERNAL_H */