Skip to content

Commit

Permalink
Finish refactoring for ZFS_MODULE_PARAM_CALL
Browse files Browse the repository at this point in the history
Linux and FreeBSD have different parameters for tunable proc handler.
This has prevented FreeBSD from implementing the ZFS_MODULE_PARAM_CALL
macro.

To complete the sharing of ZFS_MODULE_PARAM_CALL declarations, create
per-platform definitions of the parameter list, ZFS_MODULE_PARAM_ARGS.

With the declarations wired up we discovered an incorrect scope prefix
for spa_slop_shift, so this is now fixed.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #10179
  • Loading branch information
Ryan Moeller authored Apr 7, 2020
1 parent 2a15c6a commit 7e3df9d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
4 changes: 3 additions & 1 deletion include/os/linux/kernel/linux/mod_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ enum scope_prefix_types {
* spa_slop_shift
*/
/* BEGIN CSTYLED */
#define ZFS_MODULE_PARAM_CALL(scope_prefix, name_prefix, name, setfunc, getfunc, perm, desc) \
#define ZFS_MODULE_PARAM_CALL(scope_prefix, name_prefix, name, setfunc, getfunc, perm, desc) \
CTASSERT_GLOBAL((sizeof (scope_prefix) == sizeof (enum scope_prefix_types))); \
module_param_call(name_prefix ## name, setfunc, getfunc, &name_prefix ## name, perm); \
MODULE_PARM_DESC(name_prefix ## name, desc)
/* END CSTYLED */

#define ZFS_MODULE_PARAM_ARGS const char *buf, zfs_kernel_param_t *kp

#define ZFS_MODULE_DESCRIPTION(s) MODULE_DESCRIPTION(s)
#define ZFS_MODULE_AUTHOR(s) MODULE_AUTHOR(s)
#define ZFS_MODULE_LICENSE(s) MODULE_LICENSE(s)
Expand Down
4 changes: 2 additions & 2 deletions include/sys/arc_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@ extern uint64_t arc_free_memory(void);
extern int64_t arc_available_memory(void);
extern void arc_tuning_update(void);

extern int param_set_arc_long(const char *buf, zfs_kernel_param_t *kp);
extern int param_set_arc_int(const char *buf, zfs_kernel_param_t *kp);
extern int param_set_arc_long(ZFS_MODULE_PARAM_ARGS);
extern int param_set_arc_int(ZFS_MODULE_PARAM_ARGS);

#ifdef __cplusplus
}
Expand Down
8 changes: 4 additions & 4 deletions include/sys/spa.h
Original file line number Diff line number Diff line change
Expand Up @@ -1179,10 +1179,10 @@ extern void spa_notify_waiters(spa_t *spa);
extern void spa_wake_waiters(spa_t *spa);

/* module param call functions */
int param_set_deadman_ziotime(const char *val, zfs_kernel_param_t *kp);
int param_set_deadman_synctime(const char *val, zfs_kernel_param_t *kp);
int param_set_slop_shift(const char *buf, zfs_kernel_param_t *kp);
int param_set_deadman_failmode(const char *val, zfs_kernel_param_t *kp);
int param_set_deadman_ziotime(ZFS_MODULE_PARAM_ARGS);
int param_set_deadman_synctime(ZFS_MODULE_PARAM_ARGS);
int param_set_slop_shift(ZFS_MODULE_PARAM_ARGS);
int param_set_deadman_failmode(ZFS_MODULE_PARAM_ARGS);

#ifdef ZFS_DEBUG
#define dprintf_bp(bp, fmt, ...) do { \
Expand Down
1 change: 1 addition & 0 deletions include/sys/zfs_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ typedef struct zfs_kernel_param {
} zfs_kernel_param_t;

#define ZFS_MODULE_PARAM(scope_prefix, name_prefix, name, type, perm, desc)
#define ZFS_MODULE_PARAM_ARGS void
#define ZFS_MODULE_PARAM_CALL(scope_prefix, name_prefix, name, setfunc, \
getfunc, perm, desc)

Expand Down
2 changes: 1 addition & 1 deletion module/zfs/spa_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2891,5 +2891,5 @@ ZFS_MODULE_PARAM(zfs, zfs_, special_class_metadata_reserve_pct, INT, ZMOD_RW,
"free space available");
/* END CSTYLED */

ZFS_MODULE_PARAM_CALL(spa, spa_, slop_shift, param_set_slop_shift,
ZFS_MODULE_PARAM_CALL(zfs_spa, spa_, slop_shift, param_set_slop_shift,
param_get_int, ZMOD_RW, "Reserved free space in pool");

0 comments on commit 7e3df9d

Please sign in to comment.