From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8392D1387FD for ; Wed, 2 Apr 2014 10:50:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0B5F3E0B89; Wed, 2 Apr 2014 10:50:25 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 39846E0B89 for ; Wed, 2 Apr 2014 10:50:24 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1412F33F4B3 for ; Wed, 2 Apr 2014 10:50:23 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 8E51B18874 for ; Wed, 2 Apr 2014 10:50:21 +0000 (UTC) From: "Alexey Shvetsov" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Alexey Shvetsov" Message-ID: <1396435798.43571edfe360d4cbbf44cf273b8da80c9c3ba80e.alexxy@gentoo> Subject: [gentoo-commits] proj/sci:master commit in: sys-cluster/lustre/, sys-cluster/lustre/files/ X-VCS-Repository: proj/sci X-VCS-Files: sys-cluster/lustre/ChangeLog sys-cluster/lustre/files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch sys-cluster/lustre/files/0001-LU-3319-procfs-fix-symlink-handling.patch sys-cluster/lustre/files/0002-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch sys-cluster/lustre/files/0003-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch sys-cluster/lustre/files/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch sys-cluster/lustre/files/0004-LU-3319-procfs-fix-symlink-handling.patch sys-cluster/lustre/files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch sys-cluster/lustre/files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch sys-cluster/lustre/files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch sys-cluster/lustre/ files/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch sys-cluster/lustre/files/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch sys-cluster/lustre/files/0010-LU-3319-lprocfs-client-side-cleanups.patch sys-cluster/lustre/files/0011-LU-3974-llite-use-new-struct-dir_context.patch sys-cluster/lustre/files/0012-LU-3974-llite-invalidatepage-api-changed.patch sys-cluster/lustre/lustre-9999.ebuild X-VCS-Directories: sys-cluster/lustre/ sys-cluster/lustre/files/ X-VCS-Committer: alexxy X-VCS-Committer-Name: Alexey Shvetsov X-VCS-Revision: 43571edfe360d4cbbf44cf273b8da80c9c3ba80e X-VCS-Branch: master Date: Wed, 2 Apr 2014 10:50:21 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 7acdb7bb-34df-4543-b760-8f2140db69d9 X-Archives-Hash: 2192e70d0b4db2d23a4cf43ae837bc3e commit: 43571edfe360d4cbbf44cf273b8da80c9c3ba80e Author: Alexey Shvetsov gentoo org> AuthorDate: Wed Apr 2 10:49:58 2014 +0000 Commit: Alexey Shvetsov gentoo org> CommitDate: Wed Apr 2 10:49:58 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=43571edf Lustre need more patches Package-Manager: portage-2.2.10 RepoMan-Options: --force --- sys-cluster/lustre/ChangeLog | 22 + ...ld-make-AC-check-for-linux-arch-sandbox-f.patch | 95 -- .../0001-LU-3319-procfs-fix-symlink-handling.patch | 1132 ++++++++++++++++++++ ...cfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch | 123 +++ ...fs-update-zfs-proc-handling-to-seq_files.patch} | 67 +- .../0004-LU-3319-procfs-fix-symlink-handling.patch | 371 ------- ...ocfs-move-mgs-proc-handling-to-seq_files.patch} | 22 +- ...rocfs-move-osp-proc-handling-to-seq_files.patch | 192 ++-- ...rocfs-move-lod-proc-handling-to-seq_files.patch | 200 ++-- ...fs-move-mdt-mds-proc-handling-to-seq_fil.patch} | 215 ++-- ...fs-move-mdd-ofd-proc-handling-to-seq_fil.patch} | 455 +++++--- ...cfs-update-ldiskfs-proc-handling-to-seq_f.patch | 204 ++-- ...0010-LU-3319-lprocfs-client-side-cleanups.patch | 463 -------- ...-LU-3974-llite-use-new-struct-dir_context.patch | 254 ----- ...-LU-3974-llite-invalidatepage-api-changed.patch | 134 --- sys-cluster/lustre/lustre-9999.ebuild | 15 +- 16 files changed, 2028 insertions(+), 1936 deletions(-) diff --git a/sys-cluster/lustre/ChangeLog b/sys-cluster/lustre/ChangeLog index 73299e5..6b3ecb1 100644 --- a/sys-cluster/lustre/ChangeLog +++ b/sys-cluster/lustre/ChangeLog @@ -2,6 +2,28 @@ # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 # $Header: $ + 02 Apr 2014; Alexey Shvetsov + +files/0001-LU-3319-procfs-fix-symlink-handling.patch, + +files/0002-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch, + +files/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch, + +files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch, + +files/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch, + +files/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch, + -files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch, + -files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch, + -files/0003-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch, + -files/0004-LU-3319-procfs-fix-symlink-handling.patch, + -files/0007-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch, + -files/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch, + -files/0010-LU-3319-lprocfs-client-side-cleanups.patch, + -files/0011-LU-3974-llite-use-new-struct-dir_context.patch, + -files/0012-LU-3974-llite-invalidatepage-api-changed.patch, + files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch, + files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch, + files/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch, + lustre-9999.ebuild: + Lustre need more patches + 27 Feb 2014; Alexey Shvetsov files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch, files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch, diff --git a/sys-cluster/lustre/files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch b/sys-cluster/lustre/files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch deleted file mode 100644 index 63fcb0a..0000000 --- a/sys-cluster/lustre/files/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch +++ /dev/null @@ -1,95 +0,0 @@ -From f384f155612fb8b3fa6a12c4c969e29629f82027 Mon Sep 17 00:00:00 2001 -From: Alexey Shvetsov -Date: Mon, 18 Mar 2013 16:22:27 +0400 -Subject: [PATCH 01/12] LU-2982 build: make AC check for linux arch sandbox - friendly - -this commit makes AC check for linux kernel arch sandbox friendly - -Signed-off-by: Alexey Shvetsov -Change-Id: I173cd892bca5587519806cf6d300a5053dfb935f -Signed-off-by: Alexey Shvetsov ---- - config/lustre-build-linux.m4 | 66 ++++++++++++++++++++++++++++++++++++++------ - 1 file changed, 58 insertions(+), 8 deletions(-) - -diff --git a/config/lustre-build-linux.m4 b/config/lustre-build-linux.m4 -index 894101c..8062ace 100644 ---- a/config/lustre-build-linux.m4 -+++ b/config/lustre-build-linux.m4 -@@ -394,14 +394,64 @@ rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest. - # Determine the kernel's idea of the current architecture - # - AC_DEFUN([LB_LINUX_ARCH], -- [AC_MSG_CHECKING([Linux kernel architecture]) -- AS_IF([rm -f $PWD/build/arch -- make -s --no-print-directory echoarch -f $PWD/build/Makefile \ -- LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -C $LINUX $CROSS_VARS \ -- ARCHFILE=$PWD/build/arch && LINUX_ARCH=`cat $PWD/build/arch`], -- [AC_MSG_RESULT([$LINUX_ARCH])], -- [AC_MSG_ERROR([Could not determine the kernel architecture.])]) -- rm -f build/arch]) -+[LINUXARCH= -+rm -f build/conftest.i -+AC_MSG_CHECKING([Linux kernel architecture]) -+if test -s $LINUX_OBJ/include/$AUTOCONF_HDIR/compile.h ; then -+ LINUXARCHHEADER=$AUTOCONF_HDIR/compile.h -+else -+ LINUXARCHHEADER=linux/autoconf.h -+fi -+LB_LINUX_TRY_MAKE([ -+#include <$LINUXARCHHEADER> -+ -+#ifndef UTS_MACHINE -+ -+ #ifdef CONFIG_X86 -+ #ifdef CONFIG_X86_32 -+ #define UTS_MACHINE i386 -+ #endif -+ #ifdef CONFIG_X86_64 -+ #define UTS_MACHINE x86_64 -+ #endif -+ #endif -+ -+ #ifdef CONFIG_IA64 -+ #define UTS_MACHINE ia64 -+ #endif -+ -+ #ifdef CONFIG_PPC -+ #ifdef CONFIG_PPC32 -+ #define UTS_MACHINE ppc -+ #endif -+ #ifdef CONFIG_PPC64 -+ #define UTS_MACHINE ppc64 -+ #endif -+ #endif -+ -+#endif -+],[ -+ char *LINUXARCH; -+ LINUXARCH=UTS_MACHINE; -+],[ -+ $makerule LUSTRE_KERNEL_TEST=conftest.i -+],[ -+ test -s build/conftest.i -+],[ -+ # LINUXARCH="UTS_MACHINE" -+ eval $(grep "LINUXARCH=" build/conftest.i) -+],[ -+ AC_MSG_RESULT([unknown]) -+ AC_MSG_ERROR([Could not preprocess test program. Consult config.log for details.]) -+]) -+ rm -f build/conftest.i -+ if test x$LINUXARCH = x ; then -+ AC_MSG_RESULT([unknown]) -+ AC_MSG_ERROR([Could not determine Linux architecture from linux/version.h.]) -+ fi -+AC_MSG_RESULT([$LINUXARCH]) -+AC_SUBST(LINUXARCH) -+]) - - # - # LB_LINUX_TRY_COMPILE --- -1.8.5.3 - diff --git a/sys-cluster/lustre/files/0001-LU-3319-procfs-fix-symlink-handling.patch b/sys-cluster/lustre/files/0001-LU-3319-procfs-fix-symlink-handling.patch new file mode 100644 index 0000000..d0b6e9c --- /dev/null +++ b/sys-cluster/lustre/files/0001-LU-3319-procfs-fix-symlink-handling.patch @@ -0,0 +1,1132 @@ +From 4c418e7208a62c7bb7d61c1f97cf300675215bd4 Mon Sep 17 00:00:00 2001 +From: James Simmons +Date: Fri, 28 Mar 2014 11:19:07 -0400 +Subject: [PATCH 1/9] LU-3319 procfs: fix symlink handling + +While working on symlink handling for seq files I noticed a +long outstanding bug. Code was developed to link osc obds +to target_obds of the lov layer. The target_obds directory +was never created for the symlinks. This patch enables this +long forgotten feature. Also addressed is the race condition +experinced with server side code ported to seq_files that +used symlinks. To avoid the race the handle obd_proc_private +was moved from struct obd_device to struct obd_type which +now allows earlier registeration that only happens once. +The second problem addressed is the module loading race. +Several modules share the same top proc directory entry which +can become a issue if a client exist on a server node since +the linux proc system allows multiple directories of the same +name. Original Lustre had a lprocfs_srch but that doesn't +work if you use the kernels internal cache for the proc +system so you need to keep track of who grabs the proc root +first and then use the first one registered for when the +next module loads. + +Change-Id: Ib158ec4444ed7abc0f3c3e820ee4a333631a58d1 +Signed-off-by: James Simmons +--- + lustre/include/lprocfs_status.h | 4 +- + lustre/include/obd.h | 17 +++-- + lustre/include/obd_class.h | 5 +- + lustre/lmv/lmv_obd.c | 65 +++++----------- + lustre/lod/lod_dev.c | 28 +++---- + lustre/lov/lov_obd.c | 156 ++++++++++++++++++++++++--------------- + lustre/mdc/mdc_request.c | 6 +- + lustre/mdd/mdd_device.c | 6 +- + lustre/mdt/mdt_handler.c | 6 +- + lustre/mdt/mdt_mds.c | 6 +- + lustre/mgc/libmgc.c | 6 +- + lustre/mgc/mgc_request.c | 6 +- + lustre/mgs/mgs_handler.c | 6 +- + lustre/obdclass/genops.c | 55 ++++++++------ + lustre/obdclass/llog_test.c | 6 +- + lustre/obdclass/lprocfs_status.c | 1 - + lustre/obdecho/echo_client.c | 10 +-- + lustre/ofd/ofd_dev.c | 6 +- + lustre/osc/osc_request.c | 49 +++++++++--- + lustre/osd-ldiskfs/osd_handler.c | 6 +- + lustre/osd-zfs/osd_handler.c | 6 +- + lustre/osp/osp_dev.c | 33 +++++---- + lustre/ost/ost_handler.c | 6 +- + lustre/quota/qmt_dev.c | 6 +- + 24 files changed, 277 insertions(+), 224 deletions(-) + +diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h +index 978b10c..0d6fd4c 100644 +--- a/lustre/include/lprocfs_status.h ++++ b/lustre/include/lprocfs_status.h +@@ -1145,12 +1145,10 @@ static inline int lprocfs_seq_add_vars(cfs_proc_dir_entry_t *root, + struct lprocfs_seq_vars *var, + void *data) + { return 0; } +-#ifndef HAVE_ONLY_PROCFS_SEQ + static inline cfs_proc_dir_entry_t * + lprocfs_seq_register(const char *name, cfs_proc_dir_entry_t *parent, +- struct lprocfs_vars *list, void *data) ++ struct lprocfs_seq_vars *list, void *data) + { return NULL; } +-#endif + static inline void lprocfs_remove(cfs_proc_dir_entry_t **root) + { return; } + static inline void lprocfs_remove_proc_entry(const char *name, +diff --git a/lustre/include/obd.h b/lustre/include/obd.h +index bb67e43..5353524 100644 +--- a/lustre/include/obd.h ++++ b/lustre/include/obd.h +@@ -190,13 +190,15 @@ struct obd_info { + }; + + struct obd_type { +- cfs_list_t typ_chain; +- struct obd_ops *typ_dt_ops; +- struct md_ops *typ_md_ops; +- cfs_proc_dir_entry_t *typ_procroot; +- char *typ_name; +- int typ_refcnt; +- struct lu_device_type *typ_lu; ++ struct list_head typ_chain; ++ struct obd_ops *typ_dt_ops; ++ struct md_ops *typ_md_ops; ++ struct proc_dir_entry *typ_procroot; ++ struct proc_dir_entry *typ_procsym; ++ __u32 typ_sym_filter; ++ char *typ_name; ++ int typ_refcnt; ++ struct lu_device_type *typ_lu; + spinlock_t obd_type_lock; + }; + +@@ -834,7 +836,6 @@ struct obd_device { + + struct proc_dir_entry *obd_proc_entry; + struct proc_dir_entry *obd_proc_exports_entry; +- void *obd_proc_private; /* type private PDEs */ + struct proc_dir_entry *obd_svc_procroot; + struct lprocfs_stats *obd_svc_stats; + struct lprocfs_seq_vars *obd_vars; +diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h +index aeb94ba..5de7cd7 100644 +--- a/lustre/include/obd_class.h ++++ b/lustre/include/obd_class.h +@@ -86,13 +86,12 @@ struct lu_device_type; + + /* genops.c */ + struct obd_export *class_conn2export(struct lustre_handle *); +-int class_register_type(struct obd_ops *, struct md_ops *, ++int class_register_type(struct obd_ops *, struct md_ops *, bool enable_proc, + struct lprocfs_seq_vars *module_vars, + #ifndef HAVE_ONLY_PROCFS_SEQ + struct lprocfs_vars *, + #endif +- const char *nm, +- struct lu_device_type *ldt); ++ const char *nm, struct lu_device_type *ldt); + int class_unregister_type(const char *nm); + + struct obd_device *class_newdev(const char *type_name, const char *name); +diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c +index 8f26e6c..cd16eaf 100644 +--- a/lustre/lmv/lmv_obd.c ++++ b/lustre/lmv/lmv_obd.c +@@ -270,9 +270,6 @@ static int lmv_connect(const struct lu_env *env, + struct obd_uuid *cluuid, struct obd_connect_data *data, + void *localdata) + { +-#ifdef __KERNEL__ +- struct proc_dir_entry *lmv_proc_dir; +-#endif + struct lmv_obd *lmv = &obd->u.lmv; + struct lustre_handle conn = { 0 }; + int rc = 0; +@@ -304,21 +301,16 @@ static int lmv_connect(const struct lu_env *env, + if (data) + lmv->conn_data = *data; + +-#ifdef __KERNEL__ +- if (obd->obd_proc_private != NULL) { +- lmv_proc_dir = obd->obd_proc_private; +- } else { +- lmv_proc_dir = lprocfs_seq_register("target_obds", +- obd->obd_proc_entry, +- NULL, NULL); +- if (IS_ERR(lmv_proc_dir)) { ++ if (obd->obd_type->typ_procsym == NULL) { ++ obd->obd_type->typ_procsym = lprocfs_seq_register("target_obds", ++ obd->obd_proc_entry, ++ NULL, NULL); ++ if (IS_ERR(obd->obd_type->typ_procsym)) { + CERROR("could not register /proc/fs/lustre/%s/%s/target_obds.", + obd->obd_type->typ_name, obd->obd_name); +- lmv_proc_dir = NULL; ++ obd->obd_type->typ_procsym = NULL; + } +- obd->obd_proc_private = lmv_proc_dir; + } +-#endif + + /* + * All real clients should perform actual connection right away, because +@@ -329,12 +321,8 @@ static int lmv_connect(const struct lu_env *env, + if (data != NULL && (data->ocd_connect_flags & OBD_CONNECT_REAL)) + rc = lmv_check_connect(obd); + +-#ifdef __KERNEL__ +- if (rc && lmv_proc_dir) { +- lprocfs_remove(&lmv_proc_dir); +- obd->obd_proc_private = NULL; +- } +-#endif ++ if (rc && obd->obd_type->typ_procsym != NULL) ++ lprocfs_remove(&obd->obd_type->typ_procsym); + RETURN(rc); + } + +@@ -416,9 +404,6 @@ static int lmv_init_ea_size(struct obd_export *exp, int easize, + + int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) + { +-#ifdef __KERNEL__ +- struct proc_dir_entry *lmv_proc_dir; +-#endif + struct lmv_obd *lmv = &obd->u.lmv; + struct obd_uuid *cluuid = &lmv->cluuid; + struct obd_uuid lmv_mdc_uuid = { "LMV_MDC_UUID" }; +@@ -497,15 +482,13 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) + mdc_obd->obd_name, mdc_obd->obd_uuid.uuid, + atomic_read(&obd->obd_refcount)); + +-#ifdef __KERNEL__ +- lmv_proc_dir = obd->obd_proc_private; +- if (lmv_proc_dir) { ++ if (obd->obd_type->typ_procsym != NULL) { + struct proc_dir_entry *mdc_symlink; + + LASSERT(mdc_obd->obd_type != NULL); + LASSERT(mdc_obd->obd_type->typ_name != NULL); + mdc_symlink = lprocfs_add_symlink(mdc_obd->obd_name, +- lmv_proc_dir, ++ obd->obd_type->typ_procsym, + "../../../%s/%s", + mdc_obd->obd_type->typ_name, + mdc_obd->obd_name); +@@ -514,11 +497,9 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) + "/proc/fs/lustre/%s/%s/target_obds/%s.", + obd->obd_type->typ_name, obd->obd_name, + mdc_obd->obd_name); +- lprocfs_remove(&lmv_proc_dir); +- obd->obd_proc_private = NULL; ++ lprocfs_remove(&obd->obd_type->typ_procsym); + } + } +-#endif + RETURN(0); + } + +@@ -706,9 +687,6 @@ int lmv_check_connect(struct obd_device *obd) + + static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) + { +-#ifdef __KERNEL__ +- struct proc_dir_entry *lmv_proc_dir; +-#endif + struct lmv_obd *lmv = &obd->u.lmv; + struct obd_device *mdc_obd; + int rc; +@@ -725,11 +703,10 @@ static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) + mdc_obd->obd_no_recov = obd->obd_no_recov; + } + +-#ifdef __KERNEL__ +- lmv_proc_dir = obd->obd_proc_private; +- if (lmv_proc_dir) +- lprocfs_remove_proc_entry(mdc_obd->obd_name, lmv_proc_dir); +-#endif ++ if (obd->obd_type->typ_procsym != NULL) ++ lprocfs_remove_proc_entry(mdc_obd->obd_name, ++ obd->obd_type->typ_procsym); ++ + rc = obd_fid_fini(tgt->ltd_exp->exp_obd); + if (rc) + CERROR("Can't finanize fids factory\n"); +@@ -777,13 +754,11 @@ static int lmv_disconnect(struct obd_export *exp) + lmv_disconnect_mdc(obd, lmv->tgts[i]); + } + +-#ifdef __KERNEL__ +- if (obd->obd_proc_private) +- lprocfs_remove((struct proc_dir_entry **)&obd->obd_proc_private); ++ if (obd->obd_type->typ_procsym != NULL) ++ lprocfs_remove(&obd->obd_type->typ_procsym); + else + CERROR("/proc/fs/lustre/%s/%s/target_obds missing\n", + obd->obd_type->typ_name, obd->obd_name); +-#endif + + out_local: + /* +@@ -3423,11 +3398,11 @@ struct md_ops lmv_md_ops = { + + int __init lmv_init(void) + { +- return class_register_type(&lmv_obd_ops, &lmv_md_ops, NULL, ++ return class_register_type(&lmv_obd_ops, &lmv_md_ops, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- NULL, ++ NULL, + #endif +- LUSTRE_LMV_NAME, NULL); ++ LUSTRE_LMV_NAME, NULL); + } + + #ifdef __KERNEL__ +diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c +index 1d4849f..a653d6a 100644 +--- a/lustre/lod/lod_dev.c ++++ b/lustre/lod/lod_dev.c +@@ -892,8 +892,8 @@ static struct obd_ops lod_obd_device_ops = { + static int __init lod_mod_init(void) + { + struct lprocfs_static_vars lvars = { 0 }; +- cfs_proc_dir_entry_t *lov_proc_dir; +- int rc; ++ struct obd_type *type; ++ int rc; + + rc = lu_kmem_init(lod_caches); + if (rc) +@@ -901,32 +901,32 @@ static int __init lod_mod_init(void) + + lprocfs_lod_init_vars(&lvars); + +- rc = class_register_type(&lod_obd_device_ops, NULL, NULL, ++ rc = class_register_type(&lod_obd_device_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- lvars.module_vars, ++ lvars.module_vars, + #endif +- LUSTRE_LOD_NAME, &lod_device_type); ++ LUSTRE_LOD_NAME, &lod_device_type); + if (rc) { + lu_kmem_fini(lod_caches); + return rc; + } + + /* create "lov" entry in procfs for compatibility purposes */ +- lov_proc_dir = lprocfs_srch(proc_lustre_root, "lov"); +- if (lov_proc_dir == NULL) { +- lov_proc_dir = lprocfs_register("lov", proc_lustre_root, +- NULL, NULL); +- if (IS_ERR(lov_proc_dir)) +- CERROR("lod: can't create compat entry \"lov\": %d\n", +- (int)PTR_ERR(lov_proc_dir)); +- } ++ type = class_search_type(LUSTRE_LOV_NAME); ++ if (type != NULL && type->typ_procroot != NULL) ++ return rc; + ++ type = class_search_type(LUSTRE_LOD_NAME); ++ type->typ_procsym = lprocfs_register("lov", proc_lustre_root, ++ NULL, NULL); ++ if (IS_ERR(type->typ_procsym)) ++ CERROR("lod: can't create compat entry \"lov\": %d\n", ++ (int)PTR_ERR(type->typ_procsym)); + return rc; + } + + static void __exit lod_mod_exit(void) + { +- + lprocfs_try_remove_proc_entry("lov", proc_lustre_root); + + class_unregister_type(LUSTRE_LOD_NAME); +diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c +index 9d47ec5..78c11fb 100644 +--- a/lustre/lov/lov_obd.c ++++ b/lustre/lov/lov_obd.c +@@ -124,19 +124,16 @@ static int lov_notify(struct obd_device *obd, struct obd_device *watched, + int lov_connect_obd(struct obd_device *obd, __u32 index, int activate, + struct obd_connect_data *data) + { +- struct lov_obd *lov = &obd->u.lov; +- struct obd_uuid *tgt_uuid; +- struct obd_device *tgt_obd; +- static struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" }; +- struct obd_import *imp; +-#ifdef __KERNEL__ +- struct proc_dir_entry *lov_proc_dir; +-#endif +- int rc; +- ENTRY; ++ struct lov_obd *lov = &obd->u.lov; ++ struct obd_uuid *tgt_uuid; ++ struct obd_device *tgt_obd; ++ static struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" }; ++ struct obd_import *imp; ++ int rc; ++ ENTRY; + +- if (!lov->lov_tgts[index]) +- RETURN(-EINVAL); ++ if (lov->lov_tgts[index] == NULL) ++ RETURN(-EINVAL); + + tgt_uuid = &lov->lov_tgts[index]->ltd_uuid; + tgt_obd = lov->lov_tgts[index]->ltd_obd; +@@ -191,32 +188,29 @@ int lov_connect_obd(struct obd_device *obd, __u32 index, int activate, + CDEBUG(D_CONFIG, "Connected tgt idx %d %s (%s) %sactive\n", index, + obd_uuid2str(tgt_uuid), tgt_obd->obd_name, activate ? "":"in"); + +-#ifdef __KERNEL__ +- lov_proc_dir = obd->obd_proc_private; +- if (lov_proc_dir) { +- struct obd_device *osc_obd = lov->lov_tgts[index]->ltd_exp->exp_obd; ++ if (obd->obd_type->typ_procsym != NULL) { + struct proc_dir_entry *osc_symlink; +- +- LASSERT(osc_obd != NULL); +- LASSERT(osc_obd->obd_magic == OBD_DEVICE_MAGIC); +- LASSERT(osc_obd->obd_type->typ_name != NULL); +- +- osc_symlink = lprocfs_add_symlink(osc_obd->obd_name, +- lov_proc_dir, +- "../../../%s/%s", +- osc_obd->obd_type->typ_name, +- osc_obd->obd_name); +- if (osc_symlink == NULL) { +- CERROR("could not register LOV target " +- "/proc/fs/lustre/%s/%s/target_obds/%s.", +- obd->obd_type->typ_name, obd->obd_name, +- osc_obd->obd_name); +- lprocfs_remove(&lov_proc_dir); +- obd->obd_proc_private = NULL; ++ struct obd_device *osc_obd; ++ ++ osc_obd = lov->lov_tgts[index]->ltd_exp->exp_obd; ++ ++ LASSERT(osc_obd != NULL); ++ LASSERT(osc_obd->obd_magic == OBD_DEVICE_MAGIC); ++ LASSERT(osc_obd->obd_type->typ_name != NULL); ++ ++ osc_symlink = lprocfs_add_symlink(osc_obd->obd_name, ++ obd->obd_type->typ_procsym, ++ "../../../%s/%s", ++ osc_obd->obd_type->typ_name, ++ osc_obd->obd_name); ++ if (osc_symlink == NULL) { ++ CERROR("could not register LOV target " ++ "/proc/fs/lustre/%s/%s/target_obds/%s.", ++ obd->obd_type->typ_name, obd->obd_name, ++ osc_obd->obd_name); ++ lprocfs_remove(&obd->obd_type->typ_procsym); + } + } +-#endif +- + RETURN(0); + } + +@@ -247,6 +241,15 @@ static int lov_connect(const struct lu_env *env, + if (data) + lov->lov_ocd = *data; + ++ obd->obd_type->typ_procsym = lprocfs_seq_register("target_obds", ++ obd->obd_proc_entry, ++ NULL, NULL); ++ if (IS_ERR(obd->obd_type->typ_procsym)) { ++ CERROR("%s: could not register /proc/fs/lustre/%s/%s/target_obds.", ++ obd->obd_name, obd->obd_type->typ_name, obd->obd_name); ++ obd->obd_type->typ_procsym = NULL; ++ } ++ + obd_getref(obd); + for (i = 0; i < lov->desc.ld_tgt_count; i++) { + tgt = lov->lov_tgts[i]; +@@ -277,7 +280,6 @@ static int lov_connect(const struct lu_env *env, + + static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt) + { +- struct proc_dir_entry *lov_proc_dir; + struct lov_obd *lov = &obd->u.lov; + struct obd_device *osc_obd; + int rc; +@@ -293,19 +295,19 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt) + tgt->ltd_exp->exp_obd->obd_inactive = 1; + } + +- lov_proc_dir = obd->obd_proc_private; +- if (lov_proc_dir) +- lprocfs_remove_proc_entry(osc_obd->obd_name, lov_proc_dir); ++ if (osc_obd) { ++ /* Pass it on to our clients. ++ * XXX This should be an argument to disconnect, ++ * XXX not a back-door flag on the OBD. Ah well. ++ */ ++ osc_obd->obd_force = obd->obd_force; ++ osc_obd->obd_fail = obd->obd_fail; ++ osc_obd->obd_no_recov = obd->obd_no_recov; + +- if (osc_obd) { +- /* Pass it on to our clients. +- * XXX This should be an argument to disconnect, +- * XXX not a back-door flag on the OBD. Ah well. +- */ +- osc_obd->obd_force = obd->obd_force; +- osc_obd->obd_fail = obd->obd_fail; +- osc_obd->obd_no_recov = obd->obd_no_recov; +- } ++ if (obd->obd_type->typ_procsym) ++ lprocfs_remove_proc_entry(osc_obd->obd_name, ++ obd->obd_type->typ_procsym); ++ } + + obd_register_observer(osc_obd, NULL); + +@@ -350,6 +352,9 @@ static int lov_disconnect(struct obd_export *exp) + } + obd_putref(obd); + ++ if (obd->obd_type->typ_procsym) ++ lprocfs_remove(&obd->obd_type->typ_procsym); ++ + out: + rc = class_disconnect(exp); /* bz 9811 */ + RETURN(rc); +@@ -779,6 +784,9 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) + { + struct lov_desc *desc; + struct lov_obd *lov = &obd->u.lov; ++#ifdef LPROCFS ++ struct obd_type *type; ++#endif + int rc; + ENTRY; + +@@ -834,15 +842,41 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) + + #ifdef LPROCFS + obd->obd_vars = lprocfs_lov_obd_vars; +- lprocfs_seq_obd_setup(obd); +- rc = lprocfs_seq_create(obd->obd_proc_entry, "target_obd", 0444, +- &lov_proc_target_fops, obd); +- if (rc) +- CWARN("Error adding the target_obd file\n"); ++ /* If this is true then both client (lov) and server ++ * (lod) are on the same node. The lod layer if loaded ++ * first will register the lov proc directory. In that ++ * case obd->obd_type->typ_procroot will be not set. ++ * Instead we use type->typ_procsym as the parent. */ ++ type = class_search_type(LUSTRE_LOD_NAME); ++ if (type != NULL && type->typ_procsym != NULL) { ++ obd->obd_proc_entry = lprocfs_seq_register(obd->obd_name, ++ type->typ_procsym, ++ obd->obd_vars, obd); ++ if (IS_ERR(obd->obd_proc_entry)) { ++ rc = PTR_ERR(obd->obd_proc_entry); ++ CERROR("error %d setting up lprocfs for %s\n", rc, ++ obd->obd_name); ++ obd->obd_proc_entry = NULL; ++ } ++ } else { ++ rc = lprocfs_seq_obd_setup(obd); ++ } ++ ++ if (rc == 0) { ++ rc = lprocfs_seq_create(obd->obd_proc_entry, "target_obd", ++ 0444, &lov_proc_target_fops, obd); ++ if (rc) ++ CWARN("Error adding the target_obd file\n"); + +- lov->lov_pool_proc_entry = lprocfs_seq_register("pools", ++ lov->lov_pool_proc_entry = lprocfs_seq_register("pools", + obd->obd_proc_entry, + NULL, NULL); ++ if (IS_ERR(lov->lov_pool_proc_entry)) { ++ rc = PTR_ERR(lov->lov_pool_proc_entry); ++ CERROR("error %d setting up lprocfs for pools\n", rc); ++ lov->lov_pool_proc_entry = NULL; ++ } ++ } + #endif + RETURN(0); + +@@ -2365,8 +2399,10 @@ extern struct lu_kmem_descr lov_caches[]; + + int __init lov_init(void) + { ++ bool enable_proc = true; ++ struct obd_type *type; + int rc; +- ENTRY; ++ ENTRY; + + /* print an address of _any_ initialized kernel symbol from this + * module, to allow debugging with gdb that doesn't support data +@@ -2385,11 +2421,15 @@ int __init lov_init(void) + return -ENOMEM; + } + +- rc = class_register_type(&lov_obd_ops, NULL, NULL, ++ type = class_search_type(LUSTRE_LOD_NAME); ++ if (type != NULL && type->typ_procsym != NULL) ++ enable_proc = false; ++ ++ rc = class_register_type(&lov_obd_ops, NULL, enable_proc, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- NULL, ++ NULL, + #endif +- LUSTRE_LOV_NAME, &lov_device_type); ++ LUSTRE_LOV_NAME, &lov_device_type); + + if (rc) { + kmem_cache_destroy(lov_oinfo_slab); +diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c +index ee3a654..cea78ac 100644 +--- a/lustre/mdc/mdc_request.c ++++ b/lustre/mdc/mdc_request.c +@@ -3429,11 +3429,11 @@ struct md_ops mdc_md_ops = { + + int __init mdc_init(void) + { +- return class_register_type(&mdc_obd_ops, &mdc_md_ops, NULL, ++ return class_register_type(&mdc_obd_ops, &mdc_md_ops, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- NULL, ++ NULL, + #endif +- LUSTRE_MDC_NAME, NULL); ++ LUSTRE_MDC_NAME, NULL); + } + + #ifdef __KERNEL__ +diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c +index fe9de80..0fe590e 100644 +--- a/lustre/mdd/mdd_device.c ++++ b/lustre/mdd/mdd_device.c +@@ -1582,11 +1582,11 @@ static int __init mdd_mod_init(void) + hsm_actions_logops.lop_add = llog_cat_add_rec; + hsm_actions_logops.lop_declare_add = llog_cat_declare_add_rec; + +- rc = class_register_type(&mdd_obd_device_ops, NULL, NULL, ++ rc = class_register_type(&mdd_obd_device_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- lvars.module_vars, ++ lvars.module_vars, + #endif +- LUSTRE_MDD_NAME, &mdd_device_type); ++ LUSTRE_MDD_NAME, &mdd_device_type); + if (rc) + lu_kmem_fini(mdd_caches); + return rc; +diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c +index 0e1f0f6..69b1c30 100644 +--- a/lustre/mdt/mdt_handler.c ++++ b/lustre/mdt/mdt_handler.c +@@ -5901,11 +5901,11 @@ static int __init mdt_mod_init(void) + GOTO(lu_fini, rc); + + lprocfs_mdt_init_vars(&lvars); +- rc = class_register_type(&mdt_obd_device_ops, NULL, NULL, ++ rc = class_register_type(&mdt_obd_device_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- lvars.module_vars, ++ lvars.module_vars, + #endif +- LUSTRE_MDT_NAME, &mdt_device_type); ++ LUSTRE_MDT_NAME, &mdt_device_type); + if (rc) + GOTO(mds_fini, rc); + lu_fini: +diff --git a/lustre/mdt/mdt_mds.c b/lustre/mdt/mdt_mds.c +index 367f659..390164f 100644 +--- a/lustre/mdt/mdt_mds.c ++++ b/lustre/mdt/mdt_mds.c +@@ -539,11 +539,11 @@ int mds_mod_init(void) + mds_num_threads = mdt_num_threads; + } + +- return class_register_type(&mds_obd_device_ops, NULL, NULL, ++ return class_register_type(&mds_obd_device_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- lprocfs_mds_module_vars, ++ lprocfs_mds_module_vars, + #endif +- LUSTRE_MDS_NAME, &mds_device_type); ++ LUSTRE_MDS_NAME, &mds_device_type); + } + + void mds_mod_exit(void) +diff --git a/lustre/mgc/libmgc.c b/lustre/mgc/libmgc.c +index 49a329a..ec915c7 100644 +--- a/lustre/mgc/libmgc.c ++++ b/lustre/mgc/libmgc.c +@@ -158,9 +158,9 @@ struct obd_ops mgc_obd_ops = { + + int __init mgc_init(void) + { +- return class_register_type(&mgc_obd_ops, NULL, NULL, ++ return class_register_type(&mgc_obd_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- NULL, ++ NULL, + #endif +- LUSTRE_MGC_NAME, NULL); ++ LUSTRE_MGC_NAME, NULL); + } +diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c +index 8935814..7741bbf 100644 +--- a/lustre/mgc/mgc_request.c ++++ b/lustre/mgc/mgc_request.c +@@ -2022,11 +2022,11 @@ struct obd_ops mgc_obd_ops = { + + int __init mgc_init(void) + { +- return class_register_type(&mgc_obd_ops, NULL, NULL, ++ return class_register_type(&mgc_obd_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- NULL, ++ NULL, + #endif +- LUSTRE_MGC_NAME, NULL); ++ LUSTRE_MGC_NAME, NULL); + } + + #ifdef __KERNEL__ +diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c +index 8961fc3..85b219c 100644 +--- a/lustre/mgs/mgs_handler.c ++++ b/lustre/mgs/mgs_handler.c +@@ -1516,11 +1516,11 @@ static int __init mgs_init(void) + struct lprocfs_static_vars lvars; + + lprocfs_mgs_init_vars(&lvars); +- return class_register_type(&mgs_obd_device_ops, NULL, NULL, ++ return class_register_type(&mgs_obd_device_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- lvars.module_vars, ++ lvars.module_vars, + #endif +- LUSTRE_MGS_NAME, &mgs_device_type); ++ LUSTRE_MGS_NAME, &mgs_device_type); + } + + static void /*__exit*/ mgs_exit(void) +diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c +index bf8b6ce..98dbcce 100644 +--- a/lustre/obdclass/genops.c ++++ b/lustre/obdclass/genops.c +@@ -162,7 +162,7 @@ EXPORT_SYMBOL(class_put_type); + #define CLASS_MAX_NAME 1024 + + int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, +- struct lprocfs_seq_vars *module_vars, ++ bool enable_proc, struct lprocfs_seq_vars *module_vars, + #ifndef HAVE_ONLY_PROCFS_SEQ + struct lprocfs_vars *vars, + #endif +@@ -202,22 +202,24 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, + spin_lock_init(&type->obd_type_lock); + + #ifdef LPROCFS ++ if (enable_proc) { + #ifndef HAVE_ONLY_PROCFS_SEQ +- if (vars) { +- type->typ_procroot = lprocfs_register(type->typ_name, +- proc_lustre_root, +- vars, type); +- } else ++ if (vars) { ++ type->typ_procroot = lprocfs_register(type->typ_name, ++ proc_lustre_root, ++ vars, type); ++ } else + #endif +- { +- type->typ_procroot = lprocfs_seq_register(type->typ_name, +- proc_lustre_root, +- module_vars, type); +- } +- if (IS_ERR(type->typ_procroot)) { +- rc = PTR_ERR(type->typ_procroot); +- type->typ_procroot = NULL; +- GOTO (failed, rc); ++ { ++ type->typ_procroot = lprocfs_seq_register(type->typ_name, ++ proc_lustre_root, ++ module_vars, type); ++ } ++ if (IS_ERR(type->typ_procroot)) { ++ rc = PTR_ERR(type->typ_procroot); ++ type->typ_procroot = NULL; ++ GOTO(failed, rc); ++ } + } + #endif + if (ldt != NULL) { +@@ -233,18 +235,20 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, + + RETURN (0); + +- failed: +-#ifdef LPROCFS ++failed: + if (type->typ_name != NULL) { ++#ifdef LPROCFS ++ if (type->typ_procroot != NULL) { + #ifndef HAVE_ONLY_PROCFS_SEQ +- lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root); ++ lprocfs_try_remove_proc_entry(type->typ_name, ++ proc_lustre_root); + #else +- remove_proc_subtree(type->typ_name, proc_lustre_root); ++ remove_proc_subtree(type->typ_name, proc_lustre_root); + #endif +- } ++ } + #endif +- if (type->typ_name != NULL) + OBD_FREE(type->typ_name, strlen(name) + 1); ++ } + if (type->typ_md_ops != NULL) + OBD_FREE_PTR(type->typ_md_ops); + if (type->typ_dt_ops != NULL) +@@ -278,11 +282,16 @@ int class_unregister_type(const char *name) + * we can't reference pointer as it can get invalided when another + * module removes the entry */ + #ifdef LPROCFS ++ if (type->typ_procroot != NULL) { + #ifndef HAVE_ONLY_PROCFS_SEQ +- lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root); ++ lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root); + #else +- remove_proc_subtree(type->typ_name, proc_lustre_root); ++ remove_proc_subtree(type->typ_name, proc_lustre_root); + #endif ++ } ++ ++ if (type->typ_procsym != NULL) ++ lprocfs_remove(&type->typ_procsym); + #endif + if (type->typ_lu) + lu_device_type_fini(type->typ_lu); +diff --git a/lustre/obdclass/llog_test.c b/lustre/obdclass/llog_test.c +index a1051c2..18d5843 100644 +--- a/lustre/obdclass/llog_test.c ++++ b/lustre/obdclass/llog_test.c +@@ -1261,11 +1261,11 @@ static struct obd_ops llog_obd_ops = { + + static int __init llog_test_init(void) + { +- return class_register_type(&llog_obd_ops, NULL, NULL, ++ return class_register_type(&llog_obd_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- NULL, ++ NULL, + #endif +- "llog_test", NULL); ++ "llog_test", NULL); + } + + static void __exit llog_test_exit(void) +diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c +index 9956ada..30d9f59 100644 +--- a/lustre/obdclass/lprocfs_status.c ++++ b/lustre/obdclass/lprocfs_status.c +@@ -1936,7 +1936,6 @@ lprocfs_seq_obd_setup(struct obd_device *obd) + int rc = 0; + + LASSERT(obd != NULL); +- LASSERT(obd->obd_vars != NULL); + LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC); + LASSERT(obd->obd_type->typ_procroot != NULL); + +diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c +index 38cff00..632bf52 100644 +--- a/lustre/obdecho/echo_client.c ++++ b/lustre/obdecho/echo_client.c +@@ -3169,12 +3169,12 @@ int echo_client_init(void) + + rc = lu_kmem_init(echo_caches); + if (rc == 0) { +- rc = class_register_type(&echo_client_obd_ops, NULL, NULL, ++ rc = class_register_type(&echo_client_obd_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- NULL, ++ NULL, + #endif +- LUSTRE_ECHO_CLIENT_NAME, +- &echo_device_type); ++ LUSTRE_ECHO_CLIENT_NAME, ++ &echo_device_type); + if (rc) + lu_kmem_fini(echo_caches); + } +@@ -3202,7 +3202,7 @@ static int __init obdecho_init(void) + if (rc != 0) + goto failed_0; + +- rc = class_register_type(&echo_obd_ops, NULL, NULL, ++ rc = class_register_type(&echo_obd_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ + NULL, + #endif +diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c +index 4cafa48..5d7f0b4 100644 +--- a/lustre/ofd/ofd_dev.c ++++ b/lustre/ofd/ofd_dev.c +@@ -2394,11 +2394,11 @@ int __init ofd_init(void) + + lprocfs_ofd_init_vars(&lvars); + +- rc = class_register_type(&ofd_obd_ops, NULL, NULL, ++ rc = class_register_type(&ofd_obd_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- lvars.module_vars, ++ lvars.module_vars, + #endif +- LUSTRE_OST_NAME, &ofd_device_type); ++ LUSTRE_OST_NAME, &ofd_device_type); + return rc; + } + +diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c +index 2b60765..076dcf6 100644 +--- a/lustre/osc/osc_request.c ++++ b/lustre/osc/osc_request.c +@@ -3091,9 +3091,10 @@ static int brw_queue_work(const struct lu_env *env, void *data) + + int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) + { +- struct client_obd *cli = &obd->u.cli; +- void *handler; +- int rc; ++ struct client_obd *cli = &obd->u.cli; ++ struct obd_type *type; ++ void *handler; ++ int rc; + ENTRY; + + rc = ptlrpcd_addref(); +@@ -3119,10 +3120,32 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) + GOTO(out_ptlrpcd_work, rc); + + cli->cl_grant_shrink_interval = GRANT_SHRINK_INTERVAL; ++ + #ifdef LPROCFS + obd->obd_vars = lprocfs_osc_obd_vars; + #endif +- if (lprocfs_seq_obd_setup(obd) == 0) { ++ /* If this is true then both client (osc) and server (osp) are on the ++ * same node. The osp layer if loaded first will register the osc proc ++ * directory. In that case this obd_device will be attached its proc ++ * tree to type->typ_procsym instead of obd->obd_type->typ_procroot. */ ++ type = class_search_type(LUSTRE_OSP_NAME); ++ if (type && type->typ_procsym) { ++ obd->obd_proc_entry = lprocfs_seq_register(obd->obd_name, ++ type->typ_procsym, ++ obd->obd_vars, obd); ++ if (IS_ERR(obd->obd_proc_entry)) { ++ rc = PTR_ERR(obd->obd_proc_entry); ++ CERROR("error %d setting up lprocfs for %s\n", rc, ++ obd->obd_name); ++ obd->obd_proc_entry = NULL; ++ } ++ } else { ++ rc = lprocfs_seq_obd_setup(obd); ++ } ++ ++ /* If the basic OSC proc tree construction succeeded then ++ * lets do the rest. */ ++ if (rc == 0) { + lproc_osc_attach_seqstat(obd); + sptlrpc_lprocfs_cliobd_attach(obd); + ptlrpc_lprocfs_register_obd(obd); +@@ -3140,7 +3163,7 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) + + CFS_INIT_LIST_HEAD(&cli->cl_grant_shrink_list); + ns_register_cancel(obd->obd_namespace, osc_cancel_weight); +- RETURN(rc); ++ RETURN(0); + + out_ptlrpcd_work: + if (cli->cl_writeback_work != NULL) { +@@ -3282,8 +3305,10 @@ extern struct lock_class_key osc_ast_guard_class; + + int __init osc_init(void) + { +- int rc; +- ENTRY; ++ bool enable_proc = true; ++ struct obd_type *type; ++ int rc; ++ ENTRY; + + /* print an address of _any_ initialized kernel symbol from this + * module, to allow debugging with gdb that doesn't support data +@@ -3294,11 +3319,15 @@ int __init osc_init(void) + if (rc) + RETURN(rc); + +- rc = class_register_type(&osc_obd_ops, NULL, NULL, ++ type = class_search_type(LUSTRE_OSP_NAME); ++ if (type != NULL && type->typ_procsym != NULL) ++ enable_proc = false; ++ ++ rc = class_register_type(&osc_obd_ops, NULL, enable_proc, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- NULL, ++ NULL, + #endif +- LUSTRE_OSC_NAME, &osc_device_type); ++ LUSTRE_OSC_NAME, &osc_device_type); + if (rc) { + lu_kmem_fini(osc_caches); + RETURN(rc); +diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c +index 7461f9d..e0da7e6 100644 +--- a/lustre/osd-ldiskfs/osd_handler.c ++++ b/lustre/osd-ldiskfs/osd_handler.c +@@ -6019,11 +6019,11 @@ static int __init osd_mod_init(void) + if (rc) + return rc; + +- rc = class_register_type(&osd_obd_device_ops, NULL, NULL, ++ rc = class_register_type(&osd_obd_device_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- lprocfs_osd_module_vars, ++ lprocfs_osd_module_vars, + #endif +- LUSTRE_OSD_LDISKFS_NAME, &osd_device_type); ++ LUSTRE_OSD_LDISKFS_NAME, &osd_device_type); + if (rc) + lu_kmem_fini(ldiskfs_caches); + return rc; +diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c +index 1025be9..47bbc76 100644 +--- a/lustre/osd-zfs/osd_handler.c ++++ b/lustre/osd-zfs/osd_handler.c +@@ -912,11 +912,11 @@ int __init osd_init(void) + if (rc) + return rc; + +- rc = class_register_type(&osd_obd_device_ops, NULL, NULL, ++ rc = class_register_type(&osd_obd_device_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- lprocfs_osd_module_vars, ++ lprocfs_osd_module_vars, + #endif +- LUSTRE_OSD_ZFS_NAME, &osd_device_type); ++ LUSTRE_OSD_ZFS_NAME, &osd_device_type); + if (rc) + lu_kmem_fini(osd_caches); + return rc; +diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c +index 550ba5e..60bf8ef 100644 +--- a/lustre/osp/osp_dev.c ++++ b/lustre/osp/osp_dev.c +@@ -1239,7 +1239,7 @@ struct llog_operations osp_mds_ost_orig_logops; + static int __init osp_mod_init(void) + { + struct lprocfs_static_vars lvars; +- cfs_proc_dir_entry_t *osc_proc_dir; ++ struct obd_type *type; + int rc; + + rc = lu_kmem_init(osp_caches); +@@ -1248,11 +1248,11 @@ static int __init osp_mod_init(void) + + lprocfs_osp_init_vars(&lvars); + +- rc = class_register_type(&osp_obd_device_ops, NULL, NULL, ++ rc = class_register_type(&osp_obd_device_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- lvars.module_vars, ++ lvars.module_vars, + #endif +- LUSTRE_OSP_NAME, &osp_device_type); ++ LUSTRE_OSP_NAME, &osp_device_type); + + /* create "osc" entry in procfs for compatibility purposes */ + if (rc != 0) { +@@ -1262,11 +1262,11 @@ static int __init osp_mod_init(void) + + lprocfs_lwp_init_vars(&lvars); + +- rc = class_register_type(&lwp_obd_device_ops, NULL, NULL, ++ rc = class_register_type(&lwp_obd_device_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- lvars.module_vars, ++ lvars.module_vars, + #endif +- LUSTRE_LWP_NAME, &lwp_device_type); ++ LUSTRE_LWP_NAME, &lwp_device_type); + if (rc != 0) { + class_unregister_type(LUSTRE_OSP_NAME); + lu_kmem_fini(osp_caches); +@@ -1278,14 +1278,17 @@ static int __init osp_mod_init(void) + osp_mds_ost_orig_logops.lop_add = llog_cat_add_rec; + osp_mds_ost_orig_logops.lop_declare_add = llog_cat_declare_add_rec; + +- osc_proc_dir = lprocfs_srch(proc_lustre_root, "osc"); +- if (osc_proc_dir == NULL) { +- osc_proc_dir = lprocfs_register("osc", proc_lustre_root, NULL, +- NULL); +- if (IS_ERR(osc_proc_dir)) +- CERROR("osp: can't create compat entry \"osc\": %d\n", +- (int) PTR_ERR(osc_proc_dir)); +- } ++ /* create "osc" entry in procfs for compatibility purposes */ ++ type = class_search_type(LUSTRE_OSC_NAME); ++ if (type != NULL && type->typ_procroot != NULL) ++ return rc; ++ ++ type = class_search_type(LUSTRE_OSP_NAME); ++ type->typ_procsym = lprocfs_register("osc", proc_lustre_root, ++ NULL, NULL); ++ if (IS_ERR(type->typ_procsym)) ++ CERROR("osp: can't create compat entry \"osc\": %d\n", ++ (int) PTR_ERR(type->typ_procsym)); + return rc; + } + +diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c +index f7448d4..d8897cc 100644 +--- a/lustre/ost/ost_handler.c ++++ b/lustre/ost/ost_handler.c +@@ -470,11 +470,11 @@ static int __init ost_init(void) + + ENTRY; + +- rc = class_register_type(&ost_obd_ops, NULL, NULL, ++ rc = class_register_type(&ost_obd_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- NULL, ++ NULL, + #endif +- LUSTRE_OSS_NAME, NULL); ++ LUSTRE_OSS_NAME, NULL); + + if (ost_num_threads != 0 && oss_num_threads == 0) { + LCONSOLE_INFO("ost_num_threads module parameter is deprecated, " +diff --git a/lustre/quota/qmt_dev.c b/lustre/quota/qmt_dev.c +index 02ec55b..28783a0 100644 +--- a/lustre/quota/qmt_dev.c ++++ b/lustre/quota/qmt_dev.c +@@ -466,11 +466,11 @@ int qmt_glb_init(void) + int rc; + ENTRY; + +- rc = class_register_type(&qmt_obd_ops, NULL, NULL, ++ rc = class_register_type(&qmt_obd_ops, NULL, true, NULL, + #ifndef HAVE_ONLY_PROCFS_SEQ +- NULL, ++ NULL, + #endif +- LUSTRE_QMT_NAME, &qmt_device_type); ++ LUSTRE_QMT_NAME, &qmt_device_type); + RETURN(rc); + } + +-- +1.9.1 + diff --git a/sys-cluster/lustre/files/0002-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch b/sys-cluster/lustre/files/0002-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch new file mode 100644 index 0000000..d7da497 --- /dev/null +++ b/sys-cluster/lustre/files/0002-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch @@ -0,0 +1,123 @@ +From 7dbddd98e60ab73580ea52c8b53274da2283d624 Mon Sep 17 00:00:00 2001 +From: James Simmons +Date: Tue, 25 Feb 2014 12:54:05 -0500 +Subject: [PATCH 2/9] LU-3319 procfs: Move NRS TBF proc handling to seq_files + +With newer kernels moving their proc file system handling +to seq_files this patch migrates the proc handling for NRS +TBF to this new approach. + +Change-Id: I121755b611296bf7b9527de65d0e6cf8c4980151 +Signed-off-by: James Simmons +--- + lustre/ptlrpc/nrs_tbf.c | 35 ++++++++++++++--------------------- + 1 file changed, 14 insertions(+), 21 deletions(-) + +diff --git a/lustre/ptlrpc/nrs_tbf.c b/lustre/ptlrpc/nrs_tbf.c +index 96eac30..09ab0e7 100644 +--- a/lustre/ptlrpc/nrs_tbf.c ++++ b/lustre/ptlrpc/nrs_tbf.c +@@ -1572,30 +1572,26 @@ static void nrs_tbf_req_stop(struct ptlrpc_nrs_policy *policy, + */ + #define LPROCFS_NRS_RATE_MAX 65535 + +-static int ptlrpc_lprocfs_rd_nrs_tbf_rule(char *page, char **start, +- off_t off, int count, int *eof, +- void *data) ++static int ++ptlrpc_lprocfs_nrs_tbf_rule_seq_show(struct seq_file *m, void *data) + { +- struct ptlrpc_service *svc = data; ++ struct ptlrpc_service *svc = m->private; + int rc; + int rc2; + struct nrs_tbf_dump dump; + +- rc2 = snprintf(page, count, "regular_requests:\n"); ++ rc2 = seq_printf(m, "regular_requests:\n"); + /** + * Perform two separate calls to this as only one of the NRS heads' + * policies may be in the ptlrpc_nrs_pol_state::NRS_POL_STATE_STARTED or + * ptlrpc_nrs_pol_state::NRS_POL_STATE_STOPPING state. + */ + dump.td_length = 0; +- dump.td_buff = page + rc2; +- dump.td_size = count - rc2; + rc = ptlrpc_nrs_policy_control(svc, PTLRPC_NRS_QUEUE_REG, + NRS_POL_NAME_TBF, + NRS_CTL_TBF_RD_RULE, + false, &dump); + if (rc == 0) { +- *eof = 1; + rc2 += dump.td_length; + /** + * Ignore -ENODEV as the regular NRS head's policy may be in the +@@ -1608,16 +1604,13 @@ static int ptlrpc_lprocfs_rd_nrs_tbf_rule(char *page, char **start, + if (!nrs_svc_has_hp(svc)) + goto no_hp; + +- rc2 += snprintf(page + rc2, count - rc2, "high_priority_requests:\n"); ++ rc2 += seq_printf(m, "high_priority_requests:\n"); + dump.td_length = 0; +- dump.td_buff = page + rc2; +- dump.td_size = count - rc2; + rc = ptlrpc_nrs_policy_control(svc, PTLRPC_NRS_QUEUE_HP, + NRS_POL_NAME_TBF, + NRS_CTL_TBF_RD_RULE, + false, &dump); + if (rc == 0) { +- *eof = 1; + rc2 += dump.td_length; + /** + * Ignore -ENODEV as the high priority NRS head's policy may be +@@ -1762,11 +1755,12 @@ out: + + extern struct nrs_core nrs_core; + #define LPROCFS_WR_NRS_TBF_MAX_CMD (4096) +-static int ptlrpc_lprocfs_wr_nrs_tbf_rule(struct file *file, +- const char *buffer, +- unsigned long count, void *data) ++static ssize_t ++ptlrpc_lprocfs_nrs_tbf_rule_seq_write(struct file *file, const char *buffer, ++ size_t count, loff_t *off) + { +- struct ptlrpc_service *svc = data; ++ struct seq_file *m = file->private_data; ++ struct ptlrpc_service *svc = m->private; + char *kernbuf; + char *val; + int rc; +@@ -1830,7 +1824,7 @@ out_free_kernbuff: + out: + return rc ? rc : count; + } +- ++LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_tbf_rule); + + /** + * Initializes a TBF policy's lprocfs interface for service \a svc +@@ -1843,10 +1837,9 @@ out: + int nrs_tbf_lprocfs_init(struct ptlrpc_service *svc) + { + int rc; +- struct lprocfs_vars nrs_tbf_lprocfs_vars[] = { ++ struct lprocfs_seq_vars nrs_tbf_lprocfs_vars[] = { + { .name = "nrs_tbf_rule", +- .read_fptr = ptlrpc_lprocfs_rd_nrs_tbf_rule, +- .write_fptr = ptlrpc_lprocfs_wr_nrs_tbf_rule, ++ .fops = &ptlrpc_lprocfs_nrs_tbf_rule_fops, + .data = svc }, + { NULL } + }; +@@ -1854,7 +1847,7 @@ int nrs_tbf_lprocfs_init(struct ptlrpc_service *svc) + if (svc->srv_procroot == NULL) + return 0; + +- rc = lprocfs_add_vars(svc->srv_procroot, nrs_tbf_lprocfs_vars, NULL); ++ rc = lprocfs_seq_add_vars(svc->srv_procroot, nrs_tbf_lprocfs_vars, NULL); + + return rc; + } +-- +1.9.1 + diff --git a/sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch similarity index 79% rename from sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch rename to sys-cluster/lustre/files/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch index ff3c6bf..b06c8da 100644 --- a/sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch +++ b/sys-cluster/lustre/files/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch @@ -1,7 +1,7 @@ -From 699242b35f07c7c64959dca02cc359d389c7f568 Mon Sep 17 00:00:00 2001 +From abe827ebe8722336c55affd8388dacfbb38b49f1 Mon Sep 17 00:00:00 2001 From: James Simmons -Date: Fri, 3 Jan 2014 09:55:26 -0500 -Subject: [PATCH 02/12] LU-3319 procfs: update zfs proc handling to seq_files +Date: Tue, 18 Feb 2014 18:44:22 -0500 +Subject: [PATCH 3/9] LU-3319 procfs: update zfs proc handling to seq_files Migrate all zfs proc handling to using strictly seq_files. @@ -9,68 +9,61 @@ Signed-off-by: James Simmons 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(-) + lustre/osd-zfs/osd_internal.h | 3 +- + lustre/osd-zfs/osd_lproc.c | 90 +++++++++++++++++++++++++------------------ + 3 files changed, 60 insertions(+), 46 deletions(-) diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c -index 1025be9..c9bf49a 100644 +index 47bbc76..05820e0 100644 --- a/lustre/osd-zfs/osd_handler.c +++ b/lustre/osd-zfs/osd_handler.c -@@ -748,6 +748,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; -@@ -761,12 +762,12 @@ static int osd_process_config(const struct lu_env *env, +@@ -761,12 +761,13 @@ 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); ++ rc = class_process_proc_seq_param(PARAM_OSD, ++ lprocfs_osd_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); ++ lprocfs_osd_obd_vars, ++ cfg, &o->od_dt_dev); break; } default: @@ -914,7 +915,7 @@ int __init osd_init(void) - rc = class_register_type(&osd_obd_device_ops, NULL, NULL, + rc = class_register_type(&osd_obd_device_ops, NULL, true, NULL, #ifndef HAVE_ONLY_PROCFS_SEQ -- lprocfs_osd_module_vars, -+ NULL, +- lprocfs_osd_module_vars, ++ NULL, #endif - LUSTRE_OSD_ZFS_NAME, &osd_device_type); + 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 +index bc51cb1..3dc4881 100644 --- a/lustre/osd-zfs/osd_internal.h +++ b/lustre/osd-zfs/osd_internal.h -@@ -402,9 +402,6 @@ enum { +@@ -402,8 +402,7 @@ enum { }; /* osd_lproc.c */ -extern struct lprocfs_vars lprocfs_osd_obd_vars[]; -extern struct lprocfs_vars lprocfs_osd_module_vars[]; -- ++extern struct lprocfs_seq_vars lprocfs_osd_obd_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 +index 0854ce6..bed08e9 100644 --- a/lustre/osd-zfs/osd_lproc.c +++ b/lustre/osd-zfs/osd_lproc.c -@@ -107,27 +107,26 @@ out: +@@ -107,27 +107,27 @@ out: RETURN(result); } @@ -105,11 +98,12 @@ index 0854ce6..a7ce60d 100644 + size_t count, loff_t *off) { - struct dt_device *dt = data; -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct dt_device *dt = m->private; struct lu_env env; int rc; -@@ -139,20 +138,21 @@ static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer, +@@ -139,20 +139,22 @@ static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer, return rc == 0 ? count : rc; } @@ -133,12 +127,13 @@ index 0854ce6..a7ce60d 100644 + 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 seq_file *m = file->private_data; ++ struct dt_device *dt = m->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, +@@ -165,24 +167,36 @@ static int lprocfs_osd_wr_iused_est(struct file *file, const char *buffer, return count; } @@ -193,7 +188,7 @@ index 0854ce6..a7ce60d 100644 { 0 } }; -@@ -202,7 +214,7 @@ int osd_procfs_init(struct osd_device *osd, const char *name) +@@ -202,7 +216,7 @@ int osd_procfs_init(struct osd_device *osd, const char *name) LASSERT(name != NULL); LASSERT(type != NULL); @@ -203,5 +198,5 @@ index 0854ce6..a7ce60d 100644 if (IS_ERR(osd->od_proc_entry)) { rc = PTR_ERR(osd->od_proc_entry); -- -1.8.5.3 +1.9.1 diff --git a/sys-cluster/lustre/files/0004-LU-3319-procfs-fix-symlink-handling.patch b/sys-cluster/lustre/files/0004-LU-3319-procfs-fix-symlink-handling.patch deleted file mode 100644 index 935325e..0000000 --- a/sys-cluster/lustre/files/0004-LU-3319-procfs-fix-symlink-handling.patch +++ /dev/null @@ -1,371 +0,0 @@ -From 4bc21601224ea84152d9c3cc83eee33af8eb8cb2 Mon Sep 17 00:00:00 2001 -From: James Simmons -Date: Sun, 9 Feb 2014 09:37:44 -0500 -Subject: [PATCH 04/12] LU-3319 procfs: fix symlink handling - -While working on symlink handling for seq files I noticed a -long outstanding bug. Code was developed to link osc obds -to target_obds of the lov layer. The target_obds directory -was never created for the symlinks. This patches enables -this long forgotten feature. Also addressed is the race -condition experinced with server side code ported to -seq_files that used symlinks. To avoid the race the handle -obd_proc_private was moved from struct obd_device to -struct obd_type which now allows earlier registeration that -only happens once. - -Change-Id: Ib158ec4444ed7abc0f3c3e820ee4a333631a58d1 -Signed-off-by: James Simmons ---- - lustre/include/obd.h | 17 +++++---- - lustre/lmv/lmv_obd.c | 48 ++++++++--------------- - lustre/lov/lov_obd.c | 99 +++++++++++++++++++++++++++--------------------- - lustre/obdclass/genops.c | 17 +++++---- - 4 files changed, 91 insertions(+), 90 deletions(-) - -diff --git a/lustre/include/obd.h b/lustre/include/obd.h -index ac80412..42266da 100644 ---- a/lustre/include/obd.h -+++ b/lustre/include/obd.h -@@ -183,13 +183,15 @@ struct obd_info { - }; - - struct obd_type { -- cfs_list_t typ_chain; -- struct obd_ops *typ_dt_ops; -- struct md_ops *typ_md_ops; -- cfs_proc_dir_entry_t *typ_procroot; -- char *typ_name; -- int typ_refcnt; -- struct lu_device_type *typ_lu; -+ struct list_head typ_chain; -+ struct obd_ops *typ_dt_ops; -+ struct md_ops *typ_md_ops; -+ cfs_proc_dir_entry_t *typ_procroot; -+ cfs_proc_dir_entry_t *typ_procsym; -+ __u32 typ_sym_filter; -+ char *typ_name; -+ int typ_refcnt; -+ struct lu_device_type *typ_lu; - spinlock_t obd_type_lock; - }; - -@@ -825,7 +827,6 @@ struct obd_device { - - struct proc_dir_entry *obd_proc_entry; - struct proc_dir_entry *obd_proc_exports_entry; -- void *obd_proc_private; /* type private PDEs */ - struct proc_dir_entry *obd_svc_procroot; - struct lprocfs_stats *obd_svc_stats; - struct lprocfs_seq_vars *obd_vars; -diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c -index ee5f3a7..66a9448 100644 ---- a/lustre/lmv/lmv_obd.c -+++ b/lustre/lmv/lmv_obd.c -@@ -263,9 +263,6 @@ static int lmv_connect(const struct lu_env *env, - struct obd_uuid *cluuid, struct obd_connect_data *data, - void *localdata) - { --#ifdef __KERNEL__ -- struct proc_dir_entry *lmv_proc_dir; --#endif - struct lmv_obd *lmv = &obd->u.lmv; - struct lustre_handle conn = { 0 }; - int rc = 0; -@@ -298,18 +295,15 @@ static int lmv_connect(const struct lu_env *env, - lmv->conn_data = *data; - - #ifdef __KERNEL__ -- if (obd->obd_proc_private != NULL) { -- lmv_proc_dir = obd->obd_proc_private; -- } else { -- lmv_proc_dir = lprocfs_seq_register("target_obds", -- obd->obd_proc_entry, -- NULL, NULL); -- if (IS_ERR(lmv_proc_dir)) { -+ if (obd->obd_type->typ_procsym == NULL) { -+ obd->obd_type->typ_procsym = lprocfs_seq_register("target_obds", -+ obd->obd_proc_entry, -+ NULL, NULL); -+ if (IS_ERR(obd->obd_type->typ_procsym)) { - CERROR("could not register /proc/fs/lustre/%s/%s/target_obds.", - obd->obd_type->typ_name, obd->obd_name); -- lmv_proc_dir = NULL; -+ obd->obd_type->typ_procsym = NULL; - } -- obd->obd_proc_private = lmv_proc_dir; - } - #endif - -@@ -323,10 +317,8 @@ static int lmv_connect(const struct lu_env *env, - rc = lmv_check_connect(obd); - - #ifdef __KERNEL__ -- if (rc && lmv_proc_dir) { -- lprocfs_remove(&lmv_proc_dir); -- obd->obd_proc_private = NULL; -- } -+ if (rc && obd->obd_type->typ_procsym != NULL) -+ lprocfs_remove(&obd->obd_type->typ_procsym); - #endif - RETURN(rc); - } -@@ -405,9 +397,6 @@ static int lmv_init_ea_size(struct obd_export *exp, int easize, - - int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) - { --#ifdef __KERNEL__ -- struct proc_dir_entry *lmv_proc_dir; --#endif - struct lmv_obd *lmv = &obd->u.lmv; - struct obd_uuid *cluuid = &lmv->cluuid; - struct obd_uuid lmv_mdc_uuid = { "LMV_MDC_UUID" }; -@@ -487,14 +476,13 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) - cfs_atomic_read(&obd->obd_refcount)); - - #ifdef __KERNEL__ -- lmv_proc_dir = obd->obd_proc_private; -- if (lmv_proc_dir) { -+ if (obd->obd_type->typ_procsym != NULL) { - struct proc_dir_entry *mdc_symlink; - - LASSERT(mdc_obd->obd_type != NULL); - LASSERT(mdc_obd->obd_type->typ_name != NULL); - mdc_symlink = lprocfs_add_symlink(mdc_obd->obd_name, -- lmv_proc_dir, -+ obd->obd_type->typ_procsym, - "../../../%s/%s", - mdc_obd->obd_type->typ_name, - mdc_obd->obd_name); -@@ -503,8 +491,7 @@ int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) - "/proc/fs/lustre/%s/%s/target_obds/%s.", - obd->obd_type->typ_name, obd->obd_name, - mdc_obd->obd_name); -- lprocfs_remove(&lmv_proc_dir); -- obd->obd_proc_private = NULL; -+ lprocfs_remove(&obd->obd_type->typ_procsym); - } - } - #endif -@@ -696,9 +683,6 @@ int lmv_check_connect(struct obd_device *obd) - - static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) - { --#ifdef __KERNEL__ -- struct proc_dir_entry *lmv_proc_dir; --#endif - struct lmv_obd *lmv = &obd->u.lmv; - struct obd_device *mdc_obd; - int rc; -@@ -716,9 +700,9 @@ static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) - } - - #ifdef __KERNEL__ -- lmv_proc_dir = obd->obd_proc_private; -- if (lmv_proc_dir) -- lprocfs_remove_proc_entry(mdc_obd->obd_name, lmv_proc_dir); -+ if (obd->obd_type->typ_procsym != NULL) -+ lprocfs_remove_proc_entry(mdc_obd->obd_name, -+ obd->obd_type->typ_procsym); - #endif - rc = obd_fid_fini(tgt->ltd_exp->exp_obd); - if (rc) -@@ -768,8 +752,8 @@ static int lmv_disconnect(struct obd_export *exp) - } - - #ifdef __KERNEL__ -- if (obd->obd_proc_private) -- lprocfs_remove((struct proc_dir_entry **)&obd->obd_proc_private); -+ if (obd->obd_type->typ_procsym != NULL) -+ lprocfs_remove(&obd->obd_type->typ_procsym); - else - CERROR("/proc/fs/lustre/%s/%s/target_obds missing\n", - obd->obd_type->typ_name, obd->obd_name); -diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c -index 286cd15..a3310fd 100644 ---- a/lustre/lov/lov_obd.c -+++ b/lustre/lov/lov_obd.c -@@ -127,19 +127,16 @@ static int lov_notify(struct obd_device *obd, struct obd_device *watched, - int lov_connect_obd(struct obd_device *obd, __u32 index, int activate, - struct obd_connect_data *data) - { -- struct lov_obd *lov = &obd->u.lov; -- struct obd_uuid *tgt_uuid; -- struct obd_device *tgt_obd; -- static struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" }; -- struct obd_import *imp; --#ifdef __KERNEL__ -- struct proc_dir_entry *lov_proc_dir; --#endif -- int rc; -- ENTRY; -+ struct lov_obd *lov = &obd->u.lov; -+ struct obd_uuid *tgt_uuid; -+ struct obd_device *tgt_obd; -+ static struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" }; -+ struct obd_import *imp; -+ int rc; -+ ENTRY; - -- if (!lov->lov_tgts[index]) -- RETURN(-EINVAL); -+ if (lov->lov_tgts[index] == NULL) -+ RETURN(-EINVAL); - - tgt_uuid = &lov->lov_tgts[index]->ltd_uuid; - tgt_obd = lov->lov_tgts[index]->ltd_obd; -@@ -195,27 +192,25 @@ int lov_connect_obd(struct obd_device *obd, __u32 index, int activate, - obd_uuid2str(tgt_uuid), tgt_obd->obd_name, activate ? "":"in"); - - #ifdef __KERNEL__ -- lov_proc_dir = obd->obd_proc_private; -- if (lov_proc_dir) { -- struct obd_device *osc_obd = lov->lov_tgts[index]->ltd_exp->exp_obd; -+ if (obd->obd_type->typ_procsym != NULL) { -+ struct obd_device *osc_obd = lov->lov_tgts[index]->ltd_exp->exp_obd; - struct proc_dir_entry *osc_symlink; - -- LASSERT(osc_obd != NULL); -- LASSERT(osc_obd->obd_magic == OBD_DEVICE_MAGIC); -- LASSERT(osc_obd->obd_type->typ_name != NULL); -- -- osc_symlink = lprocfs_add_symlink(osc_obd->obd_name, -- lov_proc_dir, -- "../../../%s/%s", -- osc_obd->obd_type->typ_name, -- osc_obd->obd_name); -- if (osc_symlink == NULL) { -- CERROR("could not register LOV target " -- "/proc/fs/lustre/%s/%s/target_obds/%s.", -- obd->obd_type->typ_name, obd->obd_name, -- osc_obd->obd_name); -- lprocfs_remove(&lov_proc_dir); -- obd->obd_proc_private = NULL; -+ LASSERT(osc_obd != NULL); -+ LASSERT(osc_obd->obd_magic == OBD_DEVICE_MAGIC); -+ LASSERT(osc_obd->obd_type->typ_name != NULL); -+ -+ osc_symlink = lprocfs_add_symlink(osc_obd->obd_name, -+ obd->obd_type->typ_procsym, -+ "../../../%s/%s", -+ osc_obd->obd_type->typ_name, -+ osc_obd->obd_name); -+ if (osc_symlink == NULL) { -+ CERROR("could not register LOV target " -+ "/proc/fs/lustre/%s/%s/target_obds/%s.", -+ obd->obd_type->typ_name, obd->obd_name, -+ osc_obd->obd_name); -+ lprocfs_remove(&obd->obd_type->typ_procsym); - } - } - #endif -@@ -250,6 +245,17 @@ static int lov_connect(const struct lu_env *env, - if (data) - lov->lov_ocd = *data; - -+#ifdef __KERNEL__ -+ obd->obd_type->typ_procsym = lprocfs_seq_register("target_obds", -+ obd->obd_proc_entry, -+ NULL, NULL); -+ if (IS_ERR(obd->obd_type->typ_procsym)) { -+ CERROR("could not register /proc/fs/lustre/%s/%s/target_obds.", -+ obd->obd_type->typ_name, obd->obd_name); -+ obd->obd_type->typ_procsym = NULL; -+ } -+#endif -+ - obd_getref(obd); - for (i = 0; i < lov->desc.ld_tgt_count; i++) { - tgt = lov->lov_tgts[i]; -@@ -280,7 +286,6 @@ static int lov_connect(const struct lu_env *env, - - static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt) - { -- struct proc_dir_entry *lov_proc_dir; - struct lov_obd *lov = &obd->u.lov; - struct obd_device *osc_obd; - int rc; -@@ -296,18 +301,18 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt) - tgt->ltd_exp->exp_obd->obd_inactive = 1; - } - -- lov_proc_dir = obd->obd_proc_private; -- if (lov_proc_dir) -- lprocfs_remove_proc_entry(osc_obd->obd_name, lov_proc_dir); -+ if (obd->obd_type->typ_procsym) -+ lprocfs_remove_proc_entry(osc_obd->obd_name, -+ obd->obd_type->typ_procsym); - -- if (osc_obd) { -- /* Pass it on to our clients. -- * XXX This should be an argument to disconnect, -- * XXX not a back-door flag on the OBD. Ah well. -- */ -- osc_obd->obd_force = obd->obd_force; -- osc_obd->obd_fail = obd->obd_fail; -- osc_obd->obd_no_recov = obd->obd_no_recov; -+ if (osc_obd) { -+ /* Pass it on to our clients. -+ * XXX This should be an argument to disconnect, -+ * XXX not a back-door flag on the OBD. Ah well. -+ */ -+ osc_obd->obd_force = obd->obd_force; -+ osc_obd->obd_fail = obd->obd_fail; -+ osc_obd->obd_no_recov = obd->obd_no_recov; - } - - obd_register_observer(osc_obd, NULL); -@@ -353,6 +358,14 @@ static int lov_disconnect(struct obd_export *exp) - } - obd_putref(obd); - -+#ifdef __KERNEL__ -+ if (obd->obd_type->typ_procsym) -+ lprocfs_remove(&obd->obd_type->typ_procsym); -+ else -+ CERROR("/proc/fs/lustre/%s/%s/target_obds missing\n", -+ obd->obd_type->typ_name, obd->obd_name); -+#endif -+ - out: - rc = class_disconnect(exp); /* bz 9811 */ - RETURN(rc); -diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c -index 20cd0a0..00bf342 100644 ---- a/lustre/obdclass/genops.c -+++ b/lustre/obdclass/genops.c -@@ -181,14 +181,15 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, - RETURN(-EEXIST); - } - -- rc = -ENOMEM; -- OBD_ALLOC(type, sizeof(*type)); -- if (type == NULL) -- RETURN(rc); -+ rc = -ENOMEM; -+ OBD_ALLOC(type, sizeof(*type)); -+ if (type == NULL) -+ RETURN(rc); -+ memset(type, 0, sizeof(*type)); - -- OBD_ALLOC_PTR(type->typ_dt_ops); -- OBD_ALLOC_PTR(type->typ_md_ops); -- OBD_ALLOC(type->typ_name, strlen(name) + 1); -+ OBD_ALLOC_PTR(type->typ_dt_ops); -+ OBD_ALLOC_PTR(type->typ_md_ops); -+ OBD_ALLOC(type->typ_name, strlen(name) + 1); - - if (type->typ_dt_ops == NULL || - type->typ_md_ops == NULL || -@@ -242,6 +243,8 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, - if (type->typ_dt_ops != NULL) - OBD_FREE_PTR(type->typ_dt_ops); - #ifdef LPROCFS -+ if (type->typ_procsym != NULL) -+ lprocfs_remove(&type->typ_procsym); - #ifndef HAVE_ONLY_PROCFS_SEQ - lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root); - #else --- -1.8.5.3 - diff --git a/sys-cluster/lustre/files/0003-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch similarity index 96% rename from sys-cluster/lustre/files/0003-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch rename to sys-cluster/lustre/files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch index 38785b2..c7d415a 100644 --- a/sys-cluster/lustre/files/0003-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch +++ b/sys-cluster/lustre/files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch @@ -1,7 +1,7 @@ -From 44eb91a37b43a71a0d531359c9da082b6e1ec454 Mon Sep 17 00:00:00 2001 +From 00e2e7c431e38433b919735890481e4bb5707cd4 Mon Sep 17 00:00:00 2001 From: James Simmons -Date: Fri, 3 Jan 2014 09:58:53 -0500 -Subject: [PATCH 03/12] LU-3319 procfs: move mgs proc handling to seq_files +Date: Tue, 4 Mar 2014 10:45:30 -0500 +Subject: [PATCH 4/9] LU-3319 procfs: move mgs proc handling to seq_files With 3.10 linux kernel and above proc handling now only uses struct seq_files. This patch migrates the mgs @@ -271,22 +271,22 @@ index ffa2d0d..f0ea956 100644 -} #endif diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c -index 5be9040..4bb842c 100644 +index 85b219c..a9b0857 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c -@@ -1434,12 +1434,9 @@ static struct obd_ops mgs_obd_device_ops = { +@@ -1513,12 +1513,9 @@ static struct obd_ops mgs_obd_device_ops = { static int __init mgs_init(void) { - struct lprocfs_static_vars lvars; - - lprocfs_mgs_init_vars(&lvars); - return class_register_type(&mgs_obd_device_ops, NULL, NULL, + return class_register_type(&mgs_obd_device_ops, NULL, true, NULL, #ifndef HAVE_ONLY_PROCFS_SEQ -- lvars.module_vars, -+ NULL, +- lvars.module_vars, ++ NULL, #endif - LUSTRE_MGS_NAME, &mgs_device_type); + LUSTRE_MGS_NAME, &mgs_device_type); } diff --git a/lustre/mgs/mgs_internal.h b/lustre/mgs/mgs_internal.h index ca2846e..d3baacd 100644 @@ -327,7 +327,7 @@ index ca2846e..d3baacd 100644 /* mgs/lproc_mgs.c */ diff --git a/lustre/mgs/mgs_nids.c b/lustre/mgs/mgs_nids.c -index a2bae59..3248387 100644 +index 24c9d22..a4d8800 100644 --- a/lustre/mgs/mgs_nids.c +++ b/lustre/mgs/mgs_nids.c @@ -838,15 +838,14 @@ int lprocfs_rd_ir_state(struct seq_file *seq, void *data) @@ -352,5 +352,5 @@ index a2bae59..3248387 100644 return lprocfs_wr_uint(file, buffer, count, &ir_timeout); } -- -1.8.5.3 +1.9.1 diff --git a/sys-cluster/lustre/files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch index 2d5a974..e439041 100644 --- a/sys-cluster/lustre/files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch +++ b/sys-cluster/lustre/files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch @@ -1,7 +1,7 @@ -From e9786df9c5618c2cff7d81088548fefee874468a Mon Sep 17 00:00:00 2001 +From ab793e8472447314f6428025175f80afc26339ac Mon Sep 17 00:00:00 2001 From: James Simmons -Date: Sun, 9 Feb 2014 17:10:18 -0500 -Subject: [PATCH 05/12] LU-3319 procfs: move osp proc handling to seq_files +Date: Wed, 26 Mar 2014 19:59:18 -0400 +Subject: [PATCH 5/9] LU-3319 procfs: move osp proc handling to seq_files With 3.10 linux kernel and above proc handling now only uses struct seq_files. This patch migrates the osp @@ -10,17 +10,17 @@ layer proc entries over to using seq_files. Signed-off-by: James Simmons Change-Id: Id8f77d72fd35755f1b7b1c17fcf27e0731bd5ac1 --- - lustre/osp/lproc_osp.c | 373 ++++++++++++++++++++++++---------------------- - lustre/osp/lwp_dev.c | 18 +-- - lustre/osp/osp_dev.c | 48 +++--- + lustre/osp/lproc_osp.c | 402 +++++++++++++++++++++++++--------------------- + lustre/osp/lwp_dev.c | 19 +-- + lustre/osp/osp_dev.c | 32 ++-- lustre/osp/osp_internal.h | 2 - - 4 files changed, 222 insertions(+), 219 deletions(-) + 4 files changed, 228 insertions(+), 227 deletions(-) diff --git a/lustre/osp/lproc_osp.c b/lustre/osp/lproc_osp.c -index 75ebeb1..1ec40fc 100644 +index 75ebeb1..1271b7c 100644 --- a/lustre/osp/lproc_osp.c +++ b/lustre/osp/lproc_osp.c -@@ -45,24 +45,23 @@ +@@ -45,24 +45,24 @@ #include "osp_internal.h" #ifdef LPROCFS @@ -48,12 +48,13 @@ index 75ebeb1..1ec40fc 100644 { - struct obd_device *dev = data; - int val, rc; -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *dev = m->private; + int val, rc; rc = lprocfs_write_helper(buffer, count, &val); if (rc) -@@ -81,67 +80,60 @@ static int osp_wr_active(struct file *file, const char *buffer, +@@ -81,67 +81,61 @@ static int osp_wr_active(struct file *file, const char *buffer, LPROCFS_CLIMP_EXIT(dev); return count; } @@ -137,11 +138,12 @@ index 75ebeb1..1ec40fc 100644 + size_t count, loff_t *off) { - struct obd_device *dev = data; -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *dev = m->private; struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev); int val, rc; -@@ -158,25 +150,24 @@ static int osp_wr_max_rpcs_in_flight(struct file *file, const char *buffer, +@@ -158,25 +152,25 @@ static int osp_wr_max_rpcs_in_flight(struct file *file, const char *buffer, osp->opd_syn_max_rpc_in_flight = val; return count; } @@ -171,11 +173,12 @@ index 75ebeb1..1ec40fc 100644 + size_t count, loff_t *off) { - struct obd_device *dev = data; -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *dev = m->private; struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev); int val, rc; -@@ -194,23 +185,24 @@ static int osp_wr_max_rpcs_in_prog(struct file *file, const char *buffer, +@@ -194,23 +188,25 @@ static int osp_wr_max_rpcs_in_prog(struct file *file, const char *buffer, return count; } @@ -203,11 +206,12 @@ index 75ebeb1..1ec40fc 100644 + size_t count, loff_t *off) { - struct obd_device *obd = data; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev); int val, rc, i; -@@ -242,23 +234,24 @@ static int osp_wr_create_count(struct file *file, const char *buffer, +@@ -242,23 +238,25 @@ static int osp_wr_create_count(struct file *file, const char *buffer, return count; } @@ -235,11 +239,12 @@ index 75ebeb1..1ec40fc 100644 + size_t count, loff_t *off) { - struct obd_device *obd = data; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev); int val, rc; -@@ -281,89 +274,85 @@ static int osp_wr_max_create_count(struct file *file, const char *buffer, +@@ -281,89 +279,86 @@ static int osp_wr_max_create_count(struct file *file, const char *buffer, return count; } @@ -353,11 +358,12 @@ index 75ebeb1..1ec40fc 100644 + size_t count, loff_t *off) { - struct obd_device *dev = data; -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *dev = m->private; struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev); int val, rc; -@@ -381,25 +370,23 @@ static int osp_wr_maxage(struct file *file, const char *buffer, +@@ -381,25 +376,23 @@ static int osp_wr_maxage(struct file *file, const char *buffer, return count; } @@ -390,7 +396,7 @@ index 75ebeb1..1ec40fc 100644 struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev); if (osp == NULL) -@@ -411,87 +398,126 @@ static int osp_rd_destroys_in_flight(char *page, char **start, off_t off, +@@ -411,126 +404,161 @@ static int osp_rd_destroys_in_flight(char *page, char **start, off_t off, * - sync changes are zero - no llog records * - sync in progress are zero - no RPCs in flight */ @@ -566,31 +572,49 @@ index 75ebeb1..1ec40fc 100644 { struct obd_device *obd = osp->opd_obd; - struct proc_dir_entry *osc_proc_dir; -+ struct proc_dir_entry *symlink = NULL; ++ struct proc_dir_entry *osc_proc_dir = NULL; ++ struct obd_type *type; int rc; - obd->obd_proc_entry = lprocfs_register(obd->obd_name, -+ obd->obd_proc_entry = lprocfs_seq_register(obd->obd_name, - obd->obd_type->typ_procroot, - lprocfs_osp_osd_vars, - &osp->opd_dt_dev); -@@ -502,34 +528,29 @@ void osp_lprocfs_init(struct osp_device *osp) +- obd->obd_type->typ_procroot, +- lprocfs_osp_osd_vars, +- &osp->opd_dt_dev); +- if (IS_ERR(obd->obd_proc_entry)) { +- CERROR("%s: can't register in lprocfs: %ld\n", +- obd->obd_name, PTR_ERR(obd->obd_proc_entry)); +- obd->obd_proc_entry = NULL; ++ obd->obd_vars = lprocfs_osp_obd_vars; ++ if (lprocfs_seq_obd_setup(obd) != 0) return; - } +- } - rc = lprocfs_add_vars(obd->obd_proc_entry, lprocfs_osp_obd_vars, obd); -+ rc = lprocfs_seq_add_vars(obd->obd_proc_entry, lprocfs_osp_obd_vars, obd); ++ rc = lprocfs_seq_add_vars(obd->obd_proc_entry, lprocfs_osp_osd_vars, ++ &osp->opd_dt_dev); if (rc) { - CERROR("%s: can't register in lprocfs: %ld\n", - obd->obd_name, PTR_ERR(obd->obd_proc_entry)); +- CERROR("%s: can't register in lprocfs: %ld\n", +- obd->obd_name, PTR_ERR(obd->obd_proc_entry)); ++ CERROR("%s: can't register in lprocfs, rc %d\n", ++ obd->obd_name, rc); return; } -+ obd->obd_vars = lprocfs_osp_obd_vars; ptlrpc_lprocfs_register_obd(obd); -+ if (osp->opd_connect_mdt || obd->obd_type->typ_procsym == NULL || -+ !strstr(obd->obd_name, "osc")) ++ if (osp->opd_connect_mdt || !strstr(obd->obd_name, "osc")) ++ return; ++ ++ /* If the real OSC is present which is the case for setups ++ * with both server and clients on the same node then use ++ * the OSC's proc root */ ++ type = class_search_type(LUSTRE_OSC_NAME); ++ if (type != NULL && type->typ_procroot != NULL) ++ osc_proc_dir = type->typ_procroot; ++ else ++ osc_proc_dir = obd->obd_type->typ_procsym; ++ ++ if (osc_proc_dir == NULL) + return; + /* for compatibility we link old procfs's OSC entries to osp ones */ @@ -612,31 +636,28 @@ index 75ebeb1..1ec40fc 100644 - OBD_FREE(name, strlen(obd->obd_name) + 1); - osp->opd_symlink = symlink; - } -+ symlink = lprocfs_add_symlink(obd->obd_name, obd->obd_type->typ_procsym, -+ "../osp/%s", obd->obd_name); -+ if (symlink == NULL) { +- } ++ osp->opd_symlink = lprocfs_add_symlink(obd->obd_name, osc_proc_dir, ++ "../osp/%s", obd->obd_name); ++ if (osp->opd_symlink == NULL) + CERROR("could not register OSC symlink for " + "/proc/fs/lustre/osp/%s.", obd->obd_name); -+ lprocfs_remove(&obd->obd_type->typ_procsym); -+ } else { -+ osp->opd_symlink = symlink; - } } + #endif /* LPROCFS */ diff --git a/lustre/osp/lwp_dev.c b/lustre/osp/lwp_dev.c -index dc4f978..b6e84e1 100644 +index a73973a..c115ee6 100644 --- a/lustre/osp/lwp_dev.c +++ b/lustre/osp/lwp_dev.c -@@ -184,25 +184,13 @@ const struct lu_device_operations lwp_lu_ops = { +@@ -184,25 +184,9 @@ const struct lu_device_operations lwp_lu_ops = { .ldo_process_config = lwp_process_config, }; -static struct lprocfs_vars lprocfs_lwp_module_vars[] = { - { "num_refs", lprocfs_rd_numrefs, 0, 0 }, -+static struct lprocfs_seq_vars lprocfs_lwp_obd_vars[] = { - { 0 } - }; - +- { 0 } +-}; +- -static struct lprocfs_vars lprocfs_lwp_obd_vars[] = { - { 0 } -}; @@ -654,19 +675,18 @@ index dc4f978..b6e84e1 100644 int rc; ENTRY; -@@ -231,8 +219,8 @@ int lwp_init0(const struct lu_env *env, struct lwp_device *lwp, +@@ -231,8 +215,7 @@ int lwp_init0(const struct lu_env *env, struct lwp_device *lwp, RETURN(rc); } - lprocfs_lwp_init_vars(&lvars); - if (lprocfs_obd_setup(lwp->lpd_obd, lvars.obd_vars) == 0) -+ lwp->lpd_obd->obd_vars = lprocfs_lwp_obd_vars; + if (lprocfs_seq_obd_setup(lwp->lpd_obd) == 0) ptlrpc_lprocfs_register_obd(lwp->lpd_obd); RETURN(0); diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c -index a8d75ea..336b9f0 100644 +index 60bf8ef..b0c68ad 100644 --- a/lustre/osp/osp_dev.c +++ b/lustre/osp/osp_dev.c @@ -366,7 +366,7 @@ static int osp_process_config(const struct lu_env *env, @@ -693,24 +713,13 @@ index a8d75ea..336b9f0 100644 if (rc > 0) rc = 0; if (rc == -ENOSYS) { -@@ -844,6 +842,9 @@ static struct lu_device *osp_device_fini(const struct lu_env *env, - OBD_FREE_PTR(cli->cl_rpc_lock); - cli->cl_rpc_lock = NULL; - } -+ } else { -+ if (m->opd_obd->obd_type->typ_procsym != NULL) -+ lprocfs_remove(&m->opd_obd->obd_type->typ_procsym); - } - - rc = client_obd_cleanup(m->opd_obd); -@@ -1233,33 +1234,26 @@ struct llog_operations osp_mds_ost_orig_logops; +@@ -1238,33 +1236,27 @@ struct llog_operations osp_mds_ost_orig_logops; static int __init osp_mod_init(void) { - struct lprocfs_static_vars lvars; -- cfs_proc_dir_entry_t *osc_proc_dir; + struct obd_type *type; - int rc; -+ struct obd_type *type; + int rc; rc = lu_kmem_init(osp_caches); @@ -718,13 +727,13 @@ index a8d75ea..336b9f0 100644 return rc; - lprocfs_osp_init_vars(&lvars); -- - rc = class_register_type(&osp_obd_device_ops, NULL, NULL, + + rc = class_register_type(&osp_obd_device_ops, NULL, true, NULL, #ifndef HAVE_ONLY_PROCFS_SEQ -- lvars.module_vars, -+ NULL, +- lvars.module_vars, ++ NULL, #endif - LUSTRE_OSP_NAME, &osp_device_type); + LUSTRE_OSP_NAME, &osp_device_type); - - /* create "osc" entry in procfs for compatibility purposes */ if (rc != 0) { @@ -734,36 +743,27 @@ index a8d75ea..336b9f0 100644 - lprocfs_lwp_init_vars(&lvars); - - rc = class_register_type(&lwp_obd_device_ops, NULL, NULL, + rc = class_register_type(&lwp_obd_device_ops, NULL, true, NULL, #ifndef HAVE_ONLY_PROCFS_SEQ -- lvars.module_vars, -+ NULL, +- lvars.module_vars, ++ NULL, #endif - LUSTRE_LWP_NAME, &lwp_device_type); + LUSTRE_LWP_NAME, &lwp_device_type); if (rc != 0) { -@@ -1273,21 +1267,23 @@ static int __init osp_mod_init(void) - osp_mds_ost_orig_logops.lop_add = llog_cat_add_rec; - osp_mds_ost_orig_logops.lop_declare_add = llog_cat_declare_add_rec; - -- osc_proc_dir = lprocfs_srch(proc_lustre_root, "osc"); -- if (osc_proc_dir == NULL) { -- osc_proc_dir = lprocfs_register("osc", proc_lustre_root, NULL, -- NULL); -- if (IS_ERR(osc_proc_dir)) -- CERROR("osp: can't create compat entry \"osc\": %d\n", -- (int) PTR_ERR(osc_proc_dir)); -+ type = class_search_type(LUSTRE_OSC_NAME); -+ if (type) -+ return rc; -+ -+ type = class_search_type(LUSTRE_OSP_NAME); +@@ -1284,18 +1276,18 @@ static int __init osp_mod_init(void) + return rc; + + type = class_search_type(LUSTRE_OSP_NAME); +- type->typ_procsym = lprocfs_register("osc", proc_lustre_root, +- NULL, NULL); +- if (IS_ERR(type->typ_procsym)) + type->typ_procsym = lprocfs_seq_register("osc", proc_lustre_root, + NULL, NULL); + if (IS_ERR(type->typ_procsym)) { -+ CERROR("osp: can't create compat entry \"osc\": %d\n", -+ (int) PTR_ERR(type->typ_procsym)); + CERROR("osp: can't create compat entry \"osc\": %d\n", + (int) PTR_ERR(type->typ_procsym)); + type->typ_procsym = NULL; - } ++ } return rc; } @@ -775,10 +775,10 @@ index a8d75ea..336b9f0 100644 class_unregister_type(LUSTRE_OSP_NAME); lu_kmem_fini(osp_caches); diff --git a/lustre/osp/osp_internal.h b/lustre/osp/osp_internal.h -index 2af16c0..84eca11 100644 +index 1291374..66ad203 100644 --- a/lustre/osp/osp_internal.h +++ b/lustre/osp/osp_internal.h -@@ -526,7 +526,6 @@ int osp_write_last_oid_seq_files(struct lu_env *env, struct osp_device *osp, +@@ -530,7 +530,6 @@ int osp_write_last_oid_seq_files(struct lu_env *env, struct osp_device *osp, int osp_init_pre_fid(struct osp_device *osp); /* lproc_osp.c */ @@ -786,7 +786,7 @@ index 2af16c0..84eca11 100644 void osp_lprocfs_init(struct osp_device *osp); /* osp_sync.c */ -@@ -540,7 +539,6 @@ int osp_sync_fini(struct osp_device *d); +@@ -544,7 +543,6 @@ int osp_sync_fini(struct osp_device *d); void __osp_sync_check_for_work(struct osp_device *d); /* lwp_dev.c */ @@ -795,5 +795,5 @@ index 2af16c0..84eca11 100644 extern struct lu_device_type lwp_device_type; -- -1.8.5.3 +1.9.1 diff --git a/sys-cluster/lustre/files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch index 06e3571..d9bcc89 100644 --- a/sys-cluster/lustre/files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch +++ b/sys-cluster/lustre/files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch @@ -1,7 +1,7 @@ -From 2670599090a754d9fa8c7d952b530bc8fb88d56e Mon Sep 17 00:00:00 2001 +From 1394aacb441c3ba07b24a4b465f2496af8eb3c73 Mon Sep 17 00:00:00 2001 From: James Simmons -Date: Sun, 9 Feb 2014 11:08:45 -0500 -Subject: [PATCH 06/12] LU-3319 procfs: move lod proc handling to seq_files +Date: Wed, 26 Mar 2014 19:57:44 -0400 +Subject: [PATCH 6/9] LU-3319 procfs: move lod proc handling to seq_files With 3.10 linux kernel and above proc handling now only uses struct seq_files. This patch migrates the lod @@ -10,14 +10,14 @@ layer proc entries over to using seq_files. Signed-off-by: James Simmons Change-Id: Iaa0f617fcd430e91f12afbc0faf6906fd275a7a5 --- - lustre/lod/lod_dev.c | 39 ++++--- + lustre/lod/lod_dev.c | 23 ++-- lustre/lod/lod_internal.h | 1 - lustre/lod/lod_pool.c | 7 +- - lustre/lod/lproc_lod.c | 251 ++++++++++++++++++++++++---------------------- - 4 files changed, 152 insertions(+), 146 deletions(-) + lustre/lod/lproc_lod.c | 267 +++++++++++++++++++++++++--------------------- + 4 files changed, 157 insertions(+), 141 deletions(-) diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c -index a451462..8776aa3 100644 +index a653d6a..1baeb37 100644 --- a/lustre/lod/lod_dev.c +++ b/lustre/lod/lod_dev.c @@ -289,12 +289,10 @@ static int lod_process_config(const struct lu_env *env, @@ -36,70 +36,56 @@ index a451462..8776aa3 100644 if (rc > 0) rc = 0; GOTO(out, rc); -@@ -890,19 +888,16 @@ static struct obd_ops lod_obd_device_ops = { +@@ -891,7 +889,6 @@ static struct obd_ops lod_obd_device_ops = { static int __init lod_mod_init(void) { - struct lprocfs_static_vars lvars = { 0 }; -- cfs_proc_dir_entry_t *lov_proc_dir; -- int rc; -+ struct obd_type *lod, *lov; -+ int rc; + struct obd_type *type; + int rc; - rc = lu_kmem_init(lod_caches); +@@ -899,11 +896,9 @@ static int __init lod_mod_init(void) if (rc) return rc; - lprocfs_lod_init_vars(&lvars); - - rc = class_register_type(&lod_obd_device_ops, NULL, NULL, + rc = class_register_type(&lod_obd_device_ops, NULL, true, NULL, #ifndef HAVE_ONLY_PROCFS_SEQ -- lvars.module_vars, -+ NULL, +- lvars.module_vars, ++ NULL, #endif - LUSTRE_LOD_NAME, &lod_device_type); + LUSTRE_LOD_NAME, &lod_device_type); if (rc) { -@@ -911,23 +906,25 @@ static int __init lod_mod_init(void) - } +@@ -917,18 +912,18 @@ static int __init lod_mod_init(void) + return rc; - /* create "lov" entry in procfs for compatibility purposes */ -- lov_proc_dir = lprocfs_srch(proc_lustre_root, "lov"); -- if (lov_proc_dir == NULL) { -- lov_proc_dir = lprocfs_register("lov", proc_lustre_root, -- NULL, NULL); -- if (IS_ERR(lov_proc_dir)) -+ lod = class_search_type(LUSTRE_LOD_NAME); -+ lov = class_search_type(LUSTRE_LOV_NAME); -+ if (lov == NULL) { -+ lod->typ_procsym = lprocfs_seq_register("lov", proc_lustre_root, -+ NULL, NULL); -+ if (IS_ERR(lod->typ_procsym)) { - CERROR("lod: can't create compat entry \"lov\": %d\n", -- (int)PTR_ERR(lov_proc_dir)); -+ (int)PTR_ERR(lod->typ_procsym)); -+ lod->typ_procsym = NULL; -+ } -+ } else { -+ /* Map lov proc root to lod symlink */ -+ lod->typ_procsym = lov->typ_procroot; - } -- + type = class_search_type(LUSTRE_LOD_NAME); +- type->typ_procsym = lprocfs_register("lov", proc_lustre_root, +- NULL, NULL); +- if (IS_ERR(type->typ_procsym)) ++ type->typ_procsym = lprocfs_seq_register("lov", proc_lustre_root, ++ NULL, NULL); ++ if (IS_ERR(type->typ_procsym)) { + CERROR("lod: can't create compat entry \"lov\": %d\n", + (int)PTR_ERR(type->typ_procsym)); ++ type->typ_procsym = NULL; ++ } return rc; } static void __exit lod_mod_exit(void) { -- - lprocfs_try_remove_proc_entry("lov", proc_lustre_root); - class_unregister_type(LUSTRE_LOD_NAME); lu_kmem_fini(lod_caches); } diff --git a/lustre/lod/lod_internal.h b/lustre/lod/lod_internal.h -index 2a00890..65ba47a 100644 +index c3b1bc3..fc18f3d 100644 --- a/lustre/lod/lod_internal.h +++ b/lustre/lod/lod_internal.h -@@ -431,7 +431,6 @@ int qos_add_tgt(struct lod_device*, struct lod_tgt_desc *); +@@ -432,7 +432,6 @@ int qos_add_tgt(struct lod_device*, struct lod_tgt_desc *); int qos_del_tgt(struct lod_device *, struct lod_tgt_desc *); /* lproc_lod.c */ @@ -133,10 +119,10 @@ index 98b2416..1849e5d 100644 &pool_proc_operations); if (IS_ERR(new_pool->pool_proc_entry)) { diff --git a/lustre/lod/lproc_lod.c b/lustre/lod/lproc_lod.c -index e976063..e420a5e 100644 +index e976063..1598658 100644 --- a/lustre/lod/lproc_lod.c +++ b/lustre/lod/lproc_lod.c -@@ -42,23 +42,22 @@ +@@ -42,23 +42,23 @@ #include #ifdef LPROCFS @@ -163,11 +149,12 @@ index e976063..e420a5e 100644 + size_t count, loff_t *off) { - struct obd_device *dev = (struct obd_device *)data; -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *dev = m->private; struct lod_device *lod; __u64 val; int rc; -@@ -73,24 +72,24 @@ static int lod_wr_stripesize(struct file *file, const char *buffer, +@@ -73,24 +73,25 @@ static int lod_wr_stripesize(struct file *file, const char *buffer, lod->lod_desc.ld_default_stripe_size = val; return count; } @@ -196,11 +183,12 @@ index e976063..e420a5e 100644 + size_t count, loff_t *off) { - struct obd_device *dev = (struct obd_device *)data; -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *dev = m->private; struct lod_device *lod; __u64 val; int rc; -@@ -104,23 +103,23 @@ static int lod_wr_stripeoffset(struct file *file, const char *buffer, +@@ -104,23 +105,24 @@ static int lod_wr_stripeoffset(struct file *file, const char *buffer, lod->lod_desc.ld_default_stripe_offset = val; return count; } @@ -228,11 +216,12 @@ index e976063..e420a5e 100644 + size_t count, loff_t *off) { - struct obd_device *dev = (struct obd_device *)data; -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *dev = m->private; struct lod_device *lod; int val, rc; -@@ -134,24 +133,24 @@ static int lod_wr_stripetype(struct file *file, const char *buffer, +@@ -134,24 +136,25 @@ static int lod_wr_stripetype(struct file *file, const char *buffer, lod->lod_desc.ld_pattern = val; return count; } @@ -261,11 +250,12 @@ index e976063..e420a5e 100644 + size_t count, loff_t *off) { - struct obd_device *dev = (struct obd_device *)data; -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *dev = m->private; struct lod_device *lod; int val, rc; -@@ -165,62 +164,57 @@ static int lod_wr_stripecount(struct file *file, const char *buffer, +@@ -165,62 +168,58 @@ static int lod_wr_stripecount(struct file *file, const char *buffer, lod->lod_desc.ld_default_stripe_count = val; return count; } @@ -293,7 +283,7 @@ index e976063..e420a5e 100644 +static int lod_activeobd_seq_show(struct seq_file *m, void *v) { - struct obd_device* dev = (struct obd_device*)data; -+ struct obd_device* dev = m->private; ++ struct obd_device *dev = m->private; struct lod_device *lod; LASSERT(dev != NULL); @@ -344,11 +334,12 @@ index e976063..e420a5e 100644 + size_t count, loff_t *off) { - struct obd_device *dev = (struct obd_device *)data; -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *dev = m->private; struct lod_device *lod; int val, rc; -@@ -238,24 +232,24 @@ static int lod_wr_qos_priofree(struct file *file, const char *buffer, +@@ -238,24 +237,25 @@ static int lod_wr_qos_priofree(struct file *file, const char *buffer, lod->lod_qos.lq_reset = 1; return count; } @@ -377,11 +368,12 @@ index e976063..e420a5e 100644 + size_t count, loff_t *off) { - struct obd_device *dev = (struct obd_device *)data; -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *dev = m->private; struct lod_device *lod; int val, rc; -@@ -273,23 +267,23 @@ static int lod_wr_qos_thresholdrr(struct file *file, const char *buffer, +@@ -273,23 +273,24 @@ static int lod_wr_qos_thresholdrr(struct file *file, const char *buffer, lod->lod_qos.lq_dirty = 1; return count; } @@ -409,11 +401,12 @@ index e976063..e420a5e 100644 + size_t count, loff_t *off) { - struct obd_device *dev = (struct obd_device *)data; -+ struct obd_device *dev = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *dev = m->private; struct lustre_cfg_bufs bufs; struct lod_device *lod; struct lu_device *next; -@@ -327,6 +321,7 @@ static int lod_wr_qos_maxage(struct file *file, const char *buffer, +@@ -327,6 +328,7 @@ static int lod_wr_qos_maxage(struct file *file, const char *buffer, return count; } @@ -421,7 +414,7 @@ index e976063..e420a5e 100644 static void *lod_osts_seq_start(struct seq_file *p, loff_t *pos) { -@@ -414,56 +409,63 @@ static const struct seq_operations lod_osts_sops = { +@@ -414,56 +416,63 @@ static const struct seq_operations lod_osts_sops = { static int lod_osts_seq_open(struct inode *inode, struct file *file) { @@ -452,6 +445,16 @@ index e976063..e420a5e 100644 - { "qos_prio_free",lod_rd_qos_priofree, lod_wr_qos_priofree, 0 }, - { "qos_threshold_rr", lod_rd_qos_thresholdrr, lod_wr_qos_thresholdrr, 0 }, - { "qos_maxage", lod_rd_qos_maxage, lod_wr_qos_maxage, 0 }, +- { 0 } +-}; +- +-static struct lprocfs_vars lprocfs_lod_osd_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 }, +LPROC_SEQ_FOPS_RO_TYPE(lod, uuid); + +LPROC_SEQ_FOPS_RO_TYPE(lod, dt_blksize); @@ -487,13 +490,8 @@ index e976063..e420a5e 100644 { 0 } }; --static struct lprocfs_vars lprocfs_lod_osd_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 }, +-static struct lprocfs_vars lprocfs_lod_module_vars[] = { +- { "num_refs", lprocfs_rd_numrefs, 0, 0 }, +static struct lprocfs_seq_vars lprocfs_lod_osd_vars[] = { + { "blocksize", &lod_dt_blksize_fops }, + { "kbytestotal", &lod_dt_kbytestotal_fops }, @@ -504,11 +502,6 @@ index e976063..e420a5e 100644 { 0 } }; --static struct lprocfs_vars lprocfs_lod_module_vars[] = { -- { "num_refs", lprocfs_rd_numrefs, 0, 0 }, -- { 0 } --}; -- -void lprocfs_lod_init_vars(struct lprocfs_static_vars *lvars) -{ - lvars->module_vars = lprocfs_lod_module_vars; @@ -518,13 +511,18 @@ index e976063..e420a5e 100644 static const struct file_operations lod_proc_target_fops = { .owner = THIS_MODULE, .open = lod_osts_seq_open, -@@ -475,20 +477,18 @@ static const struct file_operations lod_proc_target_fops = { +@@ -474,21 +483,21 @@ static const struct file_operations lod_proc_target_fops = { + int lod_procfs_init(struct lod_device *lod) { - struct obd_device *obd = lod2obd(lod); +- struct obd_device *obd = lod2obd(lod); - struct lprocfs_static_vars lvars; - cfs_proc_dir_entry_t *lov_proc_dir; - int rc; +- int rc; ++ struct obd_device *obd = lod2obd(lod); ++ struct proc_dir_entry *lov_proc_dir = NULL; ++ struct obd_type *type; ++ int rc; - lprocfs_lod_init_vars(&lvars); - rc = lprocfs_obd_setup(obd, lvars.obd_vars); @@ -543,7 +541,7 @@ index e976063..e420a5e 100644 if (rc) { CERROR("%s: cannot setup procfs entry: %d\n", obd->obd_name, rc); -@@ -503,9 +503,9 @@ int lod_procfs_init(struct lod_device *lod) +@@ -503,9 +512,9 @@ int lod_procfs_init(struct lod_device *lod) GOTO(out, rc); } @@ -556,42 +554,38 @@ index e976063..e420a5e 100644 if (IS_ERR(lod->lod_pool_proc_entry)) { rc = PTR_ERR(lod->lod_pool_proc_entry); lod->lod_pool_proc_entry = NULL; -@@ -514,14 +514,18 @@ int lod_procfs_init(struct lod_device *lod) +@@ -514,14 +523,24 @@ int lod_procfs_init(struct lod_device *lod) GOTO(out, rc); } - /* for compatibility we link old procfs's OSC entries to osp ones */ - lov_proc_dir = lprocfs_srch(proc_lustre_root, "lov"); - if (lov_proc_dir != NULL && strstr(obd->obd_name, "lov") != NULL) -+ /* for compatibility we link old procfs's LOV entries to lod ones */ -+ if (obd->obd_type->typ_procsym != NULL) { - lod->lod_symlink = lprocfs_add_symlink(obd->obd_name, +- lod->lod_symlink = lprocfs_add_symlink(obd->obd_name, - lov_proc_dir, - "../lod/%s", - obd->obd_name); -- -+ obd->obd_type->typ_procsym, -+ "../lod/%s", -+ obd->obd_name); -+ if (lod->lod_symlink == NULL) { -+ CERROR("could not register LOV symlink for " -+ "/proc/fs/lustre/lod/%s.", obd->obd_name); -+ lprocfs_remove(&obd->obd_type->typ_procsym); -+ } -+ } ++ /* If the real LOV is present which is the case for setups ++ * with both server and clients on the same node then use ++ * the LOV's proc root */ ++ type = class_search_type(LUSTRE_LOV_NAME); ++ if (type != NULL && type->typ_procroot != NULL) ++ lov_proc_dir = type->typ_procroot; ++ else ++ lov_proc_dir = obd->obd_type->typ_procsym; ++ ++ if (lov_proc_dir == NULL) ++ RETURN(0); + ++ /* for compatibility we link old procfs's LOV entries to lod ones */ ++ lod->lod_symlink = lprocfs_add_symlink(obd->obd_name, lov_proc_dir, ++ "../lod/%s", obd->obd_name); ++ if (lod->lod_symlink == NULL) ++ CERROR("could not register LOV symlink for " ++ "/proc/fs/lustre/lod/%s.", obd->obd_name); RETURN(0); out: -@@ -542,6 +546,9 @@ void lod_procfs_fini(struct lod_device *lod) - lod->lod_pool_proc_entry = NULL; - } - -+ if (obd->obd_type->typ_procsym != NULL) -+ lprocfs_remove(&obd->obd_type->typ_procsym); -+ - lprocfs_obd_cleanup(obd); - } - -- -1.8.5.3 +1.9.1 diff --git a/sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch b/sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch similarity index 89% rename from sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch rename to sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch index c271eb7..5c1c9cd 100644 --- a/sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch +++ b/sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch @@ -1,7 +1,7 @@ -From 9ab620dbc6aae86b9d39d97ba50912dc93b6e4e2 Mon Sep 17 00:00:00 2001 +From 039e3e44e07b59923d94bea976173d9e3cbd0ba9 Mon Sep 17 00:00:00 2001 From: James Simmons -Date: Sun, 9 Feb 2014 11:04:31 -0500 -Subject: [PATCH 08/12] LU-3319 procfs: move mdt/mds proc handling to seq_files +Date: Tue, 25 Mar 2014 11:10:33 -0400 +Subject: [PATCH 7/9] LU-3319 procfs: move mdt/mds proc handling to seq_files With 3.10 linux kernel and above proc handling now only uses struct seq_files. This patch migrates the mdt/mds @@ -10,21 +10,21 @@ layer proc entries over to using seq_files. Signed-off-by: James Simmons Change-Id: Icbafdcd2c2fe3959a51dda3f9c715b0ff8d95742 --- - lustre/mdt/mdt_coordinator.c | 259 +++++++-------- + lustre/mdt/mdt_coordinator.c | 269 +++++++--------- lustre/mdt/mdt_handler.c | 16 +- lustre/mdt/mdt_hsm_cdt_actions.c | 5 +- lustre/mdt/mdt_hsm_cdt_agent.c | 5 +- lustre/mdt/mdt_hsm_cdt_requests.c | 5 +- lustre/mdt/mdt_internal.h | 14 +- - lustre/mdt/mdt_lproc.c | 639 ++++++++++++++++++-------------------- + lustre/mdt/mdt_lproc.c | 659 +++++++++++++++++++------------------- lustre/mdt/mdt_mds.c | 12 +- - 8 files changed, 442 insertions(+), 513 deletions(-) + 8 files changed, 469 insertions(+), 516 deletions(-) diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c -index 037bcbd..9bbcbd4 100644 +index a9ee560..062f6cc 100644 --- a/lustre/mdt/mdt_coordinator.c +++ b/lustre/mdt/mdt_coordinator.c -@@ -46,7 +46,7 @@ +@@ -45,7 +45,7 @@ #include #include "mdt_internal.h" @@ -33,7 +33,7 @@ index 037bcbd..9bbcbd4 100644 /** * get obj and HSM attributes on a fid -@@ -393,7 +393,7 @@ int hsm_cdt_procfs_init(struct mdt_device *mdt) +@@ -392,7 +392,7 @@ int hsm_cdt_procfs_init(struct mdt_device *mdt) ENTRY; /* init /proc entries, failure is not critical */ @@ -42,7 +42,7 @@ index 037bcbd..9bbcbd4 100644 mdt2obd_dev(mdt)->obd_proc_entry, lprocfs_mdt_hsm_vars, mdt); if (IS_ERR(cdt->cdt_proc_dir)) { -@@ -425,7 +425,7 @@ void hsm_cdt_procfs_fini(struct mdt_device *mdt) +@@ -424,7 +424,7 @@ void hsm_cdt_procfs_fini(struct mdt_device *mdt) * \param none * \retval var vector */ @@ -51,7 +51,7 @@ index 037bcbd..9bbcbd4 100644 { return lprocfs_mdt_hsm_vars; } -@@ -1786,22 +1786,17 @@ static __u64 hsm_policy_str2bit(const char *name) +@@ -1785,22 +1785,17 @@ static __u64 hsm_policy_str2bit(const char *name) * \param hexa [IN] print mask before bit names * \param buffer [OUT] string * \param count [IN] size of buffer @@ -80,7 +80,7 @@ index 037bcbd..9bbcbd4 100644 for (i = 0; i < CDT_POLICY_SHIFT_COUNT; i++) { bit = (1ULL << i); -@@ -1810,48 +1805,34 @@ static int hsm_policy_bit2str(const __u64 mask, const bool hexa, char *buffer, +@@ -1809,48 +1804,37 @@ static int hsm_policy_bit2str(const __u64 mask, const bool hexa, char *buffer, break; } if (bit & mask) @@ -95,10 +95,12 @@ index 037bcbd..9bbcbd4 100644 - count -= sz; + seq_printf(m, "%s ", hsm_policy_names[j].name); } -- /* remove last ' ' */ + /* remove last ' ' */ - *ptr = '\0'; - ptr--; - RETURN(ptr - buffer); ++ m->count--; ++ seq_putc(m, '\0'); } /* methods to read/write HSM policy flags */ @@ -140,7 +142,7 @@ index 037bcbd..9bbcbd4 100644 int rc; ENTRY; -@@ -1884,18 +1865,10 @@ static int lprocfs_wr_hsm_policy(struct file *file, const char *buffer, +@@ -1883,18 +1867,10 @@ static int lprocfs_wr_hsm_policy(struct file *file, const char *buffer, policy = hsm_policy_str2bit(token); if (policy == 0) { @@ -156,13 +158,13 @@ index 037bcbd..9bbcbd4 100644 - "supported policies are: %s\n", mdt_obd_name(mdt), - token, msg); - OBD_FREE(msg, sz); -+ "supported policies are: \n", mdt_obd_name(mdt), -+ token); ++ "supported policies are:\n", mdt_obd_name(mdt), ++ token); + hsm_policy_bit2str(m, 0, false); GOTO(out, rc = -EINVAL); } switch (sign) { -@@ -1934,25 +1907,24 @@ out: +@@ -1933,25 +1909,25 @@ out: OBD_FREE(buf, count + 1); RETURN(rc); } @@ -193,11 +195,12 @@ index 037bcbd..9bbcbd4 100644 \ { \ - struct mdt_device *mdt = data; \ -+ struct mdt_device *mdt = ((struct seq_file *)file->private_data)->private;\ ++ struct seq_file *m = file->private_data; \ ++ struct mdt_device *mdt = m->private; \ struct coordinator *cdt = &mdt->mdt_coordinator; \ int val; \ int rc; \ -@@ -1966,7 +1938,7 @@ static int lprocfs_wr_hsm_##VAR(struct file *file, const char *buffer, \ +@@ -1965,7 +1941,7 @@ static int lprocfs_wr_hsm_##VAR(struct file *file, const char *buffer, \ RETURN(count); \ } \ RETURN(-EINVAL); \ @@ -206,7 +209,7 @@ index 037bcbd..9bbcbd4 100644 GENERATE_PROC_METHOD(cdt_loop_period) GENERATE_PROC_METHOD(cdt_grace_delay) -@@ -1984,10 +1956,11 @@ GENERATE_PROC_METHOD(cdt_default_archive_id) +@@ -1983,10 +1959,12 @@ GENERATE_PROC_METHOD(cdt_default_archive_id) #define CDT_PURGE_CMD "purge" #define CDT_HELP_CMD "help" @@ -217,11 +220,12 @@ index 037bcbd..9bbcbd4 100644 + size_t count, loff_t *off) { - struct obd_device *obd = data; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); struct coordinator *cdt = &(mdt->mdt_coordinator); int rc, usage = 0; -@@ -2041,83 +2014,71 @@ int lprocfs_wr_hsm_cdt_control(struct file *file, const char *buffer, +@@ -2040,83 +2018,71 @@ int lprocfs_wr_hsm_cdt_control(struct file *file, const char *buffer, RETURN(count); } @@ -327,7 +331,7 @@ index 037bcbd..9bbcbd4 100644 } static inline enum hsm_copytool_action -@@ -2137,9 +2098,9 @@ hsm_copytool_name2action(const char *name) +@@ -2136,9 +2102,9 @@ hsm_copytool_name2action(const char *name) return -1; } @@ -340,7 +344,7 @@ index 037bcbd..9bbcbd4 100644 { char *buf, *pos, *name; size_t buf_size; -@@ -2183,69 +2144,73 @@ out: +@@ -2182,69 +2148,76 @@ out: RETURN(rc); } @@ -352,7 +356,8 @@ index 037bcbd..9bbcbd4 100644 + size_t count, loff_t *off) { - struct mdt_device *mdt = data; -+ struct mdt_device *mdt = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct mdt_device *mdt = m->private; struct coordinator *cdt = &mdt->mdt_coordinator; - return lprocfs_wr_hsm_request_mask(file, buf, count, @@ -368,8 +373,10 @@ index 037bcbd..9bbcbd4 100644 + size_t count, loff_t *off) { - struct mdt_device *mdt = data; -+ struct mdt_device *mdt = ((struct seq_file *)file->private_data)->private; - struct coordinator *cdt = &mdt->mdt_coordinator; +- struct coordinator *cdt = &mdt->mdt_coordinator; ++ struct seq_file *m = file->private_data; ++ struct mdt_device *mdt = m->private; ++ struct coordinator *cdt = &mdt->mdt_coordinator; - return lprocfs_wr_hsm_request_mask(file, buf, count, + return mdt_write_hsm_request_mask(file, buf, count, @@ -384,8 +391,10 @@ index 037bcbd..9bbcbd4 100644 + size_t count, loff_t *off) { - struct mdt_device *mdt = data; -+ struct mdt_device *mdt = ((struct seq_file *)file->private_data)->private; - struct coordinator *cdt = &mdt->mdt_coordinator; +- struct coordinator *cdt = &mdt->mdt_coordinator; ++ struct seq_file *m = file->private_data; ++ struct mdt_device *mdt = m->private; ++ struct coordinator *cdt = &mdt->mdt_coordinator; - return lprocfs_wr_hsm_request_mask(file, buf, count, + return mdt_write_hsm_request_mask(file, buf, count, @@ -461,10 +470,10 @@ index 037bcbd..9bbcbd4 100644 { 0 } }; diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c -index 17b7605..2b08be9 100644 +index 69b1c30..8b4634f 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c -@@ -4584,7 +4584,6 @@ static int mdt_process_config(const struct lu_env *env, +@@ -4644,7 +4644,6 @@ static int mdt_process_config(const struct lu_env *env, switch (cfg->lcfg_command) { case LCFG_PARAM: { @@ -472,7 +481,7 @@ index 17b7605..2b08be9 100644 struct obd_device *obd = d->ld_obd; /* For interoperability */ -@@ -4619,14 +4618,13 @@ static int mdt_process_config(const struct lu_env *env, +@@ -4679,14 +4678,13 @@ static int mdt_process_config(const struct lu_env *env, } } @@ -492,7 +501,7 @@ index 17b7605..2b08be9 100644 if (rc > 0 || rc == -ENOSYS) /* we don't understand; pass it on */ rc = next->ld_ops->ldo_process_config(env, next, -@@ -5825,7 +5823,6 @@ static struct lu_device_type mdt_device_type = { +@@ -5885,7 +5883,6 @@ static struct lu_device_type mdt_device_type = { static int __init mdt_mod_init(void) { @@ -500,17 +509,17 @@ index 17b7605..2b08be9 100644 int rc; CLASSERT(sizeof("0x0123456789ABCDEF:0x01234567:0x01234567") == -@@ -5840,10 +5837,9 @@ static int __init mdt_mod_init(void) +@@ -5900,10 +5897,9 @@ static int __init mdt_mod_init(void) if (rc) GOTO(lu_fini, rc); - lprocfs_mdt_init_vars(&lvars); - rc = class_register_type(&mdt_obd_device_ops, NULL, NULL, + rc = class_register_type(&mdt_obd_device_ops, NULL, true, NULL, #ifndef HAVE_ONLY_PROCFS_SEQ -- lvars.module_vars, -+ NULL, +- lvars.module_vars, ++ NULL, #endif - LUSTRE_MDT_NAME, &mdt_device_type); + LUSTRE_MDT_NAME, &mdt_device_type); if (rc) diff --git a/lustre/mdt/mdt_hsm_cdt_actions.c b/lustre/mdt/mdt_hsm_cdt_actions.c index da7f5a9..49c6b8b 100644 @@ -578,10 +587,10 @@ index 1300861..3125dcc 100644 RETURN(rc); } diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h -index c3d4f7f..7b0381a 100644 +index 7970b86..8fb96c8 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h -@@ -787,9 +787,6 @@ void mdt_thread_info_init(struct ptlrpc_request *req, +@@ -785,9 +785,6 @@ void mdt_thread_info_init(struct ptlrpc_request *req, void mdt_thread_info_fini(struct mdt_thread_info *mti); struct mdt_thread_info *tsi2mdt_info(struct tgt_session_info *tsi); @@ -591,7 +600,7 @@ index c3d4f7f..7b0381a 100644 int mdt_hsm_attr_set(struct mdt_thread_info *info, struct mdt_object *obj, const struct md_hsm *mh); -@@ -924,13 +921,12 @@ int mdt_hsm_cdt_fini(struct mdt_device *mdt); +@@ -925,13 +922,12 @@ int mdt_hsm_cdt_fini(struct mdt_device *mdt); int mdt_hsm_cdt_wakeup(struct mdt_device *mdt); /* coordinator control /proc interface */ @@ -609,7 +618,7 @@ index c3d4f7f..7b0381a 100644 /* md_hsm helpers */ struct mdt_object *mdt_hsm_get_md_hsm(struct mdt_thread_info *mti, const struct lu_fid *fid, -@@ -1070,8 +1066,6 @@ enum { +@@ -1071,8 +1067,6 @@ enum { }; void mdt_counter_incr(struct ptlrpc_request *req, int opcode); void mdt_stats_counter_init(struct lprocfs_stats *stats); @@ -619,7 +628,7 @@ index c3d4f7f..7b0381a 100644 void mdt_procfs_fini(struct mdt_device *mdt); diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c -index 0ee5148..658f00d 100644 +index 0ee5148..a895d57 100644 --- a/lustre/mdt/mdt_lproc.c +++ b/lustre/mdt/mdt_lproc.c @@ -156,7 +156,6 @@ static ssize_t mdt_rename_stats_seq_write(struct file *file, const char *buf, @@ -630,13 +639,12 @@ index 0ee5148..658f00d 100644 LPROC_SEQ_FOPS(mdt_rename_stats); static int lproc_mdt_attach_rename_seqstat(struct mdt_device *mdt) -@@ -213,143 +212,73 @@ void mdt_rename_counter_tally(struct mdt_thread_info *info, +@@ -213,143 +212,76 @@ void mdt_rename_counter_tally(struct mdt_thread_info *info, (unsigned int)ma->ma_attr.la_size); } -int mdt_procfs_init(struct mdt_device *mdt, const char *name) -+static int mdt_identity_expire_seq_show(struct seq_file *m, void *data) - { +-{ - struct obd_device *obd = mdt2obd_dev(mdt); - struct lprocfs_static_vars lvars; - int rc; @@ -682,7 +690,8 @@ index 0ee5148..658f00d 100644 -} - -void mdt_procfs_fini(struct mdt_device *mdt) --{ ++static int mdt_identity_expire_seq_show(struct seq_file *m, void *data) + { - struct obd_device *obd = mdt2obd_dev(mdt); - - if (obd->obd_proc_exports_entry != NULL) { @@ -721,7 +730,8 @@ index 0ee5148..658f00d 100644 - struct obd_device *obd = data; - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); - int rc, val; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; + struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); + int rc, val; @@ -752,7 +762,7 @@ index 0ee5148..658f00d 100644 - *eof = 1; - return snprintf(page, count, "%u\n", - mdt->mdt_identity_cache->uc_acquire_expire); -+ return seq_printf(m,"%u\n", mdt->mdt_identity_cache->uc_acquire_expire); ++ return seq_printf(m, "%u\n", mdt->mdt_identity_cache->uc_acquire_expire); } -static int lprocfs_wr_identity_acquire_expire(struct file *file, @@ -766,7 +776,8 @@ index 0ee5148..658f00d 100644 - struct obd_device *obd = data; - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); - int rc, val; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; + struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); + int rc, val; @@ -812,11 +823,12 @@ index 0ee5148..658f00d 100644 + size_t count, loff_t *off) { - struct obd_device *obd = data; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); struct upcall_cache *hash = mdt->mdt_identity_cache; int rc; -@@ -388,11 +317,13 @@ static int lprocfs_wr_identity_upcall(struct file *file, const char *buffer, +@@ -388,11 +320,14 @@ static int lprocfs_wr_identity_upcall(struct file *file, const char *buffer, OBD_FREE(kernbuf, count + 1); RETURN(rc); } @@ -829,11 +841,12 @@ index 0ee5148..658f00d 100644 + size_t count, void *data) { - struct obd_device *obd = data; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); int rc, uid; -@@ -403,11 +334,13 @@ static int lprocfs_wr_identity_flush(struct file *file, const char *buffer, +@@ -403,11 +338,14 @@ static int lprocfs_wr_identity_flush(struct file *file, const char *buffer, mdt_flush_identity(mdt->mdt_identity_cache, uid); return count; } @@ -846,11 +859,12 @@ index 0ee5148..658f00d 100644 + size_t count, void *data) { - struct obd_device *obd = data; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); struct identity_downcall_data *param; int size = sizeof(*param), rc, checked = 0; -@@ -415,7 +348,7 @@ static int lprocfs_wr_identity_info(struct file *file, const char *buffer, +@@ -415,7 +353,7 @@ static int lprocfs_wr_identity_info(struct file *file, const char *buffer, again: if (count < size) { CERROR("%s: invalid data count = %lu, size = %d\n", @@ -859,7 +873,7 @@ index 0ee5148..658f00d 100644 return -EINVAL; } -@@ -468,23 +401,24 @@ out: +@@ -468,23 +406,25 @@ out: return rc ? rc : count; } @@ -887,11 +901,12 @@ index 0ee5148..658f00d 100644 + size_t count, loff_t *off) { - struct obd_device *obd = data; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); int val, rc; -@@ -521,64 +455,65 @@ static int lprocfs_wr_capa(struct file *file, const char *buffer, +@@ -521,64 +461,67 @@ static int lprocfs_wr_capa(struct file *file, const char *buffer, mdt->mdt_lut.lut_oss_capa ? "enabled" : "disabled"); return count; } @@ -945,7 +960,8 @@ index 0ee5148..658f00d 100644 - struct obd_device *obd = data; - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); - int val, rc; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; + struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); + int val, rc; @@ -987,13 +1003,14 @@ index 0ee5148..658f00d 100644 - struct obd_device *obd = data; - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); - int val, rc; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; -+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; ++ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); + int val, rc; rc = lprocfs_write_helper(buffer, count, &val); if (rc) -@@ -588,11 +523,13 @@ static int lprocfs_wr_ck_timeout(struct file *file, const char *buffer, +@@ -588,11 +531,13 @@ static int lprocfs_wr_ck_timeout(struct file *file, const char *buffer, mdt->mdt_capa_conf = 1; return count; } @@ -1009,16 +1026,17 @@ index 0ee5148..658f00d 100644 { char *kbuf; char *tmpbuf; -@@ -614,7 +551,7 @@ static int lprocfs_mdt_wr_evict_client(struct file *file, const char *buffer, +@@ -614,7 +559,8 @@ static int lprocfs_mdt_wr_evict_client(struct file *file, const char *buffer, tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, BUFLEN - 1, count)); if (strncmp(tmpbuf, "nid:", 4) != 0) { - count = lprocfs_wr_evict_client(file, buffer, count, data); -+ count = lprocfs_evict_client_seq_write(file, buffer, count, off); ++ count = lprocfs_evict_client_seq_write(file, buffer, count, ++ off); goto out; } -@@ -627,21 +564,21 @@ out: +@@ -627,21 +573,22 @@ out: #undef BUFLEN @@ -1044,13 +1062,14 @@ index 0ee5148..658f00d 100644 - struct obd_device *obd = data; - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); - int val, rc; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; -+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; ++ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); + int val, rc; rc = lprocfs_write_helper(buffer, count, &val); if (rc) -@@ -659,22 +596,23 @@ static int lprocfs_wr_sec_level(struct file *file, const char *buffer, +@@ -659,22 +606,24 @@ static int lprocfs_wr_sec_level(struct file *file, const char *buffer, mdt->mdt_lut.lut_sec_level = val; return count; } @@ -1078,13 +1097,14 @@ index 0ee5148..658f00d 100644 - struct obd_device *obd = data; - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); - int val, rc; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; -+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; ++ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); + int val, rc; rc = lprocfs_write_helper(buffer, count, &val); if (rc) -@@ -682,15 +620,15 @@ static int lprocfs_wr_cos(struct file *file, const char *buffer, +@@ -682,15 +631,15 @@ static int lprocfs_wr_cos(struct file *file, const char *buffer, mdt_enable_cos(mdt, val); return count; } @@ -1106,7 +1126,7 @@ index 0ee5148..658f00d 100644 } static int safe_strtoul(const char *str, char **endp, unsigned long *res) -@@ -708,10 +646,11 @@ static int safe_strtoul(const char *str, char **endp, unsigned long *res) +@@ -708,11 +657,13 @@ static int safe_strtoul(const char *str, char **endp, unsigned long *res) return 0; } @@ -1117,11 +1137,14 @@ index 0ee5148..658f00d 100644 + size_t count, loff_t *off) { - struct obd_device *obd = data; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); +- struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; ++ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); int rc; char kernbuf[50], *tmp, *end, *errmsg; -@@ -765,22 +704,23 @@ failed: + unsigned long uid, gid; +@@ -765,23 +716,25 @@ failed: mdt_obd_name(mdt), buffer, errmsg, rc); RETURN(rc); } @@ -1151,11 +1174,14 @@ index 0ee5148..658f00d 100644 + size_t count, loff_t *off) { - struct obd_device *obd = data; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); +- struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; ++ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); int rc; char *kernbuf, *errmsg; -@@ -842,25 +782,26 @@ failed: + cfs_list_t tmp; +@@ -842,25 +795,27 @@ failed: OBD_FREE(kernbuf, count + 1); RETURN(rc); } @@ -1187,7 +1213,8 @@ index 0ee5148..658f00d 100644 - struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); - char kernbuf[16]; - unsigned long val = 0; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; + struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); + struct obd_export *exp; + char kernbuf[16]; @@ -1195,7 +1222,7 @@ index 0ee5148..658f00d 100644 if (count > (sizeof(kernbuf) - 1)) return -EINVAL; -@@ -902,20 +843,21 @@ static int lprocfs_wr_mdt_som(struct file *file, const char *buffer, +@@ -902,20 +857,22 @@ static int lprocfs_wr_mdt_som(struct file *file, const char *buffer, return count; } @@ -1220,11 +1247,12 @@ index 0ee5148..658f00d 100644 + size_t count, loff_t *off) { - struct obd_device *obd = data; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); __u32 val; int rc; -@@ -930,22 +872,22 @@ static int lprocfs_wr_enable_remote_dir(struct file *file, const char *buffer, +@@ -930,22 +887,23 @@ static int lprocfs_wr_enable_remote_dir(struct file *file, const char *buffer, mdt->mdt_enable_remote_dir = val; return count; } @@ -1252,11 +1280,12 @@ index 0ee5148..658f00d 100644 + size_t count, loff_t *off) { - struct obd_device *obd = data; -+ struct obd_device *obd = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct obd_device *obd = m->private; struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev); __u32 val; int rc; -@@ -957,97 +899,72 @@ static int lprocfs_wr_enable_remote_dir_gid(struct file *file, +@@ -957,97 +915,72 @@ static int lprocfs_wr_enable_remote_dir_gid(struct file *file, mdt->mdt_enable_remote_dir_gid = val; return count; } @@ -1420,7 +1449,7 @@ index 0ee5148..658f00d 100644 { 0 } }; -@@ -1085,21 +1002,15 @@ int lprocfs_mdt_open_files_seq_show(struct seq_file *seq, void *v) +@@ -1085,21 +1018,15 @@ int lprocfs_mdt_open_files_seq_show(struct seq_file *seq, void *v) int lprocfs_mdt_open_files_seq_open(struct inode *inode, struct file *file) { @@ -1443,7 +1472,7 @@ index 0ee5148..658f00d 100644 return 0; } -@@ -1140,3 +1051,67 @@ void mdt_stats_counter_init(struct lprocfs_stats *stats) +@@ -1140,3 +1067,67 @@ void mdt_stats_counter_init(struct lprocfs_stats *stats) lprocfs_counter_init(stats, LPROC_MDT_CROSSDIR_RENAME, 0, "crossdir_rename", "reqs"); } @@ -1512,7 +1541,7 @@ index 0ee5148..658f00d 100644 + lprocfs_job_stats_fini(obd); +} diff --git a/lustre/mdt/mdt_mds.c b/lustre/mdt/mdt_mds.c -index 367f659..4fa66c3 100644 +index 390164f..424ddf5 100644 --- a/lustre/mdt/mdt_mds.c +++ b/lustre/mdt/mdt_mds.c @@ -464,6 +464,13 @@ static struct lu_device *mds_device_free(const struct lu_env *env, @@ -1541,13 +1570,13 @@ index 367f659..4fa66c3 100644 l = ERR_PTR(rc); @@ -541,7 +549,7 @@ int mds_mod_init(void) - return class_register_type(&mds_obd_device_ops, NULL, NULL, + return class_register_type(&mds_obd_device_ops, NULL, true, NULL, #ifndef HAVE_ONLY_PROCFS_SEQ -- lprocfs_mds_module_vars, -+ NULL, +- lprocfs_mds_module_vars, ++ NULL, #endif - LUSTRE_MDS_NAME, &mds_device_type); + LUSTRE_MDS_NAME, &mds_device_type); } -- -1.8.5.3 +1.9.1 diff --git a/sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch b/sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch similarity index 87% rename from sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch rename to sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch index b2921fc..6c6106b 100644 --- a/sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch +++ b/sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch @@ -1,41 +1,36 @@ -From 6af3bd54359520829a6199e81171fd849a6656f4 Mon Sep 17 00:00:00 2001 -From: Alexey Shvetsov -Date: Thu, 27 Feb 2014 16:06:08 +0400 -Subject: [PATCH 07/12] LU-3319 procfs: move mdd/ofd proc handling to seq_files +From c6c3f4063e244cea365940adc0fd1a1c35d0b525 Mon Sep 17 00:00:00 2001 +From: James Simmons +Date: Wed, 26 Mar 2014 20:01:52 -0400 +Subject: [PATCH 8/9] LU-3319 procfs: move mdd/ofd proc handling to seq_files With 3.10 linux kernel and above proc handling now only uses struct seq_files. This patch migrates the mdd/ofd layer proc entries over to using seq_files. -Conflicts: - lustre/mdd/mdd_lproc.c - lustre/lfsck/lfsck_layout.c - Signed-off-by: James Simmons -Signed-off-by: Alexey Shvetsov Change-Id: I61b7df6bfd5efd0f12e3ca1a1813b7b62d493168 --- lustre/include/lustre_lfsck.h | 6 +- lustre/lfsck/lfsck_internal.h | 9 +- - lustre/lfsck/lfsck_layout.c | 101 ++------- - lustre/lfsck/lfsck_lib.c | 77 +++---- + lustre/lfsck/lfsck_layout.c | 104 +++------ + lustre/lfsck/lfsck_lib.c | 88 +++----- lustre/lfsck/lfsck_namespace.c | 75 ++----- lustre/mdd/mdd_device.c | 25 +-- lustre/mdd/mdd_internal.h | 1 - - lustre/mdd/mdd_lproc.c | 300 ++++++++++++--------------- + lustre/mdd/mdd_lproc.c | 302 +++++++++++-------------- lustre/obdclass/lprocfs_status.c | 9 +- - lustre/ofd/lproc_ofd.c | 436 ++++++++++++++++++++------------------- - lustre/ofd/ofd_dev.c | 48 ++--- + lustre/ofd/lproc_ofd.c | 467 ++++++++++++++++++++------------------- + lustre/ofd/ofd_dev.c | 80 +++---- lustre/ofd/ofd_internal.h | 6 +- lustre/osd-ldiskfs/osd_handler.c | 1 + lustre/osd-zfs/osd_handler.c | 1 + - 14 files changed, 462 insertions(+), 633 deletions(-) + 14 files changed, 517 insertions(+), 657 deletions(-) diff --git a/lustre/include/lustre_lfsck.h b/lustre/include/lustre_lfsck.h -index 1209bc2..bdb0955 100644 +index 0d6f666..5adbffe 100644 --- a/lustre/include/lustre_lfsck.h +++ b/lustre/include/lustre_lfsck.h -@@ -158,12 +158,12 @@ int lfsck_in_notify(const struct lu_env *env, struct dt_device *key, +@@ -148,12 +148,12 @@ int lfsck_in_notify(const struct lu_env *env, struct dt_device *key, int lfsck_query(const struct lu_env *env, struct dt_device *key, struct lfsck_request *lr); @@ -52,10 +47,10 @@ index 1209bc2..bdb0955 100644 static inline void lfsck_pack_rfa(struct lfsck_request *lr, const struct lu_fid *fid) diff --git a/lustre/lfsck/lfsck_internal.h b/lustre/lfsck/lfsck_internal.h -index 9f20729..48d3d82 100644 +index 4f84c3b..c4e6430 100644 --- a/lustre/lfsck/lfsck_internal.h +++ b/lustre/lfsck/lfsck_internal.h -@@ -293,8 +293,7 @@ struct lfsck_operations { +@@ -299,8 +299,7 @@ struct lfsck_operations { int (*lfsck_dump)(const struct lu_env *env, struct lfsck_component *com, @@ -65,7 +60,7 @@ index 9f20729..48d3d82 100644 int (*lfsck_double_scan)(const struct lu_env *env, struct lfsck_component *com); -@@ -571,10 +570,10 @@ void lfsck_component_cleanup(const struct lu_env *env, +@@ -586,10 +585,10 @@ void lfsck_component_cleanup(const struct lu_env *env, struct lfsck_component *com); void lfsck_instance_cleanup(const struct lu_env *env, struct lfsck_instance *lfsck); @@ -80,10 +75,19 @@ index 9f20729..48d3d82 100644 void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck, struct lfsck_position *pos, bool init); diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c -index f77ee87..27394e2 100644 +index de96726..c3b4458 100644 --- a/lustre/lfsck/lfsck_layout.c +++ b/lustre/lfsck/lfsck_layout.c -@@ -3657,69 +3657,53 @@ static int lfsck_layout_slave_post(const struct lu_env *env, +@@ -471,7 +471,7 @@ static struct lfsck_rbtree_node *lfsck_rbtree_new(const struct lu_env *env, + return ERR_PTR(-ENOMEM); + } + +- rb_init_node(&lrn->lrn_node); ++ RB_CLEAR_NODE(&lrn->lrn_node); + lrn->lrn_seq = fid_seq(fid); + lrn->lrn_first_oid = fid_oid(fid) & ~LFSCK_RBTREE_BITMAP_MASK; + atomic_set(&lrn->lrn_known_count, 0); +@@ -4798,69 +4798,53 @@ static int lfsck_layout_slave_post(const struct lu_env *env, } static int lfsck_layout_dump(const struct lu_env *env, @@ -152,17 +156,17 @@ index f77ee87..27394e2 100644 lo->ll_pos_first_inconsistent); - if (rc <= 0) - goto out; -- + - buf += rc; - len -= rc; - +- - rc = snprintf(buf, len, - "success_count: %u\n" + seq_printf(m, "success_count: %u\n" "repaired_dangling: "LPU64"\n" "repaired_unmatched_pair: "LPU64"\n" "repaired_multiple_referenced: "LPU64"\n" -@@ -3739,11 +3723,6 @@ static int lfsck_layout_dump(const struct lu_env *env, +@@ -4880,11 +4864,6 @@ static int lfsck_layout_dump(const struct lu_env *env, lo->ll_objs_skipped, lo->ll_objs_failed_phase1, lo->ll_objs_failed_phase2); @@ -174,7 +178,7 @@ index f77ee87..27394e2 100644 if (lo->ll_status == LS_SCANNING_PHASE1) { __u64 pos; -@@ -3760,8 +3739,7 @@ static int lfsck_layout_dump(const struct lu_env *env, +@@ -4901,8 +4880,7 @@ static int lfsck_layout_dump(const struct lu_env *env, do_div(new_checked, duration); if (rtime != 0) do_div(speed, rtime); @@ -184,7 +188,7 @@ index f77ee87..27394e2 100644 "checked_phase2: "LPU64"\n" "run_time_phase1: %u seconds\n" "run_time_phase2: %u seconds\n" -@@ -3775,11 +3753,6 @@ static int lfsck_layout_dump(const struct lu_env *env, +@@ -4916,11 +4894,6 @@ static int lfsck_layout_dump(const struct lu_env *env, lo->ll_run_time_phase2, speed, new_checked); @@ -196,29 +200,24 @@ index f77ee87..27394e2 100644 LASSERT(lfsck->li_di_oit != NULL); -@@ -3792,47 +3765,7 @@ static int lfsck_layout_dump(const struct lu_env *env, +@@ -4933,12 +4906,8 @@ static int lfsck_layout_dump(const struct lu_env *env, pos = iops->store(env, lfsck->li_di_oit); if (!lfsck->li_current_oit_processed) pos--; - rc = snprintf(buf, len, "current_position: "LPU64"\n", pos); - if (rc <= 0) - goto out; -- ++ seq_printf(m, "current_position: "LPU64"\n", pos); + - buf += rc; - len -= rc; -- } else if (lo->ll_status == LS_SCANNING_PHASE2) { -- cfs_duration_t duration = cfs_time_current() - -- lfsck->li_time_last_checkpoint; -- __u64 checked = lo->ll_objs_checked_phase1 + com->lc_new_checked; -- __u64 speed = checked; -- __u64 new_checked = com->lc_new_checked * HZ; -- __u32 rtime = lo->ll_run_time_phase1 + -- cfs_duration_sec(duration + HALF_SEC); -- -- if (duration != 0) -- do_div(new_checked, duration); -- if (rtime != 0) -- do_div(speed, rtime); + } else if (lo->ll_status == LS_SCANNING_PHASE2) { + cfs_duration_t duration = cfs_time_current() - + lfsck->li_time_last_checkpoint; +@@ -4952,28 +4921,25 @@ static int lfsck_layout_dump(const struct lu_env *env, + do_div(new_checked, duration); + if (rtime != 0) + do_div(speed, rtime); - rc = snprintf(buf, len, - "checked_phase1: "LPU64"\n" - "checked_phase2: "LPU64"\n" @@ -237,15 +236,31 @@ index f77ee87..27394e2 100644 - new_checked, - PFID(&com->lc_fid_latest_scanned_phase2)); - if (rc <= 0) -- goto out; -- ++ rc = seq_printf(m, "checked_phase1: "LPU64"\n" ++ "checked_phase2: "LPU64"\n" ++ "run_time_phase1: %u seconds\n" ++ "run_time_phase2: %u seconds\n" ++ "average_speed_phase1: "LPU64" items/sec\n" ++ "average_speed_phase2: N/A\n" ++ "real-time_speed_phase1: "LPU64" items/sec\n" ++ "real-time_speed_phase2: N/A\n" ++ "current_position: "DFID"\n", ++ checked, ++ lo->ll_objs_checked_phase2, ++ rtime, ++ lo->ll_run_time_phase2, ++ speed, ++ new_checked, ++ PFID(&com->lc_fid_latest_scanned_phase2)); ++ if (rc < 0) + goto out; + - buf += rc; - len -= rc; -+ seq_printf(m, "current_position: "LPU64"\n", pos); } else { __u64 speed1 = lo->ll_objs_checked_phase1; __u64 speed2 = lo->ll_objs_checked_phase2; -@@ -3841,8 +3774,7 @@ static int lfsck_layout_dump(const struct lu_env *env, +@@ -4982,8 +4948,7 @@ static int lfsck_layout_dump(const struct lu_env *env, do_div(speed1, lo->ll_run_time_phase1); if (lo->ll_run_time_phase2 != 0) do_div(speed2, lo->ll_run_time_phase2); @@ -255,7 +270,7 @@ index f77ee87..27394e2 100644 "checked_phase2: "LPU64"\n" "run_time_phase1: %u seconds\n" "run_time_phase2: %u seconds\n" -@@ -3857,18 +3789,11 @@ static int lfsck_layout_dump(const struct lu_env *env, +@@ -4998,18 +4963,11 @@ static int lfsck_layout_dump(const struct lu_env *env, lo->ll_run_time_phase2, speed1, speed2); @@ -276,10 +291,10 @@ index f77ee87..27394e2 100644 static int lfsck_layout_master_double_scan(const struct lu_env *env, diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c -index de7b849..d358ca1 100644 +index 3b1fe0c..84ffc08 100644 --- a/lustre/lfsck/lfsck_lib.c +++ b/lustre/lfsck/lfsck_lib.c -@@ -426,77 +426,52 @@ static inline int lfsck_instance_add(struct lfsck_instance *lfsck) +@@ -899,21 +899,15 @@ static inline int lfsck_instance_add(struct lfsck_instance *lfsck) return 0; } @@ -291,8 +306,9 @@ index de7b849..d358ca1 100644 int flag; - int rc; int i; + bool newline = (bits != 0 ? false : true); -- rc = snprintf(*buf, *len, "%s:%c", prefix, bits != 0 ? ' ' : '\n'); +- rc = snprintf(*buf, *len, "%s:%c", prefix, newline ? '\n' : ' '); - if (rc <= 0) - return -ENOSPC; + seq_printf(m, "%s:%c", prefix, bits != 0 ? ' ' : '\n'); @@ -302,20 +318,35 @@ index de7b849..d358ca1 100644 for (i = 0, flag = 1; bits != 0; i++, flag = 1 << i) { if (flag & bits) { bits &= ~flag; - if (names[i] != NULL) { +@@ -921,69 +915,43 @@ int lfsck_bits_dump(char **buf, int *len, int bits, const char *names[], + if (bits == 0) + newline = true; + - rc = snprintf(*buf, *len, "%s%c", names[i], -- bits != 0 ? ',' : '\n'); +- newline ? '\n' : ','); - if (rc <= 0) - return -ENOSPC; - - *buf += rc; - *len -= rc; + seq_printf(m, "%s%c", names[i], -+ bits != 0 ? ',' : '\n'); ++ newline ? '\n' : ','); } } } + +- if (!newline) { +- rc = snprintf(*buf, *len, "\n"); +- if (rc <= 0) +- return -ENOSPC; +- +- *buf += rc; +- *len -= rc; +- } +- - return save - *len; ++ if (!newline) ++ seq_printf(m, "\n"); + return 0; } @@ -328,7 +359,7 @@ index de7b849..d358ca1 100644 - rc = snprintf(*buf, *len, "%s: "LPU64" seconds\n", prefix, - cfs_time_current_sec() - time); + seq_printf(m, "%s: "LPU64" seconds\n", prefix, -+ cfs_time_current_sec() - time); ++ cfs_time_current_sec() - time); else - rc = snprintf(*buf, *len, "%s: N/A\n", prefix); - if (rc <= 0) @@ -376,7 +407,7 @@ index de7b849..d358ca1 100644 } void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck, -@@ -1149,7 +1124,7 @@ int lfsck_async_request(const struct lu_env *env, struct obd_export *exp, +@@ -1658,7 +1626,7 @@ int lfsck_async_request(const struct lu_env *env, struct obd_export *exp, /* external interfaces */ @@ -385,7 +416,7 @@ index de7b849..d358ca1 100644 { struct lu_env env; struct lfsck_instance *lfsck; -@@ -1162,8 +1137,7 @@ int lfsck_get_speed(struct dt_device *key, void *buf, int len) +@@ -1671,8 +1639,7 @@ int lfsck_get_speed(struct dt_device *key, void *buf, int len) lfsck = lfsck_instance_find(key, true, false); if (likely(lfsck != NULL)) { @@ -394,8 +425,8 @@ index de7b849..d358ca1 100644 + seq_printf(m, "%u\n", lfsck->li_bookmark_ram.lb_speed_limit); lfsck_instance_put(&env, lfsck); } else { - rc = -ENODEV; -@@ -1203,7 +1177,7 @@ int lfsck_set_speed(struct dt_device *key, int val) + rc = -ENXIO; +@@ -1712,7 +1679,7 @@ int lfsck_set_speed(struct dt_device *key, int val) } EXPORT_SYMBOL(lfsck_set_speed); @@ -404,7 +435,7 @@ index de7b849..d358ca1 100644 { struct lu_env env; struct lfsck_instance *lfsck; -@@ -1216,8 +1190,7 @@ int lfsck_get_windows(struct dt_device *key, void *buf, int len) +@@ -1725,8 +1692,7 @@ int lfsck_get_windows(struct dt_device *key, void *buf, int len) lfsck = lfsck_instance_find(key, true, false); if (likely(lfsck != NULL)) { @@ -413,8 +444,8 @@ index de7b849..d358ca1 100644 + seq_printf(m, "%u\n", lfsck->li_bookmark_ram.lb_async_windows); lfsck_instance_put(&env, lfsck); } else { - rc = -ENODEV; -@@ -1267,7 +1240,7 @@ int lfsck_set_windows(struct dt_device *key, int val) + rc = -ENXIO; +@@ -1776,7 +1742,7 @@ int lfsck_set_windows(struct dt_device *key, int val) } EXPORT_SYMBOL(lfsck_set_windows); @@ -423,7 +454,7 @@ index de7b849..d358ca1 100644 { struct lu_env env; struct lfsck_instance *lfsck; -@@ -1283,7 +1256,7 @@ int lfsck_dump(struct dt_device *key, void *buf, int len, enum lfsck_type type) +@@ -1792,7 +1758,7 @@ int lfsck_dump(struct dt_device *key, void *buf, int len, enum lfsck_type type) if (likely(lfsck != NULL)) { com = lfsck_component_find(lfsck, type); if (likely(com != NULL)) { @@ -433,7 +464,7 @@ index de7b849..d358ca1 100644 } else { rc = -ENOTSUPP; diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c -index 6fc08fb..2abad67 100644 +index c80fb48..bcbfb8e 100644 --- a/lustre/lfsck/lfsck_namespace.c +++ b/lustre/lfsck/lfsck_namespace.c @@ -1088,65 +1088,56 @@ static int lfsck_namespace_post(const struct lu_env *env, @@ -604,10 +635,10 @@ index 6fc08fb..2abad67 100644 static int lfsck_namespace_double_scan_main(void *args) diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c -index 40a4ee3..b0acecb 100644 +index 0fe590e..f1c76d6 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c -@@ -812,16 +812,16 @@ static int mdd_process_config(const struct lu_env *env, +@@ -884,16 +884,16 @@ static int mdd_process_config(const struct lu_env *env, ENTRY; switch (cfg->lcfg_command) { @@ -634,7 +665,7 @@ index 40a4ee3..b0acecb 100644 case LCFG_SETUP: rc = next->ld_ops->ldo_process_config(env, next, cfg); if (rc) -@@ -1497,11 +1497,8 @@ LU_CONTEXT_KEY_DEFINE(mdd, LCT_MD_THREAD); +@@ -1564,11 +1564,8 @@ LU_CONTEXT_KEY_DEFINE(mdd, LCT_MD_THREAD); static int __init mdd_mod_init(void) { @@ -646,20 +677,20 @@ index 40a4ee3..b0acecb 100644 rc = lu_kmem_init(mdd_caches); if (rc) return rc; -@@ -1517,7 +1514,7 @@ static int __init mdd_mod_init(void) +@@ -1584,7 +1581,7 @@ static int __init mdd_mod_init(void) - rc = class_register_type(&mdd_obd_device_ops, NULL, NULL, + rc = class_register_type(&mdd_obd_device_ops, NULL, true, NULL, #ifndef HAVE_ONLY_PROCFS_SEQ -- lvars.module_vars, -+ NULL, +- lvars.module_vars, ++ NULL, #endif - LUSTRE_MDD_NAME, &mdd_device_type); + LUSTRE_MDD_NAME, &mdd_device_type); if (rc) diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h -index 0bfb2a2..bccef77 100644 +index b536821..8e67fa1 100644 --- a/lustre/mdd/mdd_internal.h +++ b/lustre/mdd/mdd_internal.h -@@ -342,7 +342,6 @@ int orph_declare_index_delete(const struct lu_env *, struct mdd_object *, +@@ -346,7 +346,6 @@ int orph_declare_index_delete(const struct lu_env *, struct mdd_object *, struct thandle *); /* mdd_lproc.c */ @@ -668,7 +699,7 @@ index 0bfb2a2..bccef77 100644 int mdd_procfs_fini(struct mdd_device *mdd); diff --git a/lustre/mdd/mdd_lproc.c b/lustre/mdd/mdd_lproc.c -index de379b3..5714ee6 100644 +index de379b3..7ac4afa 100644 --- a/lustre/mdd/mdd_lproc.c +++ b/lustre/mdd/mdd_lproc.c @@ -49,56 +49,14 @@ @@ -711,10 +742,7 @@ index de379b3..5714ee6 100644 -} - -int mdd_procfs_fini(struct mdd_device *mdd) -+static ssize_t -+mdd_atime_diff_seq_write(struct file *file, const char *buffer, -+ size_t count, loff_t *off) - { +-{ - if (mdd->mdd_proc_entry) { - lprocfs_remove(&mdd->mdd_proc_entry); - mdd->mdd_proc_entry = NULL; @@ -724,7 +752,10 @@ index de379b3..5714ee6 100644 - -static int lprocfs_wr_atime_diff(struct file *file, const char *buffer, - unsigned long count, void *data) --{ ++static ssize_t ++mdd_atime_diff_seq_write(struct file *file, const char *buffer, ++ size_t count, loff_t *off) + { - struct mdd_device *mdd = data; - char kernbuf[20], *end; - unsigned long diff = 0; @@ -867,7 +898,7 @@ index de379b3..5714ee6 100644 llog_cat_process(&env, ctxt->loc_handle, lprocfs_changelog_users_cb, - &cucb, 0, 0); -+ &m, 0, 0); ++ m, 0, 0); lu_env_fini(&env); llog_ctxt_put(ctxt); @@ -968,7 +999,7 @@ index de379b3..5714ee6 100644 __u32 val; int rc; -@@ -320,54 +255,77 @@ static int lprocfs_wr_lfsck_async_windows(struct file *file, const char *buffer, +@@ -320,54 +255,87 @@ static int lprocfs_wr_lfsck_async_windows(struct file *file, const char *buffer, return rc != 0 ? rc : count; } @@ -989,12 +1020,35 @@ index de379b3..5714ee6 100644 - return rc; + return lfsck_dump(m, mdd->mdd_bottom, LT_NAMESPACE); } ++LPROC_SEQ_FOPS_RO(mdd_lfsck_namespace); -static int lprocfs_rd_lfsck_layout(char *page, char **start, off_t off, - int count, int *eof, void *data) --{ ++static int mdd_lfsck_layout_seq_show(struct seq_file *m, void *data) + { - struct mdd_device *mdd = data; -+LPROC_SEQ_FOPS_RO(mdd_lfsck_namespace); ++ struct mdd_device *mdd = m->private; + + LASSERT(mdd != NULL); +- *eof = 1; + +- return lfsck_dump(mdd->mdd_bottom, page, count, LT_LAYOUT); ++ return lfsck_dump(m, mdd->mdd_bottom, LT_LAYOUT); + } +- +-static struct lprocfs_vars lprocfs_mdd_obd_vars[] = { +- { "atime_diff", lprocfs_rd_atime_diff, lprocfs_wr_atime_diff, 0 }, +- { "changelog_mask", lprocfs_rd_changelog_mask, +- lprocfs_wr_changelog_mask, 0 }, +- { "changelog_users", lprocfs_rd_changelog_users, 0, 0}, +- { "sync_permission", lprocfs_rd_sync_perm, lprocfs_wr_sync_perm, 0 }, +- { "lfsck_speed_limit", lprocfs_rd_lfsck_speed_limit, +- lprocfs_wr_lfsck_speed_limit, 0 }, +- { "lfsck_async_windows", lprocfs_rd_lfsck_async_windows, +- lprocfs_wr_lfsck_async_windows, 0 }, +- { "lfsck_namespace", lprocfs_rd_lfsck_namespace, 0, 0 }, +- { "lfsck_layout", lprocfs_rd_lfsck_layout, 0, 0 }, ++LPROC_SEQ_FOPS_RO(mdd_lfsck_layout); + +static struct lprocfs_seq_vars lprocfs_mdd_obd_vars[] = { + { .name = "atime_diff", @@ -1007,42 +1061,34 @@ index de379b3..5714ee6 100644 + .fops = &mdd_sync_perm_fops }, + { .name = "lfsck_speed_limit", + .fops = &mdd_lfsck_speed_limit_fops }, -+ { .name = "lfsck_async_windows", -+ .fops = &mdd_lfsck_async_windows_fops }, -+ { .name = "lfsck_namespace", -+ .fops = &mdd_lfsck_namespace_fops }, -+ { 0 } -+}; - -- LASSERT(mdd != NULL); -- *eof = 1; ++ { .name = "lfsck_async_windows", ++ .fops = &mdd_lfsck_async_windows_fops }, ++ { .name = "lfsck_namespace", ++ .fops = &mdd_lfsck_namespace_fops }, ++ { .name = "lfsck_layout", ++ .fops = &mdd_lfsck_layout_fops }, + { 0 } + }; + +-static struct lprocfs_vars lprocfs_mdd_module_vars[] = { +- { "num_refs", lprocfs_rd_numrefs, 0, 0 }, +- { 0 } +-}; +- +-void lprocfs_mdd_init_vars(struct lprocfs_static_vars *lvars) +int mdd_procfs_init(struct mdd_device *mdd, const char *name) -+{ + { +- lvars->module_vars = lprocfs_mdd_module_vars; +- lvars->obd_vars = lprocfs_mdd_obd_vars; + struct obd_device *obd = class_name2obd(name); + struct obd_type *type; + int rc; + ENTRY; - -- return lfsck_dump(mdd->mdd_bottom, page, count, LT_LAYOUT); --} ++ + /* at the moment there is no linkage between lu_type + * and obd_type, so we lookup obd_type this way */ + type = class_search_type(LUSTRE_MDD_NAME); - --static struct lprocfs_vars lprocfs_mdd_obd_vars[] = { -- { "atime_diff", lprocfs_rd_atime_diff, lprocfs_wr_atime_diff, 0 }, -- { "changelog_mask", lprocfs_rd_changelog_mask, -- lprocfs_wr_changelog_mask, 0 }, -- { "changelog_users", lprocfs_rd_changelog_users, 0, 0}, -- { "sync_permission", lprocfs_rd_sync_perm, lprocfs_wr_sync_perm, 0 }, -- { "lfsck_speed_limit", lprocfs_rd_lfsck_speed_limit, -- lprocfs_wr_lfsck_speed_limit, 0 }, -- { "lfsck_async_windows", lprocfs_rd_lfsck_async_windows, -- lprocfs_wr_lfsck_async_windows, 0 }, -- { "lfsck_namespace", lprocfs_rd_lfsck_namespace, 0, 0 }, -- { "lfsck_layout", lprocfs_rd_lfsck_layout, 0, 0 }, -- { 0 } --}; ++ + LASSERT(name != NULL); + LASSERT(type != NULL); + LASSERT(obd != NULL); @@ -1059,32 +1105,23 @@ index de379b3..5714ee6 100644 + GOTO(out, rc); + } + rc = 0; - --static struct lprocfs_vars lprocfs_mdd_module_vars[] = { -- { "num_refs", lprocfs_rd_numrefs, 0, 0 }, -- { 0 } --}; + EXIT; +out: + if (rc) + mdd_procfs_fini(mdd); + return rc; -+} + } --void lprocfs_mdd_init_vars(struct lprocfs_static_vars *lvars) +int mdd_procfs_fini(struct mdd_device *mdd) - { -- lvars->module_vars = lprocfs_mdd_module_vars; -- lvars->obd_vars = lprocfs_mdd_obd_vars; ++{ + if (mdd->mdd_proc_entry) { + lprocfs_remove(&mdd->mdd_proc_entry); + mdd->mdd_proc_entry = NULL; + } + RETURN(0); - } -- ++} diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c -index 0ca58c5..5b72a5a 100644 +index 30d9f59..5e479c8 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -388,11 +388,10 @@ EXPORT_SYMBOL(lprocfs_evict_client_seq_write); @@ -1104,7 +1141,7 @@ index 0ca58c5..5b72a5a 100644 EXPORT_SYMBOL(lprocfs_evict_client_fops); #endif diff --git a/lustre/ofd/lproc_ofd.c b/lustre/ofd/lproc_ofd.c -index e303fd6..1759a7d 100644 +index 000d4ae..eb6bef0 100644 --- a/lustre/ofd/lproc_ofd.c +++ b/lustre/ofd/lproc_ofd.c @@ -47,80 +47,75 @@ @@ -1600,7 +1637,7 @@ index e303fd6..1759a7d 100644 struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); __u32 val; int rc; -@@ -516,84 +512,108 @@ static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer, +@@ -516,37 +512,34 @@ static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer, return rc != 0 ? rc : count; } @@ -1611,13 +1648,55 @@ index e303fd6..1759a7d 100644 +static int ofd_lfsck_layout_seq_show(struct seq_file *m, void *data) { - struct obd_device *obd = data; +- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); +- +- *eof = 1; ++ struct obd_device *obd = m->private; ++ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); + +- return lfsck_dump(ofd->ofd_osd, page, count, LT_LAYOUT); ++ return lfsck_dump(m, ofd->ofd_osd, LT_LAYOUT); + } ++LPROC_SEQ_FOPS_RO(ofd_lfsck_layout); + +-static int lprocfs_rd_lfsck_verify_pfid(char *page, char **start, off_t off, +- int count, int *eof, void *data) ++static int ofd_lfsck_verify_pfid_seq_show(struct seq_file *m, void *data) + { +- struct obd_device *obd = data; +- struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); +- +- *eof = 1; ++ struct obd_device *obd = m->private; ++ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); + +- return snprintf(page, count, +- "switch: %s\ndetected: "LPU64"\nrepaired: "LPU64"\n", +- ofd->ofd_lfsck_verify_pfid ? "on" : "off", +- ofd->ofd_inconsistency_self_detected, +- ofd->ofd_inconsistency_self_repaired); ++ return seq_printf(m, "switch: %s\ndetected: "LPU64"\nrepaired: "LPU64"\n", ++ ofd->ofd_lfsck_verify_pfid ? "on" : "off", ++ ofd->ofd_inconsistency_self_detected, ++ ofd->ofd_inconsistency_self_repaired); + } + +-static int lprocfs_wr_lfsck_verify_pfid(struct file *file, const char *buffer, +- unsigned long count, void *data) ++static ssize_t ++ofd_lfsck_verify_pfid_seq_write(struct file *file, const char *buffer, ++ size_t count, loff_t *off) + { +- struct obd_device *obd = data; ++ struct seq_file *m = file->private_data; + struct obd_device *obd = m->private; struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); + __u32 val; + int rc; +@@ -559,75 +552,101 @@ static int lprocfs_wr_lfsck_verify_pfid(struct file *file, const char *buffer, -- *eof = 1; -- -- return lfsck_dump(ofd->ofd_osd, page, count, LT_LAYOUT); --} + return count; + } - -static struct lprocfs_vars lprocfs_ofd_obd_vars[] = { - { "uuid", lprocfs_rd_uuid, 0, 0 }, @@ -1671,14 +1750,14 @@ index e303fd6..1759a7d 100644 - { "lfsck_speed_limit", lprocfs_rd_lfsck_speed_limit, - lprocfs_wr_lfsck_speed_limit, 0 }, - { "lfsck_layout", lprocfs_rd_lfsck_layout, 0, 0 }, +- { "lfsck_verify_pfid", lprocfs_rd_lfsck_verify_pfid, +- lprocfs_wr_lfsck_verify_pfid, 0 }, - { 0 } -}; - -static struct lprocfs_vars lprocfs_ofd_module_vars[] = { - { "num_refs", lprocfs_rd_numrefs, 0, 0 }, -+ return lfsck_dump(m, ofd->ofd_osd, LT_LAYOUT); -+} -+LPROC_SEQ_FOPS_RO(ofd_lfsck_layout); ++LPROC_SEQ_FOPS(ofd_lfsck_verify_pfid); + +LPROC_SEQ_FOPS_RO_TYPE(ofd, uuid); +LPROC_SEQ_FOPS_RO_TYPE(ofd, blksize); @@ -1764,10 +1843,12 @@ index e303fd6..1759a7d 100644 + .fops = &ofd_job_interval_fops }, + { .name = "soft_sync_limit", + .fops = &ofd_soft_sync_limit_fops }, -+ { .name = "lfsck_speed_limit", -+ .fops = &ofd_lfsck_speed_limit_fops }, -+ { .name = "lfsck_layout", -+ .fops = &ofd_lfsck_layout_fops }, ++ { .name = "lfsck_speed_limit", ++ .fops = &ofd_lfsck_speed_limit_fops }, ++ { .name = "lfsck_layout", ++ .fops = &ofd_lfsck_layout_fops }, ++ { .name = "lfsck_verify_pfid", ++ .fops = &ofd_lfsck_verify_pfid_fops }, { 0 } }; @@ -1781,7 +1862,7 @@ index e303fd6..1759a7d 100644 { LASSERT(stats && stats->ls_num >= LPROC_OFD_STATS_LAST); diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c -index 9900bed..a9cc81f 100644 +index 5d7f0b4..f75ffe1 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -240,8 +240,7 @@ static int ofd_process_config(const struct lu_env *env, struct lu_device *d, @@ -1827,16 +1908,17 @@ index 9900bed..a9cc81f 100644 if (rc) { CERROR("%s: lprocfs_obd_setup failed: %d.\n", obd->obd_name, rc); -@@ -524,7 +523,7 @@ static int ofd_procfs_init(struct ofd_device *ofd) +@@ -524,7 +523,8 @@ static int ofd_procfs_init(struct ofd_device *ofd) obd->obd_uses_nid_stats = 1; - entry = lprocfs_register("exports", obd->obd_proc_entry, NULL, NULL); -+ entry = lprocfs_seq_register("exports", obd->obd_proc_entry, NULL, NULL); ++ entry = lprocfs_seq_register("exports", obd->obd_proc_entry, NULL, ++ NULL); if (IS_ERR(entry)) { rc = PTR_ERR(entry); CERROR("%s: error %d setting up lprocfs for %s\n", -@@ -534,8 +533,10 @@ static int ofd_procfs_init(struct ofd_device *ofd) +@@ -534,8 +534,10 @@ static int ofd_procfs_init(struct ofd_device *ofd) obd->obd_proc_exports_entry = entry; entry = lprocfs_add_simple(obd->obd_proc_exports_entry, "clear", @@ -1849,7 +1931,7 @@ index 9900bed..a9cc81f 100644 if (IS_ERR(entry)) { rc = PTR_ERR(entry); CERROR("%s: add proc entry 'clear' failed: %d.\n", -@@ -551,7 +552,7 @@ static int ofd_procfs_init(struct ofd_device *ofd) +@@ -551,7 +553,7 @@ static int ofd_procfs_init(struct ofd_device *ofd) GOTO(remove_entry_clear, rc); RETURN(0); remove_entry_clear: @@ -1858,42 +1940,59 @@ index 9900bed..a9cc81f 100644 obd_cleanup: lprocfs_obd_cleanup(obd); lprocfs_free_obd_stats(obd); -@@ -564,29 +565,28 @@ static void ofd_procfs_add_brw_stats_symlink(struct ofd_device *ofd) +@@ -563,47 +565,36 @@ static void ofd_procfs_add_brw_stats_symlink(struct ofd_device *ofd) + { struct obd_device *obd = ofd_obd(ofd); struct obd_device *osd_obd = ofd->ofd_osd_exp->exp_obd; - cfs_proc_dir_entry_t *osd_root = osd_obd->obd_type->typ_procroot; +- cfs_proc_dir_entry_t *osd_root = osd_obd->obd_type->typ_procroot; - cfs_proc_dir_entry_t *osd_dir; -+ cfs_proc_dir_entry_t *osd_dir = osd_obd->obd_type->typ_procsym; ++ struct proc_dir_entry *osd_dir = osd_obd->obd_type->typ_procsym; - osd_dir = lprocfs_srch(osd_root, obd->obd_name); if (osd_dir == NULL) return; - if (lprocfs_srch(osd_dir, "brw_stats") != NULL) -+ //if (lprocfs_srch(osd_dir, "brw_stats") != NULL) - lprocfs_add_symlink("brw_stats", obd->obd_proc_entry, - "../../%s/%s/brw_stats", - osd_root->name, osd_dir->name); - +- lprocfs_add_symlink("brw_stats", obd->obd_proc_entry, +- "../../%s/%s/brw_stats", +- osd_root->name, osd_dir->name); +- - if (lprocfs_srch(osd_dir, "read_cache_enable") != NULL) -+ //if (lprocfs_srch(osd_dir, "read_cache_enable") != NULL) - lprocfs_add_symlink("read_cache_enable", obd->obd_proc_entry, - "../../%s/%s/read_cache_enable", - osd_root->name, osd_dir->name); - +- lprocfs_add_symlink("read_cache_enable", obd->obd_proc_entry, +- "../../%s/%s/read_cache_enable", +- osd_root->name, osd_dir->name); +- - if (lprocfs_srch(osd_dir, "readcache_max_filesize") != NULL) -+ //if (lprocfs_srch(osd_dir, "readcache_max_filesize") != NULL) - lprocfs_add_symlink("readcache_max_filesize", - obd->obd_proc_entry, - "../../%s/%s/readcache_max_filesize", - osd_root->name, osd_dir->name); - +- lprocfs_add_symlink("readcache_max_filesize", +- obd->obd_proc_entry, +- "../../%s/%s/readcache_max_filesize", +- osd_root->name, osd_dir->name); +- - if (lprocfs_srch(osd_dir, "writethrough_cache_enable") != NULL) -+ //if (lprocfs_srch(osd_dir, "writethrough_cache_enable") != NULL) - lprocfs_add_symlink("writethrough_cache_enable", - obd->obd_proc_entry, - "../../%s/%s/writethrough_cache_enable", -@@ -597,13 +597,8 @@ static void ofd_procfs_fini(struct ofd_device *ofd) +- lprocfs_add_symlink("writethrough_cache_enable", +- obd->obd_proc_entry, +- "../../%s/%s/writethrough_cache_enable", +- osd_root->name, osd_dir->name); ++ lprocfs_add_symlink("brw_stats", obd->obd_proc_entry, ++ "../../%s/%s/brw_stats", ++ osd_obd->obd_type->typ_name, obd->obd_name); ++ ++ lprocfs_add_symlink("read_cache_enable", obd->obd_proc_entry, ++ "../../%s/%s/read_cache_enable", ++ osd_obd->obd_type->typ_name, obd->obd_name); ++ ++ lprocfs_add_symlink("readcache_max_filesize", ++ obd->obd_proc_entry, ++ "../../%s/%s/readcache_max_filesize", ++ osd_obd->obd_type->typ_name, obd->obd_name); ++ ++ lprocfs_add_symlink("writethrough_cache_enable", ++ obd->obd_proc_entry, ++ "../../%s/%s/writethrough_cache_enable", ++ osd_obd->obd_type->typ_name, obd->obd_name); + } + + static void ofd_procfs_fini(struct ofd_device *ofd) { struct obd_device *obd = ofd_obd(ofd); @@ -1909,7 +2008,7 @@ index 9900bed..a9cc81f 100644 lprocfs_free_per_client_stats(obd); lprocfs_obd_cleanup(obd); lprocfs_free_obd_stats(obd); -@@ -2368,7 +2363,6 @@ static struct lu_device_type ofd_device_type = { +@@ -2379,7 +2370,6 @@ static struct lu_device_type ofd_device_type = { int __init ofd_init(void) { @@ -1917,24 +2016,24 @@ index 9900bed..a9cc81f 100644 int rc; rc = lu_kmem_init(ofd_caches); -@@ -2381,11 +2375,9 @@ int __init ofd_init(void) +@@ -2392,11 +2382,9 @@ int __init ofd_init(void) return(rc); } - lprocfs_ofd_init_vars(&lvars); - - rc = class_register_type(&ofd_obd_ops, NULL, NULL, + rc = class_register_type(&ofd_obd_ops, NULL, true, NULL, #ifndef HAVE_ONLY_PROCFS_SEQ -- lvars.module_vars, -+ NULL, +- lvars.module_vars, ++ NULL, #endif - LUSTRE_OST_NAME, &ofd_device_type); + LUSTRE_OST_NAME, &ofd_device_type); return rc; diff --git a/lustre/ofd/ofd_internal.h b/lustre/ofd/ofd_internal.h -index ab041ce..60cfb50 100644 +index 3aae6dd..1bdcb80 100644 --- a/lustre/ofd/ofd_internal.h +++ b/lustre/ofd/ofd_internal.h -@@ -392,13 +392,9 @@ int ofd_txn_stop_cb(const struct lu_env *env, struct thandle *txn, +@@ -403,13 +403,9 @@ int ofd_txn_stop_cb(const struct lu_env *env, struct thandle *txn, /* lproc_ofd.c */ #ifdef LPROCFS @@ -1950,10 +2049,10 @@ index ab041ce..60cfb50 100644 #endif diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c -index a8022f0..4e1ec4a 100644 +index e0da7e6..14808ee 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c -@@ -5892,6 +5892,7 @@ static int osd_obd_connect(const struct lu_env *env, struct obd_export **exp, +@@ -5921,6 +5921,7 @@ static int osd_obd_connect(const struct lu_env *env, struct obd_export **exp, osd->od_connects++; spin_unlock(&osd->od_osfs_lock); @@ -1962,7 +2061,7 @@ index a8022f0..4e1ec4a 100644 } diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c -index c9bf49a..bd2463a 100644 +index 05820e0..e711727 100644 --- a/lustre/osd-zfs/osd_handler.c +++ b/lustre/osd-zfs/osd_handler.c @@ -816,6 +816,7 @@ static int osd_obd_connect(const struct lu_env *env, struct obd_export **exp, @@ -1974,5 +2073,5 @@ index c9bf49a..bd2463a 100644 } -- -1.8.5.3 +1.9.1 diff --git a/sys-cluster/lustre/files/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch b/sys-cluster/lustre/files/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch index 7f9d4d7..cc93d19 100644 --- a/sys-cluster/lustre/files/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch +++ b/sys-cluster/lustre/files/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch @@ -1,12 +1,11 @@ -From 98a6eee60a100d445d7533eeba907e4e75c36f18 Mon Sep 17 00:00:00 2001 +From 671de4e9a7ec811db225a763b88e48379d5a4daf Mon Sep 17 00:00:00 2001 From: James Simmons -Date: Sun, 9 Feb 2014 10:45:37 -0500 -Subject: [PATCH 09/12] LU-3319 procfs: update ldiskfs proc handling to - seq_files +Date: Tue, 25 Mar 2014 12:37:41 -0400 +Subject: [PATCH 9/9] LU-3319 procfs: update ldiskfs proc handling to seq_files Migrate all ldiskfs proc handling to using strictly seq_files. Also include a fix with newer gcc complaining -certain variables are initialized. +certain variables are uninitialized. Signed-off-by: James Simmons Change-Id: Ia296a4682e2feda02bcfbe0100de8a89404cd731 @@ -14,12 +13,12 @@ Change-Id: Ia296a4682e2feda02bcfbe0100de8a89404cd731 lustre/osd-ldiskfs/osd_compat.c | 6 +- lustre/osd-ldiskfs/osd_handler.c | 16 +- lustre/osd-ldiskfs/osd_internal.h | 6 +- - lustre/osd-ldiskfs/osd_lproc.c | 336 ++++++++++++++++++++------------------ - lustre/osd-ldiskfs/osd_scrub.c | 73 +++------ - 5 files changed, 220 insertions(+), 217 deletions(-) + lustre/osd-ldiskfs/osd_lproc.c | 343 ++++++++++++++++++++------------------ + lustre/osd-ldiskfs/osd_scrub.c | 104 ++++-------- + 5 files changed, 235 insertions(+), 240 deletions(-) diff --git a/lustre/osd-ldiskfs/osd_compat.c b/lustre/osd-ldiskfs/osd_compat.c -index e693e8d..3fb6783 100644 +index 8b91b64..6330066 100644 --- a/lustre/osd-ldiskfs/osd_compat.c +++ b/lustre/osd-ldiskfs/osd_compat.c @@ -1164,7 +1164,7 @@ int osd_obj_spec_update(struct osd_thread_info *info, struct osd_device *osd, @@ -50,53 +49,46 @@ index e693e8d..3fb6783 100644 ENTRY; diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c -index 4e1ec4a..1d9a2ba 100644 +index 14808ee..2cb9af5 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c -@@ -5824,6 +5824,7 @@ static struct lu_device *osd_device_free(const struct lu_env *env, - 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; -@@ -5838,12 +5839,12 @@ static int osd_process_config(const struct lu_env *env, +@@ -5867,12 +5867,13 @@ 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, ++ rc = class_process_proc_seq_param(PARAM_OSD, ++ lprocfs_osd_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); ++ lprocfs_osd_obd_vars, ++ cfg, &o->od_dt_dev); break; default: rc = -ENOSYS; -@@ -5991,9 +5992,10 @@ static int __init osd_mod_init(void) +@@ -6020,9 +6021,10 @@ static int __init osd_mod_init(void) if (rc) return rc; -- rc = class_register_type(&osd_obd_device_ops, NULL, NULL, +- rc = class_register_type(&osd_obd_device_ops, NULL, true, NULL, -#ifndef HAVE_ONLY_PROCFS_SEQ -+ rc = class_register_type(&osd_obd_device_ops, NULL, - lprocfs_osd_module_vars, ++ rc = class_register_type(&osd_obd_device_ops, NULL, true, + lprocfs_osd_module_vars, +#ifndef HAVE_ONLY_PROCFS_SEQ -+ NULL, ++ NULL, #endif - LUSTRE_OSD_LDISKFS_NAME, &osd_device_type); + LUSTRE_OSD_LDISKFS_NAME, &osd_device_type); if (rc) diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h -index dc52885..7d54162 100644 +index 185d63d..e1bde19 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h -@@ -616,8 +616,8 @@ static inline int __osd_xattr_set(struct osd_thread_info *info, +@@ -617,8 +617,8 @@ static inline int __osd_xattr_set(struct osd_thread_info *info, #ifdef LPROCFS /* osd_lproc.c */ @@ -107,7 +99,7 @@ index dc52885..7d54162 100644 int osd_procfs_init(struct osd_device *osd, const char *name); int osd_procfs_fini(struct osd_device *osd); void osd_brw_stats_update(struct osd_device *osd, struct osd_iobuf *iobuf); -@@ -672,7 +672,7 @@ int osd_oii_insert(struct osd_device *dev, struct osd_idmap_cache *oic, +@@ -673,7 +673,7 @@ int osd_oii_insert(struct osd_device *dev, struct osd_idmap_cache *oic, int insert); int osd_oii_lookup(struct osd_device *dev, const struct lu_fid *fid, struct osd_inode_id *id); @@ -117,7 +109,7 @@ index dc52885..7d54162 100644 int osd_fld_lookup(const struct lu_env *env, struct osd_device *osd, obd_seq seq, struct lu_seq_range *range); diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c -index b9b4e3d..947a4b9 100644 +index b9b4e3d..ddaa169 100644 --- a/lustre/osd-ldiskfs/osd_lproc.c +++ b/lustre/osd-ldiskfs/osd_lproc.c @@ -237,92 +237,46 @@ out: @@ -125,7 +117,8 @@ index b9b4e3d..947a4b9 100644 } -int osd_procfs_init(struct osd_device *osd, const char *name) --{ ++static int ldiskfs_osd_fstype_seq_show(struct seq_file *m, void *data) + { - struct obd_type *type; - int rc; - ENTRY; @@ -148,7 +141,8 @@ index b9b4e3d..947a4b9 100644 - osd->od_proc_entry = NULL; - GOTO(out, rc); - } -- ++ struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private); + - rc = osd_stats_init(osd); - - EXIT; @@ -172,11 +166,9 @@ index b9b4e3d..947a4b9 100644 - -static int lprocfs_osd_rd_fstype(char *page, char **start, off_t off, int count, - int *eof, void *data) -+static int ldiskfs_osd_fstype_seq_show(struct seq_file *m, void *data) - { +-{ - struct osd_device *osd = osd_dt_dev(data); -+ struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private); - +- - LASSERT(osd != NULL); - return snprintf(page, count, "ldiskfs\n"); + LASSERT(osd != NULL); @@ -200,7 +192,7 @@ index b9b4e3d..947a4b9 100644 + return -EINPROGRESS; - return snprintf(page, count, "%s\n", osd->od_mntdev); -+ return seq_printf(m, "%u\n", osd->od_read_cache); ++ return seq_printf(m, "%s\n", osd->od_mntdev); } +LPROC_SEQ_FOPS_RO(ldiskfs_osd_mntdev); @@ -227,14 +219,14 @@ index b9b4e3d..947a4b9 100644 { - struct osd_device *osd = osd_dt_dev(data); - int val, rc; -+ struct seq_file *m = file->private_data; ++ struct seq_file *m = file->private_data; + struct dt_device *dt = m->private; + struct osd_device *osd = osd_dt_dev(dt); + int val, rc; LASSERT(osd != NULL); if (unlikely(osd->od_mnt == NULL)) -@@ -335,24 +289,26 @@ static int lprocfs_osd_wr_cache(struct file *file, const char *buffer, +@@ -335,24 +289,27 @@ static int lprocfs_osd_wr_cache(struct file *file, const char *buffer, osd->od_read_cache = !!val; return count; } @@ -263,13 +255,14 @@ index b9b4e3d..947a4b9 100644 { - struct osd_device *osd = osd_dt_dev(data); - int val, rc; -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct dt_device *dt = m->private; + struct osd_device *osd = osd_dt_dev(dt); + int val, rc; LASSERT(osd != NULL); if (unlikely(osd->od_mnt == NULL)) -@@ -365,14 +321,16 @@ static int lprocfs_osd_wr_wcache(struct file *file, const char *buffer, +@@ -365,14 +322,17 @@ static int lprocfs_osd_wr_wcache(struct file *file, const char *buffer, osd->od_writethrough_cache = !!val; return count; } @@ -285,14 +278,15 @@ index b9b4e3d..947a4b9 100644 - struct dt_device *dt = data; - struct lu_env env; - int rc; -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct dt_device *dt = m->private; + struct osd_device *osd = osd_dt_dev(dt); + struct lu_env env; + int rc; LASSERT(osd != NULL); if (unlikely(osd->od_mnt == NULL)) -@@ -386,20 +344,18 @@ static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer, +@@ -386,20 +346,18 @@ static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer, return rc == 0 ? count : rc; } @@ -320,7 +314,7 @@ index b9b4e3d..947a4b9 100644 rc = lprocfs_write_helper(buffer, count, &pdo); if (rc != 0) -@@ -409,24 +365,25 @@ static int lprocfs_osd_wr_pdo(struct file *file, const char *buffer, +@@ -409,24 +367,26 @@ static int lprocfs_osd_wr_pdo(struct file *file, const char *buffer, return count; } @@ -349,12 +343,13 @@ index b9b4e3d..947a4b9 100644 + size_t count, loff_t *off) { - struct osd_device *dev = osd_dt_dev(data); -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct dt_device *dt = m->private; + struct osd_device *dev = osd_dt_dev(dt); int val, rc; LASSERT(dev != NULL); -@@ -440,19 +397,18 @@ static int lprocfs_osd_wr_auto_scrub(struct file *file, const char *buffer, +@@ -440,19 +400,18 @@ static int lprocfs_osd_wr_auto_scrub(struct file *file, const char *buffer, dev->od_noscrub = !val; return count; } @@ -381,13 +376,11 @@ index b9b4e3d..947a4b9 100644 { int track_declares_assert; int rc; -@@ -465,38 +421,39 @@ static int lprocfs_osd_wr_track_declares_assert(struct file *file, +@@ -465,40 +424,40 @@ static int lprocfs_osd_wr_track_declares_assert(struct file *file, return count; } +LPROC_SEQ_FOPS(ldiskfs_osd_track_declares_assert); -+ -+extern int osd_scrub_dump(struct seq_file *m, struct osd_device *dev); -static int lprocfs_osd_rd_oi_scrub(char *page, char **start, off_t off, - int count, int *eof, void *data) @@ -430,12 +423,17 @@ index b9b4e3d..947a4b9 100644 + size_t count, loff_t *off) { - struct osd_device *osd = osd_dt_dev(data); -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private; -+ struct osd_device *osd = osd_dt_dev(dt); - __u64 val; - int rc; +- __u64 val; +- int rc; ++ struct seq_file *m = file->private_data; ++ struct dt_device *dt = m->private; ++ struct osd_device *osd = osd_dt_dev(dt); ++ __u64 val; ++ int rc; -@@ -512,24 +469,25 @@ int lprocfs_osd_wr_readcache(struct file *file, const char *buffer, + LASSERT(osd != NULL); + if (unlikely(osd->od_mnt == NULL)) +@@ -512,24 +471,26 @@ int lprocfs_osd_wr_readcache(struct file *file, const char *buffer, OSD_MAX_CACHE_SIZE : val; return count; } @@ -464,12 +462,13 @@ index b9b4e3d..947a4b9 100644 + size_t count, loff_t *off) { - struct osd_device *dev = osd_dt_dev(data); -+ struct dt_device *dt = ((struct seq_file *)file->private_data)->private; ++ struct seq_file *m = file->private_data; ++ struct dt_device *dt = m->private; + struct osd_device *dev = osd_dt_dev(dt); int val; int rc; -@@ -544,38 +502,102 @@ static int lprocfs_osd_wr_lma_self_repair(struct file *file, const char *buffer, +@@ -544,38 +505,102 @@ static int lprocfs_osd_wr_lma_self_repair(struct file *file, const char *buffer, dev->od_lma_self_repair = !!val; return count; } @@ -602,10 +601,10 @@ index b9b4e3d..947a4b9 100644 +} #endif diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c -index e558163..b5b91c8 100644 +index 7d6c011..05e9f25 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c -@@ -2551,80 +2551,69 @@ static const char *scrub_param_names[] = { +@@ -2571,134 +2571,112 @@ static const char *scrub_param_names[] = { NULL }; @@ -619,9 +618,11 @@ index e558163..b5b91c8 100644 int i; - rc = snprintf(*buf, *len, "%s:%c", prefix, bits != 0 ? ' ' : '\n'); +- if (rc <= 0) +- return -ENOSPC; + rc = seq_printf(m, "%s:%c", prefix, bits != 0 ? ' ' : '\n'); - if (rc <= 0) - return -ENOSPC; ++ if (rc < 0) ++ return rc; - *buf += rc; - *len -= rc; @@ -630,13 +631,15 @@ index e558163..b5b91c8 100644 bits &= ~flag; - rc = snprintf(*buf, *len, "%s%c", names[i], - bits != 0 ? ',' : '\n'); -+ rc = seq_printf(m, "%s%c", names[i], -+ bits != 0 ? ',' : '\n'); - if (rc <= 0) - return -ENOSPC; +- if (rc <= 0) +- return -ENOSPC; - - *buf += rc; - *len -= rc; ++ rc = seq_printf(m, "%s%c", names[i], ++ bits != 0 ? ',' : '\n'); ++ if (rc < 0) ++ return rc; } } - return save - *len; @@ -654,14 +657,13 @@ index e558163..b5b91c8 100644 cfs_time_current_sec() - time); else - rc = snprintf(*buf, *len, "%s: N/A\n", prefix); -+ rc = seq_printf(m, "%s: N/A\n", prefix); - if (rc <= 0) - return -ENOSPC; - +- if (rc <= 0) +- return -ENOSPC; +- - *buf += rc; - *len -= rc; -- return rc; -+ return 0; ++ rc = seq_printf(m, "%s: N/A\n", prefix); + return rc; } -static int scrub_pos_dump(char **buf, int *len, __u64 pos, const char *prefix) @@ -674,34 +676,42 @@ index e558163..b5b91c8 100644 + rc = seq_printf(m, "%s: "LPU64"\n", prefix, pos); else - rc = snprintf(*buf, *len, "%s: N/A\n", prefix); -+ rc = seq_printf(m, "%s: N/A\n", prefix); - if (rc <= 0) - return -ENOSPC; - +- if (rc <= 0) +- return -ENOSPC; +- - *buf += rc; - *len -= rc; ++ rc = seq_printf(m, "%s: N/A\n", prefix); return rc; } -int osd_scrub_dump(struct osd_device *dev, char *buf, int len) -+int osd_scrub_dump(struct seq_file *m,struct osd_device *dev) ++int osd_scrub_dump(struct seq_file *m, struct osd_device *dev) { struct osd_scrub *scrub = &dev->od_scrub; struct scrub_file *sf = &scrub->os_file; __u64 checked; __u64 speed; - int save = len; - int ret = -ENOSPC; +- int ret = -ENOSPC; int rc; down_read(&scrub->os_rwsem); - rc = snprintf(buf, len, -+ rc = seq_printf(m, - "name: OI_scrub\n" - "magic: 0x%x\n" - "oi_files: %d\n" -@@ -2634,51 +2623,48 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len) - if (rc <= 0) +- "name: OI_scrub\n" +- "magic: 0x%x\n" +- "oi_files: %d\n" +- "status: %s\n", +- sf->sf_magic, (int)sf->sf_oi_count, +- scrub_status_names[sf->sf_status]); +- if (rc <= 0) ++ rc = seq_printf(m, "name: OI_scrub\n" ++ "magic: 0x%x\n" ++ "oi_files: %d\n" ++ "status: %s\n", ++ sf->sf_magic, (int)sf->sf_oi_count, ++ scrub_status_names[sf->sf_status]); ++ if (rc < 0) goto out; - buf += rc; @@ -761,8 +771,12 @@ index e558163..b5b91c8 100644 "updated: "LPU64"\n" "failed: "LPU64"\n" "prior_updated: "LPU64"\n" -@@ -2691,8 +2677,6 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len) - if (rc <= 0) +@@ -2708,11 +2686,9 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len) + checked, sf->sf_items_updated, sf->sf_items_failed, + sf->sf_items_updated_prior, sf->sf_items_noscrub, + sf->sf_items_igif, sf->sf_success_count); +- if (rc <= 0) ++ if (rc < 0) goto out; - buf += rc; @@ -770,7 +784,7 @@ index e558163..b5b91c8 100644 speed = checked; if (thread_is_running(&scrub->os_thread)) { cfs_duration_t duration = cfs_time_current() - -@@ -2705,8 +2689,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len) +@@ -2725,8 +2701,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len) do_div(new_checked, duration); if (rtime != 0) do_div(speed, rtime); @@ -780,7 +794,7 @@ index e558163..b5b91c8 100644 "average_speed: "LPU64" objects/sec\n" "real-time_speed: "LPU64" objects/sec\n" "current_position: %u\n" -@@ -2719,8 +2702,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len) +@@ -2739,8 +2714,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len) } else { if (sf->sf_run_time != 0) do_div(speed, sf->sf_run_time); @@ -790,18 +804,22 @@ index e558163..b5b91c8 100644 "average_speed: "LPU64" objects/sec\n" "real-time_speed: N/A\n" "current_position: N/A\n" -@@ -2732,10 +2714,7 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len) +@@ -2750,14 +2724,8 @@ int osd_scrub_dump(struct osd_device *dev, char *buf, int len) + sf->sf_run_time, speed, scrub->os_lf_scanned, + scrub->os_lf_repaired, scrub->os_lf_failed); } - if (rc <= 0) - goto out; +- if (rc <= 0) +- goto out; - - buf += rc; - len -= rc; - ret = save - len; -+ ret = 0; out: up_read(&scrub->os_rwsem); +- return ret; ++ return (rc < 0 ? -ENOSPC : 0); + } -- -1.8.5.3 +1.9.1 diff --git a/sys-cluster/lustre/files/0010-LU-3319-lprocfs-client-side-cleanups.patch b/sys-cluster/lustre/files/0010-LU-3319-lprocfs-client-side-cleanups.patch deleted file mode 100644 index b076a3a..0000000 --- a/sys-cluster/lustre/files/0010-LU-3319-lprocfs-client-side-cleanups.patch +++ /dev/null @@ -1,463 +0,0 @@ -From 48d1258335516d5335567f11f5be91ceafbbac4e Mon Sep 17 00:00:00 2001 -From: James Simmons -Date: Tue, 21 Jan 2014 12:06:59 -0500 -Subject: [PATCH 10/12] LU-3319 lprocfs: client side cleanups - -Now that all the client side seq_file patches it is -time to handle the issue that people pointed out but -were not severe enough to prevent landing. This patch -addresses all the concerns as well and move all struct -lprocfs_seq_var to be initialized C99 style. - -Change-Id: I89e8b719bd067ecf4e3cab481a2d4c62d5052af0 -Signed-off-by: James Simmons ---- - lustre/fid/lproc_fid.c | 21 ++++++--- - lustre/lmv/lproc_lmv.c | 15 ++++--- - lustre/lov/lproc_lov.c | 42 ++++++++++++------ - lustre/mdc/lproc_mdc.c | 52 ++++++++++++++-------- - lustre/mgc/lproc_mgc.c | 25 +++++++---- - lustre/obdclass/lprocfs_status.c | 1 - - lustre/obdecho/echo.c | 3 +- - lustre/osc/lproc_osc.c | 94 +++++++++++++++++++++++++++------------- - lustre/osc/osc_request.c | 2 +- - lustre/ost/ost_handler.c | 3 +- - lustre/ptlrpc/lproc_ptlrpc.c | 2 +- - lustre/quota/qmt_pool.c | 3 +- - lustre/quota/qsd_lib.c | 12 +++-- - 13 files changed, 183 insertions(+), 92 deletions(-) - -diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c -index d89c4f6..3b9d170 100644 ---- a/lustre/fid/lproc_fid.c -+++ b/lustre/fid/lproc_fid.c -@@ -203,9 +203,12 @@ LPROC_SEQ_FOPS(lprocfs_server_fid_width); - LPROC_SEQ_FOPS_RO(lprocfs_server_fid_server); - - struct lprocfs_seq_vars seq_server_proc_list[] = { -- { "space", &lprocfs_server_fid_space_fops }, -- { "width", &lprocfs_server_fid_width_fops }, -- { "server", &lprocfs_server_fid_server_fops }, -+ { .name = "space", -+ .fops = &lprocfs_server_fid_space_fops }, -+ { .name = "width", -+ .fops = &lprocfs_server_fid_width_fops }, -+ { .name = "server", -+ .fops = &lprocfs_server_fid_server_fops }, - { NULL } - }; - -@@ -623,10 +626,14 @@ LPROC_SEQ_FOPS_RO(lprocfs_client_fid_server); - LPROC_SEQ_FOPS_RO(lprocfs_client_fid_fid); - - struct lprocfs_seq_vars seq_client_proc_list[] = { -- { "space", &lprocfs_client_fid_space_fops }, -- { "width", &lprocfs_client_fid_width_fops }, -- { "server", &lprocfs_client_fid_server_fops }, -- { "fid", &lprocfs_client_fid_fid_fops }, -+ { .name = "space", -+ .fops = &lprocfs_client_fid_space_fops }, -+ { .name = "width", -+ .fops = &lprocfs_client_fid_width_fops }, -+ { .name = "server", -+ .fops = &lprocfs_client_fid_server_fops }, -+ { .name = "fid", -+ .fops = &lprocfs_client_fid_fid_fops }, - { NULL } - }; - #endif -diff --git a/lustre/lmv/lproc_lmv.c b/lustre/lmv/lproc_lmv.c -index eea5927..5a7271a 100644 ---- a/lustre/lmv/lproc_lmv.c -+++ b/lustre/lmv/lproc_lmv.c -@@ -203,11 +203,16 @@ static int lmv_target_seq_open(struct inode *inode, struct file *file) - LPROC_SEQ_FOPS_RO_TYPE(lmv, uuid); - - struct lprocfs_seq_vars lprocfs_lmv_obd_vars[] = { -- { "numobd", &lmv_numobd_fops }, -- { "placement", &lmv_placement_fops }, -- { "activeobd", &lmv_activeobd_fops }, -- { "uuid", &lmv_uuid_fops }, -- { "desc_uuid", &lmv_desc_uuid_fops }, -+ { .name = "numobd", -+ .fops = &lmv_numobd_fops }, -+ { .name = "placement", -+ .fops = &lmv_placement_fops }, -+ { .name = "activeobd", -+ .fops = &lmv_activeobd_fops }, -+ { .name = "uuid", -+ .fops = &lmv_uuid_fops }, -+ { .name = "desc_uuid", -+ .fops = &lmv_desc_uuid_fops }, - { 0 } - }; - -diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c -index e400faf..7786513 100644 ---- a/lustre/lov/lproc_lov.c -+++ b/lustre/lov/lproc_lov.c -@@ -263,20 +263,34 @@ LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesfree); - LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesavail); - - struct lprocfs_seq_vars lprocfs_lov_obd_vars[] = { -- { "uuid", &lov_uuid_fops }, -- { "stripesize", &lov_stripesize_fops }, -- { "stripeoffset", &lov_stripeoffset_fops }, -- { "stripecount", &lov_stripecount_fops }, -- { "stripetype", &lov_stripetype_fops }, -- { "numobd", &lov_numobd_fops }, -- { "activeobd", &lov_activeobd_fops }, -- { "filestotal", &lov_filestotal_fops }, -- { "filesfree", &lov_filesfree_fops }, -- { "blocksize", &lov_blksize_fops }, -- { "kbytestotal", &lov_kbytestotal_fops }, -- { "kbytesfree", &lov_kbytesfree_fops }, -- { "kbytesavail", &lov_kbytesavail_fops }, -- { "desc_uuid", &lov_desc_uuid_fops }, -+ { .name = "uuid", -+ .fops = &lov_uuid_fops }, -+ { .name = "stripesize", -+ .fops = &lov_stripesize_fops }, -+ { .name = "stripeoffset", -+ .fops = &lov_stripeoffset_fops }, -+ { .name = "stripecount", -+ .fops = &lov_stripecount_fops }, -+ { .name = "stripetype", -+ .fops = &lov_stripetype_fops }, -+ { .name = "numobd", -+ .fops = &lov_numobd_fops }, -+ { .name = "activeobd", -+ .fops = &lov_activeobd_fops }, -+ { .name = "filestotal", -+ .fops = &lov_filestotal_fops }, -+ { .name = "filesfree", -+ .fops = &lov_filesfree_fops }, -+ { .name = "blocksize", -+ .fops = &lov_blksize_fops }, -+ { .name = "kbytestotal", -+ .fops = &lov_kbytestotal_fops }, -+ { .name = "kbytesfree", -+ .fops = &lov_kbytesfree_fops }, -+ { .name = "kbytesavail", -+ .fops = &lov_kbytesavail_fops }, -+ { .name = "desc_uuid", -+ .fops = &lov_desc_uuid_fops }, - { 0 } - }; - -diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c -index cba4f61..69e377f 100644 ---- a/lustre/mdc/lproc_mdc.c -+++ b/lustre/mdc/lproc_mdc.c -@@ -103,29 +103,47 @@ LPROC_SEQ_FOPS_RW_TYPE(mdc, import); - LPROC_SEQ_FOPS_RW_TYPE(mdc, pinger_recov); - - struct lprocfs_seq_vars lprocfs_mdc_obd_vars[] = { -- { "uuid", &mdc_uuid_fops, 0, 0 }, -- { "ping", &mdc_ping_fops, 0, 0222 }, -- { "connect_flags", &mdc_connect_flags_fops,0, 0 }, -- { "blocksize", &mdc_blksize_fops, 0, 0 }, -- { "kbytestotal", &mdc_kbytestotal_fops, 0, 0 }, -- { "kbytesfree", &mdc_kbytesfree_fops, 0, 0 }, -- { "kbytesavail", &mdc_kbytesavail_fops, 0, 0 }, -- { "filestotal", &mdc_filestotal_fops, 0, 0 }, -- { "filesfree", &mdc_filesfree_fops, 0, 0 }, -- { "mds_server_uuid", &mdc_server_uuid_fops, 0, 0 }, -- { "mds_conn_uuid", &mdc_conn_uuid_fops, 0, 0 }, -+ { .name = "uuid", -+ .fops = &mdc_uuid_fops }, -+ { .name = "ping", -+ .fops = &mdc_ping_fops, -+ .proc_mode = 0222 }, -+ { .name = "connect_flags", -+ .fops = &mdc_connect_flags_fops }, -+ { .name = "blocksize", -+ .fops = &mdc_blksize_fops }, -+ { .name = "kbytestotal", -+ .fops = &mdc_kbytestotal_fops }, -+ { .name = "kbytesfree", -+ .fops = &mdc_kbytesfree_fops }, -+ { .name = "kbytesavail", -+ .fops = &mdc_kbytesavail_fops }, -+ { .name = "filestotal", -+ .fops = &mdc_filestotal_fops }, -+ { .name = "filesfree", -+ .fops = &mdc_filesfree_fops }, -+ { .name = "mds_server_uuid", -+ .fops = &mdc_server_uuid_fops }, -+ { .name = "mds_conn_uuid", -+ .fops = &mdc_conn_uuid_fops }, - /* - * FIXME: below proc entry is provided, but not in used, instead - * sbi->sb_md_brw_size is used, the per obd variable should be used - * when CMD is enabled, and dir pages are managed in MDC layer. - * Remember to enable proc write function. - */ -- { "max_pages_per_rpc", &mdc_obd_max_pages_per_rpc_fops }, -- { "max_rpcs_in_flight", &mdc_max_rpcs_in_flight_fops }, -- { "timeouts", &mdc_timeouts_fops }, -- { "import", &mdc_import_fops }, -- { "state", &mdc_state_fops }, -- { "pinger_recov", &mdc_pinger_recov_fops }, -+ { .name = "max_pages_per_rpc", -+ .fops = &mdc_obd_max_pages_per_rpc_fops }, -+ { .name = "max_rpcs_in_flight", -+ .fops = &mdc_max_rpcs_in_flight_fops }, -+ { .name = "timeouts", -+ .fops = &mdc_timeouts_fops }, -+ { .name = "import", -+ .fops = &mdc_import_fops }, -+ { .name = "state", -+ .fops = &mdc_state_fops }, -+ { .name = "pinger_recov", -+ .fops = &mdc_pinger_recov_fops }, - { 0 } - }; - #endif /* LPROCFS */ -diff --git a/lustre/mgc/lproc_mgc.c b/lustre/mgc/lproc_mgc.c -index 648b6e5..f818def 100644 ---- a/lustre/mgc/lproc_mgc.c -+++ b/lustre/mgc/lproc_mgc.c -@@ -59,14 +59,23 @@ static int mgc_ir_state_seq_show(struct seq_file *m, void *v) - LPROC_SEQ_FOPS_RO(mgc_ir_state); - - struct lprocfs_seq_vars lprocfs_mgc_obd_vars[] = { -- { "uuid", &mgc_uuid_fops, 0, 0 }, -- { "ping", &mgc_ping_fops, 0, 0222 }, -- { "connect_flags", &mgc_connect_flags_fops,0, 0 }, -- { "mgs_server_uuid", &mgc_server_uuid_fops, 0, 0 }, -- { "mgs_conn_uuid", &mgc_conn_uuid_fops, 0, 0 }, -- { "import", &mgc_import_fops, 0, 0 }, -- { "state", &mgc_state_fops, 0, 0 }, -- { "ir_state", &mgc_ir_state_fops, 0, 0 }, -+ { .name = "uuid", -+ .fops = &mgc_uuid_fops }, -+ { .name = "ping", -+ .fops = &mgc_ping_fops, -+ .proc_mode = 0222 }, -+ { .name = "connect_flags", -+ .fops = &mgc_connect_flags_fops }, -+ { .name = "mgs_server_uuid", -+ .fops = &mgc_server_uuid_fops }, -+ { .name = "mgs_conn_uuid", -+ .fops = &mgc_conn_uuid_fops }, -+ { .name = "import", -+ .fops = &mgc_import_fops }, -+ { .name = "state", -+ .fops = &mgc_state_fops }, -+ { .name = "ir_state", -+ .fops = &mgc_ir_state_fops }, - { 0 } - }; - #endif /* LPROCFS */ -diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c -index 5b72a5a..551f629 100644 ---- a/lustre/obdclass/lprocfs_status.c -+++ b/lustre/obdclass/lprocfs_status.c -@@ -2583,7 +2583,6 @@ void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats) - EXPORT_SYMBOL(lprocfs_init_ldlm_stats); - - #ifdef HAVE_SERVER_SUPPORT --/* No one appears to be using this ?? */ - int lprocfs_exp_nid_seq_show(struct seq_file *m, void *data) - { - struct obd_export *exp = m->private; -diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c -index 6d63aff..8563e68 100644 ---- a/lustre/obdecho/echo.c -+++ b/lustre/obdecho/echo.c -@@ -561,7 +561,8 @@ commitrw_cleanup: - - LPROC_SEQ_FOPS_RO_TYPE(echo, uuid); - static struct lprocfs_seq_vars lprocfs_echo_obd_vars[] = { -- { "uuid", &echo_uuid_fops }, -+ { .name = "uuid", -+ .fops = &echo_uuid_fops }, - { 0 } - }; - -diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c -index d6e3703..ccfc212 100644 ---- a/lustre/osc/lproc_osc.c -+++ b/lustre/osc/lproc_osc.c -@@ -543,37 +543,69 @@ LPROC_SEQ_FOPS_RW_TYPE(osc, import); - LPROC_SEQ_FOPS_RW_TYPE(osc, pinger_recov); - - struct lprocfs_seq_vars lprocfs_osc_obd_vars[] = { -- { "uuid", &osc_uuid_fops }, -- { "ping", &osc_ping_fops, 0, 0222 }, -- { "connect_flags", &osc_connect_flags_fops }, -- { "blocksize", &osc_blksize_fops }, -- { "kbytestotal", &osc_kbytestotal_fops }, -- { "kbytesfree", &osc_kbytesfree_fops }, -- { "kbytesavail", &osc_kbytesavail_fops }, -- { "filestotal", &osc_filestotal_fops }, -- { "filesfree", &osc_filesfree_fops }, -- { "ost_server_uuid", &osc_server_uuid_fops }, -- { "ost_conn_uuid", &osc_conn_uuid_fops }, -- { "active", &osc_active_fops }, -- { "max_pages_per_rpc", &osc_obd_max_pages_per_rpc_fops }, -- { "max_rpcs_in_flight", &osc_max_rpcs_in_flight_fops }, -- { "destroys_in_flight", &osc_destroys_in_flight_fops }, -- { "max_dirty_mb", &osc_max_dirty_mb_fops }, -- { "osc_cached_mb", &osc_cached_mb_fops }, -- { "cur_dirty_bytes", &osc_cur_dirty_bytes_fops }, -- { "cur_grant_bytes", &osc_cur_grant_bytes_fops }, -- { "cur_lost_grant_bytes", &osc_cur_lost_grant_bytes_fops }, -- { "grant_shrink_interval", &osc_grant_shrink_interval_fops }, -- { "checksums", &osc_checksum_fops }, -- { "checksum_type", &osc_checksum_type_fops }, -- { "resend_count", &osc_resend_count_fops }, -- { "timeouts", &osc_timeouts_fops }, -- { "contention_seconds", &osc_contention_seconds_fops }, -- { "lockless_truncate", &osc_lockless_truncate_fops }, -- { "import", &osc_import_fops }, -- { "state", &osc_state_fops }, -- { "pinger_recov", &osc_pinger_recov_fops }, -- { "unstable_stats", &osc_unstable_stats_fops }, -+ { .name = "uuid", -+ .fops = &osc_uuid_fops }, -+ { .name = "ping", -+ .fops = &osc_ping_fops, -+ .proc_mode = 0222 }, -+ { .name = "connect_flags", -+ .fops = &osc_connect_flags_fops }, -+ { .name = "blocksize", -+ .fops = &osc_blksize_fops }, -+ { .name = "kbytestotal", -+ .fops = &osc_kbytestotal_fops }, -+ { .name = "kbytesfree", -+ .fops = &osc_kbytesfree_fops }, -+ { .name = "kbytesavail", -+ .fops = &osc_kbytesavail_fops }, -+ { .name = "filestotal", -+ .fops = &osc_filestotal_fops }, -+ { .name = "filesfree", -+ .fops = &osc_filesfree_fops }, -+ { .name = "ost_server_uuid", -+ .fops = &osc_server_uuid_fops }, -+ { .name = "ost_conn_uuid", -+ .fops = &osc_conn_uuid_fops }, -+ { .name = "active", -+ .fops = &osc_active_fops }, -+ { .name = "max_pages_per_rpc", -+ .fops = &osc_obd_max_pages_per_rpc_fops }, -+ { .name = "max_rpcs_in_flight", -+ .fops = &osc_max_rpcs_in_flight_fops }, -+ { .name = "destroys_in_flight", -+ .fops = &osc_destroys_in_flight_fops }, -+ { .name = "max_dirty_mb", -+ .fops = &osc_max_dirty_mb_fops }, -+ { .name = "osc_cached_mb", -+ .fops = &osc_cached_mb_fops }, -+ { .name = "cur_dirty_bytes", -+ .fops = &osc_cur_dirty_bytes_fops }, -+ { .name = "cur_grant_bytes", -+ .fops = &osc_cur_grant_bytes_fops }, -+ { .name = "cur_lost_grant_bytes", -+ .fops = &osc_cur_lost_grant_bytes_fops }, -+ { .name = "grant_shrink_interval", -+ .fops = &osc_grant_shrink_interval_fops }, -+ { .name = "checksums", -+ .fops = &osc_checksum_fops }, -+ { .name = "checksum_type", -+ .fops = &osc_checksum_type_fops }, -+ { .name = "resend_count", -+ .fops = &osc_resend_count_fops }, -+ { .name = "timeouts", -+ .fops = &osc_timeouts_fops }, -+ { .name = "contention_seconds", -+ .fops = &osc_contention_seconds_fops }, -+ { .name = "lockless_truncate", -+ .fops = &osc_lockless_truncate_fops }, -+ { .name = "import", -+ .fops = &osc_import_fops }, -+ { .name = "state", -+ .fops = &osc_state_fops }, -+ { .name = "pinger_recov", -+ .fops = &osc_pinger_recov_fops }, -+ { .name = "unstable_stats", -+ .fops = &osc_unstable_stats_fops }, - { 0 } - }; - -diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c -index b9d1b71..f95fb55 100644 ---- a/lustre/osc/osc_request.c -+++ b/lustre/osc/osc_request.c -@@ -3669,7 +3669,7 @@ int osc_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg) - { - int rc = class_process_proc_seq_param(PARAM_OSC, obd->obd_vars, - lcfg, obd); -- return(rc > 0 ? 0: rc); -+ return rc > 0 ? 0: rc; - } - - static int osc_process_config(struct obd_device *obd, obd_count len, void *buf) -diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c -index a39381f..d5458b2 100644 ---- a/lustre/ost/ost_handler.c -+++ b/lustre/ost/ost_handler.c -@@ -75,7 +75,8 @@ static struct cfs_cpt_table *ost_io_cptable; - LPROC_SEQ_FOPS_RO_TYPE(ost, uuid); - - static struct lprocfs_seq_vars lprocfs_ost_obd_vars[] = { -- { "uuid", &ost_uuid_fops }, -+ { .name = "uuid", -+ .fops = &ost_uuid_fops }, - { 0 } - }; - #endif /* LPROCFS */ -diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c -index 8e5a397..bf21958 100644 ---- a/lustre/ptlrpc/lproc_ptlrpc.c -+++ b/lustre/ptlrpc/lproc_ptlrpc.c -@@ -1382,7 +1382,7 @@ lprocfs_import_seq_write(struct file *file, const char *buffer, size_t count, - - *ptr = 0; - do_reconn = 0; -- ptr += strlen("::"); -+ ptr += 2; /* Skip :: */ - inst = simple_strtol(ptr, &endptr, 10); - if (*endptr) { - CERROR("config: wrong instance # %s\n", ptr); -diff --git a/lustre/quota/qmt_pool.c b/lustre/quota/qmt_pool.c -index afd450c..df6d6fc 100644 ---- a/lustre/quota/qmt_pool.c -+++ b/lustre/quota/qmt_pool.c -@@ -171,7 +171,8 @@ static int qpi_state_seq_show(struct seq_file *m, void *data) - LPROC_SEQ_FOPS_RO(qpi_state); - - static struct lprocfs_seq_vars lprocfs_quota_qpi_vars[] = { -- { "info", &qpi_state_fops }, -+ { .name = "info", -+ .fops = &qpi_state_fops }, - { NULL } - }; - -diff --git a/lustre/quota/qsd_lib.c b/lustre/quota/qsd_lib.c -index 990cfee..573473c 100644 ---- a/lustre/quota/qsd_lib.c -+++ b/lustre/quota/qsd_lib.c -@@ -208,10 +208,14 @@ qsd_timeout_seq_write(struct file *file, const char *buffer, - LPROC_SEQ_FOPS(qsd_timeout); - - static struct lprocfs_seq_vars lprocfs_quota_qsd_vars[] = { -- { "info", &qsd_state_fops }, -- { "enabled", &qsd_enabled_fops }, -- { "force_reint", &qsd_force_reint_fops }, -- { "timeout", &qsd_timeout_fops }, -+ { .name = "info", -+ .fops = &qsd_state_fops }, -+ { .name = "enabled", -+ .fops = &qsd_enabled_fops }, -+ { .name = "force_reint", -+ .fops = &qsd_force_reint_fops }, -+ { .name = "timeout", -+ .fops = &qsd_timeout_fops }, - { NULL } - }; - --- -1.8.5.3 - diff --git a/sys-cluster/lustre/files/0011-LU-3974-llite-use-new-struct-dir_context.patch b/sys-cluster/lustre/files/0011-LU-3974-llite-use-new-struct-dir_context.patch deleted file mode 100644 index 5b3983d..0000000 --- a/sys-cluster/lustre/files/0011-LU-3974-llite-use-new-struct-dir_context.patch +++ /dev/null @@ -1,254 +0,0 @@ -From b3af9f9fde020df881b52b059a9e0d5d2c6ccfb9 Mon Sep 17 00:00:00 2001 -From: James Simmons -Date: Mon, 20 Jan 2014 21:23:00 -0500 -Subject: [PATCH 11/12] LU-3974 llite: use new struct dir_context - -The readdir and nfs code over time has added more -parameters to be passed to be processed. For the 3.11 -kernel a new struct dir_context was introduced to -minimize the impact of future expansion. This patch -addresses this change. - -Conflicts: - lustre/llite/dir.c - -Signed-off-by: James Simmons -Change-Id: Ib42bf8cb06635a2a64e63b294d79e66ac82a1a5b -Signed-off-by: Alexey Shvetsov ---- - lustre/autoconf/lustre-core.m4 | 20 ++++++++++++++++ - lustre/llite/dir.c | 54 ++++++++++++++++++++++++++++++++---------- - lustre/llite/llite_internal.h | 14 ++++++++--- - lustre/llite/llite_nfs.c | 17 +++++++++---- - 4 files changed, 85 insertions(+), 20 deletions(-) - -diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 -index e6207c9..f44a277 100644 ---- a/lustre/autoconf/lustre-core.m4 -+++ b/lustre/autoconf/lustre-core.m4 -@@ -1349,6 +1349,25 @@ LB_LINUX_TRY_COMPILE([ - ]) - - # -+# 3.11 readdir now takes the new struct dir_context -+# -+AC_DEFUN([LC_HAVE_DIR_CONTEXT], -+[AC_MSG_CHECKING([if dir_context exist]) -+LB_LINUX_TRY_COMPILE([ -+ #include -+],[ -+ struct dir_context ctx; -+ -+ ctx.pos = 0; -+],[ -+ AC_DEFINE(HAVE_DIR_CONTEXT, 1, [dir_context exist]) -+ AC_MSG_RESULT([yes]) -+],[ -+ AC_MSG_RESULT([no]) -+]) -+]) -+ -+# - # 3.11 dentry_operations.d_compare() taken 5 arguments. - # - AC_DEFUN([LC_D_COMPARE_5ARGS], -@@ -1523,6 +1542,7 @@ AC_DEFUN([LC_PROG_LINUX], - LC_BLKDEV_RELEASE_RETURN_INT - - # 3.11 -+ LC_HAVE_DIR_CONTEXT - LC_D_COMPARE_5ARGS - LC_HAVE_DCOUNT - -diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c -index 6a1e3c5..05639f0 100644 ---- a/lustre/llite/dir.c -+++ b/lustre/llite/dir.c -@@ -195,9 +195,16 @@ struct lu_dirent *ll_dir_entry_next(struct inode *dir, - return entry; - } - -+ -+#ifdef HAVE_DIR_CONTEXT -+int ll_dir_read(struct inode *inode, struct md_op_data *op_data, -+ struct dir_context *ctx) -+{ -+#else - int ll_dir_read(struct inode *inode, struct md_op_data *op_data, - void *cookie, filldir_t filldir) - { -+#endif - struct ll_sb_info *sbi = ll_i2sbi(inode); - struct ll_dir_chain chain; - struct lu_dirent *ent; -@@ -241,12 +248,17 @@ int ll_dir_read(struct inode *inode, struct md_op_data *op_data, - fid_le_to_cpu(&fid, &ent->lde_fid); - ino = cl_fid_build_ino(&fid, api32); - type = ll_dirent_type_get(ent); -+ -+#ifdef HAVE_DIR_CONTEXT - /* For 'll_nfs_get_name_filldir()', it will try - * to access the 'ent' through its 'lde_name', - * so the parameter 'name' for 'filldir()' must - * be part of the 'ent'. */ -+ done = !dir_emit(ctx, ent->lde_name, namelen, ino, type); -+#else - done = filldir(cookie, ent->lde_name, namelen, lhash, - ino, type); -+#endif - if (done) { - if (op_data->op_hash_offset != MDS_DIR_END_OFF) - op_data->op_hash_offset = last_hash; -@@ -268,7 +280,11 @@ int ll_dir_read(struct inode *inode, struct md_op_data *op_data, - RETURN(rc); - } - -+#ifdef HAVE_DIR_CONTEXT -+static int ll_iterate(struct file *filp, struct dir_context *ctx) -+#else - static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir) -+#endif - { - struct inode *inode = filp->f_dentry->d_inode; - struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp); -@@ -305,22 +321,32 @@ static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir) - - op_data->op_hash_offset = pos; - op_data->op_max_pages = sbi->ll_md_brw_size >> PAGE_CACHE_SHIFT; -+#ifdef HAVE_DIR_CONTEXT -+ ctx->pos = pos; -+ rc = ll_dir_read(inode, op_data, ctx); -+ pos = ctx->pos; -+#else - rc = ll_dir_read(inode, op_data, cookie, filldir); -+#endif - if (lfd != NULL) - lfd->lfd_pos = op_data->op_hash_offset; - - if (pos == MDS_DIR_END_OFF) { - if (api32) -- filp->f_pos = LL_DIR_END_OFF_32BIT; -+ pos = LL_DIR_END_OFF_32BIT; - else -- filp->f_pos = LL_DIR_END_OFF; -+ pos = LL_DIR_END_OFF; - } else { - if (api32 && hash64) -- filp->f_pos = op_data->op_hash_offset >> 32; -+ pos = op_data->op_hash_offset >> 32; - else -- filp->f_pos = op_data->op_hash_offset; -+ pos = op_data->op_hash_offset; - } -- -+#ifdef HAVE_DIR_CONTEXT -+ ctx->pos = pos; -+#else -+ filp->f_pos = pos; -+#endif - ll_finish_md_op_data(op_data); - filp->f_version = inode->i_version; - #ifdef HAVE_TOUCH_ATIME_1ARG -@@ -1809,11 +1835,15 @@ int ll_dir_release(struct inode *inode, struct file *file) - } - - struct file_operations ll_dir_operations = { -- .llseek = ll_dir_seek, -- .open = ll_dir_open, -- .release = ll_dir_release, -- .read = generic_read_dir, -- .readdir = ll_readdir, -- .unlocked_ioctl = ll_dir_ioctl, -- .fsync = ll_fsync, -+ .llseek = ll_dir_seek, -+ .open = ll_dir_open, -+ .release = ll_dir_release, -+ .read = generic_read_dir, -+#ifdef HAVE_DIR_CONTEXT -+ .iterate = ll_iterate, -+#else -+ .readdir = ll_readdir, -+#endif -+ .unlocked_ioctl = ll_dir_ioctl, -+ .fsync = ll_fsync, - }; -diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h -index 59ecdfb..148f6fa 100644 ---- a/lustre/llite/llite_internal.h -+++ b/lustre/llite/llite_internal.h -@@ -92,9 +92,12 @@ extern struct file_operations ll_pgcache_seq_fops; - #define REMOTE_PERM_HASHSIZE 16 - - struct ll_getname_data { -- char *lgd_name; /* points to a buffer with NAME_MAX+1 size */ -- struct lu_fid lgd_fid; /* target fid we are looking for */ -- int lgd_found; /* inode matched? */ -+#ifdef HAVE_DIR_CONTEXT -+ struct dir_context ctx; -+#endif -+ char *lgd_name; /* points to a buffer with NAME_MAX+1 size */ -+ struct lu_fid lgd_fid; /* target fid we are looking for */ -+ int lgd_found; /* inode matched? */ - }; - - /* llite setxid/access permission for user on remote client */ -@@ -726,8 +729,13 @@ static void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count) {} - /* llite/dir.c */ - extern struct file_operations ll_dir_operations; - extern struct inode_operations ll_dir_inode_operations; -+#ifdef HAVE_DIR_CONTEXT -+int ll_dir_read(struct inode *inode, struct md_op_data *op_data, -+ struct dir_context *ctx); -+#else - int ll_dir_read(struct inode *inode, struct md_op_data *op_data, - void *cookie, filldir_t filldir); -+#endif - int ll_get_mdt_idx(struct inode *inode); - - struct lu_dirent *ll_dir_entry_start(struct inode *dir, -diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c -index f96d17e..713e846 100644 ---- a/lustre/llite/llite_nfs.c -+++ b/lustre/llite/llite_nfs.c -@@ -230,7 +230,14 @@ static int ll_get_name(struct dentry *dentry, char *name, - struct dentry *child) - { - struct inode *dir = dentry->d_inode; -- struct ll_getname_data lgd; -+ struct ll_getname_data lgd = { -+ .lgd_name = name, -+ .lgd_fid = ll_i2info(child->d_inode)->lli_fid, -+#ifdef HAVE_DIR_CONTEXT -+ .ctx.actor = ll_nfs_get_name_filldir, -+#endif -+ .lgd_found = 0, -+ }; - struct md_op_data *op_data; - int rc; - ENTRY; -@@ -241,10 +248,6 @@ static int ll_get_name(struct dentry *dentry, char *name, - if (!dir->i_fop) - GOTO(out, rc = -EINVAL); - -- lgd.lgd_name = name; -- lgd.lgd_fid = ll_i2info(child->d_inode)->lli_fid; -- lgd.lgd_found = 0; -- - op_data = ll_prep_md_op_data(NULL, dir, dir, NULL, 0, 0, - LUSTRE_OPC_ANY, dir); - if (IS_ERR(op_data)) -@@ -254,7 +257,11 @@ static int ll_get_name(struct dentry *dentry, char *name, - op_data->op_max_pages = - ll_i2sbi(dir)->ll_md_brw_size >> PAGE_CACHE_SHIFT; - mutex_lock(&dir->i_mutex); -+#ifdef HAVE_DIR_CONTEXT -+ rc = ll_dir_read(dir, op_data, &lgd.ctx); -+#else - rc = ll_dir_read(dir, op_data, &lgd, ll_nfs_get_name_filldir); -+#endif - mutex_unlock(&dir->i_mutex); - ll_finish_md_op_data(op_data); - if (!rc && !lgd.lgd_found) --- -1.8.5.3 - diff --git a/sys-cluster/lustre/files/0012-LU-3974-llite-invalidatepage-api-changed.patch b/sys-cluster/lustre/files/0012-LU-3974-llite-invalidatepage-api-changed.patch deleted file mode 100644 index 90e558e..0000000 --- a/sys-cluster/lustre/files/0012-LU-3974-llite-invalidatepage-api-changed.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 95cacafafbc5bc0ec28bbf7898df28bb0f0295e6 Mon Sep 17 00:00:00 2001 -From: James Simmons -Date: Tue, 24 Sep 2013 12:29:47 -0400 -Subject: [PATCH 12/12] LU-3974 llite: invalidatepage api changed - -Until recently invalidating pages from the buffer cache -was dependent only on the page passed in and the start -in the page to invalidate. Starting with the 3.11 kernel -you can also specify the length of the data in the page -to invalidate. This patch enables us to handle the new -case. - -Signed-off-by: James Simmons -Change-Id: Iedf458b20b2604bc3099d5ae38bf0ad07df83bd3 ---- - lustre/autoconf/lustre-core.m4 | 20 ++++++++++++++++++++ - lustre/include/linux/lustre_patchless_compat.h | 19 +++++++++++-------- - lustre/llite/rw26.c | 24 +++++++++++++++++------- - 3 files changed, 48 insertions(+), 15 deletions(-) - -diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 -index f44a277..5409fde 100644 ---- a/lustre/autoconf/lustre-core.m4 -+++ b/lustre/autoconf/lustre-core.m4 -@@ -1349,6 +1349,25 @@ LB_LINUX_TRY_COMPILE([ - ]) - - # -+# 3.11 invalidatepage requires the length of the range to invalidate -+# -+AC_DEFUN([LC_INVALIDATE_RANGE], -+[AC_MSG_CHECKING([if address_space_operations.invalidatepage requires 3 arguments]) -+LB_LINUX_TRY_COMPILE([ -+ #include -+],[ -+ struct address_space_operations a_ops; -+ -+ a_ops.invalidatepage(NULL,0,0); -+],[ -+ AC_DEFINE(HAVE_INVALIDATE_RANGE, 1, [address_space_operations.invalidatepage needs 3 arguments]) -+ AC_MSG_RESULT([yes]) -+],[ -+ AC_MSG_RESULT([no]) -+]) -+]) -+ -+# - # 3.11 readdir now takes the new struct dir_context - # - AC_DEFUN([LC_HAVE_DIR_CONTEXT], -@@ -1542,6 +1561,7 @@ AC_DEFUN([LC_PROG_LINUX], - LC_BLKDEV_RELEASE_RETURN_INT - - # 3.11 -+ LC_INVALIDATE_RANGE - LC_HAVE_DIR_CONTEXT - LC_D_COMPARE_5ARGS - LC_HAVE_DCOUNT -diff --git a/lustre/include/linux/lustre_patchless_compat.h b/lustre/include/linux/lustre_patchless_compat.h -index 747bd4d..5b7bab6 100644 ---- a/lustre/include/linux/lustre_patchless_compat.h -+++ b/lustre/include/linux/lustre_patchless_compat.h -@@ -78,15 +78,18 @@ static inline void ll_delete_from_page_cache(struct page *page) - static inline void - truncate_complete_page(struct address_space *mapping, struct page *page) - { -- if (page->mapping != mapping) -- return; -+ if (page->mapping != mapping) -+ return; - -- if (PagePrivate(page)) -- page->mapping->a_ops->invalidatepage(page, 0); -- -- cancel_dirty_page(page, PAGE_SIZE); -- ClearPageMappedToDisk(page); -- ll_delete_from_page_cache(page); -+ if (PagePrivate(page)) -+#ifdef HAVE_INVALIDATE_RANGE -+ page->mapping->a_ops->invalidatepage(page, 0, PAGE_CACHE_SIZE); -+#else -+ page->mapping->a_ops->invalidatepage(page, 0); -+#endif -+ cancel_dirty_page(page, PAGE_SIZE); -+ ClearPageMappedToDisk(page); -+ ll_delete_from_page_cache(page); - } - #endif /* !HAVE_TRUNCATE_COMPLETE_PAGE */ - -diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c -index 447dc43..77151de 100644 ---- a/lustre/llite/rw26.c -+++ b/lustre/llite/rw26.c -@@ -76,7 +76,13 @@ - * aligned truncate). Lustre leaves partially truncated page in the cache, - * relying on struct inode::i_size to limit further accesses. - */ --static void ll_invalidatepage(struct page *vmpage, unsigned long offset) -+static void ll_invalidatepage(struct page *vmpage, -+#ifdef HAVE_INVALIDATE_RANGE -+ unsigned int offset, unsigned int length -+#else -+ unsigned long offset -+#endif -+ ) - { - struct inode *inode; - struct lu_env *env; -@@ -88,12 +94,16 @@ static void ll_invalidatepage(struct page *vmpage, unsigned long offset) - LASSERT(PageLocked(vmpage)); - LASSERT(!PageWriteback(vmpage)); - -- /* -- * It is safe to not check anything in invalidatepage/releasepage -- * below because they are run with page locked and all our io is -- * happening with locked page too -- */ -- if (offset == 0) { -+ /* -+ * It is safe to not check anything in invalidatepage/releasepage -+ * below because they are run with page locked and all our io is -+ * happening with locked page too -+ */ -+#ifdef HAVE_INVALIDATE_RANGE -+ if (offset == 0 && length == PAGE_CACHE_SIZE) { -+#else -+ if (offset == 0) { -+#endif - env = cl_env_get(&refcheck); - if (!IS_ERR(env)) { - inode = vmpage->mapping->host; --- -1.8.5.3 - diff --git a/sys-cluster/lustre/lustre-9999.ebuild b/sys-cluster/lustre/lustre-9999.ebuild index ad303cf..c4de667 100644 --- a/sys-cluster/lustre/lustre-9999.ebuild +++ b/sys-cluster/lustre/lustre-9999.ebuild @@ -33,18 +33,15 @@ DEPEND="${RDEPEND} virtual/linux-sources" PATCHES=( - "${FILESDIR}/0001-LU-2982-build-make-AC-check-for-linux-arch-sandbox-f.patch" - "${FILESDIR}/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch" - "${FILESDIR}/0003-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch" - "${FILESDIR}/0004-LU-3319-procfs-fix-symlink-handling.patch" + "${FILESDIR}/0001-LU-3319-procfs-fix-symlink-handling.patch" + "${FILESDIR}/0002-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch" + "${FILESDIR}/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch" + "${FILESDIR}/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch" "${FILESDIR}/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch" "${FILESDIR}/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch" - "${FILESDIR}/0007-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch" - "${FILESDIR}/0008-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch" + "${FILESDIR}/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch" + "${FILESDIR}/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch" "${FILESDIR}/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch" - "${FILESDIR}/0010-LU-3319-lprocfs-client-side-cleanups.patch" - "${FILESDIR}/0011-LU-3974-llite-use-new-struct-dir_context.patch" - "${FILESDIR}/0012-LU-3974-llite-invalidatepage-api-changed.patch" ) pkg_setup() {