Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / include / lustre_net.h
index bbe3c01..a7ed10a 100644 (file)
  * considered full when less than ?_MAXREQSIZE is left in them.
  */
 
-#define LDLM_THREADS_AUTO_MIN min((int)(smp_num_cpus * smp_num_cpus * 2), 8)
+#define LDLM_THREADS_AUTO_MIN                                                 \
+        min((int)(num_online_cpus() * num_online_cpus() * 2), 8)
 #define LDLM_THREADS_AUTO_MAX (LDLM_THREADS_AUTO_MIN * 16)
 #define LDLM_BL_THREADS  LDLM_THREADS_AUTO_MIN
-#define LDLM_NBUFS      (64 * smp_num_cpus)
+#define LDLM_NBUFS      (64 * num_online_cpus())
 #define LDLM_BUFSIZE    (8 * 1024)
 #define LDLM_MAXREQSIZE (5 * 1024)
 #define LDLM_MAXREPSIZE (1024)
 #define MDS_THREADS_MIN 2
 #define MDS_THREADS_MAX 512
 #define MDS_THREADS_MIN_READPAGE 2
-#define MDS_NBUFS       (64 * smp_num_cpus)
+#define MDS_NBUFS       (64 * num_online_cpus())
 #define MDS_BUFSIZE     (8 * 1024)
 /* Assume file name length = FNAME_MAX = 256 (true for ext3).
  *        path name length = PATH_MAX = 4096
 
 #define MGS_THREADS_AUTO_MIN 2
 #define MGS_THREADS_AUTO_MAX 32
-#define MGS_NBUFS       (64 * smp_num_cpus)
+#define MGS_NBUFS       (64 * num_online_cpus())
 #define MGS_BUFSIZE     (8 * 1024)
 #define MGS_MAXREQSIZE  (7 * 1024)
 #define MGS_MAXREPSIZE  (9 * 1024)
 /* Absolute limits */
 #define OSS_THREADS_MIN 2
 #define OSS_THREADS_MAX 512
-#define OST_NBUFS       (64 * smp_num_cpus)
+#define OST_NBUFS       (64 * num_online_cpus())
 #define OST_BUFSIZE     (8 * 1024)
 /* OST_MAXREQSIZE ~= 4768 bytes =
  * lustre_msg + obdo + 16 * obd_ioobj + 256 * niobuf_remote
@@ -297,11 +298,13 @@ struct ptlrpc_request {
                  * after server commits corresponding transaction. This is
                  * used for operations that require sequence of multiple
                  * requests to be replayed. The only example currently is file
-                 * open/close. When last request in such a sequence is
-                 * committed, ->rq_replay is cleared on all requests in the
+                 * open/close/dw/setattr. When last request in such a sequence
+                 * is committed, ->rq_replay is cleared on all requests in the
                  * sequence.
                  */
                 rq_replay:1,
+                /* this is the last request in the sequence. */
+                rq_sequence:1,
                 rq_no_resend:1, rq_waiting:1, rq_receiving_reply:1,
                 rq_no_delay:1, rq_net_err:1, rq_wait_ctx:1;
         enum rq_phase rq_phase; /* one of RQ_PHASE_* */
@@ -323,6 +326,7 @@ struct ptlrpc_request {
         __u64 rq_transno;
         __u64 rq_xid;
         struct list_head rq_replay_list;
+        struct list_head rq_mod_list;
 
         struct ptlrpc_cli_ctx   *rq_cli_ctx;     /* client's half ctx */
         struct ptlrpc_svc_ctx   *rq_svc_ctx;     /* server's half ctx */
@@ -337,7 +341,9 @@ struct ptlrpc_request {
                                  rq_auth_gss:1,      /* authenticated by gss */
                                  rq_auth_remote:1,   /* authed as remote user */
                                  rq_auth_usr_root:1, /* authed as root */
-                                 rq_auth_usr_mdt:1;  /* authed as mdt */
+                                 rq_auth_usr_mdt:1,  /* authed as mdt */
+                                 /* doesn't expect reply FIXME */
+                                 rq_no_reply:1;
 
         uid_t                    rq_auth_uid;        /* authed uid */
         uid_t                    rq_auth_mapped_uid; /* authed uid mapped to */
@@ -389,8 +395,9 @@ struct ptlrpc_request {
         void  *rq_cb_data;
 
         struct ptlrpc_bulk_desc *rq_bulk;       /* client side bulk */
-        time_t rq_sent;                         /* when request sent, seconds */
-
+        time_t rq_sent;                         /* when request sent, seconds,
+                                                 * or time when request should
+                                                 * be sent */
         /* Multi-rpc bits */
         struct list_head rq_set_chain;
         struct ptlrpc_request_set *rq_set;
@@ -402,6 +409,14 @@ struct ptlrpc_request {
         struct lu_context           rq_session;
 };
 
+static inline void ptlrpc_close_replay_seq(struct ptlrpc_request *req)
+{
+        spin_lock(&req->rq_lock);
+        req->rq_replay = 0;
+        req->rq_sequence = 1;
+        spin_unlock(&req->rq_lock);
+}
+
 static inline void lustre_set_req_swabbed(struct ptlrpc_request *req, int index)
 {
         LASSERT(index < sizeof(req->rq_req_swab_mask) * 8);
@@ -886,6 +901,10 @@ __u32 lustre_msg_get_opc(struct lustre_msg *msg);
 __u64 lustre_msg_get_last_xid(struct lustre_msg *msg);
 __u64 lustre_msg_get_last_committed(struct lustre_msg *msg);
 __u64 lustre_msg_get_transno(struct lustre_msg *msg);
+__u64 lustre_msg_get_slv(struct lustre_msg *msg);
+__u32 lustre_msg_get_limit(struct lustre_msg *msg);
+void lustre_msg_set_slv(struct lustre_msg *msg, __u64 slv);
+void lustre_msg_set_limit(struct lustre_msg *msg, __u64 limit);
 int lustre_msg_get_status(struct lustre_msg *msg);
 __u32 lustre_msg_get_conn_cnt(struct lustre_msg *msg);
 __u32 lustre_msg_get_magic(struct lustre_msg *msg);
@@ -966,6 +985,7 @@ int import_set_conn_priority(struct obd_import *imp, struct obd_uuid *uuid);
 /* ptlrpc/pinger.c */
 int ptlrpc_pinger_add_import(struct obd_import *imp);
 int ptlrpc_pinger_del_import(struct obd_import *imp);
+cfs_time_t ptlrpc_suspend_wakeup_time(void);
 #ifdef __KERNEL__
 void ping_evictor_start(void);
 void ping_evictor_stop(void);