knfsd: add file to export stats about nfsd pools
[firefly-linux-kernel-4.4.55.git] / include / linux / sunrpc / svc.h
index 3afe7fb403b2733877a199485e4c804a8fc116ef..9f9f699dd4696969c06320d0332d668299271e4d 100644 (file)
  */
 typedef int            (*svc_thread_fn)(void *);
 
+/* statistics for svc_pool structures */
+struct svc_pool_stats {
+       unsigned long   packets;
+       unsigned long   sockets_queued;
+       unsigned long   threads_woken;
+       unsigned long   overloads_avoided;
+       unsigned long   threads_timedout;
+};
+
 /*
  *
  * RPC service thread pool.
@@ -41,6 +50,8 @@ struct svc_pool {
        struct list_head        sp_sockets;     /* pending sockets */
        unsigned int            sp_nrthreads;   /* # of threads in pool */
        struct list_head        sp_all_threads; /* all server threads */
+       int                     sp_nwaking;     /* number of threads woken but not yet active */
+       struct svc_pool_stats   sp_stats;       /* statistics on pool operation */
 } ____cacheline_aligned_in_smp;
 
 /*
@@ -58,10 +69,13 @@ struct svc_serv {
        struct svc_stat *       sv_stats;       /* RPC statistics */
        spinlock_t              sv_lock;
        unsigned int            sv_nrthreads;   /* # of server threads */
+       unsigned int            sv_maxconn;     /* max connections allowed or
+                                                * '0' causing max to be based
+                                                * on number of threads. */
+
        unsigned int            sv_max_payload; /* datagram payload size */
        unsigned int            sv_max_mesg;    /* max_payload + 1 page for overheads */
        unsigned int            sv_xdrsize;     /* XDR buffer size */
-
        struct list_head        sv_permsocks;   /* all permanent sockets */
        struct list_head        sv_tempsocks;   /* all temporary sockets */
        int                     sv_tmpcnt;      /* count of temporary sockets */
@@ -261,6 +275,7 @@ struct svc_rqst {
                                                 * cache pages */
        wait_queue_head_t       rq_wait;        /* synchronization */
        struct task_struct      *rq_task;       /* service thread */
+       int                     rq_waking;      /* 1 if thread is being woken */
 };
 
 /*
@@ -391,6 +406,7 @@ struct svc_serv *  svc_create_pooled(struct svc_program *, unsigned int,
                        sa_family_t, void (*shutdown)(struct svc_serv *),
                        svc_thread_fn, struct module *);
 int               svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
+int               svc_pool_stats_open(struct svc_serv *serv, struct file *file);
 void              svc_destroy(struct svc_serv *);
 int               svc_process(struct svc_rqst *);
 int               svc_register(const struct svc_serv *, const unsigned short,