Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87d32094 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman
Browse files

staging/lustre/ldlm: move namespaces/early_lock_cancel to sysfs



Move ldlm display of early_lock_cancel from procfs to sysfs

Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6784096b
Loading
Loading
Loading
Loading
+16 −12
Original line number Original line Diff line number Diff line
@@ -276,23 +276,27 @@ static ssize_t lru_size_store(struct kobject *kobj, struct attribute *attr,
}
}
LUSTRE_RW_ATTR(lru_size);
LUSTRE_RW_ATTR(lru_size);


static int lprocfs_elc_seq_show(struct seq_file *m, void *v)
static ssize_t early_lock_cancel_show(struct kobject *kobj,
				      struct attribute *attr,
				      char *buf)
{
{
	struct ldlm_namespace *ns = m->private;
	struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
	unsigned int supp = ns_connect_cancelset(ns);
						 ns_kobj);


	return lprocfs_rd_uint(m, &supp);
	return sprintf(buf, "%d\n", ns_connect_cancelset(ns));
}
}


static ssize_t lprocfs_elc_seq_write(struct file *file,
static ssize_t early_lock_cancel_store(struct kobject *kobj,
				const char __user *buffer,
				       struct attribute *attr,
				size_t count, loff_t *off)
				       const char *buffer,
				       size_t count)
{
{
	struct ldlm_namespace *ns = ((struct seq_file *)file->private_data)->private;
	struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
	unsigned int supp = -1;
						 ns_kobj);
	unsigned long supp = -1;
	int rc;
	int rc;


	rc = lprocfs_wr_uint(file, buffer, count, &supp);
	rc = kstrtoul(buffer, 10, &supp);
	if (rc < 0)
	if (rc < 0)
		return rc;
		return rc;


@@ -302,13 +306,14 @@ static ssize_t lprocfs_elc_seq_write(struct file *file,
		ns->ns_connect_flags |= OBD_CONNECT_CANCELSET;
		ns->ns_connect_flags |= OBD_CONNECT_CANCELSET;
	return count;
	return count;
}
}
LPROC_SEQ_FOPS(lprocfs_elc);
LUSTRE_RW_ATTR(early_lock_cancel);


/* These are for namespaces in /sys/fs/lustre/ldlm/namespaces/ */
/* These are for namespaces in /sys/fs/lustre/ldlm/namespaces/ */
static struct attribute *ldlm_ns_attrs[] = {
static struct attribute *ldlm_ns_attrs[] = {
	&lustre_attr_resource_count.attr,
	&lustre_attr_resource_count.attr,
	&lustre_attr_lock_count.attr,
	&lustre_attr_lock_count.attr,
	&lustre_attr_lru_size.attr,
	&lustre_attr_lru_size.attr,
	&lustre_attr_early_lock_cancel.attr,
	NULL,
	NULL,
};
};


@@ -401,7 +406,6 @@ int ldlm_namespace_proc_register(struct ldlm_namespace *ns)
				&ldlm_uint_fops);
				&ldlm_uint_fops);
		LDLM_NS_ADD_VAR("lru_max_age", &ns->ns_max_age,
		LDLM_NS_ADD_VAR("lru_max_age", &ns->ns_max_age,
				&ldlm_rw_uint_fops);
				&ldlm_rw_uint_fops);
		LDLM_NS_ADD_VAR("early_lock_cancel", ns, &lprocfs_elc_fops);
	} else {
	} else {
		LDLM_NS_ADD_VAR("ctime_age_limit", &ns->ns_ctime_age_limit,
		LDLM_NS_ADD_VAR("ctime_age_limit", &ns->ns_ctime_age_limit,
				&ldlm_rw_uint_fops);
				&ldlm_rw_uint_fops);
+13 −0
Original line number Original line Diff line number Diff line
@@ -222,3 +222,16 @@ Description:
		namespace.
		namespace.
		0 - LRU size is unlimited, controlled by server resources
		0 - LRU size is unlimited, controlled by server resources
		positive number - number of locks to allow in lock LRU list
		positive number - number of locks to allow in lock LRU list

What:		/sys/fs/lustre/ldlm/namespaces/<name>/early_lock_cancel
Date:		May 2015
Contact:	"Oleg Drokin" <oleg.drokin@intel.com>
Description:
		Controls "early lock cancellation" feature on this namespace
		if supported by the server.
		When enabled, tries to preemtively cancel locks that would be
		cancelled by verious operations and bundle the cancellation
		requests in the same RPC as the main operation, which results
		in significant speedups due to reduced lock-pingpong RPCs.
		0 - disabled
		1 - enabled (default)