]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging/lustre/osc: move suitable values from procfs to sysfs
authorOleg Drokin <green@linuxhacker.ru>
Thu, 21 May 2015 19:32:21 +0000 (15:32 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 May 2015 02:18:24 +0000 (11:18 +0900)
All single-value controls are moved from /proc/fs/lustre/osc/.../
to /sys/fs/lustre/osc/.../

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/osc/lproc_osc.c
drivers/staging/lustre/sysfs-fs-lustre

index 199913d7dddfba19a63c56b34ec047b6a3aabb9e..2f07ea5a736bf667e7898a0c4aaa86d45a5f44d5 100644 (file)
 #include <linux/seq_file.h>
 #include "osc_internal.h"
 
-static int osc_active_seq_show(struct seq_file *m, void *v)
+static ssize_t active_show(struct kobject *kobj, struct attribute *attr,
+                          char *buf)
 {
-       struct obd_device *dev = m->private;
-
-       LPROCFS_CLIMP_CHECK(dev);
-       seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
-       LPROCFS_CLIMP_EXIT(dev);
+       struct obd_device *dev = container_of(kobj, struct obd_device,
+                                             obd_kobj);
 
-       return 0;
+       return sprintf(buf, "%d\n", !dev->u.cli.cl_import->imp_deactive);
 }
 
-static ssize_t osc_active_seq_write(struct file *file,
-                               const char __user *buffer,
-                               size_t count, loff_t *off)
+static ssize_t active_store(struct kobject *kobj, struct attribute *attr,
+                           const char *buffer,
+                           size_t count)
 {
-       struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
-       int val, rc;
+       struct obd_device *dev = container_of(kobj, struct obd_device,
+                                             obd_kobj);
+       int rc;
+       unsigned long val;
 
-       rc = lprocfs_write_helper(buffer, count, &val);
+       rc = kstrtoul(buffer, 10, &val);
        if (rc)
                return rc;
        if (val < 0 || val > 1)
@@ -70,41 +70,43 @@ static ssize_t osc_active_seq_write(struct file *file,
        if (dev->u.cli.cl_import->imp_deactive == val)
                rc = ptlrpc_set_import_active(dev->u.cli.cl_import, val);
        else
-               CDEBUG(D_CONFIG, "activate %d: ignoring repeat request\n", val);
+               CDEBUG(D_CONFIG, "activate %ld: ignoring repeat request\n",
+                      val);
 
        return count;
 }
-LPROC_SEQ_FOPS(osc_active);
+LUSTRE_RW_ATTR(active);
 
-static int osc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
+static ssize_t max_rpcs_in_flight_show(struct kobject *kobj,
+                                      struct attribute *attr,
+                                      char *buf)
 {
-       struct obd_device *dev = m->private;
+       struct obd_device *dev = container_of(kobj, struct obd_device,
+                                             obd_kobj);
        struct client_obd *cli = &dev->u.cli;
 
-       client_obd_list_lock(&cli->cl_loi_list_lock);
-       seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight);
-       client_obd_list_unlock(&cli->cl_loi_list_lock);
-
-       return 0;
+       return sprintf(buf, "%u\n", cli->cl_max_rpcs_in_flight);
 }
 
-static ssize_t osc_max_rpcs_in_flight_seq_write(struct file *file,
-                       const char __user *buffer,
-                       size_t count, loff_t *off)
+static ssize_t max_rpcs_in_flight_store(struct kobject *kobj,
+                                       struct attribute *attr,
+                                       const char *buffer,
+                                       size_t count)
 {
-       struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
+       struct obd_device *dev = container_of(kobj, struct obd_device,
+                                             obd_kobj);
        struct client_obd *cli = &dev->u.cli;
        struct ptlrpc_request_pool *pool = cli->cl_import->imp_rq_pool;
-       int val, rc;
+       int rc;
+       unsigned long val;
 
-       rc = lprocfs_write_helper(buffer, count, &val);
+       rc = kstrtoul(buffer, 10, &val);
        if (rc)
                return rc;
 
        if (val < 1 || val > OSC_MAX_RIF_MAX)
                return -ERANGE;
 
-       LPROCFS_CLIMP_CHECK(dev);
        if (pool && val > cli->cl_max_rpcs_in_flight)
                pool->prp_populate(pool, val-cli->cl_max_rpcs_in_flight);
 
@@ -112,14 +114,16 @@ static ssize_t osc_max_rpcs_in_flight_seq_write(struct file *file,
        cli->cl_max_rpcs_in_flight = val;
        client_obd_list_unlock(&cli->cl_loi_list_lock);
 
-       LPROCFS_CLIMP_EXIT(dev);
        return count;
 }
-LPROC_SEQ_FOPS(osc_max_rpcs_in_flight);
+LUSTRE_RW_ATTR(max_rpcs_in_flight);
 
-static int osc_max_dirty_mb_seq_show(struct seq_file *m, void *v)
+static ssize_t max_dirty_mb_show(struct kobject *kobj,
+                                struct attribute *attr,
+                                char *buf)
 {
-       struct obd_device *dev = m->private;
+       struct obd_device *dev = container_of(kobj, struct obd_device,
+                                             obd_kobj);
        struct client_obd *cli = &dev->u.cli;
        long val;
        int mult;
@@ -129,22 +133,26 @@ static int osc_max_dirty_mb_seq_show(struct seq_file *m, void *v)
        client_obd_list_unlock(&cli->cl_loi_list_lock);
 
        mult = 1 << 20;
-       return lprocfs_seq_read_frac_helper(m, val, mult);
+       return lprocfs_read_frac_helper(buf, PAGE_SIZE, val, mult);
 }
 
-static ssize_t osc_max_dirty_mb_seq_write(struct file *file,
-                               const char __user *buffer,
-                               size_t count, loff_t *off)
+static ssize_t max_dirty_mb_store(struct kobject *kobj,
+                                 struct attribute *attr,
+                                 const char *buffer,
+                                 size_t count)
 {
-       struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
+       struct obd_device *dev = container_of(kobj, struct obd_device,
+                                             obd_kobj);
        struct client_obd *cli = &dev->u.cli;
-       int pages_number, mult, rc;
+       int rc;
+       unsigned long pages_number;
 
-       mult = 1 << (20 - PAGE_CACHE_SHIFT);
-       rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
+       rc = kstrtoul(buffer, 10, &pages_number);
        if (rc)
                return rc;
 
+       pages_number *= 1 << (20 - PAGE_CACHE_SHIFT); /* MB -> pages */
+
        if (pages_number <= 0 ||
            pages_number > OSC_MAX_DIRTY_MB_MAX << (20 - PAGE_CACHE_SHIFT) ||
            pages_number > totalram_pages / 4) /* 1/4 of RAM */
@@ -157,7 +165,7 @@ static ssize_t osc_max_dirty_mb_seq_write(struct file *file,
 
        return count;
 }
-LPROC_SEQ_FOPS(osc_max_dirty_mb);
+LUSTRE_RW_ATTR(max_dirty_mb);
 
 static int osc_cached_mb_seq_show(struct seq_file *m, void *v)
 {
@@ -210,44 +218,51 @@ static ssize_t osc_cached_mb_seq_write(struct file *file,
 }
 LPROC_SEQ_FOPS(osc_cached_mb);
 
-static int osc_cur_dirty_bytes_seq_show(struct seq_file *m, void *v)
+static ssize_t cur_dirty_bytes_show(struct kobject *kobj,
+                                   struct attribute *attr,
+                                   char *buf)
 {
-       struct obd_device *dev = m->private;
+       struct obd_device *dev = container_of(kobj, struct obd_device,
+                                             obd_kobj);
        struct client_obd *cli = &dev->u.cli;
+       int len;
 
        client_obd_list_lock(&cli->cl_loi_list_lock);
-       seq_printf(m, "%lu\n", cli->cl_dirty);
+       len = sprintf(buf, "%lu\n", cli->cl_dirty);
        client_obd_list_unlock(&cli->cl_loi_list_lock);
 
-       return 0;
+       return len;
 }
-LPROC_SEQ_FOPS_RO(osc_cur_dirty_bytes);
+LUSTRE_RO_ATTR(cur_dirty_bytes);
 
-static int osc_cur_grant_bytes_seq_show(struct seq_file *m, void *v)
+static ssize_t cur_grant_bytes_show(struct kobject *kobj,
+                                   struct attribute *attr,
+                                   char *buf)
 {
-       struct obd_device *dev = m->private;
+       struct obd_device *dev = container_of(kobj, struct obd_device,
+                                             obd_kobj);
        struct client_obd *cli = &dev->u.cli;
+       int len;
 
        client_obd_list_lock(&cli->cl_loi_list_lock);
-       seq_printf(m, "%lu\n", cli->cl_avail_grant);
+       len = sprintf(buf, "%lu\n", cli->cl_avail_grant);
        client_obd_list_unlock(&cli->cl_loi_list_lock);
 
-       return 0;
+       return len;
 }
 
-static ssize_t osc_cur_grant_bytes_seq_write(struct file *file,
-                               const char __user *buffer,
-                               size_t count, loff_t *off)
+static ssize_t cur_grant_bytes_store(struct kobject *kobj,
+                                    struct attribute *attr,
+                                    const char *buffer,
+                                    size_t count)
 {
-       struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kobj);
        struct client_obd *cli = &obd->u.cli;
-       int             rc;
-       __u64         val;
-
-       if (obd == NULL)
-               return 0;
+       int rc;
+       unsigned long long val;
 
-       rc = lprocfs_write_u64_helper(buffer, count, &val);
+       rc = kstrtoull(buffer, 10, &val);
        if (rc)
                return rc;
 
@@ -255,54 +270,56 @@ static ssize_t osc_cur_grant_bytes_seq_write(struct file *file,
        client_obd_list_lock(&cli->cl_loi_list_lock);
        if (val >= cli->cl_avail_grant) {
                client_obd_list_unlock(&cli->cl_loi_list_lock);
-               return 0;
+               return -EINVAL;
        }
        client_obd_list_unlock(&cli->cl_loi_list_lock);
 
-       LPROCFS_CLIMP_CHECK(obd);
        if (cli->cl_import->imp_state == LUSTRE_IMP_FULL)
                rc = osc_shrink_grant_to_target(cli, val);
-       LPROCFS_CLIMP_EXIT(obd);
        if (rc)
                return rc;
        return count;
 }
-LPROC_SEQ_FOPS(osc_cur_grant_bytes);
+LUSTRE_RW_ATTR(cur_grant_bytes);
 
-static int osc_cur_lost_grant_bytes_seq_show(struct seq_file *m, void *v)
+static ssize_t cur_lost_grant_bytes_show(struct kobject *kobj,
+                                        struct attribute *attr,
+                                        char *buf)
 {
-       struct obd_device *dev = m->private;
+       struct obd_device *dev = container_of(kobj, struct obd_device,
+                                             obd_kobj);
        struct client_obd *cli = &dev->u.cli;
+       int len;
 
        client_obd_list_lock(&cli->cl_loi_list_lock);
-       seq_printf(m, "%lu\n", cli->cl_lost_grant);
+       len = sprintf(buf, "%lu\n", cli->cl_lost_grant);
        client_obd_list_unlock(&cli->cl_loi_list_lock);
 
-       return 0;
+       return len;
 }
-LPROC_SEQ_FOPS_RO(osc_cur_lost_grant_bytes);
+LUSTRE_RO_ATTR(cur_lost_grant_bytes);
 
-static int osc_grant_shrink_interval_seq_show(struct seq_file *m, void *v)
+static ssize_t grant_shrink_interval_show(struct kobject *kobj,
+                                         struct attribute *attr,
+                                         char *buf)
 {
-       struct obd_device *obd = m->private;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kobj);
 
-       if (obd == NULL)
-               return 0;
-       seq_printf(m, "%d\n", obd->u.cli.cl_grant_shrink_interval);
-       return 0;
+       return sprintf(buf, "%d\n", obd->u.cli.cl_grant_shrink_interval);
 }
 
-static ssize_t osc_grant_shrink_interval_seq_write(struct file *file,
-                               const char __user *buffer,
-                               size_t count, loff_t *off)
+static ssize_t grant_shrink_interval_store(struct kobject *kobj,
+                                          struct attribute *attr,
+                                          const char *buffer,
+                                          size_t count)
 {
-       struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
-       int val, rc;
-
-       if (obd == NULL)
-               return 0;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kobj);
+       int rc;
+       unsigned long val;
 
-       rc = lprocfs_write_helper(buffer, count, &val);
+       rc = kstrtoul(buffer, 10, &val);
        if (rc)
                return rc;
 
@@ -313,30 +330,29 @@ static ssize_t osc_grant_shrink_interval_seq_write(struct file *file,
 
        return count;
 }
-LPROC_SEQ_FOPS(osc_grant_shrink_interval);
+LUSTRE_RW_ATTR(grant_shrink_interval);
 
-static int osc_checksum_seq_show(struct seq_file *m, void *v)
+static ssize_t checksums_show(struct kobject *kobj,
+                             struct attribute *attr,
+                             char *buf)
 {
-       struct obd_device *obd = m->private;
-
-       if (obd == NULL)
-               return 0;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kobj);
 
-       seq_printf(m, "%d\n", obd->u.cli.cl_checksum ? 1 : 0);
-       return 0;
+       return sprintf(buf, "%d\n", obd->u.cli.cl_checksum ? 1 : 0);
 }
 
-static ssize_t osc_checksum_seq_write(struct file *file,
-                               const char __user *buffer,
-                               size_t count, loff_t *off)
+static ssize_t checksums_store(struct kobject *kobj,
+                              struct attribute *attr,
+                              const char *buffer,
+                              size_t count)
 {
-       struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
-       int val, rc;
-
-       if (obd == NULL)
-               return 0;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kobj);
+       int rc;
+       unsigned long val;
 
-       rc = lprocfs_write_helper(buffer, count, &val);
+       rc = kstrtoul(buffer, 10, &val);
        if (rc)
                return rc;
 
@@ -344,7 +360,7 @@ static ssize_t osc_checksum_seq_write(struct file *file,
 
        return count;
 }
-LPROC_SEQ_FOPS(osc_checksum);
+LUSTRE_RW_ATTR(checksums);
 
 static int osc_checksum_type_seq_show(struct seq_file *m, void *v)
 {
@@ -400,22 +416,27 @@ static ssize_t osc_checksum_type_seq_write(struct file *file,
 }
 LPROC_SEQ_FOPS(osc_checksum_type);
 
-static int osc_resend_count_seq_show(struct seq_file *m, void *v)
+static ssize_t resend_count_show(struct kobject *kobj,
+                            struct attribute *attr,
+                            char *buf)
 {
-       struct obd_device *obd = m->private;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kobj);
 
-       seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_resends));
-       return 0;
+       return sprintf(buf, "%u\n", atomic_read(&obd->u.cli.cl_resends));
 }
 
-static ssize_t osc_resend_count_seq_write(struct file *file,
-                               const char __user *buffer,
-                               size_t count, loff_t *off)
+static ssize_t resend_count_store(struct kobject *kobj,
+                             struct attribute *attr,
+                             const char *buffer,
+                             size_t count)
 {
-       struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
-       int val, rc;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kobj);
+       int rc;
+       unsigned long val;
 
-       rc = lprocfs_write_helper(buffer, count, &val);
+       rc = kstrtoul(buffer, 10, &val);
        if (rc)
                return rc;
 
@@ -426,75 +447,94 @@ static ssize_t osc_resend_count_seq_write(struct file *file,
 
        return count;
 }
-LPROC_SEQ_FOPS(osc_resend_count);
+LUSTRE_RW_ATTR(resend_count);
 
-static int osc_contention_seconds_seq_show(struct seq_file *m, void *v)
+static ssize_t contention_seconds_show(struct kobject *kobj,
+                                      struct attribute *attr,
+                                      char *buf)
 {
-       struct obd_device *obd = m->private;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kobj);
        struct osc_device *od  = obd2osc_dev(obd);
 
-       seq_printf(m, "%u\n", od->od_contention_time);
-       return 0;
+       return sprintf(buf, "%u\n", od->od_contention_time);
 }
 
-static ssize_t osc_contention_seconds_seq_write(struct file *file,
-                                       const char __user *buffer,
-                                       size_t count, loff_t *off)
+static ssize_t contention_seconds_store(struct kobject *kobj,
+                                       struct attribute *attr,
+                                       const char *buffer,
+                                       size_t count)
 {
-       struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kobj);
        struct osc_device *od  = obd2osc_dev(obd);
 
        return lprocfs_write_helper(buffer, count, &od->od_contention_time) ?:
                count;
 }
-LPROC_SEQ_FOPS(osc_contention_seconds);
+LUSTRE_RW_ATTR(contention_seconds);
 
-static int osc_lockless_truncate_seq_show(struct seq_file *m, void *v)
+static ssize_t lockless_truncate_show(struct kobject *kobj,
+                                     struct attribute *attr,
+                                     char *buf)
 {
-       struct obd_device *obd = m->private;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kobj);
        struct osc_device *od  = obd2osc_dev(obd);
 
-       seq_printf(m, "%u\n", od->od_lockless_truncate);
-       return 0;
+       return sprintf(buf, "%u\n", od->od_lockless_truncate);
 }
 
-static ssize_t osc_lockless_truncate_seq_write(struct file *file,
-                                       const char __user *buffer,
-                                       size_t count, loff_t *off)
+static ssize_t lockless_truncate_store(struct kobject *kobj,
+                                      struct attribute *attr,
+                                      const char *buffer,
+                                      size_t count)
 {
-       struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kobj);
        struct osc_device *od  = obd2osc_dev(obd);
 
        return lprocfs_write_helper(buffer, count, &od->od_lockless_truncate) ?:
                count;
 }
-LPROC_SEQ_FOPS(osc_lockless_truncate);
+LUSTRE_RW_ATTR(lockless_truncate);
 
-static int osc_destroys_in_flight_seq_show(struct seq_file *m, void *v)
+static ssize_t destroys_in_flight_show(struct kobject *kobj,
+                                      struct attribute *attr,
+                                      char *buf)
 {
-       struct obd_device *obd = m->private;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kobj);
 
-       seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_destroy_in_flight));
-       return 0;
+       return sprintf(buf, "%u\n",
+                      atomic_read(&obd->u.cli.cl_destroy_in_flight));
 }
-LPROC_SEQ_FOPS_RO(osc_destroys_in_flight);
+LUSTRE_RO_ATTR(destroys_in_flight);
 
-static int osc_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *v)
+static ssize_t max_pages_per_rpc_show(struct kobject *kobj,
+                                     struct attribute *attr,
+                                     char *buf)
 {
-       return lprocfs_obd_rd_max_pages_per_rpc(m, m->private);
+       struct obd_device *dev = container_of(kobj, struct obd_device,
+                                             obd_kobj);
+       struct client_obd *cli = &dev->u.cli;
+
+       return sprintf(buf, "%d\n", cli->cl_max_pages_per_rpc);
 }
 
-static ssize_t osc_obd_max_pages_per_rpc_seq_write(struct file *file,
-                               const char __user *buffer,
-                               size_t count, loff_t *off)
+static ssize_t max_pages_per_rpc_store(struct kobject *kobj,
+                                      struct attribute *attr,
+                                      const char *buffer,
+                                      size_t count)
 {
-       struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
+       struct obd_device *dev = container_of(kobj, struct obd_device,
+                                             obd_kobj);
        struct client_obd *cli = &dev->u.cli;
        struct obd_connect_data *ocd = &cli->cl_import->imp_connect_data;
        int chunk_mask, rc;
-       __u64 val;
+       unsigned long long val;
 
-       rc = lprocfs_write_u64_helper(buffer, count, &val);
+       rc = kstrtoull(buffer, 10, &val);
        if (rc)
                return rc;
 
@@ -502,23 +542,19 @@ static ssize_t osc_obd_max_pages_per_rpc_seq_write(struct file *file,
        if (val >= ONE_MB_BRW_SIZE)
                val >>= PAGE_CACHE_SHIFT;
 
-       LPROCFS_CLIMP_CHECK(dev);
-
        chunk_mask = ~((1 << (cli->cl_chunkbits - PAGE_CACHE_SHIFT)) - 1);
        /* max_pages_per_rpc must be chunk aligned */
        val = (val + ~chunk_mask) & chunk_mask;
        if (val == 0 || val > ocd->ocd_brw_size >> PAGE_CACHE_SHIFT) {
-               LPROCFS_CLIMP_EXIT(dev);
                return -ERANGE;
        }
        client_obd_list_lock(&cli->cl_loi_list_lock);
        cli->cl_max_pages_per_rpc = val;
        client_obd_list_unlock(&cli->cl_loi_list_lock);
 
-       LPROCFS_CLIMP_EXIT(dev);
        return count;
 }
-LPROC_SEQ_FOPS(osc_obd_max_pages_per_rpc);
+LUSTRE_RW_ATTR(max_pages_per_rpc);
 
 LPROC_SEQ_FOPS_RO_TYPE(osc, connect_flags);
 LPROC_SEQ_FOPS_RO_TYPE(osc, server_uuid);
@@ -537,22 +573,9 @@ static struct lprocfs_vars lprocfs_osc_obd_vars[] = {
        /*{ "filegroups",      lprocfs_rd_filegroups,  NULL, 0 },*/
        { "ost_server_uuid", &osc_server_uuid_fops, NULL, 0 },
        { "ost_conn_uuid",   &osc_conn_uuid_fops, NULL, 0 },
-       { "active",          &osc_active_fops, NULL },
-       { "max_pages_per_rpc", &osc_obd_max_pages_per_rpc_fops, NULL },
-       { "max_rpcs_in_flight", &osc_max_rpcs_in_flight_fops, NULL },
-       { "destroys_in_flight", &osc_destroys_in_flight_fops, NULL, 0 },
-       { "max_dirty_mb",    &osc_max_dirty_mb_fops, NULL },
        { "osc_cached_mb",   &osc_cached_mb_fops, NULL },
-       { "cur_dirty_bytes", &osc_cur_dirty_bytes_fops, NULL, 0 },
-       { "cur_grant_bytes", &osc_cur_grant_bytes_fops, NULL },
-       { "cur_lost_grant_bytes", &osc_cur_lost_grant_bytes_fops, NULL, 0},
-       { "grant_shrink_interval", &osc_grant_shrink_interval_fops, NULL },
-       { "checksums",       &osc_checksum_fops, NULL },
        { "checksum_type",   &osc_checksum_type_fops, NULL },
-       { "resend_count",    &osc_resend_count_fops, NULL},
        { "timeouts",        &osc_timeouts_fops, NULL, 0 },
-       { "contention_seconds", &osc_contention_seconds_fops, NULL },
-       { "lockless_truncate",  &osc_lockless_truncate_fops, NULL },
        { "import",             &osc_import_fops, NULL },
        { "state",              &osc_state_fops, NULL, 0 },
        { "pinger_recov",       &osc_pinger_recov_fops, NULL },
@@ -724,7 +747,29 @@ int lproc_osc_attach_seqstat(struct obd_device *dev)
        return rc;
 }
 
+static struct attribute *osc_attrs[] = {
+       &lustre_attr_active.attr,
+       &lustre_attr_checksums.attr,
+       &lustre_attr_contention_seconds.attr,
+       &lustre_attr_cur_dirty_bytes.attr,
+       &lustre_attr_cur_grant_bytes.attr,
+       &lustre_attr_cur_lost_grant_bytes.attr,
+       &lustre_attr_destroys_in_flight.attr,
+       &lustre_attr_grant_shrink_interval.attr,
+       &lustre_attr_lockless_truncate.attr,
+       &lustre_attr_max_dirty_mb.attr,
+       &lustre_attr_max_pages_per_rpc.attr,
+       &lustre_attr_max_rpcs_in_flight.attr,
+       &lustre_attr_resend_count.attr,
+       NULL,
+};
+
+static struct attribute_group osc_attr_group = {
+       .attrs = osc_attrs,
+};
+
 void lprocfs_osc_init_vars(struct lprocfs_static_vars *lvars)
 {
+       lvars->sysfs_vars  = &osc_attr_group;
        lvars->obd_vars    = lprocfs_osc_obd_vars;
 }
index a99078c25d6a81e7b2fe255af8c8efcd3287d8a4..5e2d55b5b173435a96da15724f292dc119ec9418 100644 (file)
@@ -391,7 +391,7 @@ Description:
                Maximum number of readdir pages to fit into a single readdir
                RPC.
 
-What:          /sys/fs/lustre/mdc/{connection_name}/max_rpcs_in_flight
+What:          /sys/fs/lustre/{mdc,osc}/{connection_name}/max_rpcs_in_flight
 Date:          May 2015
 Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
 Description:
@@ -400,3 +400,108 @@ Description:
                latency links, but has a chance of overloading a server
                if you have too many clients like this.
                Default: 8
+
+What:          /sys/fs/lustre/osc/{connection_name}/max_pages_per_rpc
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Maximum number of pages to fit into a single RPC.
+               Typically bigger RPCs allow for better performance.
+               Default: however many pages to form 1M of data (256 pages
+               for 4K page sized platforms)
+
+What:          /sys/fs/lustre/osc/{connection_name}/active
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Controls accessibility of this connection. If set to 0,
+               fail all accesses immediately.
+
+What:          /sys/fs/lustre/osc/{connection_name}/checksums
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Controls whenever to checksum bulk RPC data over the wire
+               to this target.
+               1: enable (default) ; 0: disable
+
+What:          /sys/fs/lustre/osc/{connection_name}/contention_seconds
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Controls for how long to consider a file contended once
+               indicated as such by the server.
+               When a file is considered contended, all operations switch to
+               synchronous lockless mode to avoid cache and lock pingpong.
+
+What:          /sys/fs/lustre/osc/{connection_name}/cur_dirty_bytes
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Displays how many dirty bytes is presently in the cache for this
+               target.
+
+What:          /sys/fs/lustre/osc/{connection_name}/cur_grant_bytes
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Shows how many bytes we have as a "dirty cache" grant from the
+               server. Writing a value smaller than shown allows to release
+               some grant back to the server.
+               Dirty cache grant is a way Lustre ensures that cached successful
+               writes on client do not end up discarded by the server due to
+               lack of space later on.
+
+What:          /sys/fs/lustre/osc/{connection_name}/cur_lost_grant_bytes
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Shows how many granted bytes were released to the server due
+               to lack of write activity on this client.
+
+What:          /sys/fs/lustre/osc/{connection_name}/grant_shrink_interval
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Number of seconds with no write activity for this target
+               to start releasing dirty grant back to the server.
+
+What:          /sys/fs/lustre/osc/{connection_name}/destroys_in_flight
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Number of DESTROY RPCs currently in flight to this target.
+
+What:          /sys/fs/lustre/osc/{connection_name}/lockless_truncate
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Controls whether lockless truncate RPCs are allowed to this
+               target.
+               Lockless truncate causes server to perform the locking which
+               is beneficial if the truncate is not followed by a write
+               immediately.
+               1: enable ; 0: disable (default)
+
+What:          /sys/fs/lustre/osc/{connection_name}/max_dirty_mb
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Controls how much dirty data this client can accumulate
+               for this target. This is orthogonal to dirty grant and is
+               a hard limit even if the server would allow a bigger dirty
+               cache.
+               While allowing higher dirty cache is beneficial for write
+               performance, flushing write cache takes longer and as such
+               the node might be more prone to OOMs.
+               Having this value set too low might result in not being able
+               to sent too many parallel WRITE RPCs.
+               Default: 32
+
+What:          /sys/fs/lustre/osc/{connection_name}/resend_count
+Date:          May 2015
+Contact:       "Oleg Drokin" <oleg.drokin@intel.com>
+Description:
+               Controls how many times to try and resend RPCs to this target
+               that failed with "recoverable" status, such as EAGAIN,
+               ENOMEM.