aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Shvetsov <alexxy@gentoo.org>2014-04-22 11:22:13 +0400
committerAlexey Shvetsov <alexxy@gentoo.org>2014-04-22 11:22:13 +0400
commit15086580d6a3dfef447706752a9747f08d55e27a (patch)
tree3772719ab03c1868ab69bc3c005aba790e3f6ae8 /sys-cluster
parentsci-biology/mira-4.0.2: version bump (diff)
downloadsci-15086580d6a3dfef447706752a9747f08d55e27a.tar.gz
sci-15086580d6a3dfef447706752a9747f08d55e27a.tar.bz2
sci-15086580d6a3dfef447706752a9747f08d55e27a.zip
Update lustre patches
Package-Manager: portage-2.2.10 RepoMan-Options: --force
Diffstat (limited to 'sys-cluster')
-rw-r--r--sys-cluster/lustre/ChangeLog21
-rw-r--r--sys-cluster/lustre/files/0001-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch (renamed from sys-cluster/lustre/files/0002-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch)6
-rw-r--r--sys-cluster/lustre/files/0001-LU-3319-procfs-fix-symlink-handling.patch1132
-rw-r--r--sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch (renamed from sys-cluster/lustre/files/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch)14
-rw-r--r--sys-cluster/lustre/files/0003-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch (renamed from sys-cluster/lustre/files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch)4
-rw-r--r--sys-cluster/lustre/files/0004-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch (renamed from sys-cluster/lustre/files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch)8
-rw-r--r--sys-cluster/lustre/files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch356
-rw-r--r--sys-cluster/lustre/files/0005-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch (renamed from sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch)22
-rw-r--r--sys-cluster/lustre/files/0006-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch (renamed from sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch)98
-rw-r--r--sys-cluster/lustre/files/0007-LU-4416-mm-Backport-shrinker-changes-from-upstream.patch (renamed from sys-cluster/lustre/files/0010-LU-4416-mm-Backport-shrinker-changes-from-upstream.patch)16
-rw-r--r--sys-cluster/lustre/files/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch826
-rw-r--r--sys-cluster/lustre/lustre-9999.ebuild26
12 files changed, 102 insertions, 2427 deletions
diff --git a/sys-cluster/lustre/ChangeLog b/sys-cluster/lustre/ChangeLog
index 0ed9678dc..4b22fd947 100644
--- a/sys-cluster/lustre/ChangeLog
+++ b/sys-cluster/lustre/ChangeLog
@@ -2,6 +2,27 @@
# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
+ 22 Apr 2014; Alexey Shvetsov <alexxy@gentoo.org>
+ +files/0001-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch,
+ +files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch,
+ +files/0003-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch,
+ +files/0004-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch,
+ +files/0005-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch,
+ +files/0006-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch,
+ +files/0007-LU-4416-mm-Backport-shrinker-changes-from-upstream.patch,
+ -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/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/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/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch,
+ -files/0010-LU-4416-mm-Backport-shrinker-changes-from-upstream.patch,
+ lustre-9999.ebuild:
+ Update lustre patches
+
02 Apr 2014; Alexey Shvetsov <alexxy@gentoo.org>
+files/0010-LU-4416-mm-Backport-shrinker-changes-from-upstream.patch,
+files/lustre-readline6.3_fix.patch,
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/0001-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch
index 5c6701343..a00e07006 100644
--- a/sys-cluster/lustre/files/0002-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch
+++ b/sys-cluster/lustre/files/0001-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch
@@ -1,7 +1,7 @@
-From 7dbddd98e60ab73580ea52c8b53274da2283d624 Mon Sep 17 00:00:00 2001
+From b0d57f2b81f5ec6f1f2cad9914cdb01960377f01 Mon Sep 17 00:00:00 2001
From: James Simmons <uja.ornl@gmail.com>
Date: Tue, 25 Feb 2014 12:54:05 -0500
-Subject: [PATCH 02/10] LU-3319 procfs: Move NRS TBF proc handling to seq_files
+Subject: [PATCH 1/7] 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
@@ -14,7 +14,7 @@ Signed-off-by: James Simmons <uja.ornl@gmail.com>
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
+index 80fa9ff..93b9103 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,
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
deleted file mode 100644
index 458360169..000000000
--- a/sys-cluster/lustre/files/0001-LU-3319-procfs-fix-symlink-handling.patch
+++ /dev/null
@@ -1,1132 +0,0 @@
-From 4c418e7208a62c7bb7d61c1f97cf300675215bd4 Mon Sep 17 00:00:00 2001
-From: James Simmons <uja.ornl@gmail.com>
-Date: Fri, 28 Mar 2014 11:19:07 -0400
-Subject: [PATCH 01/10] 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 <uja.ornl@gmail.com>
----
- 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/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
index 90f17704b..7a8299b9f 100644
--- a/sys-cluster/lustre/files/0003-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
+++ b/sys-cluster/lustre/files/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch
@@ -1,7 +1,7 @@
-From abe827ebe8722336c55affd8388dacfbb38b49f1 Mon Sep 17 00:00:00 2001
+From 2c8c53a01d77519c8de108bbe69734e5931f41d8 Mon Sep 17 00:00:00 2001
From: James Simmons <uja.ornl@gmail.com>
Date: Tue, 18 Feb 2014 18:44:22 -0500
-Subject: [PATCH 03/10] LU-3319 procfs: update zfs proc handling to seq_files
+Subject: [PATCH 2/7] LU-3319 procfs: update zfs proc handling to seq_files
Migrate all zfs proc handling to using strictly seq_files.
@@ -14,10 +14,10 @@ Change-Id: I6dc7e65c3e74e7934a17939815ec3c334fac58c7
3 files changed, 60 insertions(+), 46 deletions(-)
diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c
-index 47bbc76..05820e0 100644
+index 0dc8c2e..29a3617 100644
--- a/lustre/osd-zfs/osd_handler.c
+++ b/lustre/osd-zfs/osd_handler.c
-@@ -761,12 +761,13 @@ static int osd_process_config(const struct lu_env *env,
+@@ -767,12 +767,13 @@ static int osd_process_config(const struct lu_env *env,
break;
case LCFG_PARAM: {
LASSERT(&o->od_dt_dev);
@@ -36,7 +36,7 @@ index 47bbc76..05820e0 100644
break;
}
default:
-@@ -914,7 +915,7 @@ int __init osd_init(void)
+@@ -920,7 +921,7 @@ int __init osd_init(void)
rc = class_register_type(&osd_obd_device_ops, NULL, true, NULL,
#ifndef HAVE_ONLY_PROCFS_SEQ
@@ -46,10 +46,10 @@ index 47bbc76..05820e0 100644
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..3dc4881 100644
+index 63f680c..740dba7 100644
--- a/lustre/osd-zfs/osd_internal.h
+++ b/lustre/osd-zfs/osd_internal.h
-@@ -402,8 +402,7 @@ enum {
+@@ -420,8 +420,7 @@ enum {
};
/* osd_lproc.c */
diff --git a/sys-cluster/lustre/files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0003-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch
index 5b94e9adc..1dcde79e1 100644
--- a/sys-cluster/lustre/files/0005-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch
+++ b/sys-cluster/lustre/files/0003-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch
@@ -1,7 +1,7 @@
-From ab793e8472447314f6428025175f80afc26339ac Mon Sep 17 00:00:00 2001
+From 9028aafc0c8651d6a840d9066ca7d950106fbdc5 Mon Sep 17 00:00:00 2001
From: James Simmons <uja.ornl@gmail.com>
Date: Wed, 26 Mar 2014 19:59:18 -0400
-Subject: [PATCH 05/10] LU-3319 procfs: move osp proc handling to seq_files
+Subject: [PATCH 3/7] 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
diff --git a/sys-cluster/lustre/files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch b/sys-cluster/lustre/files/0004-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch
index 67c955b2a..9b9e0aedc 100644
--- a/sys-cluster/lustre/files/0006-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch
+++ b/sys-cluster/lustre/files/0004-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch
@@ -1,7 +1,7 @@
-From 1394aacb441c3ba07b24a4b465f2496af8eb3c73 Mon Sep 17 00:00:00 2001
+From d13a2c80d2a861b1c9fe98e5db3ae1af06a1103a Mon Sep 17 00:00:00 2001
From: James Simmons <uja.ornl@gmail.com>
Date: Wed, 26 Mar 2014 19:57:44 -0400
-Subject: [PATCH 06/10] LU-3319 procfs: move lod proc handling to seq_files
+Subject: [PATCH 4/7] 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
@@ -17,7 +17,7 @@ Change-Id: Iaa0f617fcd430e91f12afbc0faf6906fd275a7a5
4 files changed, 157 insertions(+), 141 deletions(-)
diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c
-index a653d6a..1baeb37 100644
+index 8a6743d..e63c6ed 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,
@@ -94,7 +94,7 @@ index c3b1bc3..fc18f3d 100644
void lod_procfs_fini(struct lod_device *lod);
diff --git a/lustre/lod/lod_pool.c b/lustre/lod/lod_pool.c
-index 98b2416..1849e5d 100644
+index 149507f..810e1aa 100644
--- a/lustre/lod/lod_pool.c
+++ b/lustre/lod/lod_pool.c
@@ -283,7 +283,7 @@ static int pool_proc_open(struct inode *inode, struct file *file)
diff --git a/sys-cluster/lustre/files/0004-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
deleted file mode 100644
index c5712a1d9..000000000
--- a/sys-cluster/lustre/files/0004-LU-3319-procfs-move-mgs-proc-handling-to-seq_files.patch
+++ /dev/null
@@ -1,356 +0,0 @@
-From 00e2e7c431e38433b919735890481e4bb5707cd4 Mon Sep 17 00:00:00 2001
-From: James Simmons <uja.ornl@gmail.com>
-Date: Tue, 4 Mar 2014 10:45:30 -0500
-Subject: [PATCH 04/10] 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
-layer proc entries over to using seq_files.
-
-Signed-off-by: James Simmons <uja.ornl@gmail.com>
-Change-Id: I1a12dd9b1fc8f139116a8f3a684956a5ba88f055
----
- lustre/mgs/lproc_mgs.c | 202 +++++++++++++++++++++++-----------------------
- lustre/mgs/mgs_handler.c | 5 +-
- lustre/mgs/mgs_internal.h | 13 +--
- lustre/mgs/mgs_nids.c | 11 ++-
- 4 files changed, 110 insertions(+), 121 deletions(-)
-
-diff --git a/lustre/mgs/lproc_mgs.c b/lustre/mgs/lproc_mgs.c
-index ffa2d0d..f0ea956 100644
---- a/lustre/mgs/lproc_mgs.c
-+++ b/lustre/mgs/lproc_mgs.c
-@@ -126,19 +126,110 @@ static int mgsself_srpc_seq_show(struct seq_file *seq, void *v)
-
- return 0;
- }
--
- LPROC_SEQ_FOPS_RO(mgsself_srpc);
-
-+static int mgs_live_seq_show(struct seq_file *seq, void *v)
-+{
-+ struct fs_db *fsdb = seq->private;
-+ struct mgs_tgt_srpc_conf *srpc_tgt;
-+ int i;
-+
-+ mutex_lock(&fsdb->fsdb_mutex);
-+
-+ seq_printf(seq, "fsname: %s\n", fsdb->fsdb_name);
-+ seq_printf(seq, "flags: %#lx gen: %d\n",
-+ fsdb->fsdb_flags, fsdb->fsdb_gen);
-+ for (i = 0; i < INDEX_MAP_SIZE * 8; i++)
-+ if (test_bit(i, fsdb->fsdb_mdt_index_map))
-+ seq_printf(seq, "%s-MDT%04x\n", fsdb->fsdb_name, i);
-+ for (i = 0; i < INDEX_MAP_SIZE * 8; i++)
-+ if (test_bit(i, fsdb->fsdb_ost_index_map))
-+ seq_printf(seq, "%s-OST%04x\n", fsdb->fsdb_name, i);
-+
-+ seq_printf(seq, "\nSecure RPC Config Rules:\n");
-+#if 0
-+ seq_printf(seq, "%s.%s=%s\n", fsdb->fsdb_name,
-+ PARAM_SRPC_UDESC, fsdb->fsdb_srpc_fl_udesc ? "yes" : "no");
-+#endif
-+ for (srpc_tgt = fsdb->fsdb_srpc_tgt; srpc_tgt;
-+ srpc_tgt = srpc_tgt->mtsc_next) {
-+ seq_show_srpc_rules(seq, srpc_tgt->mtsc_tgt,
-+ &srpc_tgt->mtsc_rset);
-+ }
-+ seq_show_srpc_rules(seq, fsdb->fsdb_name, &fsdb->fsdb_srpc_gen);
-+
-+ lprocfs_rd_ir_state(seq, fsdb);
-+
-+ mutex_unlock(&fsdb->fsdb_mutex);
-+ return 0;
-+}
-+
-+static ssize_t mgs_live_seq_write(struct file *file, const char *buf,
-+ size_t len, loff_t *off)
-+{
-+ struct seq_file *seq = file->private_data;
-+ struct fs_db *fsdb = seq->private;
-+ ssize_t rc;
-+
-+ rc = lprocfs_wr_ir_state(file, buf, len, fsdb);
-+ if (rc >= 0)
-+ rc = len;
-+ return rc;
-+}
-+LPROC_SEQ_FOPS(mgs_live);
-+
-+int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb)
-+{
-+ int rc;
-+
-+ if (!mgs->mgs_proc_live)
-+ return 0;
-+ rc = lprocfs_seq_create(mgs->mgs_proc_live, fsdb->fsdb_name, 0644,
-+ &mgs_live_fops, fsdb);
-+
-+ return 0;
-+}
-+
-+int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb)
-+{
-+ if (!mgs->mgs_proc_live)
-+ return 0;
-+
-+ /* didn't create the proc file for MGSSELF_NAME */
-+ if (!test_bit(FSDB_MGS_SELF, &fsdb->fsdb_flags))
-+ lprocfs_remove_proc_entry(fsdb->fsdb_name, mgs->mgs_proc_live);
-+ return 0;
-+}
-+
-+LPROC_SEQ_FOPS_RO_TYPE(mgs, uuid);
-+LPROC_SEQ_FOPS_RO_TYPE(mgs, num_exports);
-+LPROC_SEQ_FOPS_RO_TYPE(mgs, hash);
-+LPROC_SEQ_FOPS_WO_TYPE(mgs, evict_client);
-+LPROC_SEQ_FOPS_RW_TYPE(mgs, ir_timeout);
-+
-+struct lprocfs_seq_vars lprocfs_mgs_obd_vars[] = {
-+ { .name = "uuid",
-+ .fops = &mgs_uuid_fops },
-+ { .name = "num_exports",
-+ .fops = &mgs_num_exports_fops },
-+ { .name = "hash_stats",
-+ .fops = &mgs_hash_fops },
-+ { .name = "evict_client",
-+ .fops = &mgs_evict_client_fops },
-+ { .name = "ir_timeout",
-+ .fops = &mgs_ir_timeout_fops },
-+ { 0 }
-+};
-+
- int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name)
- {
- struct obd_device *obd = mgs->mgs_obd;
- struct obd_device *osd_obd = mgs->mgs_bottom->dd_lu_dev.ld_obd;
- int osd_len = strlen(osd_name) - strlen("-osd");
- int rc;
-- struct lprocfs_static_vars lvars;
-
-- lprocfs_mgs_init_vars(&lvars);
-- rc = lprocfs_obd_setup(obd, lvars.obd_vars);
-+ obd->obd_vars = lprocfs_mgs_obd_vars;
-+ rc = lprocfs_seq_obd_setup(obd);
- if (rc != 0)
- GOTO(out, rc);
-
-@@ -152,17 +243,17 @@ int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name)
- if (rc != 0)
- GOTO(out, rc);
-
-- mgs->mgs_proc_live = lprocfs_register("live", obd->obd_proc_entry,
-- NULL, NULL);
-+ mgs->mgs_proc_live = lprocfs_seq_register("live", obd->obd_proc_entry,
-+ NULL, NULL);
- if (IS_ERR(mgs->mgs_proc_live)) {
- rc = PTR_ERR(mgs->mgs_proc_live);
- mgs->mgs_proc_live = NULL;
- GOTO(out, rc);
- }
-
-- obd->obd_proc_exports_entry = lprocfs_register("exports",
-- obd->obd_proc_entry,
-- NULL, NULL);
-+ obd->obd_proc_exports_entry = lprocfs_seq_register("exports",
-+ obd->obd_proc_entry,
-+ NULL, NULL);
- if (IS_ERR(obd->obd_proc_exports_entry)) {
- rc = PTR_ERR(obd->obd_proc_exports_entry);
- obd->obd_proc_exports_entry = NULL;
-@@ -215,7 +306,6 @@ void lproc_mgs_cleanup(struct mgs_device *mgs)
-
- if (mgs->mgs_proc_live != NULL) {
- /* Should be no live entries */
-- LASSERT(mgs->mgs_proc_live->subdir == NULL);
- lprocfs_remove(&mgs->mgs_proc_live);
- mgs->mgs_proc_live = NULL;
- }
-@@ -226,92 +316,6 @@ void lproc_mgs_cleanup(struct mgs_device *mgs)
- lprocfs_free_md_stats(obd);
- }
-
--static int mgs_live_seq_show(struct seq_file *seq, void *v)
--{
-- struct fs_db *fsdb = seq->private;
-- struct mgs_tgt_srpc_conf *srpc_tgt;
-- int i;
--
-- mutex_lock(&fsdb->fsdb_mutex);
--
-- seq_printf(seq, "fsname: %s\n", fsdb->fsdb_name);
-- seq_printf(seq, "flags: %#lx gen: %d\n",
-- fsdb->fsdb_flags, fsdb->fsdb_gen);
-- for (i = 0; i < INDEX_MAP_SIZE * 8; i++)
-- if (test_bit(i, fsdb->fsdb_mdt_index_map))
-- seq_printf(seq, "%s-MDT%04x\n", fsdb->fsdb_name, i);
-- for (i = 0; i < INDEX_MAP_SIZE * 8; i++)
-- if (test_bit(i, fsdb->fsdb_ost_index_map))
-- seq_printf(seq, "%s-OST%04x\n", fsdb->fsdb_name, i);
--
-- seq_printf(seq, "\nSecure RPC Config Rules:\n");
--#if 0
-- seq_printf(seq, "%s.%s=%s\n", fsdb->fsdb_name,
-- PARAM_SRPC_UDESC, fsdb->fsdb_srpc_fl_udesc ? "yes" : "no");
--#endif
-- for (srpc_tgt = fsdb->fsdb_srpc_tgt; srpc_tgt;
-- srpc_tgt = srpc_tgt->mtsc_next) {
-- seq_show_srpc_rules(seq, srpc_tgt->mtsc_tgt,
-- &srpc_tgt->mtsc_rset);
-- }
-- seq_show_srpc_rules(seq, fsdb->fsdb_name, &fsdb->fsdb_srpc_gen);
--
-- lprocfs_rd_ir_state(seq, fsdb);
--
-- mutex_unlock(&fsdb->fsdb_mutex);
-- return 0;
--}
--
--static ssize_t mgs_live_seq_write(struct file *file, const char *buf,
-- size_t len, loff_t *off)
--{
-- struct seq_file *seq = file->private_data;
-- struct fs_db *fsdb = seq->private;
-- ssize_t rc;
--
-- rc = lprocfs_wr_ir_state(file, buf, len, fsdb);
-- if (rc >= 0)
-- rc = len;
-- return rc;
--}
--LPROC_SEQ_FOPS(mgs_live);
--
--int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb)
--{
-- int rc;
--
-- if (!mgs->mgs_proc_live)
-- return 0;
-- rc = lprocfs_seq_create(mgs->mgs_proc_live, fsdb->fsdb_name, 0644,
-- &mgs_live_fops, fsdb);
--
-- return 0;
--}
--
--int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb)
--{
-- if (!mgs->mgs_proc_live)
-- return 0;
--
-- /* didn't create the proc file for MGSSELF_NAME */
-- if (!test_bit(FSDB_MGS_SELF, &fsdb->fsdb_flags))
-- lprocfs_remove_proc_entry(fsdb->fsdb_name, mgs->mgs_proc_live);
-- return 0;
--}
--
--struct lprocfs_vars lprocfs_mgs_obd_vars[] = {
-- { "uuid", lprocfs_rd_uuid, 0, 0 },
-- { "num_exports", lprocfs_rd_num_exports, 0, 0 },
-- { "hash_stats", lprocfs_obd_rd_hash, 0, 0 },
-- { "evict_client", 0, lprocfs_wr_evict_client, 0 },
-- { "ir_timeout", lprocfs_rd_ir_timeout, lprocfs_wr_ir_timeout, 0 },
-- { 0 }
--};
--
--struct lprocfs_vars lprocfs_mgs_module_vars[] = {
-- { 0 }
--};
--
- void mgs_counter_incr(struct obd_export *exp, int opcode)
- {
- lprocfs_counter_incr(exp->exp_obd->obd_stats, opcode);
-@@ -329,10 +333,4 @@ void mgs_stats_counter_init(struct lprocfs_stats *stats)
- lprocfs_counter_init(stats, LPROC_MGS_TARGET_REG, 0, "tgtreg", "reqs");
- lprocfs_counter_init(stats, LPROC_MGS_TARGET_DEL, 0, "tgtdel", "reqs");
- }
--
--void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars)
--{
-- lvars->module_vars = lprocfs_mgs_module_vars;
-- lvars->obd_vars = lprocfs_mgs_obd_vars;
--}
- #endif
-diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c
-index 85b219c..a9b0857 100644
---- a/lustre/mgs/mgs_handler.c
-+++ b/lustre/mgs/mgs_handler.c
-@@ -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, true, NULL,
- #ifndef HAVE_ONLY_PROCFS_SEQ
-- lvars.module_vars,
-+ NULL,
- #endif
- LUSTRE_MGS_NAME, &mgs_device_type);
- }
-diff --git a/lustre/mgs/mgs_internal.h b/lustre/mgs/mgs_internal.h
-index ca2846e..d3baacd 100644
---- a/lustre/mgs/mgs_internal.h
-+++ b/lustre/mgs/mgs_internal.h
-@@ -229,10 +229,10 @@ int mgs_get_ir_logs(struct ptlrpc_request *req);
- int lprocfs_wr_ir_state(struct file *file, const char *buffer,
- unsigned long count, void *data);
- int lprocfs_rd_ir_state(struct seq_file *seq, void *data);
--int lprocfs_wr_ir_timeout(struct file *file, const char *buffer,
-- unsigned long count, void *data);
--int lprocfs_rd_ir_timeout(char *page, char **start, off_t off, int count,
-- int *eof, void *data);
-+ssize_t
-+lprocfs_ir_timeout_seq_write(struct file *file, const char *buffer,
-+ size_t count, loff_t *off);
-+int lprocfs_ir_timeout_seq_show(struct seq_file *seq, void *data);
- void mgs_fsc_cleanup(struct obd_export *exp);
- void mgs_fsc_cleanup_by_fsdb(struct fs_db *fsdb);
- int mgs_fsc_attach(const struct lu_env *env, struct obd_export *exp,
-@@ -250,7 +250,6 @@ int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name);
- void lproc_mgs_cleanup(struct mgs_device *mgs);
- int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb);
- int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb);
--void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars);
- #else
- static inline int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name)
- {return 0;}
-@@ -260,10 +259,6 @@ static inline int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb)
- {return 0;}
- static inline int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb)
- {return 0;}
--static void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars)
--{
-- memset(lvars, 0, sizeof(*lvars));
--}
- #endif
-
- /* mgs/lproc_mgs.c */
-diff --git a/lustre/mgs/mgs_nids.c b/lustre/mgs/mgs_nids.c
-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)
- return 0;
- }
-
--int lprocfs_rd_ir_timeout(char *page, char **start, off_t off, int count,
-- int *eof, void *data)
-+int lprocfs_ir_timeout_seq_show(struct seq_file *m, void *data)
- {
-- *eof = 1;
-- return snprintf(page, count, "%d\n", ir_timeout);
-+ return lprocfs_uint_seq_show(m, &ir_timeout);
- }
-
--int lprocfs_wr_ir_timeout(struct file *file, const char *buffer,
-- unsigned long count, void *data)
-+ssize_t
-+lprocfs_ir_timeout_seq_write(struct file *file, const char *buffer,
-+ size_t count, loff_t *off)
- {
- return lprocfs_wr_uint(file, buffer, count, &ir_timeout);
- }
---
-1.9.1
-
diff --git a/sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch b/sys-cluster/lustre/files/0005-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch
index 2205759c1..62919149a 100644
--- a/sys-cluster/lustre/files/0007-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch
+++ b/sys-cluster/lustre/files/0005-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch
@@ -1,7 +1,7 @@
-From 039e3e44e07b59923d94bea976173d9e3cbd0ba9 Mon Sep 17 00:00:00 2001
+From dfc3f832947083639506d38c032e8b237198fee2 Mon Sep 17 00:00:00 2001
From: James Simmons <uja.ornl@gmail.com>
Date: Tue, 25 Mar 2014 11:10:33 -0400
-Subject: [PATCH 07/10] LU-3319 procfs: move mdt/mds proc handling to seq_files
+Subject: [PATCH 5/7] 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
@@ -470,10 +470,10 @@ index a9ee560..062f6cc 100644
{ 0 }
};
diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c
-index 69b1c30..8b4634f 100644
+index 329c5fc..3f46d6e 100644
--- a/lustre/mdt/mdt_handler.c
+++ b/lustre/mdt/mdt_handler.c
-@@ -4644,7 +4644,6 @@ static int mdt_process_config(const struct lu_env *env,
+@@ -4672,7 +4672,6 @@ static int mdt_process_config(const struct lu_env *env,
switch (cfg->lcfg_command) {
case LCFG_PARAM: {
@@ -481,7 +481,7 @@ index 69b1c30..8b4634f 100644
struct obd_device *obd = d->ld_obd;
/* For interoperability */
-@@ -4679,14 +4678,13 @@ static int mdt_process_config(const struct lu_env *env,
+@@ -4707,14 +4706,13 @@ static int mdt_process_config(const struct lu_env *env,
}
}
@@ -501,7 +501,7 @@ index 69b1c30..8b4634f 100644
if (rc > 0 || rc == -ENOSYS)
/* we don't understand; pass it on */
rc = next->ld_ops->ldo_process_config(env, next,
-@@ -5885,7 +5883,6 @@ static struct lu_device_type mdt_device_type = {
+@@ -5913,7 +5911,6 @@ static struct lu_device_type mdt_device_type = {
static int __init mdt_mod_init(void)
{
@@ -509,7 +509,7 @@ index 69b1c30..8b4634f 100644
int rc;
CLASSERT(sizeof("0x0123456789ABCDEF:0x01234567:0x01234567") ==
-@@ -5900,10 +5897,9 @@ static int __init mdt_mod_init(void)
+@@ -5928,10 +5925,9 @@ static int __init mdt_mod_init(void)
if (rc)
GOTO(lu_fini, rc);
@@ -587,10 +587,10 @@ index 1300861..3125dcc 100644
RETURN(rc);
}
diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h
-index 7970b86..8fb96c8 100644
+index 5b8cea1..cb52ef4 100644
--- a/lustre/mdt/mdt_internal.h
+++ b/lustre/mdt/mdt_internal.h
-@@ -785,9 +785,6 @@ void mdt_thread_info_init(struct ptlrpc_request *req,
+@@ -759,9 +759,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);
@@ -600,7 +600,7 @@ index 7970b86..8fb96c8 100644
int mdt_hsm_attr_set(struct mdt_thread_info *info, struct mdt_object *obj,
const struct md_hsm *mh);
-@@ -925,13 +922,12 @@ int mdt_hsm_cdt_fini(struct mdt_device *mdt);
+@@ -899,13 +896,12 @@ int mdt_hsm_cdt_fini(struct mdt_device *mdt);
int mdt_hsm_cdt_wakeup(struct mdt_device *mdt);
/* coordinator control /proc interface */
@@ -618,7 +618,7 @@ index 7970b86..8fb96c8 100644
/* md_hsm helpers */
struct mdt_object *mdt_hsm_get_md_hsm(struct mdt_thread_info *mti,
const struct lu_fid *fid,
-@@ -1071,8 +1067,6 @@ enum {
+@@ -1045,8 +1041,6 @@ enum {
};
void mdt_counter_incr(struct ptlrpc_request *req, int opcode);
void mdt_stats_counter_init(struct lprocfs_stats *stats);
diff --git a/sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch b/sys-cluster/lustre/files/0006-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch
index 37dd14ca3..296c47635 100644
--- a/sys-cluster/lustre/files/0008-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch
+++ b/sys-cluster/lustre/files/0006-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch
@@ -1,7 +1,7 @@
-From c6c3f4063e244cea365940adc0fd1a1c35d0b525 Mon Sep 17 00:00:00 2001
+From aaafceb14e7eaa2a8171dc99172d20311fd05db2 Mon Sep 17 00:00:00 2001
From: James Simmons <uja.ornl@gmail.com>
Date: Wed, 26 Mar 2014 20:01:52 -0400
-Subject: [PATCH 08/10] LU-3319 procfs: move mdd/ofd proc handling to seq_files
+Subject: [PATCH 6/7] 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
@@ -9,10 +9,11 @@ layer proc entries over to using seq_files.
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I61b7df6bfd5efd0f12e3ca1a1813b7b62d493168
+Signed-off-by: Alexey Shvetsov <alexxy@gentoo.org>
---
lustre/include/lustre_lfsck.h | 6 +-
lustre/lfsck/lfsck_internal.h | 9 +-
- lustre/lfsck/lfsck_layout.c | 104 +++------
+ lustre/lfsck/lfsck_layout.c | 69 ++----
lustre/lfsck/lfsck_lib.c | 88 +++-----
lustre/lfsck/lfsck_namespace.c | 75 ++-----
lustre/mdd/mdd_device.c | 25 +--
@@ -24,7 +25,7 @@ Change-Id: I61b7df6bfd5efd0f12e3ca1a1813b7b62d493168
lustre/ofd/ofd_internal.h | 6 +-
lustre/osd-ldiskfs/osd_handler.c | 1 +
lustre/osd-zfs/osd_handler.c | 1 +
- 14 files changed, 517 insertions(+), 657 deletions(-)
+ 14 files changed, 500 insertions(+), 639 deletions(-)
diff --git a/lustre/include/lustre_lfsck.h b/lustre/include/lustre_lfsck.h
index 0d6f666..5adbffe 100644
@@ -75,7 +76,7 @@ index 4f84c3b..c4e6430 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 de96726..c3b4458 100644
+index c808808..2430fc0 100644
--- a/lustre/lfsck/lfsck_layout.c
+++ b/lustre/lfsck/lfsck_layout.c
@@ -471,7 +471,7 @@ static struct lfsck_rbtree_node *lfsck_rbtree_new(const struct lu_env *env,
@@ -156,10 +157,10 @@ index de96726..c3b4458 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"
@@ -178,7 +179,7 @@ index de96726..c3b4458 100644
if (lo->ll_status == LS_SCANNING_PHASE1) {
__u64 pos;
-@@ -4901,8 +4880,7 @@ static int lfsck_layout_dump(const struct lu_env *env,
+@@ -4902,8 +4881,7 @@ static int lfsck_layout_dump(const struct lu_env *env,
do_div(new_checked, duration);
if (rtime != 0)
do_div(speed, rtime);
@@ -188,7 +189,7 @@ index de96726..c3b4458 100644
"checked_phase2: "LPU64"\n"
"run_time_phase1: %u seconds\n"
"run_time_phase2: %u seconds\n"
-@@ -4916,11 +4894,6 @@ static int lfsck_layout_dump(const struct lu_env *env,
+@@ -4917,11 +4895,6 @@ static int lfsck_layout_dump(const struct lu_env *env,
lo->ll_run_time_phase2,
speed,
new_checked);
@@ -200,7 +201,7 @@ index de96726..c3b4458 100644
LASSERT(lfsck->li_di_oit != NULL);
-@@ -4933,12 +4906,8 @@ static int lfsck_layout_dump(const struct lu_env *env,
+@@ -4934,12 +4907,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--;
@@ -214,45 +215,8 @@ index de96726..c3b4458 100644
} 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"
-- "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)
-+ 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)
+@@ -4978,8 +4947,6 @@ static int lfsck_layout_dump(const struct lu_env *env,
+ if (rc <= 0)
goto out;
- buf += rc;
@@ -260,7 +224,7 @@ index de96726..c3b4458 100644
} else {
__u64 speed1 = lo->ll_objs_checked_phase1;
__u64 speed2 = lo->ll_objs_checked_phase2;
-@@ -4982,8 +4948,7 @@ static int lfsck_layout_dump(const struct lu_env *env,
+@@ -4988,8 +4955,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);
@@ -270,7 +234,7 @@ index de96726..c3b4458 100644
"checked_phase2: "LPU64"\n"
"run_time_phase1: %u seconds\n"
"run_time_phase2: %u seconds\n"
-@@ -4998,18 +4963,11 @@ static int lfsck_layout_dump(const struct lu_env *env,
+@@ -5004,18 +4970,11 @@ static int lfsck_layout_dump(const struct lu_env *env,
lo->ll_run_time_phase2,
speed1,
speed2);
@@ -291,7 +255,7 @@ index de96726..c3b4458 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 3b1fe0c..84ffc08 100644
+index c1304b5..43b09b7 100644
--- a/lustre/lfsck/lfsck_lib.c
+++ b/lustre/lfsck/lfsck_lib.c
@@ -899,21 +899,15 @@ static inline int lfsck_instance_add(struct lfsck_instance *lfsck)
@@ -407,7 +371,7 @@ index 3b1fe0c..84ffc08 100644
}
void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck,
-@@ -1658,7 +1626,7 @@ int lfsck_async_request(const struct lu_env *env, struct obd_export *exp,
+@@ -1655,7 +1623,7 @@ int lfsck_async_request(const struct lu_env *env, struct obd_export *exp,
/* external interfaces */
@@ -416,7 +380,7 @@ index 3b1fe0c..84ffc08 100644
{
struct lu_env env;
struct lfsck_instance *lfsck;
-@@ -1671,8 +1639,7 @@ int lfsck_get_speed(struct dt_device *key, void *buf, int len)
+@@ -1668,8 +1636,7 @@ int lfsck_get_speed(struct dt_device *key, void *buf, int len)
lfsck = lfsck_instance_find(key, true, false);
if (likely(lfsck != NULL)) {
@@ -426,7 +390,7 @@ index 3b1fe0c..84ffc08 100644
lfsck_instance_put(&env, lfsck);
} else {
rc = -ENXIO;
-@@ -1712,7 +1679,7 @@ int lfsck_set_speed(struct dt_device *key, int val)
+@@ -1709,7 +1676,7 @@ int lfsck_set_speed(struct dt_device *key, int val)
}
EXPORT_SYMBOL(lfsck_set_speed);
@@ -435,7 +399,7 @@ index 3b1fe0c..84ffc08 100644
{
struct lu_env env;
struct lfsck_instance *lfsck;
-@@ -1725,8 +1692,7 @@ int lfsck_get_windows(struct dt_device *key, void *buf, int len)
+@@ -1722,8 +1689,7 @@ int lfsck_get_windows(struct dt_device *key, void *buf, int len)
lfsck = lfsck_instance_find(key, true, false);
if (likely(lfsck != NULL)) {
@@ -445,7 +409,7 @@ index 3b1fe0c..84ffc08 100644
lfsck_instance_put(&env, lfsck);
} else {
rc = -ENXIO;
-@@ -1776,7 +1742,7 @@ int lfsck_set_windows(struct dt_device *key, int val)
+@@ -1773,7 +1739,7 @@ int lfsck_set_windows(struct dt_device *key, int val)
}
EXPORT_SYMBOL(lfsck_set_windows);
@@ -454,7 +418,7 @@ index 3b1fe0c..84ffc08 100644
{
struct lu_env env;
struct lfsck_instance *lfsck;
-@@ -1792,7 +1758,7 @@ int lfsck_dump(struct dt_device *key, void *buf, int len, enum lfsck_type type)
+@@ -1789,7 +1755,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)) {
@@ -687,10 +651,10 @@ index 0fe590e..f1c76d6 100644
LUSTRE_MDD_NAME, &mdd_device_type);
if (rc)
diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h
-index b536821..8e67fa1 100644
+index a95a42c..64183e3 100644
--- a/lustre/mdd/mdd_internal.h
+++ b/lustre/mdd/mdd_internal.h
-@@ -346,7 +346,6 @@ int orph_declare_index_delete(const struct lu_env *, struct mdd_object *,
+@@ -347,7 +347,6 @@ int orph_declare_index_delete(const struct lu_env *, struct mdd_object *,
struct thandle *);
/* mdd_lproc.c */
@@ -1862,7 +1826,7 @@ index 000d4ae..eb6bef0 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 5d7f0b4..f75ffe1 100644
+index 9b82e51..126f29e 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,
@@ -2008,7 +1972,7 @@ index 5d7f0b4..f75ffe1 100644
lprocfs_free_per_client_stats(obd);
lprocfs_obd_cleanup(obd);
lprocfs_free_obd_stats(obd);
-@@ -2379,7 +2370,6 @@ static struct lu_device_type ofd_device_type = {
+@@ -2387,7 +2378,6 @@ static struct lu_device_type ofd_device_type = {
int __init ofd_init(void)
{
@@ -2016,7 +1980,7 @@ index 5d7f0b4..f75ffe1 100644
int rc;
rc = lu_kmem_init(ofd_caches);
-@@ -2392,11 +2382,9 @@ int __init ofd_init(void)
+@@ -2400,11 +2390,9 @@ int __init ofd_init(void)
return(rc);
}
@@ -2049,10 +2013,10 @@ index 3aae6dd..1bdcb80 100644
#endif
diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c
-index e0da7e6..14808ee 100644
+index 4b5370a..3767f3f 100644
--- a/lustre/osd-ldiskfs/osd_handler.c
+++ b/lustre/osd-ldiskfs/osd_handler.c
-@@ -5921,6 +5921,7 @@ static int osd_obd_connect(const struct lu_env *env, struct obd_export **exp,
+@@ -5931,6 +5931,7 @@ static int osd_obd_connect(const struct lu_env *env, struct obd_export **exp,
osd->od_connects++;
spin_unlock(&osd->od_osfs_lock);
@@ -2061,10 +2025,10 @@ index e0da7e6..14808ee 100644
}
diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c
-index 05820e0..e711727 100644
+index 29a3617..ad8908a 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,
+@@ -822,6 +822,7 @@ static int osd_obd_connect(const struct lu_env *env, struct obd_export **exp,
osd->od_connects++;
spin_unlock(&osd->od_objset.lock);
diff --git a/sys-cluster/lustre/files/0010-LU-4416-mm-Backport-shrinker-changes-from-upstream.patch b/sys-cluster/lustre/files/0007-LU-4416-mm-Backport-shrinker-changes-from-upstream.patch
index e508fb4c7..dc787bc28 100644
--- a/sys-cluster/lustre/files/0010-LU-4416-mm-Backport-shrinker-changes-from-upstream.patch
+++ b/sys-cluster/lustre/files/0007-LU-4416-mm-Backport-shrinker-changes-from-upstream.patch
@@ -1,7 +1,7 @@
-From 3027cd3a234dc4a6531844b885e63b93a2fb6c67 Mon Sep 17 00:00:00 2001
+From 44803997002325709aa62807a55ccf8b6c1ba638 Mon Sep 17 00:00:00 2001
From: yangsheng <yang.sheng@intel.com>
Date: Fri, 28 Feb 2014 20:30:18 +0800
-Subject: [PATCH 10/10] LU-4416 mm: Backport shrinker changes from upstream
+Subject: [PATCH 7/7] LU-4416 mm: Backport shrinker changes from upstream
Convert shrinker to new count/scan API.
--ptlrpc shrinker
@@ -22,10 +22,10 @@ Change-Id: Idbd7cd3b7488202e5e8f6fdf757ae6d20e28d642
6 files changed, 342 insertions(+), 163 deletions(-)
diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4
-index cb86497..93360ce 100644
+index 815f082..a6b728a 100644
--- a/libcfs/autoconf/lustre-libcfs.m4
+++ b/libcfs/autoconf/lustre-libcfs.m4
-@@ -288,6 +288,26 @@ fi
+@@ -295,6 +295,26 @@ fi
])
#
@@ -52,7 +52,7 @@ index cb86497..93360ce 100644
# LIBCFS_PROG_LINUX
#
# LNet linux kernel checks
-@@ -319,6 +339,8 @@ LIBCFS_HAVE_CRC32
+@@ -328,6 +348,8 @@ LIBCFS_HAVE_CRC32
LIBCFS_ENABLE_CRC32_ACCEL
# 3.10
LIBCFS_ENABLE_CRC32C_ACCEL
@@ -132,10 +132,10 @@ index 6109645..ce20cb8 100644
register_shrinker(s);
diff --git a/libcfs/include/libcfs/posix/libcfs.h b/libcfs/include/libcfs/posix/libcfs.h
-index 180d18e..38cebbb 100644
+index 6a16be3..c839486 100644
--- a/libcfs/include/libcfs/posix/libcfs.h
+++ b/libcfs/include/libcfs/posix/libcfs.h
-@@ -278,12 +278,19 @@ struct shrinker {
+@@ -269,12 +269,19 @@ struct shrinker {
#endif
};
@@ -632,7 +632,7 @@ index 1304e95..0850b2a 100644
return -ENOMEM;
diff --git a/lustre/ptlrpc/sec_bulk.c b/lustre/ptlrpc/sec_bulk.c
-index 0601486..9d970f20 100644
+index bb1e782..9da60ad 100644
--- a/lustre/ptlrpc/sec_bulk.c
+++ b/lustre/ptlrpc/sec_bulk.c
@@ -232,30 +232,46 @@ static void enc_pools_release_free_pages(long npages)
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
deleted file mode 100644
index 50f9f1c3d..000000000
--- a/sys-cluster/lustre/files/0009-LU-3319-procfs-update-ldiskfs-proc-handling-to-seq_f.patch
+++ /dev/null
@@ -1,826 +0,0 @@
-From 671de4e9a7ec811db225a763b88e48379d5a4daf Mon Sep 17 00:00:00 2001
-From: James Simmons <uja.ornl@gmail.com>
-Date: Tue, 25 Mar 2014 12:37:41 -0400
-Subject: [PATCH 09/10] 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 uninitialized.
-
-Signed-off-by: James Simmons <uja.ornl@gmail.com>
-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 | 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 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,
- handle_t *th)
- {
- struct dentry *root;
-- char *name;
-+ char *name = NULL;
- int rc;
- ENTRY;
-
-@@ -1185,7 +1185,7 @@ int osd_obj_spec_insert(struct osd_thread_info *info, struct osd_device *osd,
- handle_t *th)
- {
- struct dentry *root;
-- char *name;
-+ char *name = NULL;
- int rc;
- ENTRY;
-
-@@ -1207,7 +1207,7 @@ int osd_obj_spec_lookup(struct osd_thread_info *info, struct osd_device *osd,
- struct dentry *root;
- struct dentry *dentry;
- struct inode *inode;
-- char *name;
-+ char *name = NULL;
- int rc = -ENOENT;
- ENTRY;
-
-diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c
-index 14808ee..2cb9af5 100644
---- a/lustre/osd-ldiskfs/osd_handler.c
-+++ b/lustre/osd-ldiskfs/osd_handler.c
-@@ -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,
-+ 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,
-+ lprocfs_osd_obd_vars,
-+ cfg, &o->od_dt_dev);
- break;
- default:
- rc = -ENOSYS;
-@@ -6020,9 +6021,10 @@ static int __init osd_mod_init(void)
- if (rc)
- return rc;
-
-- 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, true,
- lprocfs_osd_module_vars,
-+#ifndef HAVE_ONLY_PROCFS_SEQ
-+ NULL,
- #endif
- 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 185d63d..e1bde19 100644
---- a/lustre/osd-ldiskfs/osd_internal.h
-+++ b/lustre/osd-ldiskfs/osd_internal.h
-@@ -617,8 +617,8 @@ static inline int __osd_xattr_set(struct osd_thread_info *info,
-
- #ifdef LPROCFS
- /* 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[];
-+extern struct lprocfs_seq_vars lprocfs_osd_module_vars[];
- 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);
-@@ -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);
--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_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..ddaa169 100644
---- a/lustre/osd-ldiskfs/osd_lproc.c
-+++ b/lustre/osd-ldiskfs/osd_lproc.c
-@@ -237,92 +237,46 @@ out:
- RETURN(result);
- }
-
--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;
--
-- /* 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_OSD_LDISKFS_NAME);
--
-- LASSERT(name != NULL);
-- LASSERT(type != NULL);
--
-- /* Find the type procroot and add the proc entry for this device */
-- osd->od_proc_entry = lprocfs_register(name, type->typ_procroot,
-- lprocfs_osd_obd_vars,
-- &osd->od_dt_dev);
-- if (IS_ERR(osd->od_proc_entry)) {
-- rc = PTR_ERR(osd->od_proc_entry);
-- CERROR("Error %d setting up lprocfs for %s\n",
-- rc, name);
-- 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;
--out:
-- if (rc)
-- osd_procfs_fini(osd);
-- return rc;
--}
--
--int osd_procfs_fini(struct osd_device *osd)
--{
-- if (osd->od_stats)
-- lprocfs_free_stats(&osd->od_stats);
--
-- if (osd->od_proc_entry) {
-- lprocfs_remove(&osd->od_proc_entry);
-- osd->od_proc_entry = NULL;
-- }
-- RETURN(0);
--}
--
--static int lprocfs_osd_rd_fstype(char *page, char **start, off_t off, int count,
-- int *eof, void *data)
--{
-- struct osd_device *osd = osd_dt_dev(data);
--
-- LASSERT(osd != NULL);
-- return snprintf(page, count, "ldiskfs\n");
-+ LASSERT(osd != NULL);
-+ return seq_printf(m, "ldiskfs\n");
- }
-+LPROC_SEQ_FOPS_RO(ldiskfs_osd_fstype);
-
--static int lprocfs_osd_rd_mntdev(char *page, char **start, off_t off, int count,
-- int *eof, void *data)
-+static int ldiskfs_osd_mntdev_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);
-+ LASSERT(osd != NULL);
- if (unlikely(osd->od_mnt == NULL))
-- return -EINPROGRESS;
--
-- *eof = 1;
-+ return -EINPROGRESS;
-
-- return snprintf(page, count, "%s\n", osd->od_mntdev);
-+ return seq_printf(m, "%s\n", osd->od_mntdev);
- }
-+LPROC_SEQ_FOPS_RO(ldiskfs_osd_mntdev);
-
--static int lprocfs_osd_rd_cache(char *page, char **start, off_t off,
-- int count, int *eof, void *data)
-+static int ldiskfs_osd_cache_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);
- if (unlikely(osd->od_mnt == NULL))
- return -EINPROGRESS;
-
-- return snprintf(page, count, "%u\n", osd->od_read_cache);
-+ return seq_printf(m, "%u\n", osd->od_read_cache);
- }
-
--static int lprocfs_osd_wr_cache(struct file *file, const char *buffer,
-- unsigned long count, void *data)
-+static ssize_t
-+ldiskfs_osd_cache_seq_write(struct file *file, const char *buffer,
-+ size_t count, loff_t *off)
- {
-- struct osd_device *osd = osd_dt_dev(data);
-- int val, rc;
-+ 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,27 @@ static int lprocfs_osd_wr_cache(struct file *file, const char *buffer,
- osd->od_read_cache = !!val;
- return count;
- }
-+LPROC_SEQ_FOPS(ldiskfs_osd_cache);
-
--static int lprocfs_osd_rd_wcache(char *page, char **start, off_t off,
-- int count, int *eof, void *data)
-+static int ldiskfs_osd_wcache_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);
- if (unlikely(osd->od_mnt == NULL))
- return -EINPROGRESS;
-
-- return snprintf(page, count, "%u\n", osd->od_writethrough_cache);
-+ return seq_printf(m, "%u\n", osd->od_writethrough_cache);
- }
-
--static int lprocfs_osd_wr_wcache(struct file *file, const char *buffer,
-- unsigned long count, void *data)
-+static ssize_t
-+ldiskfs_osd_wcache_seq_write(struct file *file, const char *buffer,
-+ size_t count, loff_t *off)
- {
-- struct osd_device *osd = osd_dt_dev(data);
-- int val, rc;
-+ 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 +322,17 @@ static int lprocfs_osd_wr_wcache(struct file *file, const char *buffer,
- osd->od_writethrough_cache = !!val;
- return count;
- }
-+LPROC_SEQ_FOPS(ldiskfs_osd_wcache);
-
--static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer,
-- unsigned long count, void *data)
-+static ssize_t
-+lprocfs_osd_force_sync_seq_write(struct file *file, const char *buffer,
-+ size_t count, loff_t *off)
- {
-- struct osd_device *osd = osd_dt_dev(data);
-- struct dt_device *dt = data;
-- struct lu_env env;
-- int rc;
-+ 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 +346,18 @@ static int lprocfs_osd_wr_force_sync(struct file *file, const char *buffer,
-
- return rc == 0 ? count : rc;
- }
-+LPROC_SEQ_FOPS_WO_TYPE(ldiskfs, osd_force_sync);
-
--static int lprocfs_osd_rd_pdo(char *page, char **start, off_t off, int count,
-- int *eof, void *data)
-+static int ldiskfs_osd_pdo_seq_show(struct seq_file *m, void *data)
- {
-- *eof = 1;
--
-- return snprintf(page, count, "%s\n", ldiskfs_pdo ? "ON" : "OFF");
-+ return seq_printf(m, "%s\n", ldiskfs_pdo ? "ON" : "OFF");
- }
-
--static int lprocfs_osd_wr_pdo(struct file *file, const char *buffer,
-- unsigned long count, void *data)
-+static ssize_t
-+ldiskfs_osd_pdo_seq_write(struct file *file, const char *buffer,
-+ size_t count, loff_t *off)
- {
-- int pdo;
-- int rc;
-+ int pdo, rc;
-
- rc = lprocfs_write_helper(buffer, count, &pdo);
- if (rc != 0)
-@@ -409,24 +367,26 @@ static int lprocfs_osd_wr_pdo(struct file *file, const char *buffer,
-
- return count;
- }
-+LPROC_SEQ_FOPS(ldiskfs_osd_pdo);
-
--static int lprocfs_osd_rd_auto_scrub(char *page, char **start, off_t off,
-- int count, int *eof, void *data)
-+static int ldiskfs_osd_auto_scrub_seq_show(struct seq_file *m, void *data)
- {
-- struct osd_device *dev = osd_dt_dev(data);
-+ struct osd_device *dev = osd_dt_dev((struct dt_device *)m->private);
-
- LASSERT(dev != NULL);
- if (unlikely(dev->od_mnt == NULL))
- return -EINPROGRESS;
-
-- *eof = 1;
-- return snprintf(page, count, "%d\n", !dev->od_noscrub);
-+ return seq_printf(m, "%d\n", !dev->od_noscrub);
- }
-
--static int lprocfs_osd_wr_auto_scrub(struct file *file, const char *buffer,
-- unsigned long count, void *data)
-+static ssize_t
-+ldiskfs_osd_auto_scrub_seq_write(struct file *file, const char *buffer,
-+ size_t count, loff_t *off)
- {
-- struct osd_device *dev = osd_dt_dev(data);
-+ 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 +400,18 @@ static int lprocfs_osd_wr_auto_scrub(struct file *file, const char *buffer,
- dev->od_noscrub = !val;
- return count;
- }
-+LPROC_SEQ_FOPS(ldiskfs_osd_auto_scrub);
-
--static int lprocfs_osd_rd_track_declares_assert(char *page, char **start,
-- off_t off, int count,
-- int *eof, void *data)
-+static int
-+ldiskfs_osd_track_declares_assert_seq_show(struct seq_file *m, void *data)
- {
-- *eof = 1;
--
-- return snprintf(page, count, "%d\n", ldiskfs_track_declares_assert);
-+ return seq_printf(m, "%d\n", ldiskfs_track_declares_assert);
- }
-
--static int lprocfs_osd_wr_track_declares_assert(struct file *file,
-+static ssize_t
-+ldiskfs_osd_track_declares_assert_seq_write(struct file *file,
- const char *buffer,
-- unsigned long count, void *data)
-+ size_t count, loff_t *off)
- {
- int track_declares_assert;
- int rc;
-@@ -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);
-
--static int lprocfs_osd_rd_oi_scrub(char *page, char **start, off_t off,
-- int count, int *eof, void *data)
-+static int ldiskfs_osd_oi_scrub_seq_show(struct seq_file *m, void *data)
- {
-- struct osd_device *dev = osd_dt_dev(data);
-+ struct osd_device *dev = osd_dt_dev((struct dt_device *)m->private);
-
- LASSERT(dev != NULL);
- if (unlikely(dev->od_mnt == NULL))
- return -EINPROGRESS;
-
-- *eof = 1;
-- return osd_scrub_dump(dev, page, count);
-+ return osd_scrub_dump(m, dev);
- }
-+LPROC_SEQ_FOPS_RO(ldiskfs_osd_oi_scrub);
-
--int lprocfs_osd_rd_readcache(char *page, char **start, off_t off, int count,
-- int *eof, void *data)
-+int ldiskfs_osd_readcache_seq_show(struct seq_file *m, void *data)
- {
-- struct osd_device *osd = osd_dt_dev(data);
-- int rc;
-+ struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private);
-
- LASSERT(osd != NULL);
- if (unlikely(osd->od_mnt == NULL))
- return -EINPROGRESS;
-
-- rc = snprintf(page, count, LPU64"\n", osd->od_readcache_max_filesize);
-- return rc;
-+ return seq_printf(m, LPU64"\n", osd->od_readcache_max_filesize);
- }
-
--int lprocfs_osd_wr_readcache(struct file *file, const char *buffer,
-- unsigned long count, void *data)
-+ssize_t
-+ldiskfs_osd_readcache_seq_write(struct file *file, const char *buffer,
-+ size_t count, loff_t *off)
- {
-- struct osd_device *osd = osd_dt_dev(data);
-- __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;
-
- 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;
- }
-+LPROC_SEQ_FOPS(ldiskfs_osd_readcache);
-
--static int lprocfs_osd_rd_lma_self_repair(char *page, char **start, off_t off,
-- int count, int *eof, void *data)
-+static int ldiskfs_osd_lma_self_repair_seq_show(struct seq_file *m, void *data)
- {
-- struct osd_device *dev = osd_dt_dev(data);
-+ struct osd_device *dev = osd_dt_dev((struct dt_device *)m->private);
-
- LASSERT(dev != NULL);
- if (unlikely(dev->od_mnt == NULL))
- return -EINPROGRESS;
-
-- *eof = 1;
-- return snprintf(page, count, "%d\n", !!dev->od_lma_self_repair);
-+ return seq_printf(m, "%d\n", !!dev->od_lma_self_repair);
- }
-
--static int lprocfs_osd_wr_lma_self_repair(struct file *file, const char *buffer,
-- unsigned long count, void *data)
-+static ssize_t
-+ldiskfs_osd_lma_self_repair_seq_write(struct file *file, const char *buffer,
-+ size_t count, loff_t *off)
- {
-- struct osd_device *dev = osd_dt_dev(data);
-+ 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 +505,102 @@ static int lprocfs_osd_wr_lma_self_repair(struct file *file, const char *buffer,
- dev->od_lma_self_repair = !!val;
- return count;
- }
--
--struct lprocfs_vars lprocfs_osd_obd_vars[] = {
-- { "blocksize", lprocfs_dt_rd_blksize, 0, 0 },
-- { "kbytestotal", lprocfs_dt_rd_kbytestotal, 0, 0 },
-- { "kbytesfree", lprocfs_dt_rd_kbytesfree, 0, 0 },
-- { "kbytesavail", lprocfs_dt_rd_kbytesavail, 0, 0 },
-- { "filestotal", lprocfs_dt_rd_filestotal, 0, 0 },
-- { "filesfree", lprocfs_dt_rd_filesfree, 0, 0 },
-- { "fstype", lprocfs_osd_rd_fstype, 0, 0 },
-- { "mntdev", lprocfs_osd_rd_mntdev, 0, 0 },
-- { "force_sync", 0, lprocfs_osd_wr_force_sync },
-- { "pdo", lprocfs_osd_rd_pdo, lprocfs_osd_wr_pdo, 0 },
-- { "auto_scrub", lprocfs_osd_rd_auto_scrub,
-- lprocfs_osd_wr_auto_scrub, 0 },
-- { "oi_scrub", lprocfs_osd_rd_oi_scrub, 0, 0 },
-- { "force_sync", 0, lprocfs_osd_wr_force_sync },
-- { "read_cache_enable", lprocfs_osd_rd_cache, lprocfs_osd_wr_cache, 0 },
-- { "writethrough_cache_enable", lprocfs_osd_rd_wcache,
-- lprocfs_osd_wr_wcache, 0 },
-- { "readcache_max_filesize", lprocfs_osd_rd_readcache,
-- lprocfs_osd_wr_readcache, 0 },
-- { "lma_self_repair", lprocfs_osd_rd_lma_self_repair,
-- lprocfs_osd_wr_lma_self_repair, 0, 0 },
-+LPROC_SEQ_FOPS(ldiskfs_osd_lma_self_repair);
-+
-+LPROC_SEQ_FOPS_RO_TYPE(ldiskfs, dt_blksize);
-+LPROC_SEQ_FOPS_RO_TYPE(ldiskfs, dt_kbytestotal);
-+LPROC_SEQ_FOPS_RO_TYPE(ldiskfs, dt_kbytesfree);
-+LPROC_SEQ_FOPS_RO_TYPE(ldiskfs, dt_kbytesavail);
-+LPROC_SEQ_FOPS_RO_TYPE(ldiskfs, dt_filestotal);
-+LPROC_SEQ_FOPS_RO_TYPE(ldiskfs, dt_filesfree);
-+
-+struct lprocfs_seq_vars lprocfs_osd_obd_vars[] = {
-+ { .name = "blocksize",
-+ .fops = &ldiskfs_dt_blksize_fops },
-+ { .name = "kbytestotal",
-+ .fops = &ldiskfs_dt_kbytestotal_fops },
-+ { .name = "kbytesfree",
-+ .fops = &ldiskfs_dt_kbytesfree_fops },
-+ { .name = "kbytesavail",
-+ .fops = &ldiskfs_dt_kbytesavail_fops },
-+ { .name = "filestotal",
-+ .fops = &ldiskfs_dt_filestotal_fops },
-+ { .name = "filesfree",
-+ .fops = &ldiskfs_dt_filesfree_fops },
-+ { .name = "fstype",
-+ .fops = &ldiskfs_osd_fstype_fops },
-+ { .name = "mntdev",
-+ .fops = &ldiskfs_osd_mntdev_fops },
-+ { .name = "force_sync",
-+ .fops = &ldiskfs_osd_force_sync_fops },
-+ { .name = "pdo",
-+ .fops = &ldiskfs_osd_pdo_fops },
-+ { .name = "auto_scrub",
-+ .fops = &ldiskfs_osd_auto_scrub_fops },
-+ { .name = "oi_scrub",
-+ .fops = &ldiskfs_osd_oi_scrub_fops },
-+ { .name = "read_cache_enable",
-+ .fops = &ldiskfs_osd_cache_fops },
-+ { .name = "writethrough_cache_enable",
-+ .fops = &ldiskfs_osd_wcache_fops },
-+ { .name = "readcache_max_filesize",
-+ .fops = &ldiskfs_osd_readcache_fops },
-+ { .name = "lma_self_repair",
-+ .fops = &ldiskfs_osd_lma_self_repair_fops },
- { 0 }
- };
-
--struct lprocfs_vars lprocfs_osd_module_vars[] = {
-- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
-- { "track_declares_assert", lprocfs_osd_rd_track_declares_assert,
-- lprocfs_osd_wr_track_declares_assert,
-- 0 },
-- { 0 }
-+struct lprocfs_seq_vars lprocfs_osd_module_vars[] = {
-+ { .name = "track_declares_assert",
-+ .fops = &ldiskfs_osd_track_declares_assert_fops },
-+ { 0 }
- };
-
-+
-+int osd_procfs_init(struct osd_device *osd, const char *name)
-+{
-+ struct obd_type *type;
-+ int rc;
-+ ENTRY;
-+
-+ if (osd->od_proc_entry)
-+ RETURN(0);
-+
-+ /* 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_OSD_LDISKFS_NAME);
-+
-+ LASSERT(name != NULL);
-+ LASSERT(type != NULL);
-+
-+ /* Find the type procroot and add the proc entry for this device */
-+ osd->od_proc_entry = lprocfs_seq_register(name, type->typ_procroot,
-+ lprocfs_osd_obd_vars,
-+ &osd->od_dt_dev);
-+ if (IS_ERR(osd->od_proc_entry)) {
-+ rc = PTR_ERR(osd->od_proc_entry);
-+ CERROR("Error %d setting up lprocfs for %s\n",
-+ rc, name);
-+ osd->od_proc_entry = NULL;
-+ GOTO(out, rc);
-+ }
-+
-+ rc = osd_stats_init(osd);
-+
-+ EXIT;
-+out:
-+ if (rc)
-+ osd_procfs_fini(osd);
-+ return rc;
-+}
-+
-+int osd_procfs_fini(struct osd_device *osd)
-+{
-+ if (osd->od_stats)
-+ lprocfs_free_stats(&osd->od_stats);
-+
-+ if (osd->od_proc_entry)
-+ lprocfs_remove(&osd->od_proc_entry);
-+ RETURN(0);
-+}
- #endif
-diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c
-index 7d6c011..05e9f25 100644
---- a/lustre/osd-ldiskfs/osd_scrub.c
-+++ b/lustre/osd-ldiskfs/osd_scrub.c
-@@ -2571,134 +2571,112 @@ static const char *scrub_param_names[] = {
- NULL
- };
-
--static int scrub_bits_dump(char **buf, int *len, int bits, const char *names[],
-+static int scrub_bits_dump(struct seq_file *m, int bits, const char *names[],
- const char *prefix)
- {
-- int save = *len;
- int flag;
- int rc;
- 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 rc;
-
-- *buf += rc;
-- *len -= rc;
- for (i = 0, flag = 1; bits != 0; i++, flag = 1 << i) {
- if (flag & bits) {
- bits &= ~flag;
-- rc = snprintf(*buf, *len, "%s%c", names[i],
-- bits != 0 ? ',' : '\n');
-- 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;
-+ return 0;
- }
-
--static int scrub_time_dump(char **buf, int *len, __u64 time, const char *prefix)
-+static int scrub_time_dump(struct seq_file *m, __u64 time, const char *prefix)
- {
- int rc;
-
- if (time != 0)
-- rc = snprintf(*buf, *len, "%s: "LPU64" seconds\n", prefix,
-+ rc = seq_printf(m, "%s: "LPU64" seconds\n", prefix,
- cfs_time_current_sec() - time);
- else
-- rc = snprintf(*buf, *len, "%s: N/A\n", prefix);
-- if (rc <= 0)
-- return -ENOSPC;
--
-- *buf += rc;
-- *len -= rc;
-+ 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)
-+static int scrub_pos_dump(struct seq_file *m, __u64 pos, const char *prefix)
- {
- int rc;
-
- if (pos != 0)
-- rc = snprintf(*buf, *len, "%s: "LPU64"\n", prefix, pos);
-+ rc = seq_printf(m, "%s: "LPU64"\n", prefix, pos);
- else
-- rc = snprintf(*buf, *len, "%s: N/A\n", prefix);
-- 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)
- {
- 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 rc;
-
- down_read(&scrub->os_rwsem);
-- rc = snprintf(buf, len,
-- "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;
-- len -= rc;
-- rc = scrub_bits_dump(&buf, &len, sf->sf_flags, scrub_flags_names,
-+ rc = scrub_bits_dump(m, sf->sf_flags, scrub_flags_names,
- "flags");
- if (rc < 0)
- goto out;
-
-- rc = scrub_bits_dump(&buf, &len, sf->sf_param, scrub_param_names,
-+ rc = scrub_bits_dump(m, sf->sf_param, scrub_param_names,
- "param");
- if (rc < 0)
- goto out;
-
-- rc = scrub_time_dump(&buf, &len, sf->sf_time_last_complete,
-+ rc = scrub_time_dump(m, sf->sf_time_last_complete,
- "time_since_last_completed");
- if (rc < 0)
- goto out;
-
-- rc = scrub_time_dump(&buf, &len, sf->sf_time_latest_start,
-+ rc = scrub_time_dump(m, sf->sf_time_latest_start,
- "time_since_latest_start");
- if (rc < 0)
- goto out;
-
-- rc = scrub_time_dump(&buf, &len, sf->sf_time_last_checkpoint,
-+ rc = scrub_time_dump(m, sf->sf_time_last_checkpoint,
- "time_since_last_checkpoint");
- if (rc < 0)
- goto out;
-
-- rc = scrub_pos_dump(&buf, &len, sf->sf_pos_latest_start,
-+ rc = scrub_pos_dump(m, sf->sf_pos_latest_start,
- "latest_start_position");
- if (rc < 0)
- goto out;
-
-- rc = scrub_pos_dump(&buf, &len, sf->sf_pos_last_checkpoint,
-+ rc = scrub_pos_dump(m, sf->sf_pos_last_checkpoint,
- "last_checkpoint_position");
- if (rc < 0)
- goto out;
-
-- rc = scrub_pos_dump(&buf, &len, sf->sf_pos_first_inconsistent,
-+ rc = scrub_pos_dump(m, sf->sf_pos_first_inconsistent,
- "first_failure_position");
- if (rc < 0)
- goto out;
-
- checked = sf->sf_items_checked + scrub->os_new_checked;
-- rc = snprintf(buf, len,
-- "checked: "LPU64"\n"
-+ rc = seq_printf(m, "checked: "LPU64"\n"
- "updated: "LPU64"\n"
- "failed: "LPU64"\n"
- "prior_updated: "LPU64"\n"
-@@ -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;
-- len -= rc;
- speed = checked;
- if (thread_is_running(&scrub->os_thread)) {
- cfs_duration_t duration = cfs_time_current() -
-@@ -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);
-- rc = snprintf(buf, len,
-- "run_time: %u seconds\n"
-+ rc = seq_printf(m, "run_time: %u seconds\n"
- "average_speed: "LPU64" objects/sec\n"
- "real-time_speed: "LPU64" objects/sec\n"
- "current_position: %u\n"
-@@ -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);
-- rc = snprintf(buf, len,
-- "run_time: %u seconds\n"
-+ rc = seq_printf(m, "run_time: %u seconds\n"
- "average_speed: "LPU64" objects/sec\n"
- "real-time_speed: N/A\n"
- "current_position: N/A\n"
-@@ -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;
--
-- buf += rc;
-- len -= rc;
-- ret = save - len;
-
- out:
- up_read(&scrub->os_rwsem);
-- return ret;
-+ return (rc < 0 ? -ENOSPC : 0);
- }
---
-1.9.1
-
diff --git a/sys-cluster/lustre/lustre-9999.ebuild b/sys-cluster/lustre/lustre-9999.ebuild
index 50587cc94..f777e39ea 100644
--- a/sys-cluster/lustre/lustre-9999.ebuild
+++ b/sys-cluster/lustre/lustre-9999.ebuild
@@ -7,6 +7,14 @@ EAPI=5
WANT_AUTOCONF="2.5"
WANT_AUTOMAKE="1.10"
+if [[ $PV = *9999* ]]; then
+ KEYWORDS=""
+ EGIT_BRANCH="master"
+else
+ KEYWORDS="~amd64"
+ EGIT_TAG="${PV}"
+fi
+
inherit git-r3 autotools linux-mod toolchain-funcs udev flag-o-matic
DESCRIPTION="Lustre is a parallel distributed file system"
@@ -16,7 +24,6 @@ EGIT_REPO_URI="git://git.whamcloud.com/fs/lustre-release.git"
LICENSE="GPL-2"
SLOT="0"
-KEYWORDS=""
IUSE="+client +utils server liblustre readline tests tcpd +urandom"
RDEPEND="
@@ -33,16 +40,13 @@ DEPEND="${RDEPEND}
virtual/linux-sources"
PATCHES=(
- "${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-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-4416-mm-Backport-shrinker-changes-from-upstream.patch"
+ "${FILESDIR}/0001-LU-3319-procfs-Move-NRS-TBF-proc-handling-to-seq_fil.patch"
+ "${FILESDIR}/0002-LU-3319-procfs-update-zfs-proc-handling-to-seq_files.patch"
+ "${FILESDIR}/0003-LU-3319-procfs-move-osp-proc-handling-to-seq_files.patch"
+ "${FILESDIR}/0004-LU-3319-procfs-move-lod-proc-handling-to-seq_files.patch"
+ "${FILESDIR}/0005-LU-3319-procfs-move-mdt-mds-proc-handling-to-seq_fil.patch"
+ "${FILESDIR}/0006-LU-3319-procfs-move-mdd-ofd-proc-handling-to-seq_fil.patch"
+ "${FILESDIR}/0007-LU-4416-mm-Backport-shrinker-changes-from-upstream.patch"
"${FILESDIR}/lustre-readline6.3_fix.patch"
)