From: James Simmons Date: Thu, 14 Nov 2013 14:48:08 +0000 (-0500) Subject: LU-3319 procfs: move ost proc handling over to seq_file X-Git-Tag: 2.5.53~3 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=14b115c8e24dd99fc27e17d77865a238f0a767e2 LU-3319 procfs: move ost proc handling over to seq_file 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 Change-Id: Idf2bc014ada9292d545f761aa27c777412a66671 Reviewed-on: http://review.whamcloud.com/7928 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Yang Sheng Reviewed-by: Oleg Drokin --- diff --git a/lustre/ost/Makefile.in b/lustre/ost/Makefile.in index 6bd8be3..bae023e 100644 --- a/lustre/ost/Makefile.in +++ b/lustre/ost/Makefile.in @@ -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 index a978c51..0000000 --- a/lustre/ost/lproc_ost.c +++ /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 -#include -#include -#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 */ diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 662a489..7567acf 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -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); diff --git a/lustre/ost/ost_internal.h b/lustre/ost/ost_internal.h index 8b475a1..63c8415 100644 --- a/lustre/ost/ost_internal.h +++ b/lustre/ost/ost_internal.h @@ -39,13 +39,4 @@ #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 */