aboutsummaryrefslogtreecommitdiff
blob: b835516237f4c8423745dda48877dad25302fc15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
From ae21b1ad797973ad686dfc1c0cad8d313ddaf4d7 Mon Sep 17 00:00:00 2001
From: Andreas Dilger <andreas.dilger@intel.com>
Date: Tue, 6 May 2014 09:51:45 -0400
Subject: [PATCH 4/6] LU-2096 lprocfs: symlinks for forward compatibility

Currently, the "ofd" device is still named "obdfilter" in the Lustre
configuration and in /proc/fs/lustre.  It would be better to name it
"ost" which is has been the long term goal but retain the "ofd"
module name.

The per-OST device statistics should really be under "ost/{target}",
like the per-MDT statistics are under "mdt/{target}" already in 2.x.

Similarly, the "OSS" statistics have always been under "ost/OSS", but
would be better in their own "oss" subdirectory much like what is done
for "MDS" statistics.

Add symlinks in lprocfs for "ost/OSS -> oss", "obdfilter -> ofd -> ost",
and "obdfilter/{target} -> ost/{target}" for forward compatibility so
that when we finally are able to make these changes to the module names
userspace tools and scripts can have a smoother transition between
Lustre versions.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: Ia0835e39aba7c8a540a6247bd3d56bc14e500c1e
Signed-off-by: Alexey Shvetsov <alexxy@gentoo.org>
---
 lustre/include/obd.h      |  4 ++--
 lustre/mgs/mgs_llog.c     |  4 ++--
 lustre/obdclass/genops.c  |  2 +-
 lustre/ofd/ofd_dev.c      | 32 +++++++++++++++++++++++++++++++-
 lustre/ofd/ofd_internal.h |  2 ++
 lustre/ost/ost_handler.c  | 12 +++++++++++-
 6 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/lustre/include/obd.h b/lustre/include/obd.h
index 3abcc4d..a79c901 100644
--- a/lustre/include/obd.h
+++ b/lustre/include/obd.h
@@ -516,8 +516,8 @@ struct niobuf_local {
 #define LUSTRE_MDS_NAME         "mds"
 #define LUSTRE_MDT_NAME         "mdt"
 #define LUSTRE_MDC_NAME         "mdc"
-#define LUSTRE_OSS_NAME         "ost"       /* FIXME change name to oss */
-#define LUSTRE_OST_NAME         "obdfilter" /* FIXME change name to ost */
+#define LUSTRE_OSS_NAME         "oss"
+#define LUSTRE_OST_NAME         "ost"
 #define LUSTRE_OSC_NAME         "osc"
 #define LUSTRE_LOV_NAME         "lov"
 #define LUSTRE_MGS_NAME         "mgs"
diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c
index aca72e3..cd1174d 100644
--- a/lustre/mgs/mgs_llog.c
+++ b/lustre/mgs/mgs_llog.c
@@ -2450,7 +2450,7 @@ static int mgs_write_log_ost(const struct lu_env *env,
         }
 
         /*
-        attach obdfilter ost1 ost1_UUID
+	attach ost ost1 ost1_UUID
         setup /dev/loop2 ldiskfs f|n errors=remount-ro,user_xattr
         */
         if (class_find_param(ptr, PARAM_FAILMODE, &ptr) == 0)
@@ -2466,7 +2466,7 @@ static int mgs_write_log_ost(const struct lu_env *env,
                 snprintf(mti->mti_uuid, sizeof(mti->mti_uuid),
                          "%s_UUID", mti->mti_svname);
 	rc = record_attach(env, llh, mti->mti_svname,
-                           "obdfilter"/*LUSTRE_OST_NAME*/, mti->mti_uuid);
+			   "ost"/*LUSTRE_OST_NAME*/, mti->mti_uuid);
 	if (rc)
 		GOTO(out_end, rc);
 	rc = record_setup(env, llh, mti->mti_svname,
diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c
index d7c541a..1479f5a 100644
--- a/lustre/obdclass/genops.c
+++ b/lustre/obdclass/genops.c
@@ -121,7 +121,7 @@ struct obd_type *class_get_type(const char *name)
         if (!type) {
                 const char *modname = name;
 
-		if (strcmp(modname, "obdfilter") == 0)
+		if (strcmp(modname, "ost") == 0)
 			modname = "ofd";
 
 		if (strcmp(modname, LUSTRE_LWP_NAME) == 0)
diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c
index 0f0d51a..b597b03 100644
--- a/lustre/ofd/ofd_dev.c
+++ b/lustre/ofd/ofd_dev.c
@@ -2375,10 +2375,23 @@ static struct lu_device_type ofd_device_type = {
 	.ldt_ctx_tags	= LCT_DT_THREAD
 };
 
+/*
+ * In the normal case all we have one symlink, type->typ_procsym to
+ * address the renaming of proc directories due to the OSD api
+ * introducton. OFD is special in that this subsystem the name has
+ * changed from obdfilter to ofd to lastly ost. So we need two
+ * symlinks to point to "ost". Hopefully in 2.9 we can removal all
+ * this symlink madness.
+ *
+ * Symlink called "obdfilter" that points to  "ost" directory.
+ */
+static struct proc_dir_entry *ofd_symlink;
+
 int __init ofd_init(void)
 {
 	struct lprocfs_static_vars	lvars;
-	int				rc;
+	struct obd_type *type;
+	int rc;
 
 	rc = lu_kmem_init(ofd_caches);
 	if (rc)
@@ -2397,13 +2410,30 @@ int __init ofd_init(void)
 				 lvars.module_vars,
 #endif
 				 LUSTRE_OST_NAME, &ofd_device_type);
+
+	/* For forward compatibility symlink "obdfilter" and "ofd" to "ost"
+	 * in procfs. Remove the symlinks entirely when access via
+	 * "obdfilter/ofd" can be deprecated, maybe 2.9? */
+	type = class_search_type(LUSTRE_OST_NAME);
+	LASSERT(type != NULL);
+	type->typ_procsym = lprocfs_add_symlink("ofd", proc_lustre_root,
+						"ost");
+
+	ofd_symlink = lprocfs_add_symlink("obdfilter", proc_lustre_root,
+					  "ost");
 	return rc;
 }
 
 void __exit ofd_exit(void)
 {
+	struct obd_type *type = class_search_type(LUSTRE_OST_NAME);
+
 	ofd_fmd_exit();
 	lu_kmem_fini(ofd_caches);
+	if (ofd_symlink)
+		lprocfs_remove(&ofd_symlink);
+	if (type->typ_procsym)
+		lprocfs_remove(&type->typ_procsym);
 	class_unregister_type(LUSTRE_OST_NAME);
 }
 
diff --git a/lustre/ofd/ofd_internal.h b/lustre/ofd/ofd_internal.h
index 4f12506..98a5cba 100644
--- a/lustre/ofd/ofd_internal.h
+++ b/lustre/ofd/ofd_internal.h
@@ -193,6 +193,8 @@ struct ofd_device {
 	struct ptlrpc_thread	 ofd_inconsistency_thread;
 	struct list_head	 ofd_inconsistency_list;
 	spinlock_t		 ofd_inconsistency_lock;
+	/* create a symlink "obdfilter" from the "ost" directory */
+	struct proc_dir_entry	*ofd_symlink;
 };
 
 static inline struct ofd_device *ofd_dev(struct lu_device *d)
diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c
index bae0a40..02ddb87 100644
--- a/lustre/ost/ost_handler.c
+++ b/lustre/ost/ost_handler.c
@@ -95,13 +95,20 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                 RETURN(rc);
 
 #ifdef LPROCFS
+	obd->obd_type->typ_procsym = lprocfs_add_symlink("ost/OSS", proc_lustre_root,
+							 "../oss/OSS");
+	if (IS_ERR(obd->obd_type->typ_procsym)) {
+		CERROR("ost: can't create compat entry \"ost/OSS\": %d\n",
+		       (int)PTR_ERR(obd->obd_type->typ_procsym));
+		obd->obd_type->typ_procsym = NULL;
+	}
 	obd->obd_vars = lprocfs_ost_obd_vars;
 	lprocfs_seq_obd_setup(obd);
 #endif
 	mutex_init(&ost->ost_health_mutex);
 
 	svc_conf = (typeof(svc_conf)) {
-		.psc_name		= LUSTRE_OSS_NAME,
+		.psc_name		= "ost",
 		.psc_watchdog_factor	= OSS_SERVICE_WATCHDOG_FACTOR,
 		.psc_buf		= {
 			.bc_nbufs		= OST_NBUFS,
@@ -379,6 +386,9 @@ static int ost_cleanup(struct obd_device *obd)
 
 	mutex_unlock(&ost->ost_health_mutex);
 
+	if (obd->obd_type->typ_procsym)
+		lprocfs_remove(&obd->obd_type->typ_procsym);
+
 	lprocfs_obd_cleanup(obd);
 
 	if (ost_io_cptable != NULL) {
-- 
1.9.3