Whamcloud - gitweb
LU-1144 ptlrpc: implement a NUMA aware ptlrpcd binding policy
[fs/lustre-release.git] / lustre / include / lustre_net.h
index 54bc06b..41acb98 100644 (file)
@@ -28,9 +28,8 @@
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
- */
-/*
- * Copyright (c) 2011 Whamcloud, Inc.
+ *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 #define MDT_MAX_THREADS 512UL
 #endif
 #define MDS_NBUFS       (64 * cfs_num_online_cpus())
-#define MDS_BUFSIZE     (8 * 1024)
 /**
  * Assume file name length = FNAME_MAX = 256 (true for ext3).
  *        path name length = PATH_MAX = 4096
- *        LOV MD size max  = EA_MAX = 4000
+ *        LOV MD size max  = EA_MAX = 48000 (2000 stripes)
  * symlink:  FNAME_MAX + PATH_MAX  <- largest
  * link:     FNAME_MAX + PATH_MAX  (mds_rec_link < mds_rec_create)
  * rename:   FNAME_MAX + FNAME_MAX
  * Realistic size is about 512 bytes (20 character name + 128 char symlink),
  * except in the open case where there are a large number of OSTs in a LOV.
  */
-#define MDS_MAXREQSIZE  (5 * 1024)
-#define MDS_MAXREPSIZE  max(9 * 1024, 362 + LOV_MAX_STRIPE_COUNT * 56)
+#define MDS_MAXREPSIZE  max(10 * 1024, 362 + LOV_MAX_STRIPE_COUNT * 56)
+#define MDS_MAXREQSIZE  MDS_MAXREPSIZE
+
+/** MDS_BUFSIZE = max_reqsize + max sptlrpc payload size */
+#define MDS_BUFSIZE     (MDS_MAXREQSIZE + 1024)
 
 /** FLD_MAXREQSIZE == lustre_msg + __u32 padding + ptlrpc_body + opc */
 #define FLD_MAXREQSIZE  (160)
@@ -446,6 +447,10 @@ struct ptlrpc_hpreq_ops {
          * Check if the request is a high priority one.
          */
         int  (*hpreq_check)(struct ptlrpc_request *);
+        /**
+         * Called after the request has been handled.
+         */
+        void (*hpreq_fini)(struct ptlrpc_request *);
 };
 
 /**
@@ -829,25 +834,22 @@ ptlrpc_rqphase2str(struct ptlrpc_request *req)
 
 #define REQ_FLAGS_FMT "%s:%s%s%s%s%s%s%s%s%s%s%s%s"
 
-void _debug_req(struct ptlrpc_request *req, __u32 mask,
+void _debug_req(struct ptlrpc_request *req,
                 struct libcfs_debug_msg_data *data, const char *fmt, ...)
-        __attribute__ ((format (printf, 4, 5)));
+        __attribute__ ((format (printf, 3, 4)));
 
 /**
  * Helper that decides if we need to print request accordig to current debug
  * level settings
  */
-#define debug_req(cdls, level, req, file, func, line, fmt, a...)              \
+#define debug_req(msgdata, mask, cdls, req, fmt, a...)                        \
 do {                                                                          \
-        CFS_CHECK_STACK();                                                    \
+        CFS_CHECK_STACK(msgdata, mask, cdls);                                 \
                                                                               \
-        if (((level) & D_CANTMASK) != 0 ||                                    \
-            ((libcfs_debug & (level)) != 0 &&                                 \
-             (libcfs_subsystem_debug & DEBUG_SUBSYSTEM) != 0)) {              \
-                static struct libcfs_debug_msg_data _req_dbg_data =           \
-                DEBUG_MSG_DATA_INIT(cdls, DEBUG_SUBSYSTEM, file, func, line); \
-                _debug_req((req), (level), &_req_dbg_data, fmt, ##a);         \
-        }                                                                     \
+        if (((mask) & D_CANTMASK) != 0 ||                                     \
+            ((libcfs_debug & (mask)) != 0 &&                                  \
+             (libcfs_subsystem_debug & DEBUG_SUBSYSTEM) != 0))                \
+                _debug_req((req), msgdata, fmt, ##a);                         \
 } while(0)
 
 /**
@@ -858,11 +860,12 @@ do {                                                                          \
 do {                                                                          \
         if ((level) & (D_ERROR | D_WARNING)) {                                \
                 static cfs_debug_limit_state_t cdls;                          \
-                debug_req(&cdls, level, req, __FILE__, __func__, __LINE__,    \
-                          "@@@ "fmt" ", ## args);                             \
-        } else                                                                \
-                debug_req(NULL, level, req, __FILE__, __func__, __LINE__,     \
-                          "@@@ "fmt" ", ## args);                             \
+                LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, level, &cdls);            \
+                debug_req(&msgdata, level, &cdls, req, "@@@ "fmt" ", ## args);\
+        } else {                                                              \
+                LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, level, NULL);             \
+                debug_req(&msgdata, level, NULL, req, "@@@ "fmt" ", ## args); \
+        }                                                                     \
 } while (0)
 /** @} */
 
@@ -1525,6 +1528,12 @@ __u64 ptlrpc_next_xid(void);
 __u64 ptlrpc_sample_next_xid(void);
 __u64 ptlrpc_req_xid(struct ptlrpc_request *request);
 
+/* Set of routines to run a function in ptlrpcd context */
+void *ptlrpcd_alloc_work(struct obd_import *imp,
+                         int (*cb)(const struct lu_env *, void *), void *data);
+void ptlrpcd_destroy_work(void *handler);
+int ptlrpcd_queue_work(void *handler);
+
 /** @} */
 
 struct ptlrpc_service_conf {
@@ -1916,7 +1925,9 @@ typedef enum {
         /* <free1 bound1> <free2 bound2> ... <freeN boundN> */
         PDB_POLICY_PAIR          = 3,
         /* <free1 bound1> <bound1 free2> ... <freeN boundN> <boundN free1>,
-         * means each ptlrpcd[X] has two partners: thread[X-1] and thread[X+1]*/
+         * means each ptlrpcd[X] has two partners: thread[X-1] and thread[X+1].
+         * If kernel supports NUMA, pthrpcd threads are binded and
+         * grouped by NUMA node */
         PDB_POLICY_NEIGHBOR      = 4,
 } pdb_policy_t;