#define LDLM_DEFAULT_LRU_SIZE (100 * num_online_cpus())
#define LDLM_DEFAULT_MAX_ALIVE 3900 /* 3900 seconds ~65 min */
#define LDLM_CTIME_AGE_LIMIT (10)
+/* if client lock is unused for that time it can be cancelled if any other
+ * client shows interest in that lock, e.g. glimpse is occured. */
+#define LDLM_DIRTY_AGE_LIMIT (10)
#define LDLM_DEFAULT_PARALLEL_AST_LIMIT 1024
/**
* for a directory and may save an RPC for a later stat.
*/
time64_t ns_ctime_age_limit;
-
+ /**
+ * Number of seconds since the lock was last used. The client may
+ * cancel the lock limited by this age and flush related data if
+ * any other client shows interest in it doing glimpse request.
+ * This allows to cache stat data locally for such files early.
+ */
+ time64_t ns_dirty_age_limit;
/**
* Used to rate-limit ldlm_namespace_dump calls.
* \see ldlm_namespace_dump. Increased by 10 seconds every time
!lock->l_readers && !lock->l_writers &&
ktime_after(ktime_get(),
ktime_add(lock->l_last_used,
- ktime_set(10, 0)))) {
+ ktime_set(ns->ns_dirty_age_limit, 0)))) {
unlock_res_and_lock(lock);
if (ldlm_bl_to_thread_lock(ns, NULL, lock))
ldlm_handle_bl_callback(ns, NULL, lock);
}
LUSTRE_RW_ATTR(early_lock_cancel);
+static ssize_t dirty_age_limit_show(struct kobject *kobj,
+ struct attribute *attr, char *buf)
+{
+ struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
+ ns_kobj);
+
+ return sprintf(buf, "%llu\n", ns->ns_dirty_age_limit);
+}
+
+static ssize_t dirty_age_limit_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count)
+{
+ struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
+ ns_kobj);
+ unsigned long long tmp;
+
+ if (kstrtoull(buffer, 10, &tmp))
+ return -EINVAL;
+
+ ns->ns_dirty_age_limit = tmp;
+
+ return count;
+}
+LUSTRE_RW_ATTR(dirty_age_limit);
+
#ifdef HAVE_SERVER_SUPPORT
static ssize_t ctime_age_limit_show(struct kobject *kobj,
struct attribute *attr, char *buf)
&lustre_attr_lru_size.attr,
&lustre_attr_lru_max_age.attr,
&lustre_attr_early_lock_cancel.attr,
+ &lustre_attr_dirty_age_limit.attr,
#ifdef HAVE_SERVER_SUPPORT
&lustre_attr_ctime_age_limit.attr,
&lustre_attr_lock_timeouts.attr,
ns->ns_max_unused = LDLM_DEFAULT_LRU_SIZE;
ns->ns_max_age = ktime_set(LDLM_DEFAULT_MAX_ALIVE, 0);
ns->ns_ctime_age_limit = LDLM_CTIME_AGE_LIMIT;
+ ns->ns_dirty_age_limit = LDLM_DIRTY_AGE_LIMIT;
ns->ns_timeouts = 0;
ns->ns_orig_connect_flags = 0;
ns->ns_connect_flags = 0;