hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/fs/xfs/xfs_sysfs.c
....@@ -10,9 +10,7 @@
1010 #include "xfs_log_format.h"
1111 #include "xfs_trans_resv.h"
1212 #include "xfs_sysfs.h"
13
-#include "xfs_log.h"
1413 #include "xfs_log_priv.h"
15
-#include "xfs_stats.h"
1614 #include "xfs_mount.h"
1715
1816 struct xfs_sysfs_attr {
....@@ -64,19 +62,6 @@
6462 .show = xfs_sysfs_object_show,
6563 .store = xfs_sysfs_object_store,
6664 };
67
-
68
-/*
69
- * xfs_mount kobject. The mp kobject also serves as the per-mount parent object
70
- * that is identified by the fsname under sysfs.
71
- */
72
-
73
-static inline struct xfs_mount *
74
-to_mp(struct kobject *kobject)
75
-{
76
- struct xfs_kobj *kobj = to_kobj(kobject);
77
-
78
- return container_of(kobj, struct xfs_mount, m_kobj);
79
-}
8065
8166 static struct attribute *xfs_mp_attrs[] = {
8267 NULL,
....@@ -183,10 +168,74 @@
183168 }
184169 XFS_SYSFS_ATTR_RW(mount_delay);
185170
171
+static ssize_t
172
+always_cow_store(
173
+ struct kobject *kobject,
174
+ const char *buf,
175
+ size_t count)
176
+{
177
+ ssize_t ret;
178
+
179
+ ret = kstrtobool(buf, &xfs_globals.always_cow);
180
+ if (ret < 0)
181
+ return ret;
182
+ return count;
183
+}
184
+
185
+static ssize_t
186
+always_cow_show(
187
+ struct kobject *kobject,
188
+ char *buf)
189
+{
190
+ return snprintf(buf, PAGE_SIZE, "%d\n", xfs_globals.always_cow);
191
+}
192
+XFS_SYSFS_ATTR_RW(always_cow);
193
+
194
+#ifdef DEBUG
195
+/*
196
+ * Override how many threads the parallel work queue is allowed to create.
197
+ * This has to be a debug-only global (instead of an errortag) because one of
198
+ * the main users of parallel workqueues is mount time quotacheck.
199
+ */
200
+STATIC ssize_t
201
+pwork_threads_store(
202
+ struct kobject *kobject,
203
+ const char *buf,
204
+ size_t count)
205
+{
206
+ int ret;
207
+ int val;
208
+
209
+ ret = kstrtoint(buf, 0, &val);
210
+ if (ret)
211
+ return ret;
212
+
213
+ if (val < -1 || val > num_possible_cpus())
214
+ return -EINVAL;
215
+
216
+ xfs_globals.pwork_threads = val;
217
+
218
+ return count;
219
+}
220
+
221
+STATIC ssize_t
222
+pwork_threads_show(
223
+ struct kobject *kobject,
224
+ char *buf)
225
+{
226
+ return snprintf(buf, PAGE_SIZE, "%d\n", xfs_globals.pwork_threads);
227
+}
228
+XFS_SYSFS_ATTR_RW(pwork_threads);
229
+#endif /* DEBUG */
230
+
186231 static struct attribute *xfs_dbg_attrs[] = {
187232 ATTR_LIST(bug_on_assert),
188233 ATTR_LIST(log_recovery_delay),
189234 ATTR_LIST(mount_delay),
235
+ ATTR_LIST(always_cow),
236
+#ifdef DEBUG
237
+ ATTR_LIST(pwork_threads),
238
+#endif
190239 NULL,
191240 };
192241