aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch')
-rw-r--r--sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch207
1 files changed, 207 insertions, 0 deletions
diff --git a/sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
new file mode 100644
index 000000000..939f1fcc1
--- /dev/null
+++ b/sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
@@ -0,0 +1,207 @@
+From c05c0be01814527d8d3762963c7a6d4c28189d2d Mon Sep 17 00:00:00 2001
+From: James Simmons <uja.ornl@gmail.com>
+Date: Fri, 3 Jan 2014 09:55:26 -0500
+Subject: [PATCH 02/12] LU-3319 procfs: update zfs proc handling to seq_files
+
+Migrate all zfs proc handling to using strictly seq_files.
+
+Signed-off-by: James Simmons <uja.ornl@gmail.com>
+Change-Id: I6dc7e65c3e74e7934a17939815ec3c334fac58c7
+---
+ lustre/osd-zfs/osd_handler.c | 13 ++++---
+ lustre/osd-zfs/osd_internal.h | 3 --
+ lustre/osd-zfs/osd_lproc.c | 88 ++++++++++++++++++++++++-------------------
+ 3 files changed, 57 insertions(+), 47 deletions(-)
+
+diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c
+index d4193cd..36bf6a4 100644
+--- a/lustre/osd-zfs/osd_handler.c
++++ b/lustre/osd-zfs/osd_handler.c
+@@ -745,6 +745,7 @@ static int osd_device_init(const struct lu_env *env, struct lu_device *d,
+ static int osd_process_config(const struct lu_env *env,
+ struct lu_device *d, struct lustre_cfg *cfg)
+ {
++ struct obd_device *obd = d->ld_obd;
+ struct osd_device *o = osd_dev(d);
+ int rc;
+ ENTRY;
+@@ -758,12 +759,12 @@ static int osd_process_config(const struct lu_env *env,
+ break;
+ case LCFG_PARAM: {
+ LASSERT(&o->od_dt_dev);
+- rc = class_process_proc_param(PARAM_OSD, lprocfs_osd_obd_vars,
+- cfg, &o->od_dt_dev);
++ rc = class_process_proc_seq_param(PARAM_OSD, obd->obd_vars,
++ cfg, &o->od_dt_dev);
+ if (rc > 0 || rc == -ENOSYS)
+- rc = class_process_proc_param(PARAM_OST,
+- lprocfs_osd_obd_vars,
+- cfg, &o->od_dt_dev);
++ rc = class_process_proc_seq_param(PARAM_OST,
++ obd->obd_vars, cfg,
++ &o->od_dt_dev);
+ break;
+ }
+ default:
+@@ -911,7 +912,7 @@ int __init osd_init(void)
+
+ rc = class_register_type(&osd_obd_device_ops, NULL, NULL,
+ #ifndef HAVE_ONLY_PROCFS_SEQ
+- lprocfs_osd_module_vars,
++ NULL,
+ #endif
+ LUSTRE_OSD_ZFS_NAME, &osd_device_type);
+ if (rc)
+diff --git a/lustre/osd-zfs/osd_internal.h b/lustre/osd-zfs/osd_internal.h
+index bc51cb1..77b118f 100644
+--- a/lustre/osd-zfs/osd_internal.h
++++ b/lustre/osd-zfs/osd_internal.h
+@@ -402,9 +402,6 @@ enum {
+ };
+
+ /* osd_lproc.c */
+-extern struct lprocfs_vars lprocfs_osd_obd_vars[];
+-extern struct lprocfs_vars lprocfs_osd_module_vars[];
+-
+ int osd_procfs_init(struct osd_device *osd, const char *name);
+ int osd_procfs_fini(struct osd_device *osd);
+
+diff --git a/lustre/osd-zfs/osd_lproc.c b/lustre/osd-zfs/osd_lproc.c
+index 0854ce6..a7ce60d 100644
+--- a/lustre/osd-zfs/osd_lproc.c
++++ b/lustre/osd-zfs/osd_lproc.c
+@@ -107,27 +107,26 @@ out:
+ RETURN(result);
+ }
+
+-static int lprocfs_osd_rd_fstype(char *page, char **start, off_t off,
+- int count, int *eof, void *data)
++static int zfs_osd_fstype_seq_show(struct seq_file *m, void *data)
+ {
+- return snprintf(page, count, "zfs\n");
++ return seq_printf(m, "zfs\n");
+ }
++LPROC_SEQ_FOPS_RO(zfs_osd_fstype);
+
+-static int lprocfs_osd_rd_mntdev(char *page, char **start, off_t off, int count,
+- int *eof, void *data)
++static int zfs_osd_mntdev_seq_show(struct seq_file *m, void *data)
+ {
+- struct osd_device *osd = osd_dt_dev((struct dt_device *)data);
++ struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private);
+
+ LASSERT(osd != NULL);
+- *eof = 1;
+-
+- return snprintf(page, count, "%s\n", osd->od_mntdev);
++ return seq_printf(m, "%s\n", osd->od_mntdev);
+ }
++LPROC_SEQ_FOPS_RO(zfs_osd_mntdev);
+
+-static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer,
+- unsigned long count, void *data)
++static ssize_t
++lprocfs_osd_force_sync_seq_write(struct file *file, const char *buffer,
++ size_t count, loff_t *off)
+ {
+- struct dt_device *dt = data;
++ struct dt_device *dt = ((struct seq_file *)file->private_data)->private;
+ struct lu_env env;
+ int rc;
+
+@@ -139,20 +138,21 @@ static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer,
+
+ return rc == 0 ? count : rc;
+ }
++LPROC_SEQ_FOPS_WO_TYPE(zfs, osd_force_sync);
+
+-static int lprocfs_osd_rd_iused_est(char *page, char **start, off_t off, int count,
+- int *eof, void *data)
++static int zfs_osd_iused_est_seq_show(struct seq_file *m, void *data)
+ {
+- struct osd_device *osd = osd_dt_dev((struct dt_device *)data);
++ struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private);
+ LASSERT(osd != NULL);
+
+- return snprintf(page, count, "%d\n", osd->od_quota_iused_est);
++ return seq_printf(m, "%d\n", osd->od_quota_iused_est);
+ }
+
+-static int lprocfs_osd_wr_iused_est(struct file *file, const char *buffer,
+- unsigned long count, void *data)
++static ssize_t zfs_osd_iused_est_seq_write(struct file *file, const char *buffer,
++ size_t count, loff_t *off)
+ {
+- struct osd_device *osd = osd_dt_dev((struct dt_device *)data);
++ struct dt_device *dt = ((struct seq_file *)file->private_data)->private;
++ struct osd_device *osd = osd_dt_dev(dt);
+ int rc, val;
+
+ LASSERT(osd != NULL);
+@@ -165,24 +165,36 @@ static int lprocfs_osd_wr_iused_est(struct file *file, const char *buffer,
+
+ return count;
+ }
+-
+-struct lprocfs_vars lprocfs_osd_obd_vars[] = {
+- { "blocksize", lprocfs_dt_rd_blksize, 0, 0 },
+- { "kbytestotal", lprocfs_dt_rd_kbytestotal, 0, 0 },
+- { "kbytesfree", lprocfs_dt_rd_kbytesfree, 0, 0 },
+- { "kbytesavail", lprocfs_dt_rd_kbytesavail, 0, 0 },
+- { "filestotal", lprocfs_dt_rd_filestotal, 0, 0 },
+- { "filesfree", lprocfs_dt_rd_filesfree, 0, 0 },
+- { "fstype", lprocfs_osd_rd_fstype, 0, 0 },
+- { "mntdev", lprocfs_osd_rd_mntdev, 0, 0 },
+- { "force_sync", 0, lprocfs_osd_wr_force_sync },
+- { "quota_iused_estimate", lprocfs_osd_rd_iused_est,
+- lprocfs_osd_wr_iused_est, 0, 0 },
+- { 0 }
+-};
+-
+-struct lprocfs_vars lprocfs_osd_module_vars[] = {
+- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
++LPROC_SEQ_FOPS(zfs_osd_iused_est);
++
++LPROC_SEQ_FOPS_RO_TYPE(zfs, dt_blksize);
++LPROC_SEQ_FOPS_RO_TYPE(zfs, dt_kbytestotal);
++LPROC_SEQ_FOPS_RO_TYPE(zfs, dt_kbytesfree);
++LPROC_SEQ_FOPS_RO_TYPE(zfs, dt_kbytesavail);
++LPROC_SEQ_FOPS_RO_TYPE(zfs, dt_filestotal);
++LPROC_SEQ_FOPS_RO_TYPE(zfs, dt_filesfree);
++
++struct lprocfs_seq_vars lprocfs_osd_obd_vars[] = {
++ { .name = "blocksize",
++ .fops = &zfs_dt_blksize_fops },
++ { .name = "kbytestotal",
++ .fops = &zfs_dt_kbytestotal_fops },
++ { .name = "kbytesfree",
++ .fops = &zfs_dt_kbytesfree_fops },
++ { .name = "kbytesavail",
++ .fops = &zfs_dt_kbytesavail_fops },
++ { .name = "filestotal",
++ .fops = &zfs_dt_filestotal_fops },
++ { .name = "filesfree",
++ .fops = &zfs_dt_filesfree_fops },
++ { .name = "fstype",
++ .fops = &zfs_osd_fstype_fops },
++ { .name = "mntdev",
++ .fops = &zfs_osd_mntdev_fops },
++ { .name = "force_sync",
++ .fops = &zfs_osd_force_sync_fops },
++ { .name = "quota_iused_estimate",
++ .fops = &zfs_osd_iused_est_fops },
+ { 0 }
+ };
+
+@@ -202,7 +214,7 @@ int osd_procfs_init(struct osd_device *osd, const char *name)
+ LASSERT(name != NULL);
+ LASSERT(type != NULL);
+
+- osd->od_proc_entry = lprocfs_register(name, type->typ_procroot,
++ osd->od_proc_entry = lprocfs_seq_register(name, type->typ_procroot,
+ lprocfs_osd_obd_vars, &osd->od_dt_dev);
+ if (IS_ERR(osd->od_proc_entry)) {
+ rc = PTR_ERR(osd->od_proc_entry);
+--
+1.8.5.3
+