Dave Chinner | 0b61f8a | 2018-06-05 19:42:14 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Brian Foster | a31b1d3 | 2014-07-15 08:07:01 +1000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2014 Red Hat, Inc. |
| 4 | * All Rights Reserved. |
Brian Foster | a31b1d3 | 2014-07-15 08:07:01 +1000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include "xfs.h" |
Carlos Maiolino | 192852b | 2016-05-18 10:58:51 +1000 | [diff] [blame] | 8 | #include "xfs_shared.h" |
Brian Foster | 801cc4e | 2016-03-15 11:42:44 +1100 | [diff] [blame] | 9 | #include "xfs_format.h" |
Brian Foster | baff4e4 | 2014-07-15 08:07:29 +1000 | [diff] [blame] | 10 | #include "xfs_log_format.h" |
Brian Foster | 801cc4e | 2016-03-15 11:42:44 +1100 | [diff] [blame] | 11 | #include "xfs_trans_resv.h" |
Carlos Maiolino | 192852b | 2016-05-18 10:58:51 +1000 | [diff] [blame] | 12 | #include "xfs_sysfs.h" |
Dave Chinner | 0020a19 | 2021-08-10 18:00:44 -0700 | [diff] [blame] | 13 | #include "xfs_log.h" |
Brian Foster | baff4e4 | 2014-07-15 08:07:29 +1000 | [diff] [blame] | 14 | #include "xfs_log_priv.h" |
Brian Foster | 801cc4e | 2016-03-15 11:42:44 +1100 | [diff] [blame] | 15 | #include "xfs_mount.h" |
Brian Foster | a31b1d3 | 2014-07-15 08:07:01 +1000 | [diff] [blame] | 16 | |
| 17 | struct xfs_sysfs_attr { |
| 18 | struct attribute attr; |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 19 | ssize_t (*show)(struct kobject *kobject, char *buf); |
| 20 | ssize_t (*store)(struct kobject *kobject, const char *buf, |
| 21 | size_t count); |
Brian Foster | a31b1d3 | 2014-07-15 08:07:01 +1000 | [diff] [blame] | 22 | }; |
| 23 | |
| 24 | static inline struct xfs_sysfs_attr * |
| 25 | to_attr(struct attribute *attr) |
| 26 | { |
| 27 | return container_of(attr, struct xfs_sysfs_attr, attr); |
| 28 | } |
| 29 | |
| 30 | #define XFS_SYSFS_ATTR_RW(name) \ |
| 31 | static struct xfs_sysfs_attr xfs_sysfs_attr_##name = __ATTR_RW(name) |
| 32 | #define XFS_SYSFS_ATTR_RO(name) \ |
| 33 | static struct xfs_sysfs_attr xfs_sysfs_attr_##name = __ATTR_RO(name) |
Bill O'Donnell | bb230c1 | 2015-10-12 05:15:45 +1100 | [diff] [blame] | 34 | #define XFS_SYSFS_ATTR_WO(name) \ |
| 35 | static struct xfs_sysfs_attr xfs_sysfs_attr_##name = __ATTR_WO(name) |
Brian Foster | a31b1d3 | 2014-07-15 08:07:01 +1000 | [diff] [blame] | 36 | |
| 37 | #define ATTR_LIST(name) &xfs_sysfs_attr_##name.attr |
| 38 | |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 39 | STATIC ssize_t |
| 40 | xfs_sysfs_object_show( |
| 41 | struct kobject *kobject, |
| 42 | struct attribute *attr, |
| 43 | char *buf) |
| 44 | { |
| 45 | struct xfs_sysfs_attr *xfs_attr = to_attr(attr); |
| 46 | |
| 47 | return xfs_attr->show ? xfs_attr->show(kobject, buf) : 0; |
| 48 | } |
| 49 | |
| 50 | STATIC ssize_t |
| 51 | xfs_sysfs_object_store( |
| 52 | struct kobject *kobject, |
| 53 | struct attribute *attr, |
| 54 | const char *buf, |
| 55 | size_t count) |
| 56 | { |
| 57 | struct xfs_sysfs_attr *xfs_attr = to_attr(attr); |
| 58 | |
| 59 | return xfs_attr->store ? xfs_attr->store(kobject, buf, count) : 0; |
| 60 | } |
| 61 | |
| 62 | static const struct sysfs_ops xfs_sysfs_ops = { |
| 63 | .show = xfs_sysfs_object_show, |
| 64 | .store = xfs_sysfs_object_store, |
| 65 | }; |
| 66 | |
Brian Foster | 801cc4e | 2016-03-15 11:42:44 +1100 | [diff] [blame] | 67 | static struct attribute *xfs_mp_attrs[] = { |
Brian Foster | 801cc4e | 2016-03-15 11:42:44 +1100 | [diff] [blame] | 68 | NULL, |
| 69 | }; |
Greg Kroah-Hartman | 219aac5 | 2022-01-03 11:10:18 -0800 | [diff] [blame] | 70 | ATTRIBUTE_GROUPS(xfs_mp); |
Brian Foster | 801cc4e | 2016-03-15 11:42:44 +1100 | [diff] [blame] | 71 | |
| 72 | struct kobj_type xfs_mp_ktype = { |
| 73 | .release = xfs_sysfs_release, |
| 74 | .sysfs_ops = &xfs_sysfs_ops, |
Greg Kroah-Hartman | 219aac5 | 2022-01-03 11:10:18 -0800 | [diff] [blame] | 75 | .default_groups = xfs_mp_groups, |
Brian Foster | 801cc4e | 2016-03-15 11:42:44 +1100 | [diff] [blame] | 76 | }; |
| 77 | |
Brian Foster | 65b6573 | 2014-09-09 11:52:42 +1000 | [diff] [blame] | 78 | #ifdef DEBUG |
| 79 | /* debug */ |
| 80 | |
Brian Foster | 2e22717 | 2014-09-09 11:56:13 +1000 | [diff] [blame] | 81 | STATIC ssize_t |
Brian Foster | ccdab3d | 2017-06-14 21:29:12 -0700 | [diff] [blame] | 82 | bug_on_assert_store( |
| 83 | struct kobject *kobject, |
| 84 | const char *buf, |
| 85 | size_t count) |
| 86 | { |
| 87 | int ret; |
| 88 | int val; |
| 89 | |
| 90 | ret = kstrtoint(buf, 0, &val); |
| 91 | if (ret) |
| 92 | return ret; |
| 93 | |
| 94 | if (val == 1) |
| 95 | xfs_globals.bug_on_assert = true; |
| 96 | else if (val == 0) |
| 97 | xfs_globals.bug_on_assert = false; |
| 98 | else |
| 99 | return -EINVAL; |
| 100 | |
| 101 | return count; |
| 102 | } |
| 103 | |
| 104 | STATIC ssize_t |
| 105 | bug_on_assert_show( |
| 106 | struct kobject *kobject, |
| 107 | char *buf) |
| 108 | { |
Qing Wang | 53eb47b | 2021-10-14 09:37:03 -0700 | [diff] [blame] | 109 | return sysfs_emit(buf, "%d\n", xfs_globals.bug_on_assert); |
Brian Foster | ccdab3d | 2017-06-14 21:29:12 -0700 | [diff] [blame] | 110 | } |
| 111 | XFS_SYSFS_ATTR_RW(bug_on_assert); |
| 112 | |
| 113 | STATIC ssize_t |
Brian Foster | 2e22717 | 2014-09-09 11:56:13 +1000 | [diff] [blame] | 114 | log_recovery_delay_store( |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 115 | struct kobject *kobject, |
Brian Foster | 2e22717 | 2014-09-09 11:56:13 +1000 | [diff] [blame] | 116 | const char *buf, |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 117 | size_t count) |
Brian Foster | 2e22717 | 2014-09-09 11:56:13 +1000 | [diff] [blame] | 118 | { |
| 119 | int ret; |
| 120 | int val; |
| 121 | |
| 122 | ret = kstrtoint(buf, 0, &val); |
| 123 | if (ret) |
| 124 | return ret; |
| 125 | |
| 126 | if (val < 0 || val > 60) |
| 127 | return -EINVAL; |
| 128 | |
| 129 | xfs_globals.log_recovery_delay = val; |
| 130 | |
| 131 | return count; |
| 132 | } |
| 133 | |
| 134 | STATIC ssize_t |
| 135 | log_recovery_delay_show( |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 136 | struct kobject *kobject, |
| 137 | char *buf) |
Brian Foster | 2e22717 | 2014-09-09 11:56:13 +1000 | [diff] [blame] | 138 | { |
Qing Wang | 53eb47b | 2021-10-14 09:37:03 -0700 | [diff] [blame] | 139 | return sysfs_emit(buf, "%d\n", xfs_globals.log_recovery_delay); |
Brian Foster | 2e22717 | 2014-09-09 11:56:13 +1000 | [diff] [blame] | 140 | } |
| 141 | XFS_SYSFS_ATTR_RW(log_recovery_delay); |
| 142 | |
Dave Chinner | dae5cd8 | 2018-05-10 21:50:23 -0700 | [diff] [blame] | 143 | STATIC ssize_t |
| 144 | mount_delay_store( |
| 145 | struct kobject *kobject, |
| 146 | const char *buf, |
| 147 | size_t count) |
| 148 | { |
| 149 | int ret; |
| 150 | int val; |
| 151 | |
| 152 | ret = kstrtoint(buf, 0, &val); |
| 153 | if (ret) |
| 154 | return ret; |
| 155 | |
| 156 | if (val < 0 || val > 60) |
| 157 | return -EINVAL; |
| 158 | |
| 159 | xfs_globals.mount_delay = val; |
| 160 | |
| 161 | return count; |
| 162 | } |
| 163 | |
| 164 | STATIC ssize_t |
| 165 | mount_delay_show( |
| 166 | struct kobject *kobject, |
| 167 | char *buf) |
| 168 | { |
Qing Wang | 53eb47b | 2021-10-14 09:37:03 -0700 | [diff] [blame] | 169 | return sysfs_emit(buf, "%d\n", xfs_globals.mount_delay); |
Dave Chinner | dae5cd8 | 2018-05-10 21:50:23 -0700 | [diff] [blame] | 170 | } |
| 171 | XFS_SYSFS_ATTR_RW(mount_delay); |
| 172 | |
Christoph Hellwig | 66ae56a | 2019-02-18 09:38:49 -0800 | [diff] [blame] | 173 | static ssize_t |
| 174 | always_cow_store( |
| 175 | struct kobject *kobject, |
| 176 | const char *buf, |
| 177 | size_t count) |
| 178 | { |
| 179 | ssize_t ret; |
| 180 | |
| 181 | ret = kstrtobool(buf, &xfs_globals.always_cow); |
| 182 | if (ret < 0) |
| 183 | return ret; |
| 184 | return count; |
| 185 | } |
| 186 | |
| 187 | static ssize_t |
| 188 | always_cow_show( |
| 189 | struct kobject *kobject, |
| 190 | char *buf) |
| 191 | { |
Qing Wang | 53eb47b | 2021-10-14 09:37:03 -0700 | [diff] [blame] | 192 | return sysfs_emit(buf, "%d\n", xfs_globals.always_cow); |
Christoph Hellwig | 66ae56a | 2019-02-18 09:38:49 -0800 | [diff] [blame] | 193 | } |
| 194 | XFS_SYSFS_ATTR_RW(always_cow); |
| 195 | |
Darrick J. Wong | 4078671 | 2019-07-03 07:33:26 -0700 | [diff] [blame] | 196 | #ifdef DEBUG |
| 197 | /* |
| 198 | * Override how many threads the parallel work queue is allowed to create. |
| 199 | * This has to be a debug-only global (instead of an errortag) because one of |
| 200 | * the main users of parallel workqueues is mount time quotacheck. |
| 201 | */ |
| 202 | STATIC ssize_t |
| 203 | pwork_threads_store( |
| 204 | struct kobject *kobject, |
| 205 | const char *buf, |
| 206 | size_t count) |
| 207 | { |
| 208 | int ret; |
| 209 | int val; |
| 210 | |
| 211 | ret = kstrtoint(buf, 0, &val); |
| 212 | if (ret) |
| 213 | return ret; |
| 214 | |
| 215 | if (val < -1 || val > num_possible_cpus()) |
| 216 | return -EINVAL; |
| 217 | |
| 218 | xfs_globals.pwork_threads = val; |
| 219 | |
| 220 | return count; |
| 221 | } |
| 222 | |
| 223 | STATIC ssize_t |
| 224 | pwork_threads_show( |
| 225 | struct kobject *kobject, |
| 226 | char *buf) |
| 227 | { |
Qing Wang | 53eb47b | 2021-10-14 09:37:03 -0700 | [diff] [blame] | 228 | return sysfs_emit(buf, "%d\n", xfs_globals.pwork_threads); |
Darrick J. Wong | 4078671 | 2019-07-03 07:33:26 -0700 | [diff] [blame] | 229 | } |
| 230 | XFS_SYSFS_ATTR_RW(pwork_threads); |
Allison Henderson | 535e2f7 | 2022-05-11 17:01:22 +1000 | [diff] [blame] | 231 | |
| 232 | static ssize_t |
| 233 | larp_store( |
| 234 | struct kobject *kobject, |
| 235 | const char *buf, |
| 236 | size_t count) |
| 237 | { |
| 238 | ssize_t ret; |
| 239 | |
| 240 | ret = kstrtobool(buf, &xfs_globals.larp); |
| 241 | if (ret < 0) |
| 242 | return ret; |
| 243 | return count; |
| 244 | } |
| 245 | |
| 246 | STATIC ssize_t |
| 247 | larp_show( |
| 248 | struct kobject *kobject, |
| 249 | char *buf) |
| 250 | { |
| 251 | return snprintf(buf, PAGE_SIZE, "%d\n", xfs_globals.larp); |
| 252 | } |
| 253 | XFS_SYSFS_ATTR_RW(larp); |
Darrick J. Wong | 4078671 | 2019-07-03 07:33:26 -0700 | [diff] [blame] | 254 | #endif /* DEBUG */ |
| 255 | |
Brian Foster | 65b6573 | 2014-09-09 11:52:42 +1000 | [diff] [blame] | 256 | static struct attribute *xfs_dbg_attrs[] = { |
Brian Foster | ccdab3d | 2017-06-14 21:29:12 -0700 | [diff] [blame] | 257 | ATTR_LIST(bug_on_assert), |
Brian Foster | 2e22717 | 2014-09-09 11:56:13 +1000 | [diff] [blame] | 258 | ATTR_LIST(log_recovery_delay), |
Dave Chinner | dae5cd8 | 2018-05-10 21:50:23 -0700 | [diff] [blame] | 259 | ATTR_LIST(mount_delay), |
Christoph Hellwig | 66ae56a | 2019-02-18 09:38:49 -0800 | [diff] [blame] | 260 | ATTR_LIST(always_cow), |
Darrick J. Wong | 4078671 | 2019-07-03 07:33:26 -0700 | [diff] [blame] | 261 | #ifdef DEBUG |
| 262 | ATTR_LIST(pwork_threads), |
Allison Henderson | 535e2f7 | 2022-05-11 17:01:22 +1000 | [diff] [blame] | 263 | ATTR_LIST(larp), |
Darrick J. Wong | 4078671 | 2019-07-03 07:33:26 -0700 | [diff] [blame] | 264 | #endif |
Brian Foster | 65b6573 | 2014-09-09 11:52:42 +1000 | [diff] [blame] | 265 | NULL, |
| 266 | }; |
Greg Kroah-Hartman | 219aac5 | 2022-01-03 11:10:18 -0800 | [diff] [blame] | 267 | ATTRIBUTE_GROUPS(xfs_dbg); |
Brian Foster | 65b6573 | 2014-09-09 11:52:42 +1000 | [diff] [blame] | 268 | |
Brian Foster | 65b6573 | 2014-09-09 11:52:42 +1000 | [diff] [blame] | 269 | struct kobj_type xfs_dbg_ktype = { |
| 270 | .release = xfs_sysfs_release, |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 271 | .sysfs_ops = &xfs_sysfs_ops, |
Greg Kroah-Hartman | 219aac5 | 2022-01-03 11:10:18 -0800 | [diff] [blame] | 272 | .default_groups = xfs_dbg_groups, |
Brian Foster | 65b6573 | 2014-09-09 11:52:42 +1000 | [diff] [blame] | 273 | }; |
| 274 | |
| 275 | #endif /* DEBUG */ |
| 276 | |
Bill O'Donnell | bb230c1 | 2015-10-12 05:15:45 +1100 | [diff] [blame] | 277 | /* stats */ |
| 278 | |
Bill O'Donnell | 80529c4 | 2015-10-12 05:19:45 +1100 | [diff] [blame] | 279 | static inline struct xstats * |
| 280 | to_xstats(struct kobject *kobject) |
| 281 | { |
| 282 | struct xfs_kobj *kobj = to_kobj(kobject); |
| 283 | |
| 284 | return container_of(kobj, struct xstats, xs_kobj); |
| 285 | } |
| 286 | |
Bill O'Donnell | bb230c1 | 2015-10-12 05:15:45 +1100 | [diff] [blame] | 287 | STATIC ssize_t |
| 288 | stats_show( |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 289 | struct kobject *kobject, |
| 290 | char *buf) |
Bill O'Donnell | bb230c1 | 2015-10-12 05:15:45 +1100 | [diff] [blame] | 291 | { |
Bill O'Donnell | 80529c4 | 2015-10-12 05:19:45 +1100 | [diff] [blame] | 292 | struct xstats *stats = to_xstats(kobject); |
| 293 | |
| 294 | return xfs_stats_format(stats->xs_stats, buf); |
Bill O'Donnell | bb230c1 | 2015-10-12 05:15:45 +1100 | [diff] [blame] | 295 | } |
| 296 | XFS_SYSFS_ATTR_RO(stats); |
| 297 | |
| 298 | STATIC ssize_t |
| 299 | stats_clear_store( |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 300 | struct kobject *kobject, |
Bill O'Donnell | bb230c1 | 2015-10-12 05:15:45 +1100 | [diff] [blame] | 301 | const char *buf, |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 302 | size_t count) |
Bill O'Donnell | bb230c1 | 2015-10-12 05:15:45 +1100 | [diff] [blame] | 303 | { |
| 304 | int ret; |
| 305 | int val; |
Bill O'Donnell | 80529c4 | 2015-10-12 05:19:45 +1100 | [diff] [blame] | 306 | struct xstats *stats = to_xstats(kobject); |
Bill O'Donnell | bb230c1 | 2015-10-12 05:15:45 +1100 | [diff] [blame] | 307 | |
| 308 | ret = kstrtoint(buf, 0, &val); |
| 309 | if (ret) |
| 310 | return ret; |
| 311 | |
| 312 | if (val != 1) |
| 313 | return -EINVAL; |
Bill O'Donnell | 80529c4 | 2015-10-12 05:19:45 +1100 | [diff] [blame] | 314 | |
| 315 | xfs_stats_clearall(stats->xs_stats); |
Bill O'Donnell | bb230c1 | 2015-10-12 05:15:45 +1100 | [diff] [blame] | 316 | return count; |
| 317 | } |
| 318 | XFS_SYSFS_ATTR_WO(stats_clear); |
| 319 | |
| 320 | static struct attribute *xfs_stats_attrs[] = { |
| 321 | ATTR_LIST(stats), |
| 322 | ATTR_LIST(stats_clear), |
| 323 | NULL, |
| 324 | }; |
Greg Kroah-Hartman | 219aac5 | 2022-01-03 11:10:18 -0800 | [diff] [blame] | 325 | ATTRIBUTE_GROUPS(xfs_stats); |
Bill O'Donnell | bb230c1 | 2015-10-12 05:15:45 +1100 | [diff] [blame] | 326 | |
Bill O'Donnell | bb230c1 | 2015-10-12 05:15:45 +1100 | [diff] [blame] | 327 | struct kobj_type xfs_stats_ktype = { |
| 328 | .release = xfs_sysfs_release, |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 329 | .sysfs_ops = &xfs_sysfs_ops, |
Greg Kroah-Hartman | 219aac5 | 2022-01-03 11:10:18 -0800 | [diff] [blame] | 330 | .default_groups = xfs_stats_groups, |
Bill O'Donnell | bb230c1 | 2015-10-12 05:15:45 +1100 | [diff] [blame] | 331 | }; |
| 332 | |
Brian Foster | baff4e4 | 2014-07-15 08:07:29 +1000 | [diff] [blame] | 333 | /* xlog */ |
| 334 | |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 335 | static inline struct xlog * |
| 336 | to_xlog(struct kobject *kobject) |
| 337 | { |
| 338 | struct xfs_kobj *kobj = to_kobj(kobject); |
| 339 | |
| 340 | return container_of(kobj, struct xlog, l_kobj); |
| 341 | } |
| 342 | |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 343 | STATIC ssize_t |
| 344 | log_head_lsn_show( |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 345 | struct kobject *kobject, |
| 346 | char *buf) |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 347 | { |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 348 | int cycle; |
| 349 | int block; |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 350 | struct xlog *log = to_xlog(kobject); |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 351 | |
| 352 | spin_lock(&log->l_icloglock); |
| 353 | cycle = log->l_curr_cycle; |
| 354 | block = log->l_curr_block; |
| 355 | spin_unlock(&log->l_icloglock); |
| 356 | |
Qing Wang | 53eb47b | 2021-10-14 09:37:03 -0700 | [diff] [blame] | 357 | return sysfs_emit(buf, "%d:%d\n", cycle, block); |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 358 | } |
| 359 | XFS_SYSFS_ATTR_RO(log_head_lsn); |
| 360 | |
| 361 | STATIC ssize_t |
| 362 | log_tail_lsn_show( |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 363 | struct kobject *kobject, |
| 364 | char *buf) |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 365 | { |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 366 | int cycle; |
| 367 | int block; |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 368 | struct xlog *log = to_xlog(kobject); |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 369 | |
| 370 | xlog_crack_atomic_lsn(&log->l_tail_lsn, &cycle, &block); |
Qing Wang | 53eb47b | 2021-10-14 09:37:03 -0700 | [diff] [blame] | 371 | return sysfs_emit(buf, "%d:%d\n", cycle, block); |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 372 | } |
| 373 | XFS_SYSFS_ATTR_RO(log_tail_lsn); |
| 374 | |
| 375 | STATIC ssize_t |
| 376 | reserve_grant_head_show( |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 377 | struct kobject *kobject, |
| 378 | char *buf) |
| 379 | |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 380 | { |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 381 | int cycle; |
| 382 | int bytes; |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 383 | struct xlog *log = to_xlog(kobject); |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 384 | |
| 385 | xlog_crack_grant_head(&log->l_reserve_head.grant, &cycle, &bytes); |
Qing Wang | 53eb47b | 2021-10-14 09:37:03 -0700 | [diff] [blame] | 386 | return sysfs_emit(buf, "%d:%d\n", cycle, bytes); |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 387 | } |
| 388 | XFS_SYSFS_ATTR_RO(reserve_grant_head); |
| 389 | |
| 390 | STATIC ssize_t |
| 391 | write_grant_head_show( |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 392 | struct kobject *kobject, |
| 393 | char *buf) |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 394 | { |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 395 | int cycle; |
| 396 | int bytes; |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 397 | struct xlog *log = to_xlog(kobject); |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 398 | |
| 399 | xlog_crack_grant_head(&log->l_write_head.grant, &cycle, &bytes); |
Qing Wang | 53eb47b | 2021-10-14 09:37:03 -0700 | [diff] [blame] | 400 | return sysfs_emit(buf, "%d:%d\n", cycle, bytes); |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 401 | } |
| 402 | XFS_SYSFS_ATTR_RO(write_grant_head); |
| 403 | |
Brian Foster | baff4e4 | 2014-07-15 08:07:29 +1000 | [diff] [blame] | 404 | static struct attribute *xfs_log_attrs[] = { |
Brian Foster | 80d6d69 | 2014-07-15 08:07:48 +1000 | [diff] [blame] | 405 | ATTR_LIST(log_head_lsn), |
| 406 | ATTR_LIST(log_tail_lsn), |
| 407 | ATTR_LIST(reserve_grant_head), |
| 408 | ATTR_LIST(write_grant_head), |
Brian Foster | baff4e4 | 2014-07-15 08:07:29 +1000 | [diff] [blame] | 409 | NULL, |
| 410 | }; |
Greg Kroah-Hartman | 219aac5 | 2022-01-03 11:10:18 -0800 | [diff] [blame] | 411 | ATTRIBUTE_GROUPS(xfs_log); |
Brian Foster | baff4e4 | 2014-07-15 08:07:29 +1000 | [diff] [blame] | 412 | |
Brian Foster | baff4e4 | 2014-07-15 08:07:29 +1000 | [diff] [blame] | 413 | struct kobj_type xfs_log_ktype = { |
| 414 | .release = xfs_sysfs_release, |
Bill O'Donnell | a27c2640 | 2015-10-12 05:18:45 +1100 | [diff] [blame] | 415 | .sysfs_ops = &xfs_sysfs_ops, |
Greg Kroah-Hartman | 219aac5 | 2022-01-03 11:10:18 -0800 | [diff] [blame] | 416 | .default_groups = xfs_log_groups, |
Brian Foster | baff4e4 | 2014-07-15 08:07:29 +1000 | [diff] [blame] | 417 | }; |
Carlos Maiolino | 192852b | 2016-05-18 10:58:51 +1000 | [diff] [blame] | 418 | |
| 419 | /* |
| 420 | * Metadata IO error configuration |
| 421 | * |
| 422 | * The sysfs structure here is: |
| 423 | * ...xfs/<dev>/error/<class>/<errno>/<error_attrs> |
| 424 | * |
| 425 | * where <class> allows us to discriminate between data IO and metadata IO, |
| 426 | * and any other future type of IO (e.g. special inode or directory error |
| 427 | * handling) we care to support. |
| 428 | */ |
Carlos Maiolino | 192852b | 2016-05-18 10:58:51 +1000 | [diff] [blame] | 429 | static inline struct xfs_error_cfg * |
| 430 | to_error_cfg(struct kobject *kobject) |
| 431 | { |
| 432 | struct xfs_kobj *kobj = to_kobj(kobject); |
| 433 | return container_of(kobj, struct xfs_error_cfg, kobj); |
| 434 | } |
| 435 | |
Carlos Maiolino | e6b3bb7 | 2016-05-18 11:11:27 +1000 | [diff] [blame] | 436 | static inline struct xfs_mount * |
| 437 | err_to_mp(struct kobject *kobject) |
| 438 | { |
| 439 | struct xfs_kobj *kobj = to_kobj(kobject); |
| 440 | return container_of(kobj, struct xfs_mount, m_error_kobj); |
| 441 | } |
| 442 | |
Carlos Maiolino | a5ea70d | 2016-05-18 11:08:15 +1000 | [diff] [blame] | 443 | static ssize_t |
| 444 | max_retries_show( |
| 445 | struct kobject *kobject, |
| 446 | char *buf) |
| 447 | { |
Eric Sandeen | 7716981 | 2016-09-14 07:51:30 +1000 | [diff] [blame] | 448 | int retries; |
Carlos Maiolino | a5ea70d | 2016-05-18 11:08:15 +1000 | [diff] [blame] | 449 | struct xfs_error_cfg *cfg = to_error_cfg(kobject); |
| 450 | |
Carlos Maiolino | ff97f23 | 2017-01-03 20:34:17 -0800 | [diff] [blame] | 451 | if (cfg->max_retries == XFS_ERR_RETRY_FOREVER) |
Eric Sandeen | 7716981 | 2016-09-14 07:51:30 +1000 | [diff] [blame] | 452 | retries = -1; |
| 453 | else |
| 454 | retries = cfg->max_retries; |
| 455 | |
Qing Wang | 53eb47b | 2021-10-14 09:37:03 -0700 | [diff] [blame] | 456 | return sysfs_emit(buf, "%d\n", retries); |
Carlos Maiolino | a5ea70d | 2016-05-18 11:08:15 +1000 | [diff] [blame] | 457 | } |
| 458 | |
| 459 | static ssize_t |
| 460 | max_retries_store( |
| 461 | struct kobject *kobject, |
| 462 | const char *buf, |
| 463 | size_t count) |
| 464 | { |
| 465 | struct xfs_error_cfg *cfg = to_error_cfg(kobject); |
| 466 | int ret; |
| 467 | int val; |
| 468 | |
| 469 | ret = kstrtoint(buf, 0, &val); |
| 470 | if (ret) |
| 471 | return ret; |
| 472 | |
| 473 | if (val < -1) |
| 474 | return -EINVAL; |
| 475 | |
Eric Sandeen | 7716981 | 2016-09-14 07:51:30 +1000 | [diff] [blame] | 476 | if (val == -1) |
Carlos Maiolino | ff97f23 | 2017-01-03 20:34:17 -0800 | [diff] [blame] | 477 | cfg->max_retries = XFS_ERR_RETRY_FOREVER; |
Eric Sandeen | 7716981 | 2016-09-14 07:51:30 +1000 | [diff] [blame] | 478 | else |
| 479 | cfg->max_retries = val; |
Carlos Maiolino | a5ea70d | 2016-05-18 11:08:15 +1000 | [diff] [blame] | 480 | return count; |
| 481 | } |
| 482 | XFS_SYSFS_ATTR_RW(max_retries); |
| 483 | |
| 484 | static ssize_t |
| 485 | retry_timeout_seconds_show( |
| 486 | struct kobject *kobject, |
| 487 | char *buf) |
| 488 | { |
Eric Sandeen | 7716981 | 2016-09-14 07:51:30 +1000 | [diff] [blame] | 489 | int timeout; |
Carlos Maiolino | a5ea70d | 2016-05-18 11:08:15 +1000 | [diff] [blame] | 490 | struct xfs_error_cfg *cfg = to_error_cfg(kobject); |
| 491 | |
Eric Sandeen | 7716981 | 2016-09-14 07:51:30 +1000 | [diff] [blame] | 492 | if (cfg->retry_timeout == XFS_ERR_RETRY_FOREVER) |
| 493 | timeout = -1; |
| 494 | else |
| 495 | timeout = jiffies_to_msecs(cfg->retry_timeout) / MSEC_PER_SEC; |
| 496 | |
Qing Wang | 53eb47b | 2021-10-14 09:37:03 -0700 | [diff] [blame] | 497 | return sysfs_emit(buf, "%d\n", timeout); |
Carlos Maiolino | a5ea70d | 2016-05-18 11:08:15 +1000 | [diff] [blame] | 498 | } |
| 499 | |
| 500 | static ssize_t |
| 501 | retry_timeout_seconds_store( |
| 502 | struct kobject *kobject, |
| 503 | const char *buf, |
| 504 | size_t count) |
| 505 | { |
| 506 | struct xfs_error_cfg *cfg = to_error_cfg(kobject); |
| 507 | int ret; |
| 508 | int val; |
| 509 | |
| 510 | ret = kstrtoint(buf, 0, &val); |
| 511 | if (ret) |
| 512 | return ret; |
| 513 | |
Eric Sandeen | 7716981 | 2016-09-14 07:51:30 +1000 | [diff] [blame] | 514 | /* 1 day timeout maximum, -1 means infinite */ |
| 515 | if (val < -1 || val > 86400) |
Carlos Maiolino | a5ea70d | 2016-05-18 11:08:15 +1000 | [diff] [blame] | 516 | return -EINVAL; |
| 517 | |
Eric Sandeen | 7716981 | 2016-09-14 07:51:30 +1000 | [diff] [blame] | 518 | if (val == -1) |
| 519 | cfg->retry_timeout = XFS_ERR_RETRY_FOREVER; |
| 520 | else { |
| 521 | cfg->retry_timeout = msecs_to_jiffies(val * MSEC_PER_SEC); |
| 522 | ASSERT(msecs_to_jiffies(val * MSEC_PER_SEC) < LONG_MAX); |
| 523 | } |
Carlos Maiolino | a5ea70d | 2016-05-18 11:08:15 +1000 | [diff] [blame] | 524 | return count; |
| 525 | } |
| 526 | XFS_SYSFS_ATTR_RW(retry_timeout_seconds); |
| 527 | |
Carlos Maiolino | e6b3bb7 | 2016-05-18 11:11:27 +1000 | [diff] [blame] | 528 | static ssize_t |
| 529 | fail_at_unmount_show( |
| 530 | struct kobject *kobject, |
| 531 | char *buf) |
| 532 | { |
| 533 | struct xfs_mount *mp = err_to_mp(kobject); |
| 534 | |
Qing Wang | 53eb47b | 2021-10-14 09:37:03 -0700 | [diff] [blame] | 535 | return sysfs_emit(buf, "%d\n", mp->m_fail_unmount); |
Carlos Maiolino | e6b3bb7 | 2016-05-18 11:11:27 +1000 | [diff] [blame] | 536 | } |
| 537 | |
| 538 | static ssize_t |
| 539 | fail_at_unmount_store( |
| 540 | struct kobject *kobject, |
| 541 | const char *buf, |
| 542 | size_t count) |
| 543 | { |
| 544 | struct xfs_mount *mp = err_to_mp(kobject); |
| 545 | int ret; |
| 546 | int val; |
| 547 | |
| 548 | ret = kstrtoint(buf, 0, &val); |
| 549 | if (ret) |
| 550 | return ret; |
| 551 | |
| 552 | if (val < 0 || val > 1) |
| 553 | return -EINVAL; |
| 554 | |
| 555 | mp->m_fail_unmount = val; |
| 556 | return count; |
| 557 | } |
| 558 | XFS_SYSFS_ATTR_RW(fail_at_unmount); |
| 559 | |
Carlos Maiolino | a5ea70d | 2016-05-18 11:08:15 +1000 | [diff] [blame] | 560 | static struct attribute *xfs_error_attrs[] = { |
| 561 | ATTR_LIST(max_retries), |
| 562 | ATTR_LIST(retry_timeout_seconds), |
| 563 | NULL, |
| 564 | }; |
Greg Kroah-Hartman | 219aac5 | 2022-01-03 11:10:18 -0800 | [diff] [blame] | 565 | ATTRIBUTE_GROUPS(xfs_error); |
Carlos Maiolino | a5ea70d | 2016-05-18 11:08:15 +1000 | [diff] [blame] | 566 | |
Eric Biggers | f1b8243 | 2016-10-20 15:42:30 +1100 | [diff] [blame] | 567 | static struct kobj_type xfs_error_cfg_ktype = { |
Carlos Maiolino | 192852b | 2016-05-18 10:58:51 +1000 | [diff] [blame] | 568 | .release = xfs_sysfs_release, |
| 569 | .sysfs_ops = &xfs_sysfs_ops, |
Greg Kroah-Hartman | 219aac5 | 2022-01-03 11:10:18 -0800 | [diff] [blame] | 570 | .default_groups = xfs_error_groups, |
Carlos Maiolino | 192852b | 2016-05-18 10:58:51 +1000 | [diff] [blame] | 571 | }; |
| 572 | |
Eric Biggers | f1b8243 | 2016-10-20 15:42:30 +1100 | [diff] [blame] | 573 | static struct kobj_type xfs_error_ktype = { |
Carlos Maiolino | 192852b | 2016-05-18 10:58:51 +1000 | [diff] [blame] | 574 | .release = xfs_sysfs_release, |
Carlos Maiolino | e6b3bb7 | 2016-05-18 11:11:27 +1000 | [diff] [blame] | 575 | .sysfs_ops = &xfs_sysfs_ops, |
Carlos Maiolino | 192852b | 2016-05-18 10:58:51 +1000 | [diff] [blame] | 576 | }; |
| 577 | |
Carlos Maiolino | ef6a50f | 2016-05-18 11:06:44 +1000 | [diff] [blame] | 578 | /* |
| 579 | * Error initialization tables. These need to be ordered in the same |
| 580 | * order as the enums used to index the array. All class init tables need to |
| 581 | * define a "default" behaviour as the first entry, all other entries can be |
| 582 | * empty. |
| 583 | */ |
| 584 | struct xfs_error_init { |
| 585 | char *name; |
| 586 | int max_retries; |
Carlos Maiolino | a5ea70d | 2016-05-18 11:08:15 +1000 | [diff] [blame] | 587 | int retry_timeout; /* in seconds */ |
Carlos Maiolino | ef6a50f | 2016-05-18 11:06:44 +1000 | [diff] [blame] | 588 | }; |
| 589 | |
| 590 | static const struct xfs_error_init xfs_error_meta_init[XFS_ERR_ERRNO_MAX] = { |
| 591 | { .name = "default", |
Carlos Maiolino | e0a431b3 | 2016-05-18 11:09:28 +1000 | [diff] [blame] | 592 | .max_retries = XFS_ERR_RETRY_FOREVER, |
Eric Sandeen | 7716981 | 2016-09-14 07:51:30 +1000 | [diff] [blame] | 593 | .retry_timeout = XFS_ERR_RETRY_FOREVER, |
Carlos Maiolino | ef6a50f | 2016-05-18 11:06:44 +1000 | [diff] [blame] | 594 | }, |
Carlos Maiolino | e0a431b3 | 2016-05-18 11:09:28 +1000 | [diff] [blame] | 595 | { .name = "EIO", |
| 596 | .max_retries = XFS_ERR_RETRY_FOREVER, |
Eric Sandeen | 7716981 | 2016-09-14 07:51:30 +1000 | [diff] [blame] | 597 | .retry_timeout = XFS_ERR_RETRY_FOREVER, |
Carlos Maiolino | e0a431b3 | 2016-05-18 11:09:28 +1000 | [diff] [blame] | 598 | }, |
| 599 | { .name = "ENOSPC", |
| 600 | .max_retries = XFS_ERR_RETRY_FOREVER, |
Eric Sandeen | 7716981 | 2016-09-14 07:51:30 +1000 | [diff] [blame] | 601 | .retry_timeout = XFS_ERR_RETRY_FOREVER, |
Carlos Maiolino | e0a431b3 | 2016-05-18 11:09:28 +1000 | [diff] [blame] | 602 | }, |
| 603 | { .name = "ENODEV", |
Eric Sandeen | 7716981 | 2016-09-14 07:51:30 +1000 | [diff] [blame] | 604 | .max_retries = 0, /* We can't recover from devices disappearing */ |
| 605 | .retry_timeout = 0, |
Carlos Maiolino | e0a431b3 | 2016-05-18 11:09:28 +1000 | [diff] [blame] | 606 | }, |
Carlos Maiolino | ef6a50f | 2016-05-18 11:06:44 +1000 | [diff] [blame] | 607 | }; |
| 608 | |
| 609 | static int |
| 610 | xfs_error_sysfs_init_class( |
| 611 | struct xfs_mount *mp, |
| 612 | int class, |
| 613 | const char *parent_name, |
| 614 | struct xfs_kobj *parent_kobj, |
| 615 | const struct xfs_error_init init[]) |
| 616 | { |
| 617 | struct xfs_error_cfg *cfg; |
| 618 | int error; |
| 619 | int i; |
| 620 | |
| 621 | ASSERT(class < XFS_ERR_CLASS_MAX); |
| 622 | |
| 623 | error = xfs_sysfs_init(parent_kobj, &xfs_error_ktype, |
| 624 | &mp->m_error_kobj, parent_name); |
| 625 | if (error) |
| 626 | return error; |
| 627 | |
| 628 | for (i = 0; i < XFS_ERR_ERRNO_MAX; i++) { |
| 629 | cfg = &mp->m_error_cfg[class][i]; |
| 630 | error = xfs_sysfs_init(&cfg->kobj, &xfs_error_cfg_ktype, |
| 631 | parent_kobj, init[i].name); |
| 632 | if (error) |
| 633 | goto out_error; |
| 634 | |
| 635 | cfg->max_retries = init[i].max_retries; |
Eric Sandeen | 7716981 | 2016-09-14 07:51:30 +1000 | [diff] [blame] | 636 | if (init[i].retry_timeout == XFS_ERR_RETRY_FOREVER) |
| 637 | cfg->retry_timeout = XFS_ERR_RETRY_FOREVER; |
| 638 | else |
| 639 | cfg->retry_timeout = msecs_to_jiffies( |
Carlos Maiolino | a5ea70d | 2016-05-18 11:08:15 +1000 | [diff] [blame] | 640 | init[i].retry_timeout * MSEC_PER_SEC); |
Carlos Maiolino | ef6a50f | 2016-05-18 11:06:44 +1000 | [diff] [blame] | 641 | } |
| 642 | return 0; |
| 643 | |
| 644 | out_error: |
| 645 | /* unwind the entries that succeeded */ |
| 646 | for (i--; i >= 0; i--) { |
| 647 | cfg = &mp->m_error_cfg[class][i]; |
| 648 | xfs_sysfs_del(&cfg->kobj); |
| 649 | } |
| 650 | xfs_sysfs_del(parent_kobj); |
| 651 | return error; |
| 652 | } |
| 653 | |
Carlos Maiolino | 192852b | 2016-05-18 10:58:51 +1000 | [diff] [blame] | 654 | int |
| 655 | xfs_error_sysfs_init( |
| 656 | struct xfs_mount *mp) |
| 657 | { |
| 658 | int error; |
| 659 | |
| 660 | /* .../xfs/<dev>/error/ */ |
| 661 | error = xfs_sysfs_init(&mp->m_error_kobj, &xfs_error_ktype, |
| 662 | &mp->m_kobj, "error"); |
Carlos Maiolino | ffd40ef | 2016-05-18 11:01:00 +1000 | [diff] [blame] | 663 | if (error) |
| 664 | return error; |
| 665 | |
Carlos Maiolino | e6b3bb7 | 2016-05-18 11:11:27 +1000 | [diff] [blame] | 666 | error = sysfs_create_file(&mp->m_error_kobj.kobject, |
| 667 | ATTR_LIST(fail_at_unmount)); |
| 668 | |
| 669 | if (error) |
| 670 | goto out_error; |
| 671 | |
Carlos Maiolino | ffd40ef | 2016-05-18 11:01:00 +1000 | [diff] [blame] | 672 | /* .../xfs/<dev>/error/metadata/ */ |
Carlos Maiolino | ef6a50f | 2016-05-18 11:06:44 +1000 | [diff] [blame] | 673 | error = xfs_error_sysfs_init_class(mp, XFS_ERR_METADATA, |
| 674 | "metadata", &mp->m_error_meta_kobj, |
| 675 | xfs_error_meta_init); |
Carlos Maiolino | ffd40ef | 2016-05-18 11:01:00 +1000 | [diff] [blame] | 676 | if (error) |
| 677 | goto out_error; |
| 678 | |
Carlos Maiolino | ffd40ef | 2016-05-18 11:01:00 +1000 | [diff] [blame] | 679 | return 0; |
| 680 | |
Carlos Maiolino | ffd40ef | 2016-05-18 11:01:00 +1000 | [diff] [blame] | 681 | out_error: |
| 682 | xfs_sysfs_del(&mp->m_error_kobj); |
Carlos Maiolino | 192852b | 2016-05-18 10:58:51 +1000 | [diff] [blame] | 683 | return error; |
| 684 | } |
| 685 | |
| 686 | void |
| 687 | xfs_error_sysfs_del( |
| 688 | struct xfs_mount *mp) |
| 689 | { |
Carlos Maiolino | ffd40ef | 2016-05-18 11:01:00 +1000 | [diff] [blame] | 690 | struct xfs_error_cfg *cfg; |
| 691 | int i, j; |
| 692 | |
| 693 | for (i = 0; i < XFS_ERR_CLASS_MAX; i++) { |
| 694 | for (j = 0; j < XFS_ERR_ERRNO_MAX; j++) { |
| 695 | cfg = &mp->m_error_cfg[i][j]; |
| 696 | |
| 697 | xfs_sysfs_del(&cfg->kobj); |
| 698 | } |
| 699 | } |
| 700 | xfs_sysfs_del(&mp->m_error_meta_kobj); |
Carlos Maiolino | 192852b | 2016-05-18 10:58:51 +1000 | [diff] [blame] | 701 | xfs_sysfs_del(&mp->m_error_kobj); |
| 702 | } |
Carlos Maiolino | df30939 | 2016-05-18 11:05:33 +1000 | [diff] [blame] | 703 | |
| 704 | struct xfs_error_cfg * |
| 705 | xfs_error_get_cfg( |
| 706 | struct xfs_mount *mp, |
| 707 | int error_class, |
| 708 | int error) |
| 709 | { |
| 710 | struct xfs_error_cfg *cfg; |
| 711 | |
Eric Sandeen | e97f6c5 | 2016-07-20 10:48:51 +1000 | [diff] [blame] | 712 | if (error < 0) |
| 713 | error = -error; |
| 714 | |
Carlos Maiolino | df30939 | 2016-05-18 11:05:33 +1000 | [diff] [blame] | 715 | switch (error) { |
Carlos Maiolino | e0a431b3 | 2016-05-18 11:09:28 +1000 | [diff] [blame] | 716 | case EIO: |
| 717 | cfg = &mp->m_error_cfg[error_class][XFS_ERR_EIO]; |
| 718 | break; |
| 719 | case ENOSPC: |
| 720 | cfg = &mp->m_error_cfg[error_class][XFS_ERR_ENOSPC]; |
| 721 | break; |
| 722 | case ENODEV: |
| 723 | cfg = &mp->m_error_cfg[error_class][XFS_ERR_ENODEV]; |
| 724 | break; |
Carlos Maiolino | df30939 | 2016-05-18 11:05:33 +1000 | [diff] [blame] | 725 | default: |
| 726 | cfg = &mp->m_error_cfg[error_class][XFS_ERR_DEFAULT]; |
| 727 | break; |
| 728 | } |
| 729 | |
| 730 | return cfg; |
| 731 | } |