Whamcloud - gitweb
LU-3319 procfs: move ost proc handling over to seq_file 28/7928/6
authorJames Simmons <uja.ornl@gmail.com>
Thu, 14 Nov 2013 14:48:08 +0000 (09:48 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 28 Dec 2013 03:23:43 +0000 (03:23 +0000)
Most of the current proc handling of the OST is already
based on seq_file handling except for the reporting of
the UUID of the OST. This patch moves this last piece
so that the OST layer will use strictly proc files with
seq_files.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: Idf2bc014ada9292d545f761aa27c777412a66671
Reviewed-on: http://review.whamcloud.com/7928
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ost/Makefile.in
lustre/ost/lproc_ost.c [deleted file]
lustre/ost/ost_handler.c
lustre/ost/ost_internal.h

index 6bd8be3..bae023e 100644 (file)
@@ -1,5 +1,5 @@
 MODULES := ost
-ost-objs := ost_handler.o lproc_ost.o
+ost-objs := ost_handler.o
 
 EXTRA_DIST = $(ost-objs:%.o=%.c) ost_internal.h
 
diff --git a/lustre/ost/lproc_ost.c b/lustre/ost/lproc_ost.c
deleted file mode 100644 (file)
index a978c51..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-#define DEBUG_SUBSYSTEM S_OST
-
-#include <obd_class.h>
-#include <lprocfs_status.h>
-#include <linux/seq_file.h>
-#include "ost_internal.h"
-
-#ifdef LPROCFS
-static struct lprocfs_vars lprocfs_ost_obd_vars[] = {
-        { "uuid",            lprocfs_rd_uuid,   0, 0 },
-        { 0 }
-};
-
-static struct lprocfs_vars lprocfs_ost_module_vars[] = {
-        { "num_refs",       lprocfs_rd_numrefs, 0, 0 },
-        { 0 }
-};
-
-void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars)
-{
-    lvars->module_vars  = lprocfs_ost_module_vars;
-    lvars->obd_vars     = lprocfs_ost_obd_vars;
-}
-
-#endif /* LPROCFS */
index 662a489..7567acf 100644 (file)
@@ -538,12 +538,20 @@ static int ost_io_hpreq_handler(struct ptlrpc_request *req)
 
 static struct cfs_cpt_table    *ost_io_cptable;
 
+#ifdef LPROCFS
+LPROC_SEQ_FOPS_RO_TYPE(ost, uuid);
+
+static struct lprocfs_seq_vars lprocfs_ost_obd_vars[] = {
+       { "uuid",       &ost_uuid_fops  },
+       { 0 }
+};
+#endif /* LPROCFS */
+
 /* Sigh - really, this is an OSS, the _server_, not the _target_ */
 static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
 {
        static struct ptlrpc_service_conf       svc_conf;
        struct ost_obd *ost = &obd->u.ost;
-       struct lprocfs_static_vars lvars;
        nodemask_t              *mask;
        int rc;
        ENTRY;
@@ -552,9 +560,10 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
         if (rc)
                 RETURN(rc);
 
-        lprocfs_ost_init_vars(&lvars);
-        lprocfs_obd_setup(obd, lvars.obd_vars);
-
+#ifdef LPROCFS
+       obd->obd_vars = lprocfs_ost_obd_vars;
+       lprocfs_seq_obd_setup(obd);
+#endif
        mutex_init(&ost->ost_health_mutex);
 
        svc_conf = (typeof(svc_conf)) {
@@ -877,15 +886,13 @@ static struct obd_ops ost_obd_ops = {
 
 static int __init ost_init(void)
 {
-       struct lprocfs_static_vars lvars;
        int rc;
 
        ENTRY;
 
-        lprocfs_ost_init_vars(&lvars);
        rc = class_register_type(&ost_obd_ops, NULL, NULL,
 #ifndef HAVE_ONLY_PROCFS_SEQ
-                               lvars.module_vars,
+                               NULL,
 #endif
                                LUSTRE_OSS_NAME, NULL);
 
index 8b475a1..63c8415 100644 (file)
 
 #define OSS_SERVICE_WATCHDOG_FACTOR 2
 
-#ifdef LPROCFS
-void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars);
-#else
-static void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars)
-{
-        memset(lvars, 0, sizeof(*lvars));
-}
-#endif
-
 #endif /* OST_INTERNAL_H */