blob: c5984351e4d8dacd68b2fbb5a5bdf3fb6b70b312 [file] [log] [blame]
David Teiglandb3b94fa2006-01-16 16:50:04 +00001/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License v.2.
8 */
9
10#include <linux/sched.h>
11#include <linux/slab.h>
12#include <linux/spinlock.h>
13#include <linux/completion.h>
14#include <linux/buffer_head.h>
15#include <linux/module.h>
16#include <linux/kobject.h>
17#include <asm/semaphore.h>
18#include <asm/uaccess.h>
19
20#include "gfs2.h"
21#include "lm.h"
22#include "sys.h"
23#include "super.h"
24#include "glock.h"
25#include "quota.h"
26
27char *gfs2_sys_margs;
28spinlock_t gfs2_sys_margs_lock;
29
30static ssize_t id_show(struct gfs2_sbd *sdp, char *buf)
31{
32 return sprintf(buf, "%s\n", sdp->sd_vfs->s_id);
33}
34
35static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
36{
37 return sprintf(buf, "%s\n", sdp->sd_fsname);
38}
39
40static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
41{
42 unsigned int count;
43
Steven Whitehousef55ab262006-02-21 12:51:39 +000044 mutex_lock(&sdp->sd_freeze_lock);
David Teiglandb3b94fa2006-01-16 16:50:04 +000045 count = sdp->sd_freeze_count;
Steven Whitehousef55ab262006-02-21 12:51:39 +000046 mutex_unlock(&sdp->sd_freeze_lock);
David Teiglandb3b94fa2006-01-16 16:50:04 +000047
48 return sprintf(buf, "%u\n", count);
49}
50
51static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
52{
53 ssize_t ret = len;
54 int error = 0;
55 int n = simple_strtol(buf, NULL, 0);
56
57 if (!capable(CAP_SYS_ADMIN))
58 return -EACCES;
59
60 switch (n) {
61 case 0:
62 gfs2_unfreeze_fs(sdp);
63 break;
64 case 1:
65 error = gfs2_freeze_fs(sdp);
66 break;
67 default:
68 ret = -EINVAL;
69 }
70
71 if (error)
72 fs_warn(sdp, "freeze %d error %d", n, error);
73
74 return ret;
75}
76
77static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf)
78{
79 unsigned int b = test_bit(SDF_SHUTDOWN, &sdp->sd_flags);
80 return sprintf(buf, "%u\n", b);
81}
82
83static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
84{
85 if (!capable(CAP_SYS_ADMIN))
86 return -EACCES;
87
88 if (simple_strtol(buf, NULL, 0) != 1)
89 return -EINVAL;
90
91 gfs2_lm_withdraw(sdp,
92 "GFS2: fsid=%s: withdrawing from cluster at user's request\n",
93 sdp->sd_fsname);
94 return len;
95}
96
97static ssize_t statfs_sync_store(struct gfs2_sbd *sdp, const char *buf,
98 size_t len)
99{
100 if (!capable(CAP_SYS_ADMIN))
101 return -EACCES;
102
103 if (simple_strtol(buf, NULL, 0) != 1)
104 return -EINVAL;
105
106 gfs2_statfs_sync(sdp);
107 return len;
108}
109
110static ssize_t shrink_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
111{
112 if (!capable(CAP_SYS_ADMIN))
113 return -EACCES;
114
115 if (simple_strtol(buf, NULL, 0) != 1)
116 return -EINVAL;
117
118 gfs2_gl_hash_clear(sdp, NO_WAIT);
119 return len;
120}
121
122static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf,
123 size_t len)
124{
125 if (!capable(CAP_SYS_ADMIN))
126 return -EACCES;
127
128 if (simple_strtol(buf, NULL, 0) != 1)
129 return -EINVAL;
130
131 gfs2_quota_sync(sdp);
132 return len;
133}
134
135static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf,
136 size_t len)
137{
138 uint32_t id;
139
140 if (!capable(CAP_SYS_ADMIN))
141 return -EACCES;
142
143 id = simple_strtoul(buf, NULL, 0);
144
145 gfs2_quota_refresh(sdp, 1, id);
146 return len;
147}
148
149static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf,
150 size_t len)
151{
152 uint32_t id;
153
154 if (!capable(CAP_SYS_ADMIN))
155 return -EACCES;
156
157 id = simple_strtoul(buf, NULL, 0);
158
159 gfs2_quota_refresh(sdp, 0, id);
160 return len;
161}
162
163struct gfs2_attr {
164 struct attribute attr;
165 ssize_t (*show)(struct gfs2_sbd *, char *);
166 ssize_t (*store)(struct gfs2_sbd *, const char *, size_t);
167};
168
169#define GFS2_ATTR(name, mode, show, store) \
170static struct gfs2_attr gfs2_attr_##name = __ATTR(name, mode, show, store)
171
172GFS2_ATTR(id, 0444, id_show, NULL);
173GFS2_ATTR(fsname, 0444, fsname_show, NULL);
174GFS2_ATTR(freeze, 0644, freeze_show, freeze_store);
175GFS2_ATTR(shrink, 0200, NULL, shrink_store);
176GFS2_ATTR(withdraw, 0644, withdraw_show, withdraw_store);
177GFS2_ATTR(statfs_sync, 0200, NULL, statfs_sync_store);
178GFS2_ATTR(quota_sync, 0200, NULL, quota_sync_store);
179GFS2_ATTR(quota_refresh_user, 0200, NULL, quota_refresh_user_store);
180GFS2_ATTR(quota_refresh_group, 0200, NULL, quota_refresh_group_store);
181
182static struct attribute *gfs2_attrs[] = {
183 &gfs2_attr_id.attr,
184 &gfs2_attr_fsname.attr,
185 &gfs2_attr_freeze.attr,
186 &gfs2_attr_shrink.attr,
187 &gfs2_attr_withdraw.attr,
188 &gfs2_attr_statfs_sync.attr,
189 &gfs2_attr_quota_sync.attr,
190 &gfs2_attr_quota_refresh_user.attr,
191 &gfs2_attr_quota_refresh_group.attr,
192 NULL,
193};
194
195static ssize_t gfs2_attr_show(struct kobject *kobj, struct attribute *attr,
196 char *buf)
197{
198 struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
199 struct gfs2_attr *a = container_of(attr, struct gfs2_attr, attr);
200 return a->show ? a->show(sdp, buf) : 0;
201}
202
203static ssize_t gfs2_attr_store(struct kobject *kobj, struct attribute *attr,
204 const char *buf, size_t len)
205{
206 struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
207 struct gfs2_attr *a = container_of(attr, struct gfs2_attr, attr);
208 return a->store ? a->store(sdp, buf, len) : len;
209}
210
211static struct sysfs_ops gfs2_attr_ops = {
212 .show = gfs2_attr_show,
213 .store = gfs2_attr_store,
214};
215
216static struct kobj_type gfs2_ktype = {
217 .default_attrs = gfs2_attrs,
218 .sysfs_ops = &gfs2_attr_ops,
219};
220
221static struct kset gfs2_kset = {
222 .subsys = &fs_subsys,
223 .kobj = {.name = "gfs2",},
224 .ktype = &gfs2_ktype,
225};
226
227/*
228 * display struct lm_lockstruct fields
229 */
230
231struct lockstruct_attr {
232 struct attribute attr;
233 ssize_t (*show)(struct gfs2_sbd *, char *);
234};
235
236#define LOCKSTRUCT_ATTR(name, fmt) \
237static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
238{ \
239 return sprintf(buf, fmt, sdp->sd_lockstruct.ls_##name); \
240} \
241static struct lockstruct_attr lockstruct_attr_##name = __ATTR_RO(name)
242
243LOCKSTRUCT_ATTR(jid, "%u\n");
244LOCKSTRUCT_ATTR(first, "%u\n");
245LOCKSTRUCT_ATTR(lvb_size, "%u\n");
246LOCKSTRUCT_ATTR(flags, "%d\n");
247
248static struct attribute *lockstruct_attrs[] = {
249 &lockstruct_attr_jid.attr,
250 &lockstruct_attr_first.attr,
251 &lockstruct_attr_lvb_size.attr,
252 &lockstruct_attr_flags.attr,
253 NULL
254};
255
256/*
257 * display struct gfs2_args fields
258 */
259
260struct args_attr {
261 struct attribute attr;
262 ssize_t (*show)(struct gfs2_sbd *, char *);
263};
264
265#define ARGS_ATTR(name, fmt) \
266static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
267{ \
268 return sprintf(buf, fmt, sdp->sd_args.ar_##name); \
269} \
270static struct args_attr args_attr_##name = __ATTR_RO(name)
271
272ARGS_ATTR(lockproto, "%s\n");
273ARGS_ATTR(locktable, "%s\n");
274ARGS_ATTR(hostdata, "%s\n");
275ARGS_ATTR(spectator, "%d\n");
276ARGS_ATTR(ignore_local_fs, "%d\n");
277ARGS_ATTR(localcaching, "%d\n");
278ARGS_ATTR(localflocks, "%d\n");
279ARGS_ATTR(debug, "%d\n");
280ARGS_ATTR(upgrade, "%d\n");
281ARGS_ATTR(num_glockd, "%u\n");
282ARGS_ATTR(posix_acl, "%d\n");
283ARGS_ATTR(quota, "%u\n");
284ARGS_ATTR(suiddir, "%d\n");
285ARGS_ATTR(data, "%d\n");
286
287/* one oddball doesn't fit the macro mold */
288static ssize_t noatime_show(struct gfs2_sbd *sdp, char *buf)
289{
290 return sprintf(buf, "%d\n", !!test_bit(SDF_NOATIME, &sdp->sd_flags));
291}
292static struct args_attr args_attr_noatime = __ATTR_RO(noatime);
293
294static struct attribute *args_attrs[] = {
295 &args_attr_lockproto.attr,
296 &args_attr_locktable.attr,
297 &args_attr_hostdata.attr,
298 &args_attr_spectator.attr,
299 &args_attr_ignore_local_fs.attr,
300 &args_attr_localcaching.attr,
301 &args_attr_localflocks.attr,
302 &args_attr_debug.attr,
303 &args_attr_upgrade.attr,
304 &args_attr_num_glockd.attr,
305 &args_attr_posix_acl.attr,
306 &args_attr_quota.attr,
307 &args_attr_suiddir.attr,
308 &args_attr_data.attr,
309 &args_attr_noatime.attr,
310 NULL
311};
312
313/*
314 * display counters from superblock
315 */
316
317struct counters_attr {
318 struct attribute attr;
319 ssize_t (*show)(struct gfs2_sbd *, char *);
320};
321
322#define COUNTERS_ATTR_GENERAL(name, fmt, val) \
323static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
324{ \
325 return sprintf(buf, fmt, val); \
326} \
327static struct counters_attr counters_attr_##name = __ATTR_RO(name)
328
329#define COUNTERS_ATTR_SIMPLE(name, fmt) \
330 COUNTERS_ATTR_GENERAL(name, fmt, sdp->sd_##name)
331
332#define COUNTERS_ATTR_ATOMIC(name, fmt) \
333 COUNTERS_ATTR_GENERAL(name, fmt, (unsigned int)atomic_read(&sdp->sd_##name))
334
335COUNTERS_ATTR_ATOMIC(glock_count, "%u\n");
336COUNTERS_ATTR_ATOMIC(glock_held_count, "%u\n");
337COUNTERS_ATTR_ATOMIC(inode_count, "%u\n");
338COUNTERS_ATTR_ATOMIC(bufdata_count, "%u\n");
339COUNTERS_ATTR_ATOMIC(unlinked_count, "%u\n");
340COUNTERS_ATTR_ATOMIC(quota_count, "%u\n");
341COUNTERS_ATTR_SIMPLE(log_num_gl, "%u\n");
342COUNTERS_ATTR_SIMPLE(log_num_buf, "%u\n");
343COUNTERS_ATTR_SIMPLE(log_num_revoke, "%u\n");
344COUNTERS_ATTR_SIMPLE(log_num_rg, "%u\n");
345COUNTERS_ATTR_SIMPLE(log_num_databuf, "%u\n");
346COUNTERS_ATTR_SIMPLE(log_blks_free, "%u\n");
347COUNTERS_ATTR_GENERAL(jd_blocks, "%u\n", sdp->sd_jdesc->jd_blocks);
348COUNTERS_ATTR_ATOMIC(reclaim_count, "%u\n");
349COUNTERS_ATTR_SIMPLE(log_wraps, "%llu\n");
350COUNTERS_ATTR_ATOMIC(fh2dentry_misses, "%u\n");
351COUNTERS_ATTR_ATOMIC(reclaimed, "%u\n");
352COUNTERS_ATTR_ATOMIC(log_flush_incore, "%u\n");
353COUNTERS_ATTR_ATOMIC(log_flush_ondisk, "%u\n");
354COUNTERS_ATTR_ATOMIC(glock_nq_calls, "%u\n");
355COUNTERS_ATTR_ATOMIC(glock_dq_calls, "%u\n");
356COUNTERS_ATTR_ATOMIC(glock_prefetch_calls, "%u\n");
357COUNTERS_ATTR_ATOMIC(lm_lock_calls, "%u\n");
358COUNTERS_ATTR_ATOMIC(lm_unlock_calls, "%u\n");
359COUNTERS_ATTR_ATOMIC(lm_callbacks, "%u\n");
360COUNTERS_ATTR_ATOMIC(ops_address, "%u\n");
361COUNTERS_ATTR_ATOMIC(ops_dentry, "%u\n");
362COUNTERS_ATTR_ATOMIC(ops_export, "%u\n");
363COUNTERS_ATTR_ATOMIC(ops_file, "%u\n");
364COUNTERS_ATTR_ATOMIC(ops_inode, "%u\n");
365COUNTERS_ATTR_ATOMIC(ops_super, "%u\n");
366COUNTERS_ATTR_ATOMIC(ops_vm, "%u\n");
367
368static struct attribute *counters_attrs[] = {
369 &counters_attr_glock_count.attr,
370 &counters_attr_glock_held_count.attr,
371 &counters_attr_inode_count.attr,
372 &counters_attr_bufdata_count.attr,
373 &counters_attr_unlinked_count.attr,
374 &counters_attr_quota_count.attr,
375 &counters_attr_log_num_gl.attr,
376 &counters_attr_log_num_buf.attr,
377 &counters_attr_log_num_revoke.attr,
378 &counters_attr_log_num_rg.attr,
379 &counters_attr_log_num_databuf.attr,
380 &counters_attr_log_blks_free.attr,
381 &counters_attr_jd_blocks.attr,
382 &counters_attr_reclaim_count.attr,
383 &counters_attr_log_wraps.attr,
384 &counters_attr_fh2dentry_misses.attr,
385 &counters_attr_reclaimed.attr,
386 &counters_attr_log_flush_incore.attr,
387 &counters_attr_log_flush_ondisk.attr,
388 &counters_attr_glock_nq_calls.attr,
389 &counters_attr_glock_dq_calls.attr,
390 &counters_attr_glock_prefetch_calls.attr,
391 &counters_attr_lm_lock_calls.attr,
392 &counters_attr_lm_unlock_calls.attr,
393 &counters_attr_lm_callbacks.attr,
394 &counters_attr_ops_address.attr,
395 &counters_attr_ops_dentry.attr,
396 &counters_attr_ops_export.attr,
397 &counters_attr_ops_file.attr,
398 &counters_attr_ops_inode.attr,
399 &counters_attr_ops_super.attr,
400 &counters_attr_ops_vm.attr,
401 NULL
402};
403
404/*
405 * get and set struct gfs2_tune fields
406 */
407
408static ssize_t quota_scale_show(struct gfs2_sbd *sdp, char *buf)
409{
410 return sprintf(buf, "%u %u\n", sdp->sd_tune.gt_quota_scale_num,
411 sdp->sd_tune.gt_quota_scale_den);
412}
413
414static ssize_t quota_scale_store(struct gfs2_sbd *sdp, const char *buf,
415 size_t len)
416{
417 struct gfs2_tune *gt = &sdp->sd_tune;
418 unsigned int x, y;
419
420 if (!capable(CAP_SYS_ADMIN))
421 return -EACCES;
422
423 if (sscanf(buf, "%u %u", &x, &y) != 2 || !y)
424 return -EINVAL;
425
426 spin_lock(&gt->gt_spin);
427 gt->gt_quota_scale_num = x;
428 gt->gt_quota_scale_den = y;
429 spin_unlock(&gt->gt_spin);
430 return len;
431}
432
433static ssize_t tune_set(struct gfs2_sbd *sdp, unsigned int *field,
434 int check_zero, const char *buf, size_t len)
435{
436 struct gfs2_tune *gt = &sdp->sd_tune;
437 unsigned int x;
438
439 if (!capable(CAP_SYS_ADMIN))
440 return -EACCES;
441
442 x = simple_strtoul(buf, NULL, 0);
443
444 if (check_zero && !x)
445 return -EINVAL;
446
447 spin_lock(&gt->gt_spin);
448 *field = x;
449 spin_unlock(&gt->gt_spin);
450 return len;
451}
452
453struct tune_attr {
454 struct attribute attr;
455 ssize_t (*show)(struct gfs2_sbd *, char *);
456 ssize_t (*store)(struct gfs2_sbd *, const char *, size_t);
457};
458
459#define TUNE_ATTR_3(name, show, store) \
460static struct tune_attr tune_attr_##name = __ATTR(name, 0644, show, store)
461
462#define TUNE_ATTR_2(name, store) \
463static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
464{ \
465 return sprintf(buf, "%u\n", sdp->sd_tune.gt_##name); \
466} \
467TUNE_ATTR_3(name, name##_show, store)
468
469#define TUNE_ATTR(name, check_zero) \
470static ssize_t name##_store(struct gfs2_sbd *sdp, const char *buf, size_t len)\
471{ \
472 return tune_set(sdp, &sdp->sd_tune.gt_##name, check_zero, buf, len); \
473} \
474TUNE_ATTR_2(name, name##_store)
475
476#define TUNE_ATTR_DAEMON(name, process) \
477static ssize_t name##_store(struct gfs2_sbd *sdp, const char *buf, size_t len)\
478{ \
479 ssize_t r = tune_set(sdp, &sdp->sd_tune.gt_##name, 1, buf, len); \
480 wake_up_process(sdp->sd_##process); \
481 return r; \
482} \
483TUNE_ATTR_2(name, name##_store)
484
485TUNE_ATTR(ilimit, 0);
486TUNE_ATTR(ilimit_tries, 0);
487TUNE_ATTR(ilimit_min, 0);
488TUNE_ATTR(demote_secs, 0);
489TUNE_ATTR(incore_log_blocks, 0);
490TUNE_ATTR(log_flush_secs, 0);
491TUNE_ATTR(jindex_refresh_secs, 0);
492TUNE_ATTR(quota_warn_period, 0);
493TUNE_ATTR(quota_quantum, 0);
494TUNE_ATTR(atime_quantum, 0);
495TUNE_ATTR(max_readahead, 0);
496TUNE_ATTR(complain_secs, 0);
497TUNE_ATTR(reclaim_limit, 0);
498TUNE_ATTR(prefetch_secs, 0);
499TUNE_ATTR(statfs_slow, 0);
500TUNE_ATTR(new_files_jdata, 0);
501TUNE_ATTR(new_files_directio, 0);
502TUNE_ATTR(quota_simul_sync, 1);
503TUNE_ATTR(quota_cache_secs, 1);
504TUNE_ATTR(max_atomic_write, 1);
505TUNE_ATTR(stall_secs, 1);
506TUNE_ATTR(entries_per_readdir, 1);
507TUNE_ATTR(greedy_default, 1);
508TUNE_ATTR(greedy_quantum, 1);
509TUNE_ATTR(greedy_max, 1);
510TUNE_ATTR(statfs_quantum, 1);
511TUNE_ATTR_DAEMON(scand_secs, scand_process);
512TUNE_ATTR_DAEMON(recoverd_secs, recoverd_process);
513TUNE_ATTR_DAEMON(logd_secs, logd_process);
514TUNE_ATTR_DAEMON(quotad_secs, quotad_process);
515TUNE_ATTR_DAEMON(inoded_secs, inoded_process);
516TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store);
517
518static struct attribute *tune_attrs[] = {
519 &tune_attr_ilimit.attr,
520 &tune_attr_ilimit_tries.attr,
521 &tune_attr_ilimit_min.attr,
522 &tune_attr_demote_secs.attr,
523 &tune_attr_incore_log_blocks.attr,
524 &tune_attr_log_flush_secs.attr,
525 &tune_attr_jindex_refresh_secs.attr,
526 &tune_attr_quota_warn_period.attr,
527 &tune_attr_quota_quantum.attr,
528 &tune_attr_atime_quantum.attr,
529 &tune_attr_max_readahead.attr,
530 &tune_attr_complain_secs.attr,
531 &tune_attr_reclaim_limit.attr,
532 &tune_attr_prefetch_secs.attr,
533 &tune_attr_statfs_slow.attr,
534 &tune_attr_quota_simul_sync.attr,
535 &tune_attr_quota_cache_secs.attr,
536 &tune_attr_max_atomic_write.attr,
537 &tune_attr_stall_secs.attr,
538 &tune_attr_entries_per_readdir.attr,
539 &tune_attr_greedy_default.attr,
540 &tune_attr_greedy_quantum.attr,
541 &tune_attr_greedy_max.attr,
542 &tune_attr_statfs_quantum.attr,
543 &tune_attr_scand_secs.attr,
544 &tune_attr_recoverd_secs.attr,
545 &tune_attr_logd_secs.attr,
546 &tune_attr_quotad_secs.attr,
547 &tune_attr_inoded_secs.attr,
548 &tune_attr_quota_scale.attr,
549 &tune_attr_new_files_jdata.attr,
550 &tune_attr_new_files_directio.attr,
551 NULL
552};
553
554static struct attribute_group lockstruct_group = {
555 .name = "lockstruct",
556 .attrs = lockstruct_attrs
557};
558
559static struct attribute_group counters_group = {
560 .name = "counters",
561 .attrs = counters_attrs
562};
563
564static struct attribute_group args_group = {
565 .name = "args",
566 .attrs = args_attrs
567};
568
569static struct attribute_group tune_group = {
570 .name = "tune",
571 .attrs = tune_attrs
572};
573
574int gfs2_sys_fs_add(struct gfs2_sbd *sdp)
575{
576 int error;
577
578 sdp->sd_kobj.kset = &gfs2_kset;
579 sdp->sd_kobj.ktype = &gfs2_ktype;
580
581 error = kobject_set_name(&sdp->sd_kobj, "%s", sdp->sd_table_name);
582 if (error)
583 goto fail;
584
585 error = kobject_register(&sdp->sd_kobj);
586 if (error)
587 goto fail;
588
589 error = sysfs_create_group(&sdp->sd_kobj, &lockstruct_group);
590 if (error)
591 goto fail_reg;
592
593 error = sysfs_create_group(&sdp->sd_kobj, &counters_group);
594 if (error)
595 goto fail_lockstruct;
596
597 error = sysfs_create_group(&sdp->sd_kobj, &args_group);
598 if (error)
599 goto fail_counters;
600
601 error = sysfs_create_group(&sdp->sd_kobj, &tune_group);
602 if (error)
603 goto fail_args;
604
605 return 0;
606
607 fail_args:
608 sysfs_remove_group(&sdp->sd_kobj, &args_group);
609 fail_counters:
610 sysfs_remove_group(&sdp->sd_kobj, &counters_group);
611 fail_lockstruct:
612 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group);
613 fail_reg:
614 kobject_unregister(&sdp->sd_kobj);
615 fail:
616 return error;
617}
618
619void gfs2_sys_fs_del(struct gfs2_sbd *sdp)
620{
621 sysfs_remove_group(&sdp->sd_kobj, &tune_group);
622 sysfs_remove_group(&sdp->sd_kobj, &args_group);
623 sysfs_remove_group(&sdp->sd_kobj, &counters_group);
624 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group);
625 kobject_unregister(&sdp->sd_kobj);
626}
627
628int gfs2_sys_init(void)
629{
630 gfs2_sys_margs = NULL;
631 spin_lock_init(&gfs2_sys_margs_lock);
632 return kset_register(&gfs2_kset);
633}
634
635void gfs2_sys_uninit(void)
636{
637 kfree(gfs2_sys_margs);
638 kset_unregister(&gfs2_kset);
639}
640