diff options
Diffstat (limited to 'fs/gfs2/sys.c')
-rw-r--r-- | fs/gfs2/sys.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 446329728d52..54fd98425991 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -8,7 +8,6 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
11 | #include <linux/slab.h> | ||
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
14 | #include <linux/buffer_head.h> | 13 | #include <linux/buffer_head.h> |
@@ -49,7 +48,7 @@ static ssize_t gfs2_attr_store(struct kobject *kobj, struct attribute *attr, | |||
49 | return a->store ? a->store(sdp, buf, len) : len; | 48 | return a->store ? a->store(sdp, buf, len) : len; |
50 | } | 49 | } |
51 | 50 | ||
52 | static struct sysfs_ops gfs2_attr_ops = { | 51 | static const struct sysfs_ops gfs2_attr_ops = { |
53 | .show = gfs2_attr_show, | 52 | .show = gfs2_attr_show, |
54 | .store = gfs2_attr_store, | 53 | .store = gfs2_attr_store, |
55 | }; | 54 | }; |
@@ -85,11 +84,7 @@ static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf) | |||
85 | buf[0] = '\0'; | 84 | buf[0] = '\0'; |
86 | if (!gfs2_uuid_valid(uuid)) | 85 | if (!gfs2_uuid_valid(uuid)) |
87 | return 0; | 86 | return 0; |
88 | return snprintf(buf, PAGE_SIZE, "%02X%02X%02X%02X-%02X%02X-" | 87 | return snprintf(buf, PAGE_SIZE, "%pUB\n", uuid); |
89 | "%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X\n", | ||
90 | uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], | ||
91 | uuid[6], uuid[7], uuid[8], uuid[9], uuid[10], uuid[11], | ||
92 | uuid[12], uuid[13], uuid[14], uuid[15]); | ||
93 | } | 88 | } |
94 | 89 | ||
95 | static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf) | 90 | static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf) |
@@ -158,7 +153,7 @@ static ssize_t statfs_sync_store(struct gfs2_sbd *sdp, const char *buf, | |||
158 | if (simple_strtol(buf, NULL, 0) != 1) | 153 | if (simple_strtol(buf, NULL, 0) != 1) |
159 | return -EINVAL; | 154 | return -EINVAL; |
160 | 155 | ||
161 | gfs2_statfs_sync(sdp); | 156 | gfs2_statfs_sync(sdp->sd_vfs, 0); |
162 | return len; | 157 | return len; |
163 | } | 158 | } |
164 | 159 | ||
@@ -171,13 +166,14 @@ static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf, | |||
171 | if (simple_strtol(buf, NULL, 0) != 1) | 166 | if (simple_strtol(buf, NULL, 0) != 1) |
172 | return -EINVAL; | 167 | return -EINVAL; |
173 | 168 | ||
174 | gfs2_quota_sync(sdp); | 169 | gfs2_quota_sync(sdp->sd_vfs, 0, 1); |
175 | return len; | 170 | return len; |
176 | } | 171 | } |
177 | 172 | ||
178 | static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf, | 173 | static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf, |
179 | size_t len) | 174 | size_t len) |
180 | { | 175 | { |
176 | int error; | ||
181 | u32 id; | 177 | u32 id; |
182 | 178 | ||
183 | if (!capable(CAP_SYS_ADMIN)) | 179 | if (!capable(CAP_SYS_ADMIN)) |
@@ -185,13 +181,14 @@ static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf, | |||
185 | 181 | ||
186 | id = simple_strtoul(buf, NULL, 0); | 182 | id = simple_strtoul(buf, NULL, 0); |
187 | 183 | ||
188 | gfs2_quota_refresh(sdp, 1, id); | 184 | error = gfs2_quota_refresh(sdp, 1, id); |
189 | return len; | 185 | return error ? error : len; |
190 | } | 186 | } |
191 | 187 | ||
192 | static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf, | 188 | static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf, |
193 | size_t len) | 189 | size_t len) |
194 | { | 190 | { |
191 | int error; | ||
195 | u32 id; | 192 | u32 id; |
196 | 193 | ||
197 | if (!capable(CAP_SYS_ADMIN)) | 194 | if (!capable(CAP_SYS_ADMIN)) |
@@ -199,8 +196,8 @@ static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf, | |||
199 | 196 | ||
200 | id = simple_strtoul(buf, NULL, 0); | 197 | id = simple_strtoul(buf, NULL, 0); |
201 | 198 | ||
202 | gfs2_quota_refresh(sdp, 0, id); | 199 | error = gfs2_quota_refresh(sdp, 0, id); |
203 | return len; | 200 | return error ? error : len; |
204 | } | 201 | } |
205 | 202 | ||
206 | static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len) | 203 | static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len) |
@@ -480,7 +477,6 @@ TUNE_ATTR(complain_secs, 0); | |||
480 | TUNE_ATTR(statfs_slow, 0); | 477 | TUNE_ATTR(statfs_slow, 0); |
481 | TUNE_ATTR(new_files_jdata, 0); | 478 | TUNE_ATTR(new_files_jdata, 0); |
482 | TUNE_ATTR(quota_simul_sync, 1); | 479 | TUNE_ATTR(quota_simul_sync, 1); |
483 | TUNE_ATTR(stall_secs, 1); | ||
484 | TUNE_ATTR(statfs_quantum, 1); | 480 | TUNE_ATTR(statfs_quantum, 1); |
485 | TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store); | 481 | TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store); |
486 | 482 | ||
@@ -493,7 +489,6 @@ static struct attribute *tune_attrs[] = { | |||
493 | &tune_attr_complain_secs.attr, | 489 | &tune_attr_complain_secs.attr, |
494 | &tune_attr_statfs_slow.attr, | 490 | &tune_attr_statfs_slow.attr, |
495 | &tune_attr_quota_simul_sync.attr, | 491 | &tune_attr_quota_simul_sync.attr, |
496 | &tune_attr_stall_secs.attr, | ||
497 | &tune_attr_statfs_quantum.attr, | 492 | &tune_attr_statfs_quantum.attr, |
498 | &tune_attr_quota_scale.attr, | 493 | &tune_attr_quota_scale.attr, |
499 | &tune_attr_new_files_jdata.attr, | 494 | &tune_attr_new_files_jdata.attr, |
@@ -573,18 +568,12 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj, | |||
573 | add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name); | 568 | add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name); |
574 | if (!sdp->sd_args.ar_spectator) | 569 | if (!sdp->sd_args.ar_spectator) |
575 | add_uevent_var(env, "JOURNALID=%u", sdp->sd_lockstruct.ls_jid); | 570 | add_uevent_var(env, "JOURNALID=%u", sdp->sd_lockstruct.ls_jid); |
576 | if (gfs2_uuid_valid(uuid)) { | 571 | if (gfs2_uuid_valid(uuid)) |
577 | add_uevent_var(env, "UUID=%02X%02X%02X%02X-%02X%02X-%02X%02X-" | 572 | add_uevent_var(env, "UUID=%pUB", uuid); |
578 | "%02X%02X-%02X%02X%02X%02X%02X%02X", | ||
579 | uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], | ||
580 | uuid[5], uuid[6], uuid[7], uuid[8], uuid[9], | ||
581 | uuid[10], uuid[11], uuid[12], uuid[13], | ||
582 | uuid[14], uuid[15]); | ||
583 | } | ||
584 | return 0; | 573 | return 0; |
585 | } | 574 | } |
586 | 575 | ||
587 | static struct kset_uevent_ops gfs2_uevent_ops = { | 576 | static const struct kset_uevent_ops gfs2_uevent_ops = { |
588 | .uevent = gfs2_uevent, | 577 | .uevent = gfs2_uevent, |
589 | }; | 578 | }; |
590 | 579 | ||