#include "vvp_internal.h"
struct proc_dir_entry *proc_lustre_fs_root;
+static struct kobject *llite_kobj;
+
+int llite_tunables_register(void)
+{
+ int rc = 0;
+
+ proc_lustre_fs_root = lprocfs_register("llite", proc_lustre_root,
+ NULL, NULL);
+ if (IS_ERR(proc_lustre_fs_root)) {
+ rc = PTR_ERR(proc_lustre_fs_root);
+ CERROR("cannot register '/proc/fs/lustre/llite': rc = %d\n",
+ rc);
+ proc_lustre_fs_root = NULL;
+ return rc;
+ }
+
+ llite_kobj = class_setup_tunables("llite");
+ if (IS_ERR(llite_kobj)) {
+ rc = PTR_ERR(llite_kobj);
+ llite_kobj = NULL;
+ }
+
+ return rc;
+}
+
+void llite_tunables_unregister(void)
+{
+ if (llite_kobj)
+ kobject_put(llite_kobj);
+
+ lprocfs_remove(&proc_lustre_fs_root);
+}
#ifdef CONFIG_PROC_FS
/* /proc/lustre/llite mount point registration */
static const struct file_operations ll_rw_offset_stats_fops;
static __s64 ll_stats_pid_write(const char __user *buf, size_t len);
-static int ll_blksize_seq_show(struct seq_file *m, void *v)
+static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
struct obd_statfs osfs;
int rc;
- LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, OBD_STATFS_NODELAY);
- if (!rc)
- seq_printf(m, "%u\n", osfs.os_bsize);
- return rc;
+ rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY);
+ if (rc)
+ return rc;
+
+ return sprintf(buf, "%u\n", osfs.os_bsize);
}
-LPROC_SEQ_FOPS_RO(ll_blksize);
+LUSTRE_RO_ATTR(blocksize);
static int ll_stat_blksize_seq_show(struct seq_file *m, void *v)
{
{
struct seq_file *m = file->private_data;
struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
- __s64 val;
+ unsigned int val;
int rc;
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtouint_from_user(buffer, count, 0, &val);
if (rc)
return rc;
}
LPROC_SEQ_FOPS(ll_stat_blksize);
-static int ll_kbytestotal_seq_show(struct seq_file *m, void *v)
+static ssize_t kbytestotal_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
struct obd_statfs osfs;
+ u32 blk_size;
+ u64 result;
int rc;
- LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, OBD_STATFS_NODELAY);
- if (!rc) {
- __u32 blk_size = osfs.os_bsize >> 10;
- __u64 result = osfs.os_blocks;
+ rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY);
+ if (rc)
+ return rc;
- while (blk_size >>= 1)
- result <<= 1;
+ blk_size = osfs.os_bsize >> 10;
+ result = osfs.os_blocks;
- seq_printf(m, "%llu\n", result);
- }
- return rc;
+ while (blk_size >>= 1)
+ result <<= 1;
+
+ return sprintf(buf, "%llu\n", result);
}
-LPROC_SEQ_FOPS_RO(ll_kbytestotal);
+LUSTRE_RO_ATTR(kbytestotal);
-static int ll_kbytesfree_seq_show(struct seq_file *m, void *v)
+static ssize_t kbytesfree_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
struct obd_statfs osfs;
+ u32 blk_size;
+ u64 result;
int rc;
- LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, OBD_STATFS_NODELAY);
- if (!rc) {
- __u32 blk_size = osfs.os_bsize >> 10;
- __u64 result = osfs.os_bfree;
+ rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY);
+ if (rc)
+ return rc;
- while (blk_size >>= 1)
- result <<= 1;
+ blk_size = osfs.os_bsize >> 10;
+ result = osfs.os_bfree;
- seq_printf(m, "%llu\n", result);
- }
- return rc;
+ while (blk_size >>= 1)
+ result <<= 1;
+
+ return sprintf(buf, "%llu\n", result);
}
-LPROC_SEQ_FOPS_RO(ll_kbytesfree);
+LUSTRE_RO_ATTR(kbytesfree);
-static int ll_kbytesavail_seq_show(struct seq_file *m, void *v)
+static ssize_t kbytesavail_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
struct obd_statfs osfs;
+ u32 blk_size;
+ u64 result;
int rc;
- LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, OBD_STATFS_NODELAY);
- if (!rc) {
- __u32 blk_size = osfs.os_bsize >> 10;
- __u64 result = osfs.os_bavail;
+ rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY);
+ if (rc)
+ return rc;
- while (blk_size >>= 1)
- result <<= 1;
+ blk_size = osfs.os_bsize >> 10;
+ result = osfs.os_bavail;
- seq_printf(m, "%llu\n", result);
- }
- return rc;
+ while (blk_size >>= 1)
+ result <<= 1;
+
+ return sprintf(buf, "%llu\n", result);
}
-LPROC_SEQ_FOPS_RO(ll_kbytesavail);
+LUSTRE_RO_ATTR(kbytesavail);
-static int ll_filestotal_seq_show(struct seq_file *m, void *v)
+static ssize_t filestotal_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
struct obd_statfs osfs;
int rc;
- LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, OBD_STATFS_NODELAY);
- if (!rc)
- seq_printf(m, "%llu\n", osfs.os_files);
- return rc;
+ rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY);
+ if (rc)
+ return rc;
+
+ return sprintf(buf, "%llu\n", osfs.os_files);
}
-LPROC_SEQ_FOPS_RO(ll_filestotal);
+LUSTRE_RO_ATTR(filestotal);
-static int ll_filesfree_seq_show(struct seq_file *m, void *v)
+static ssize_t filesfree_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
struct obd_statfs osfs;
int rc;
- LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, OBD_STATFS_NODELAY);
- if (!rc)
- seq_printf(m, "%llu\n", osfs.os_ffree);
- return rc;
+ rc = ll_statfs_internal(sbi, &osfs, OBD_STATFS_NODELAY);
+ if (rc)
+ return rc;
+
+ return sprintf(buf, "%llu\n", osfs.os_ffree);
}
-LPROC_SEQ_FOPS_RO(ll_filesfree);
+LUSTRE_RO_ATTR(filesfree);
-static int ll_client_type_seq_show(struct seq_file *m, void *v)
+static ssize_t client_type_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
-
- LASSERT(sbi != NULL);
-
- seq_puts(m, "local client\n");
- return 0;
+ return sprintf(buf, "local client\n");
}
-LPROC_SEQ_FOPS_RO(ll_client_type);
+LUSTRE_RO_ATTR(client_type);
-static int ll_fstype_seq_show(struct seq_file *m, void *v)
+static ssize_t fstype_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct super_block *sb = m->private;
-
- LASSERT(sb != NULL);
- seq_printf(m, "%s\n", sb->s_type->name);
- return 0;
+ return sprintf(buf, "lustre\n");
}
-LPROC_SEQ_FOPS_RO(ll_fstype);
+LUSTRE_RO_ATTR(fstype);
-static int ll_sb_uuid_seq_show(struct seq_file *m, void *v)
+static ssize_t uuid_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
- LASSERT(sb != NULL);
- seq_printf(m, "%s\n", ll_s2sbi(sb)->ll_sb_uuid.uuid);
- return 0;
+ return sprintf(buf, "%s\n", sbi->ll_sb_uuid.uuid);
}
-LPROC_SEQ_FOPS_RO(ll_sb_uuid);
+LUSTRE_RO_ATTR(uuid);
static int ll_xattr_cache_seq_show(struct seq_file *m, void *v)
{
{
struct seq_file *m = file->private_data;
struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
- __s64 val;
+ bool val;
int rc;
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtobool_from_user(buffer, count, &val);
if (rc)
return rc;
- if (val != 0 && val != 1)
- return -ERANGE;
-
- if (val == 1 && !(sbi->ll_flags & LL_SBI_XATTR_CACHE))
+ if (val && !(sbi->ll_flags & LL_SBI_XATTR_CACHE))
return -ENOTSUPP;
sbi->ll_xattr_cache_enabled = val;
}
LPROC_SEQ_FOPS(ll_max_cached_mb);
-static int ll_checksum_seq_show(struct seq_file *m, void *v)
+static ssize_t checksum_pages_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct super_block *sb = m->private;
- struct ll_sb_info *sbi = ll_s2sbi(sb);
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
- seq_printf(m, "%u\n", (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0);
- return 0;
+ return sprintf(buf, "%u\n", (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0);
}
-static ssize_t ll_checksum_seq_write(struct file *file,
- const char __user *buffer,
- size_t count, loff_t *off)
+static ssize_t checksum_pages_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer,
+ size_t count)
{
- struct seq_file *m = file->private_data;
- struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
+ bool val;
+ int tmp;
int rc;
- __s64 val;
if (!sbi->ll_dt_exp)
/* Not set up yet */
return -EAGAIN;
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtobool(buffer, &val);
if (rc)
return rc;
if (val)
sbi->ll_flags |= LL_SBI_CHECKSUM;
else
sbi->ll_flags &= ~LL_SBI_CHECKSUM;
+ tmp = val;
rc = obd_set_info_async(NULL, sbi->ll_dt_exp, sizeof(KEY_CHECKSUM),
- KEY_CHECKSUM, sizeof(val), &val, NULL);
+ KEY_CHECKSUM, sizeof(tmp), &tmp, NULL);
if (rc)
CWARN("Failed to set OSC checksum flags: %d\n", rc);
return count;
}
-LPROC_SEQ_FOPS(ll_checksum);
+LUSTRE_RW_ATTR(checksum_pages);
static int ll_rd_track_id(struct seq_file *m, enum stats_track_type type)
{
void *data, enum stats_track_type type)
{
struct super_block *sb = data;
+ unsigned int pid;
int rc;
- __s64 pid;
- rc = lprocfs_str_to_s64(buffer, count, &pid);
+ rc = kstrtouint_from_user(buffer, count, 0, &pid);
if (rc)
return rc;
- if (pid > INT_MAX || pid < 0)
- return -ERANGE;
ll_s2sbi(sb)->ll_stats_track_id = pid;
if (pid == 0)
}
LPROC_SEQ_FOPS(ll_track_gid);
+static ssize_t statahead_running_max_show(struct kobject *kobj,
+ struct attribute *attr,
+ char *buf)
+{
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
+
+ return snprintf(buf, 16, "%u\n", sbi->ll_sa_running_max);
+}
+
+static ssize_t statahead_running_max_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer,
+ size_t count)
+{
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
+ unsigned long val;
+ int rc;
+
+ rc = kstrtoul(buffer, 0, &val);
+ if (rc)
+ return rc;
+
+ if (val <= LL_SA_RUNNING_MAX) {
+ sbi->ll_sa_running_max = val;
+ return count;
+ }
+
+ CERROR("Bad statahead_running_max value %lu. Valid values "
+ "are in the range [0, %d]\n", val, LL_SA_RUNNING_MAX);
+
+ return -ERANGE;
+}
+LUSTRE_RW_ATTR(statahead_running_max);
+
static int ll_statahead_max_seq_show(struct seq_file *m, void *v)
{
struct super_block *sb = m->private;
{
struct seq_file *m = file->private_data;
struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
+ unsigned int val;
int rc;
- __s64 val;
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtouint_from_user(buffer, count, 0, &val);
if (rc)
return rc;
- if (val >= 0 && val <= LL_SA_RPC_MAX)
+ if (val <= LL_SA_RPC_MAX)
sbi->ll_sa_max = val;
else
- CERROR("Bad statahead_max value %lld. Valid values are in "
+ CERROR("Bad statahead_max value %u. Valid values are in "
"the range [0, %d]\n", val, LL_SA_RPC_MAX);
return count;
{
struct seq_file *m = file->private_data;
struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
+ bool val;
int rc;
- __s64 val;
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtobool_from_user(buffer, count, &val);
if (rc)
return rc;
{
struct seq_file *m = file->private_data;
struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
+ bool val;
int rc;
- __s64 val;
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtobool_from_user(buffer, count, &val);
if (rc)
return rc;
struct seq_file *seq = file->private_data;
struct super_block *sb = (struct super_block *)seq->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);
- __s64 val;
+ unsigned int val;
int rc;
if (count == 0)
return 0;
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtouint_from_user(buffer, count, 0, &val);
if (rc)
return rc;
- if (val < 0 || val > INT_MAX)
- return -ERANGE;
rc = ll_set_default_mdsize(sbi, val);
if (rc)
}
LPROC_SEQ_FOPS_RO(ll_sbi_flags);
+static int ll_tiny_write_seq_show(struct seq_file *m, void *v)
+{
+ struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+
+ seq_printf(m, "%u\n", !!(sbi->ll_flags & LL_SBI_TINY_WRITE));
+ return 0;
+}
+
+static ssize_t ll_tiny_write_seq_write(
+ struct file *file, const char __user *buffer, size_t count, loff_t *off)
+{
+ struct seq_file *m = file->private_data;
+ struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+ bool val;
+ int rc;
+
+ rc = kstrtobool_from_user(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ spin_lock(&sbi->ll_lock);
+ if (val)
+ sbi->ll_flags |= LL_SBI_TINY_WRITE;
+ else
+ sbi->ll_flags &= ~LL_SBI_TINY_WRITE;
+ spin_unlock(&sbi->ll_lock);
+
+ return count;
+}
+LPROC_SEQ_FOPS(ll_tiny_write);
+
static int ll_fast_read_seq_show(struct seq_file *m, void *v)
{
struct super_block *sb = m->private;
struct seq_file *m = file->private_data;
struct super_block *sb = m->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);
+ bool val;
int rc;
- __s64 val;
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtobool_from_user(buffer, count, &val);
if (rc)
return rc;
spin_lock(&sbi->ll_lock);
- if (val == 1)
+ if (val)
sbi->ll_flags |= LL_SBI_FAST_READ;
else
sbi->ll_flags &= ~LL_SBI_FAST_READ;
struct seq_file *m = file->private_data;
struct super_block *sb = m->private;
struct ll_sb_info *sbi = ll_s2sbi(sb);
+ bool val;
int rc;
- __s64 val;
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtobool_from_user(buffer, count, &val);
if (rc)
return rc;
spin_lock(&sbi->ll_lock);
- if (val == 1)
+ if (val)
sbi->ll_flags |= LL_SBI_PIO;
else
sbi->ll_flags &= ~LL_SBI_PIO;
struct seq_file *seq = file->private_data;
struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)seq->private);
char kernbuf[128];
+ bool val;
int rc;
- __s64 val;
if (count == 0)
return 0;
buffer += lprocfs_find_named_value(kernbuf, "unstable_check:", &count) -
kernbuf;
- rc = lprocfs_str_to_s64(buffer, count, &val);
+ rc = kstrtobool_from_user(buffer, count, &val);
if (rc < 0)
return rc;
/* borrow lru lock to set the value */
spin_lock(&sbi->ll_cache->ccc_lru_lock);
- sbi->ll_cache->ccc_unstable_check = !!val;
+ sbi->ll_cache->ccc_unstable_check = val;
spin_unlock(&sbi->ll_cache->ccc_lru_lock);
return count;
LPROC_SEQ_FOPS(ll_nosquash_nids);
struct lprocfs_vars lprocfs_llite_obd_vars[] = {
- { .name = "uuid",
- .fops = &ll_sb_uuid_fops },
- { .name = "fstype",
- .fops = &ll_fstype_fops },
{ .name = "site",
.fops = &ll_site_stats_fops },
- { .name = "blocksize",
- .fops = &ll_blksize_fops },
{ .name = "stat_blocksize",
.fops = &ll_stat_blksize_fops },
- { .name = "kbytestotal",
- .fops = &ll_kbytestotal_fops },
- { .name = "kbytesfree",
- .fops = &ll_kbytesfree_fops },
- { .name = "kbytesavail",
- .fops = &ll_kbytesavail_fops },
- { .name = "filestotal",
- .fops = &ll_filestotal_fops },
- { .name = "filesfree",
- .fops = &ll_filesfree_fops },
- { .name = "client_type",
- .fops = &ll_client_type_fops },
{ .name = "max_read_ahead_mb",
.fops = &ll_max_readahead_mb_fops },
{ .name = "max_read_ahead_per_file_mb",
.fops = &ll_max_read_ahead_whole_mb_fops },
{ .name = "max_cached_mb",
.fops = &ll_max_cached_mb_fops },
- { .name = "checksum_pages",
- .fops = &ll_checksum_fops },
{ .name = "stats_track_pid",
.fops = &ll_track_pid_fops },
{ .name = "stats_track_ppid",
.fops = &ll_fast_read_fops, },
{ .name = "pio",
.fops = &ll_pio_fops, },
+ { .name = "tiny_write",
+ .fops = &ll_tiny_write_fops, },
{ NULL }
};
#define MAX_STRING_SIZE 128
+static struct attribute *llite_attrs[] = {
+ &lustre_attr_blocksize.attr,
+ &lustre_attr_kbytestotal.attr,
+ &lustre_attr_kbytesfree.attr,
+ &lustre_attr_kbytesavail.attr,
+ &lustre_attr_filestotal.attr,
+ &lustre_attr_filesfree.attr,
+ &lustre_attr_client_type.attr,
+ &lustre_attr_fstype.attr,
+ &lustre_attr_uuid.attr,
+ &lustre_attr_checksum_pages.attr,
+ &lustre_attr_statahead_running_max.attr,
+ NULL,
+};
+
+static void llite_kobj_release(struct kobject *kobj)
+{
+ struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
+ ll_kset.kobj);
+ complete(&sbi->ll_kobj_unregister);
+}
+
+static struct kobj_type llite_ktype = {
+ .default_attrs = llite_attrs,
+ .sysfs_ops = &lustre_sysfs_ops,
+ .release = llite_kobj_release,
+};
+
static const struct llite_file_opcode {
__u32 opcode;
__u32 type;
LPROC_SEQ_FOPS_RO_TYPE(llite, name);
LPROC_SEQ_FOPS_RO_TYPE(llite, uuid);
-int lprocfs_ll_register_mountpoint(struct proc_dir_entry *parent,
- struct super_block *sb)
+int ll_debugfs_register_super(struct super_block *sb, const char *name)
{
- struct lprocfs_vars lvars[2];
struct lustre_sb_info *lsi = s2lsi(sb);
struct ll_sb_info *sbi = ll_s2sbi(sb);
- char name[MAX_STRING_SIZE + 1], *ptr;
- int err, id, len, rc;
- ENTRY;
+ struct lprocfs_vars lvars[2];
+ int err, id, rc;
+ ENTRY;
memset(lvars, 0, sizeof(lvars));
-
- name[MAX_STRING_SIZE] = '\0';
lvars[0].name = name;
LASSERT(sbi != NULL);
- /* Get fsname */
- len = strlen(lsi->lsi_lmd->lmd_profile);
- ptr = strrchr(lsi->lsi_lmd->lmd_profile, '-');
- if (ptr && (strcmp(ptr, "-client") == 0))
- len -= 7;
-
- /* Mount info */
- snprintf(name, MAX_STRING_SIZE, "%.*s-%p", len,
- lsi->lsi_lmd->lmd_profile, sb);
-
- sbi->ll_proc_root = lprocfs_register(name, parent, NULL, NULL);
+ sbi->ll_proc_root = lprocfs_register(name, proc_lustre_fs_root,
+ NULL, NULL);
if (IS_ERR(sbi->ll_proc_root)) {
err = PTR_ERR(sbi->ll_proc_root);
sbi->ll_proc_root = NULL;
sbi->ll_stats = lprocfs_alloc_stats(LPROC_LL_FILE_OPCODES,
LPROCFS_STATS_FLAG_NONE);
if (sbi->ll_stats == NULL)
- GOTO(out, err = -ENOMEM);
+ GOTO(out_proc, err = -ENOMEM);
+
/* do counter init */
for (id = 0; id < LPROC_LL_FILE_OPCODES; id++) {
__u32 type = llite_opcode_table[id].type;
(type & LPROCFS_CNTR_AVGMINMAX),
llite_opcode_table[id].opname, ptr);
}
+
err = lprocfs_register_stats(sbi->ll_proc_root, "stats", sbi->ll_stats);
if (err)
- GOTO(out, err);
+ GOTO(out_stats, err);
sbi->ll_ra_stats = lprocfs_alloc_stats(ARRAY_SIZE(ra_stat_string),
LPROCFS_STATS_FLAG_NONE);
if (sbi->ll_ra_stats == NULL)
- GOTO(out, err = -ENOMEM);
+ GOTO(out_stats, err = -ENOMEM);
for (id = 0; id < ARRAY_SIZE(ra_stat_string); id++)
lprocfs_counter_init(sbi->ll_ra_stats, id, 0,
err = lprocfs_register_stats(sbi->ll_proc_root, "read_ahead_stats",
sbi->ll_ra_stats);
if (err)
- GOTO(out, err);
-
+ GOTO(out_ra_stats, err);
err = lprocfs_add_vars(sbi->ll_proc_root, lprocfs_llite_obd_vars, sb);
if (err)
- GOTO(out, err);
+ GOTO(out_ra_stats, err);
+
+ /* Yes we also register sysfs mount kset here as well */
+ sbi->ll_kset.kobj.parent = llite_kobj;
+ sbi->ll_kset.kobj.ktype = &llite_ktype;
+ init_completion(&sbi->ll_kobj_unregister);
+ err = kobject_set_name(&sbi->ll_kset.kobj, "%s", name);
+ if (err)
+ GOTO(out_ra_stats, err);
+
+ err = kset_register(&sbi->ll_kset);
+ if (err)
+ GOTO(out_ra_stats, err);
+
+ lsi->lsi_kobj = kobject_get(&sbi->ll_kset.kobj);
+
+ RETURN(0);
+out_ra_stats:
+ lprocfs_free_stats(&sbi->ll_ra_stats);
+out_stats:
+ lprocfs_free_stats(&sbi->ll_stats);
+out_proc:
+ lprocfs_remove(&sbi->ll_proc_root);
-out:
- if (err) {
- lprocfs_remove(&sbi->ll_proc_root);
- lprocfs_free_stats(&sbi->ll_ra_stats);
- lprocfs_free_stats(&sbi->ll_stats);
- }
RETURN(err);
}
RETURN(err);
}
-void lprocfs_ll_unregister_mountpoint(struct ll_sb_info *sbi)
+void ll_debugfs_unregister_super(struct super_block *sb)
{
+ struct lustre_sb_info *lsi = s2lsi(sb);
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+
+ kobject_put(lsi->lsi_kobj);
+
+ kset_unregister(&sbi->ll_kset);
+ wait_for_completion(&sbi->ll_kobj_unregister);
+
if (sbi->ll_proc_root) {
lprocfs_remove(&sbi->ll_proc_root);
lprocfs_free_stats(&sbi->ll_ra_stats);
for (i = 0; i < LL_OFFSET_HIST_MAX; i++) {
if (offset[i].rw_pid != 0)
seq_printf(seq,
- "%3c %10d %14Lu %14Lu %17lu %17lu %14Lu",
+ "%3c %10d %14llu %14llu %17lu %17lu %14llu\n",
offset[i].rw_op == READ ? 'R' : 'W',
offset[i].rw_pid,
offset[i].rw_range_start,
for (i = 0; i < LL_PROCESS_HIST_MAX; i++) {
if (process[i].rw_pid != 0)
seq_printf(seq,
- "%3c %10d %14Lu %14Lu %17lu %17lu %14Lu",
+ "%3c %10d %14llu %14llu %17lu %17lu %14llu\n",
process[i].rw_op == READ ? 'R' : 'W',
process[i].rw_pid,
process[i].rw_range_start,
*/
static __s64 ll_stats_pid_write(const char __user *buf, size_t len)
{
- __s64 value = 1;
+ unsigned long long value = 1;
int rc;
char kernbuf[16];
- rc = lprocfs_str_to_s64(buf, len, &value);
-
+ rc = kstrtoull_from_user(buf, len, 0, &value);
if (rc < 0 && len < sizeof(kernbuf)) {
if (copy_from_user(kernbuf, buf, len))