.. | .. |
---|
10 | 10 | #include "xfs_log_format.h" |
---|
11 | 11 | #include "xfs_trans_resv.h" |
---|
12 | 12 | #include "xfs_sysfs.h" |
---|
13 | | -#include "xfs_log.h" |
---|
14 | 13 | #include "xfs_log_priv.h" |
---|
15 | | -#include "xfs_stats.h" |
---|
16 | 14 | #include "xfs_mount.h" |
---|
17 | 15 | |
---|
18 | 16 | struct xfs_sysfs_attr { |
---|
.. | .. |
---|
64 | 62 | .show = xfs_sysfs_object_show, |
---|
65 | 63 | .store = xfs_sysfs_object_store, |
---|
66 | 64 | }; |
---|
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 | | -} |
---|
80 | 65 | |
---|
81 | 66 | static struct attribute *xfs_mp_attrs[] = { |
---|
82 | 67 | NULL, |
---|
.. | .. |
---|
183 | 168 | } |
---|
184 | 169 | XFS_SYSFS_ATTR_RW(mount_delay); |
---|
185 | 170 | |
---|
| 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 | + |
---|
186 | 231 | static struct attribute *xfs_dbg_attrs[] = { |
---|
187 | 232 | ATTR_LIST(bug_on_assert), |
---|
188 | 233 | ATTR_LIST(log_recovery_delay), |
---|
189 | 234 | ATTR_LIST(mount_delay), |
---|
| 235 | + ATTR_LIST(always_cow), |
---|
| 236 | +#ifdef DEBUG |
---|
| 237 | + ATTR_LIST(pwork_threads), |
---|
| 238 | +#endif |
---|
190 | 239 | NULL, |
---|
191 | 240 | }; |
---|
192 | 241 | |
---|