+struct ldlm_pool_ops {
+ int (*po_recalc)(struct ldlm_pool *pl);
+ int (*po_shrink)(struct ldlm_pool *pl, int nr,
+ unsigned int gfp_mask);
+ int (*po_setup)(struct ldlm_pool *pl, int limit);
+};
+
+/**
+ * One second for pools thread check interval. Each pool has own period.
+ */
+#define LDLM_POOLS_THREAD_PERIOD (1)
+
+/**
+ * ~6% margin for modest pools. See ldlm_pool.c for details.
+ */
+#define LDLM_POOLS_MODEST_MARGIN_SHIFT (4)
+
+/**
+ * Default recalc period for server side pools in sec.
+ */
+#define LDLM_POOL_SRV_DEF_RECALC_PERIOD (1)
+
+/**
+ * Default recalc period for client side pools in sec.
+ */
+#define LDLM_POOL_CLI_DEF_RECALC_PERIOD (10)
+
+struct ldlm_pool {
+ /**
+ * Pool proc directory.
+ */
+ cfs_proc_dir_entry_t *pl_proc_dir;
+ /**
+ * Pool name, should be long enough to contain compound proc entry name.
+ */
+ char pl_name[100];
+ /**
+ * Lock for protecting slv/clv updates.
+ */
+ cfs_spinlock_t pl_lock;
+ /**
+ * Number of allowed locks in in pool, both, client and server side.
+ */
+ cfs_atomic_t pl_limit;
+ /**
+ * Number of granted locks in
+ */
+ cfs_atomic_t pl_granted;
+ /**
+ * Grant rate per T.
+ */
+ cfs_atomic_t pl_grant_rate;
+ /**
+ * Cancel rate per T.
+ */
+ cfs_atomic_t pl_cancel_rate;
+ /**
+ * Server lock volume. Protected by pl_lock.
+ */
+ __u64 pl_server_lock_volume;
+ /**
+ * Current biggest client lock volume. Protected by pl_lock.
+ */
+ __u64 pl_client_lock_volume;
+ /**
+ * Lock volume factor. SLV on client is calculated as following:
+ * server_slv * lock_volume_factor.
+ */
+ cfs_atomic_t pl_lock_volume_factor;
+ /**
+ * Time when last slv from server was obtained.
+ */
+ time_t pl_recalc_time;
+ /**
+ * Recalc period for pool.
+ */
+ time_t pl_recalc_period;
+ /**
+ * Recalc and shrink ops.
+ */
+ struct ldlm_pool_ops *pl_ops;
+ /**
+ * Number of planned locks for next period.
+ */
+ int pl_grant_plan;
+ /**
+ * Pool statistics.
+ */
+ struct lprocfs_stats *pl_stats;
+};
+