#define LDLM_DIRTY_AGE_LIMIT (10)
#define LDLM_DEFAULT_PARALLEL_AST_LIMIT 1024
#define LDLM_DEFAULT_LRU_SHRINK_BATCH (16)
+#define LDLM_DEFAULT_SLV_RECALC_PCT (10)
/**
* LDLM non-error return states
*
*/
+/* Cancel lru flag, it indicates we cancel aged locks. */
+enum ldlm_lru_flags {
+ LDLM_LRU_FLAG_NO_WAIT = 0x1, /* Cancel locks w/o blocking (neither
+ * sending nor waiting for any RPCs) */
+ LDLM_LRU_FLAG_CLEANUP = 0x2, /* Used when clearing lru, tells
+ * prepare_lru_list to set discard flag
+ * on PR extent locks so we don't waste
+ * time saving pages that will be
+ * discarded momentarily */
+};
+
struct ldlm_pool;
struct ldlm_lock;
struct ldlm_resource;
*/
struct ldlm_pool_ops {
/** Recalculate pool \a pl usage */
- int (*po_recalc)(struct ldlm_pool *pl);
+ int (*po_recalc)(struct ldlm_pool *pl, bool force);
/** Cancel at least \a nr locks from pool \a pl */
int (*po_shrink)(struct ldlm_pool *pl, int nr, gfp_t gfp_mask);
int (*po_setup)(struct ldlm_pool *pl, int limit);
*/
unsigned int ns_cancel_batch;
+ /**
+ * How much the SLV should decrease in %% to trigger LRU cancel urgently.
+ */
+ unsigned int ns_recalc_pct;
+
/** Maximum allowed age (last used time) for locks in the LRU. Set in
* seconds from userspace, but stored in ns to avoid repeat conversions.
*/
* Flag to indicate namespace is being freed. Used to determine if
* recalculation of LDLM pool statistics should be skipped.
*/
- unsigned ns_stopping:1;
+ unsigned ns_stopping:1,
+
+ /**
+ * Flag to indicate the LRU recalc on RPC reply is in progress.
+ * Used to limit the process by 1 thread only.
+ */
+ ns_rpc_recalc:1;
/**
* Which bucket should we start with the lock reclaim.
int ldlm_pool_shrink(struct ldlm_pool *pl, int nr, gfp_t gfp_mask);
void ldlm_pool_fini(struct ldlm_pool *pl);
int ldlm_pool_setup(struct ldlm_pool *pl, int limit);
-time64_t ldlm_pool_recalc(struct ldlm_pool *pl);
+time64_t ldlm_pool_recalc(struct ldlm_pool *pl, bool force);
__u32 ldlm_pool_get_lvf(struct ldlm_pool *pl);
__u64 ldlm_pool_get_slv(struct ldlm_pool *pl);
__u64 ldlm_pool_get_clv(struct ldlm_pool *pl);