aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-29 10:29:46 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-06-01 04:47:44 -0400
commitd5bf5cf9e150512f04ef8ae7744964b052d2f061 (patch)
treecb9ace5d4cc717b322297787804e36f782dd6687
parent00905f006608c95f828ed27b3e18f11c9e55431a (diff)
staging: lustre: make ldebugfs_add_vars a void function
The call to ldebugfs_add_vars() can not really fail, so have it just return nothing, which allows us to clean up a lot of unused error handling code. Cc: Oleg Drokin <oleg.drokin@intel.com> Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: James Simmons <jsimmons@infradead.org> Cc: NeilBrown <neilb@suse.com> Cc: Roman Storozhenko <romeusmeister@gmail.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Quentin Bouget <quentin.bouget@cea.fr> Cc: Aastha Gupta <aastha.gupta4104@gmail.com> Cc: Ben Evans <bevans@cray.com> Cc: Arvind Yadav <arvind.yadav.cs@gmail.com> Cc: Arushi Singhal <arushisinghal19971997@gmail.com> Cc: Frank Zago <fzago@cray.com> Cc: Patrick Farrell <paf@cray.com> Cc: Simo Koskinen <koskisoft@gmail.com> Cc: Andriy Skulysh <andriy.skulysh@seagate.com> Cc: "John L. Hammond" <john.hammond@intel.com> Cc: Mathias Rav <mathiasrav@gmail.com> Cc: Dafna Hirschfeld <dafna3@gmail.com> Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com> Cc: lustre-devel@lists.lustre.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/lustre/lustre/fid/fid_request.c37
-rw-r--r--drivers/staging/lustre/lustre/fld/fld_request.c30
-rw-r--r--drivers/staging/lustre/lustre/include/lprocfs_status.h5
-rw-r--r--drivers/staging/lustre/lustre/include/lustre_dlm.h2
-rw-r--r--drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c4
-rw-r--r--drivers/staging/lustre/lustre/ldlm/ldlm_resource.c21
-rw-r--r--drivers/staging/lustre/lustre/llite/lproc_llite.c5
-rw-r--r--drivers/staging/lustre/lustre/obdclass/lprocfs_status.c17
8 files changed, 27 insertions, 94 deletions
diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c
index dfcac0afa106..bc748ab6645d 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -295,26 +295,12 @@ static void seq_client_debugfs_fini(struct lu_client_seq *seq)
295 ldebugfs_remove(&seq->lcs_debugfs_entry); 295 ldebugfs_remove(&seq->lcs_debugfs_entry);
296} 296}
297 297
298static int seq_client_debugfs_init(struct lu_client_seq *seq) 298static void seq_client_debugfs_init(struct lu_client_seq *seq)
299{ 299{
300 int rc;
301
302 seq->lcs_debugfs_entry = debugfs_create_dir(seq->lcs_name, 300 seq->lcs_debugfs_entry = debugfs_create_dir(seq->lcs_name,
303 seq_debugfs_dir); 301 seq_debugfs_dir);
304 302
305 rc = ldebugfs_add_vars(seq->lcs_debugfs_entry, 303 ldebugfs_add_vars(seq->lcs_debugfs_entry, seq_client_debugfs_list, seq);
306 seq_client_debugfs_list, seq);
307 if (rc) {
308 CERROR("%s: Can't init sequence manager debugfs, rc %d\n",
309 seq->lcs_name, rc);
310 goto out_cleanup;
311 }
312
313 return 0;
314
315out_cleanup:
316 seq_client_debugfs_fini(seq);
317 return rc;
318} 304}
319 305
320static void seq_client_fini(struct lu_client_seq *seq) 306static void seq_client_fini(struct lu_client_seq *seq)
@@ -327,13 +313,9 @@ static void seq_client_fini(struct lu_client_seq *seq)
327 } 313 }
328} 314}
329 315
330static int seq_client_init(struct lu_client_seq *seq, 316static void seq_client_init(struct lu_client_seq *seq, struct obd_export *exp,
331 struct obd_export *exp, 317 enum lu_cli_type type, const char *prefix)
332 enum lu_cli_type type,
333 const char *prefix)
334{ 318{
335 int rc;
336
337 LASSERT(seq); 319 LASSERT(seq);
338 LASSERT(prefix); 320 LASSERT(prefix);
339 321
@@ -354,10 +336,7 @@ static int seq_client_init(struct lu_client_seq *seq,
354 snprintf(seq->lcs_name, sizeof(seq->lcs_name), 336 snprintf(seq->lcs_name, sizeof(seq->lcs_name),
355 "cli-%s", prefix); 337 "cli-%s", prefix);
356 338
357 rc = seq_client_debugfs_init(seq); 339 seq_client_debugfs_init(seq);
358 if (rc)
359 seq_client_fini(seq);
360 return rc;
361} 340}
362 341
363int client_fid_init(struct obd_device *obd, 342int client_fid_init(struct obd_device *obd,
@@ -380,12 +359,10 @@ int client_fid_init(struct obd_device *obd,
380 snprintf(prefix, MAX_OBD_NAME + 5, "cli-%s", obd->obd_name); 359 snprintf(prefix, MAX_OBD_NAME + 5, "cli-%s", obd->obd_name);
381 360
382 /* Init client side sequence-manager */ 361 /* Init client side sequence-manager */
383 rc = seq_client_init(cli->cl_seq, exp, type, prefix); 362 seq_client_init(cli->cl_seq, exp, type, prefix);
384 kfree(prefix); 363 kfree(prefix);
385 if (rc)
386 goto out_free_seq;
387 364
388 return rc; 365 return 0;
389out_free_seq: 366out_free_seq:
390 kfree(cli->cl_seq); 367 kfree(cli->cl_seq);
391 cli->cl_seq = NULL; 368 cli->cl_seq = NULL;
diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c
index 409850379fc3..cb67fee19451 100644
--- a/drivers/staging/lustre/lustre/fld/fld_request.c
+++ b/drivers/staging/lustre/lustre/fld/fld_request.c
@@ -217,25 +217,12 @@ int fld_client_del_target(struct lu_client_fld *fld, __u64 idx)
217 217
218static struct dentry *fld_debugfs_dir; 218static struct dentry *fld_debugfs_dir;
219 219
220static int fld_client_debugfs_init(struct lu_client_fld *fld) 220static void fld_client_debugfs_init(struct lu_client_fld *fld)
221{ 221{
222 int rc;
223
224 fld->lcf_debugfs_entry = debugfs_create_dir(fld->lcf_name, 222 fld->lcf_debugfs_entry = debugfs_create_dir(fld->lcf_name,
225 fld_debugfs_dir); 223 fld_debugfs_dir);
226 224
227 rc = ldebugfs_add_vars(fld->lcf_debugfs_entry, 225 ldebugfs_add_vars(fld->lcf_debugfs_entry, fld_client_debugfs_list, fld);
228 fld_client_debugfs_list, fld);
229 if (rc) {
230 CERROR("%s: Can't init FLD debufs, rc %d\n", fld->lcf_name, rc);
231 goto out_cleanup;
232 }
233
234 return 0;
235
236out_cleanup:
237 fld_client_debugfs_fini(fld);
238 return rc;
239} 226}
240 227
241void fld_client_debugfs_fini(struct lu_client_fld *fld) 228void fld_client_debugfs_fini(struct lu_client_fld *fld)
@@ -254,7 +241,7 @@ int fld_client_init(struct lu_client_fld *fld,
254 const char *prefix, int hash) 241 const char *prefix, int hash)
255{ 242{
256 int cache_size, cache_threshold; 243 int cache_size, cache_threshold;
257 int rc; 244 int rc = 0;
258 245
259 snprintf(fld->lcf_name, sizeof(fld->lcf_name), 246 snprintf(fld->lcf_name, sizeof(fld->lcf_name),
260 "cli-%s", prefix); 247 "cli-%s", prefix);
@@ -284,15 +271,10 @@ int fld_client_init(struct lu_client_fld *fld,
284 goto out; 271 goto out;
285 } 272 }
286 273
287 rc = fld_client_debugfs_init(fld); 274 fld_client_debugfs_init(fld);
288 if (rc)
289 goto out;
290out: 275out:
291 if (rc) 276 CDEBUG(D_INFO, "%s: Using \"%s\" hash\n",
292 fld_client_fini(fld); 277 fld->lcf_name, fld->lcf_hash->fh_name);
293 else
294 CDEBUG(D_INFO, "%s: Using \"%s\" hash\n",
295 fld->lcf_name, fld->lcf_hash->fh_name);
296 return rc; 278 return rc;
297} 279}
298EXPORT_SYMBOL(fld_client_init); 280EXPORT_SYMBOL(fld_client_init);
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 912c65b2f72b..b18bcb337504 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -450,9 +450,8 @@ int lprocfs_exp_cleanup(struct obd_export *exp);
450extern const struct file_operations lprocfs_stats_seq_fops; 450extern const struct file_operations lprocfs_stats_seq_fops;
451 451
452/* lprocfs_status.c */ 452/* lprocfs_status.c */
453int ldebugfs_add_vars(struct dentry *parent, 453void ldebugfs_add_vars(struct dentry *parent, struct lprocfs_vars *var,
454 struct lprocfs_vars *var, 454 void *data);
455 void *data);
456 455
457void ldebugfs_remove(struct dentry **entryp); 456void ldebugfs_remove(struct dentry **entryp);
458 457
diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h
index b3532adac31c..2c55241258cc 100644
--- a/drivers/staging/lustre/lustre/include/lustre_dlm.h
+++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h
@@ -1185,7 +1185,7 @@ void ldlm_namespace_free_prior(struct ldlm_namespace *ns,
1185void ldlm_namespace_free_post(struct ldlm_namespace *ns); 1185void ldlm_namespace_free_post(struct ldlm_namespace *ns);
1186void ldlm_namespace_get(struct ldlm_namespace *ns); 1186void ldlm_namespace_get(struct ldlm_namespace *ns);
1187void ldlm_namespace_put(struct ldlm_namespace *ns); 1187void ldlm_namespace_put(struct ldlm_namespace *ns);
1188int ldlm_debugfs_setup(void); 1188void ldlm_debugfs_setup(void);
1189void ldlm_debugfs_cleanup(void); 1189void ldlm_debugfs_cleanup(void);
1190 1190
1191/* resource.c - internal */ 1191/* resource.c - internal */
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
index b0a29f50c7d6..5963e90d0938 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
@@ -979,9 +979,7 @@ static int ldlm_setup(void)
979 goto out; 979 goto out;
980 } 980 }
981 981
982 rc = ldlm_debugfs_setup(); 982 ldlm_debugfs_setup();
983 if (rc != 0)
984 goto out;
985 983
986 memset(&conf, 0, sizeof(conf)); 984 memset(&conf, 0, sizeof(conf));
987 conf = (typeof(conf)) { 985 conf = (typeof(conf)) {
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
index 691899ef8044..6b94a2b2a0fc 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
@@ -106,10 +106,8 @@ static struct lprocfs_vars ldlm_debugfs_list[] = {
106 { NULL } 106 { NULL }
107}; 107};
108 108
109int ldlm_debugfs_setup(void) 109void ldlm_debugfs_setup(void)
110{ 110{
111 int rc;
112
113 ldlm_debugfs_dir = debugfs_create_dir(OBD_LDLM_DEVICENAME, 111 ldlm_debugfs_dir = debugfs_create_dir(OBD_LDLM_DEVICENAME,
114 debugfs_lustre_root); 112 debugfs_lustre_root);
115 113
@@ -118,22 +116,7 @@ int ldlm_debugfs_setup(void)
118 116
119 ldlm_svc_debugfs_dir = debugfs_create_dir("services", ldlm_debugfs_dir); 117 ldlm_svc_debugfs_dir = debugfs_create_dir("services", ldlm_debugfs_dir);
120 118
121 rc = ldebugfs_add_vars(ldlm_debugfs_dir, ldlm_debugfs_list, NULL); 119 ldebugfs_add_vars(ldlm_debugfs_dir, ldlm_debugfs_list, NULL);
122 if (rc) {
123 CERROR("LProcFS failed in ldlm-init\n");
124 goto err_svc;
125 }
126
127 return 0;
128
129err_svc:
130 ldebugfs_remove(&ldlm_svc_debugfs_dir);
131 ldebugfs_remove(&ldlm_ns_debugfs_dir);
132 ldebugfs_remove(&ldlm_debugfs_dir);
133 ldlm_svc_debugfs_dir = NULL;
134 ldlm_ns_debugfs_dir = NULL;
135 ldlm_debugfs_dir = NULL;
136 return rc;
137} 120}
138 121
139void ldlm_debugfs_cleanup(void) 122void ldlm_debugfs_cleanup(void)
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index 1ac36c9ed455..d2f42c727ed4 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -1210,10 +1210,7 @@ int ldebugfs_register_mountpoint(struct dentry *parent,
1210 debugfs_create_file("stats", 0644, sbi->ll_debugfs_entry, 1210 debugfs_create_file("stats", 0644, sbi->ll_debugfs_entry,
1211 sbi->ll_ra_stats, &lprocfs_stats_seq_fops); 1211 sbi->ll_ra_stats, &lprocfs_stats_seq_fops);
1212 1212
1213 err = ldebugfs_add_vars(sbi->ll_debugfs_entry, 1213 ldebugfs_add_vars(sbi->ll_debugfs_entry, lprocfs_llite_obd_vars, sb);
1214 lprocfs_llite_obd_vars, sb);
1215 if (err)
1216 goto out;
1217 1214
1218 sbi->ll_kobj.kset = llite_kset; 1215 sbi->ll_kobj.kset = llite_kset;
1219 init_completion(&sbi->ll_kobj_unregister); 1216 init_completion(&sbi->ll_kobj_unregister);
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 91af79facbc0..a8299a8cdad9 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -302,15 +302,13 @@ EXPORT_SYMBOL(lprocfs_seq_release);
302 302
303static const struct file_operations lprocfs_generic_fops = { }; 303static const struct file_operations lprocfs_generic_fops = { };
304 304
305int ldebugfs_add_vars(struct dentry *parent, 305void ldebugfs_add_vars(struct dentry *parent, struct lprocfs_vars *list,
306 struct lprocfs_vars *list, 306 void *data)
307 void *data)
308{ 307{
309 if (IS_ERR_OR_NULL(parent) || IS_ERR_OR_NULL(list)) 308 if (IS_ERR_OR_NULL(parent) || IS_ERR_OR_NULL(list))
310 return -EINVAL; 309 return;
311 310
312 while (list->name) { 311 while (list->name) {
313 struct dentry *entry;
314 umode_t mode = 0; 312 umode_t mode = 0;
315 313
316 if (list->proc_mode != 0000) { 314 if (list->proc_mode != 0000) {
@@ -321,13 +319,12 @@ int ldebugfs_add_vars(struct dentry *parent,
321 if (list->fops->write) 319 if (list->fops->write)
322 mode |= 0200; 320 mode |= 0200;
323 } 321 }
324 entry = debugfs_create_file(list->name, mode, parent, 322 debugfs_create_file(list->name, mode, parent,
325 list->data ?: data, 323 list->data ?: data,
326 list->fops ?: &lprocfs_generic_fops 324 list->fops ?: &lprocfs_generic_fops);
327 );
328 list++; 325 list++;
329 } 326 }
330 return 0; 327 return;
331} 328}
332EXPORT_SYMBOL_GPL(ldebugfs_add_vars); 329EXPORT_SYMBOL_GPL(ldebugfs_add_vars);
333 330