aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-22 10:21:51 -0500
committerAndreas Gruenbacher <agruenba@redhat.com>2019-01-23 06:30:34 -0500
commit2abbf9a4d262511999ac11b4ddc8521c9ee72b88 (patch)
treeb1ec689584229fed8e6df5718c1621abac661f26 /fs/gfs2
parent49a57857aeea06ca831043acbb0fa5e0f50602fd (diff)
gfs: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. There is no need to save the dentries for the debugfs files, so drop those variables to save a bit of space and make the code simpler. Cc: Bob Peterson <rpeterso@redhat.com> Cc: Andreas Gruenbacher <agruenba@redhat.com> Cc: cluster-devel@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/glock.c70
-rw-r--r--fs/gfs2/glock.h4
-rw-r--r--fs/gfs2/incore.h3
-rw-r--r--fs/gfs2/main.c6
4 files changed, 17 insertions, 66 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index b92740edc416..f66773c71bcd 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -2131,71 +2131,29 @@ static const struct file_operations gfs2_sbstats_fops = {
2131 .release = seq_release, 2131 .release = seq_release,
2132}; 2132};
2133 2133
2134int gfs2_create_debugfs_file(struct gfs2_sbd *sdp) 2134void gfs2_create_debugfs_file(struct gfs2_sbd *sdp)
2135{ 2135{
2136 struct dentry *dent; 2136 sdp->debugfs_dir = debugfs_create_dir(sdp->sd_table_name, gfs2_root);
2137
2138 dent = debugfs_create_dir(sdp->sd_table_name, gfs2_root);
2139 if (IS_ERR_OR_NULL(dent))
2140 goto fail;
2141 sdp->debugfs_dir = dent;
2142
2143 dent = debugfs_create_file("glocks",
2144 S_IFREG | S_IRUGO,
2145 sdp->debugfs_dir, sdp,
2146 &gfs2_glocks_fops);
2147 if (IS_ERR_OR_NULL(dent))
2148 goto fail;
2149 sdp->debugfs_dentry_glocks = dent;
2150
2151 dent = debugfs_create_file("glstats",
2152 S_IFREG | S_IRUGO,
2153 sdp->debugfs_dir, sdp,
2154 &gfs2_glstats_fops);
2155 if (IS_ERR_OR_NULL(dent))
2156 goto fail;
2157 sdp->debugfs_dentry_glstats = dent;
2158
2159 dent = debugfs_create_file("sbstats",
2160 S_IFREG | S_IRUGO,
2161 sdp->debugfs_dir, sdp,
2162 &gfs2_sbstats_fops);
2163 if (IS_ERR_OR_NULL(dent))
2164 goto fail;
2165 sdp->debugfs_dentry_sbstats = dent;
2166 2137
2167 return 0; 2138 debugfs_create_file("glocks", S_IFREG | S_IRUGO, sdp->debugfs_dir, sdp,
2168fail: 2139 &gfs2_glocks_fops);
2169 gfs2_delete_debugfs_file(sdp); 2140
2170 return dent ? PTR_ERR(dent) : -ENOMEM; 2141 debugfs_create_file("glstats", S_IFREG | S_IRUGO, sdp->debugfs_dir, sdp,
2142 &gfs2_glstats_fops);
2143
2144 debugfs_create_file("sbstats", S_IFREG | S_IRUGO, sdp->debugfs_dir, sdp,
2145 &gfs2_sbstats_fops);
2171} 2146}
2172 2147
2173void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp) 2148void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp)
2174{ 2149{
2175 if (sdp->debugfs_dir) { 2150 debugfs_remove_recursive(sdp->debugfs_dir);
2176 if (sdp->debugfs_dentry_glocks) { 2151 sdp->debugfs_dir = NULL;
2177 debugfs_remove(sdp->debugfs_dentry_glocks);
2178 sdp->debugfs_dentry_glocks = NULL;
2179 }
2180 if (sdp->debugfs_dentry_glstats) {
2181 debugfs_remove(sdp->debugfs_dentry_glstats);
2182 sdp->debugfs_dentry_glstats = NULL;
2183 }
2184 if (sdp->debugfs_dentry_sbstats) {
2185 debugfs_remove(sdp->debugfs_dentry_sbstats);
2186 sdp->debugfs_dentry_sbstats = NULL;
2187 }
2188 debugfs_remove(sdp->debugfs_dir);
2189 sdp->debugfs_dir = NULL;
2190 }
2191} 2152}
2192 2153
2193int gfs2_register_debugfs(void) 2154void gfs2_register_debugfs(void)
2194{ 2155{
2195 gfs2_root = debugfs_create_dir("gfs2", NULL); 2156 gfs2_root = debugfs_create_dir("gfs2", NULL);
2196 if (IS_ERR(gfs2_root))
2197 return PTR_ERR(gfs2_root);
2198 return gfs2_root ? 0 : -ENOMEM;
2199} 2157}
2200 2158
2201void gfs2_unregister_debugfs(void) 2159void gfs2_unregister_debugfs(void)
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index 8949bf28b249..936b3295839c 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -243,9 +243,9 @@ extern void gfs2_glock_free(struct gfs2_glock *gl);
243extern int __init gfs2_glock_init(void); 243extern int __init gfs2_glock_init(void);
244extern void gfs2_glock_exit(void); 244extern void gfs2_glock_exit(void);
245 245
246extern int gfs2_create_debugfs_file(struct gfs2_sbd *sdp); 246extern void gfs2_create_debugfs_file(struct gfs2_sbd *sdp);
247extern void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp); 247extern void gfs2_delete_debugfs_file(struct gfs2_sbd *sdp);
248extern int gfs2_register_debugfs(void); 248extern void gfs2_register_debugfs(void);
249extern void gfs2_unregister_debugfs(void); 249extern void gfs2_unregister_debugfs(void);
250 250
251extern const struct lm_lockops gfs2_dlm_ops; 251extern const struct lm_lockops gfs2_dlm_ops;
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index e10e0b0a7cd5..cdf07b408f54 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -853,9 +853,6 @@ struct gfs2_sbd {
853 853
854 unsigned long sd_last_warning; 854 unsigned long sd_last_warning;
855 struct dentry *debugfs_dir; /* debugfs directory */ 855 struct dentry *debugfs_dir; /* debugfs directory */
856 struct dentry *debugfs_dentry_glocks;
857 struct dentry *debugfs_dentry_glstats;
858 struct dentry *debugfs_dentry_sbstats;
859}; 856};
860 857
861static inline void gfs2_glstats_inc(struct gfs2_glock *gl, int which) 858static inline void gfs2_glstats_inc(struct gfs2_glock *gl, int which)
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index c7603063f861..136484ef35d3 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -178,16 +178,12 @@ static int __init init_gfs2_fs(void)
178 if (!gfs2_page_pool) 178 if (!gfs2_page_pool)
179 goto fail_mempool; 179 goto fail_mempool;
180 180
181 error = gfs2_register_debugfs(); 181 gfs2_register_debugfs();
182 if (error)
183 goto fail_debugfs;
184 182
185 pr_info("GFS2 installed\n"); 183 pr_info("GFS2 installed\n");
186 184
187 return 0; 185 return 0;
188 186
189fail_debugfs:
190 mempool_destroy(gfs2_page_pool);
191fail_mempool: 187fail_mempool:
192 destroy_workqueue(gfs2_freeze_wq); 188 destroy_workqueue(gfs2_freeze_wq);
193fail_wq3: 189fail_wq3: