Skip to content

Commit ba180bd

Browse files
committed
Don't attempt to use the portable sysctl macros
Instead, define the FreeBSD and Linux sysctls separately. Signed-off-by: Alan Somers <[email protected]>
1 parent 6a214e6 commit ba180bd

File tree

7 files changed

+32
-35
lines changed

7 files changed

+32
-35
lines changed

include/os/freebsd/spl/sys/mod_os.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@
9494
#define param_set_max_auto_ashift_args(var) \
9595
CTLTYPE_UINT, NULL, 0, param_set_max_auto_ashift, "IU"
9696

97-
#define param_set_raidz_impl_args(var) \
98-
CTLTYPE_STRING, NULL, 0, param_set_raidz_impl, "A"
99-
10097
#define spa_taskq_read_param_set_args(var) \
10198
CTLTYPE_STRING, NULL, 0, spa_taskq_read_param, "A"
10299

include/sys/vdev_impl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ struct abd;
6262
extern uint_t zfs_vdev_queue_depth_pct;
6363
extern uint_t zfs_vdev_def_queue_depth;
6464
extern uint_t zfs_vdev_async_write_max_active;
65-
extern const char *zfs_vdev_raidz_impl;
6665

6766
/*
6867
* Virtual device operations
@@ -646,7 +645,6 @@ extern int vdev_obsolete_counts_are_precise(vdev_t *vd, boolean_t *are_precise);
646645
int vdev_checkpoint_sm_object(vdev_t *vd, uint64_t *sm_obj);
647646
void vdev_metaslab_group_create(vdev_t *vd);
648647
uint64_t vdev_best_ashift(uint64_t logical, uint64_t a, uint64_t b);
649-
int param_set_raidz_impl(ZFS_MODULE_PARAM_ARGS);
650648

651649
/*
652650
* Vdev ashift optimization tunables

include/sys/vdev_raidz.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,14 @@ extern const zio_vsd_ops_t vdev_raidz_vsd_ops;
6666
/*
6767
* vdev_raidz_math interface
6868
*/
69-
#if defined(__linux__)
70-
extern const char *zfs_vdev_raidz_impl;
71-
#endif
7269
void vdev_raidz_math_init(void);
7370
void vdev_raidz_math_fini(void);
7471
const struct raidz_impl_ops *vdev_raidz_math_get_ops(void);
7572
int vdev_raidz_math_generate(struct raidz_map *, struct raidz_row *);
7673
int vdev_raidz_math_reconstruct(struct raidz_map *, struct raidz_row *,
7774
const int *, const int *, const int);
78-
int vdev_raidz_impl_set(const char *);
7975
int vdev_raidz_impl_get(char *buffer, size_t size);
76+
int vdev_raidz_impl_set(const char *);
8077

8178
typedef struct vdev_raidz_expand {
8279
uint64_t vre_vdev_id;

module/os/freebsd/zfs/sysctl_os.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ param_set_deadman_failmode(SYSCTL_HANDLER_ARGS)
679679
return (-param_set_deadman_failmode_common(buf));
680680
}
681681

682-
int
682+
static int
683683
param_set_raidz_impl(SYSCTL_HANDLER_ARGS)
684684
{
685685
char *buf;
@@ -808,6 +808,12 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, validate_skip,
808808

809809
/* vdev_mirror.c */
810810

811+
/* vdev_raidz_math.c */
812+
813+
SYSCTL_PROC(_vfs_zfs_vdev, OID_AUTO, raidz_impl,
814+
CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
815+
NULL, 0, param_set_raidz_impl, "IU", "select RAIDZ implementation");
816+
811817
/* vdev_queue.c */
812818

813819
extern uint_t zfs_vdev_max_active;

module/os/linux/zfs/vdev_disk.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,15 +1637,6 @@ param_set_max_auto_ashift(const char *buf, zfs_kernel_param_t *kp)
16371637
return (0);
16381638
}
16391639

1640-
int
1641-
param_set_raidz_impl(const char *val, zfs_kernel_param_t *kp)
1642-
{
1643-
int error;
1644-
1645-
error = vdev_raidz_impl_set(val);
1646-
return (error);
1647-
}
1648-
16491640
ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, open_timeout_ms, UINT, ZMOD_RW,
16501641
"Timeout before determining that a device is missing");
16511642

module/zfs/vdev.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6580,7 +6580,3 @@ ZFS_MODULE_PARAM_CALL(zfs_vdev, zfs_vdev_, max_auto_ashift,
65806580
param_set_max_auto_ashift, param_get_uint, ZMOD_RW,
65816581
"Maximum ashift used when optimizing for logical -> physical sector "
65826582
"size on new top-level vdevs");
6583-
6584-
ZFS_MODULE_PARAM_CALL(zfs_vdev, zfs_vdev_, raidz_impl,
6585-
param_set_raidz_impl, param_get_charp, ZMOD_RW,
6586-
"RAIDZ implementation");

module/zfs/vdev_raidz_math.c

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,8 @@ static boolean_t raidz_math_initialized = B_FALSE;
8181

8282
#define RAIDZ_IMPL_READ(i) (*(volatile uint32_t *) &(i))
8383

84-
static uint32_t zfs_vdev_raidz_impl_setting = IMPL_SCALAR;
84+
static uint32_t zfs_vdev_raidz_impl = IMPL_SCALAR;
8585
static uint32_t user_sel_impl = IMPL_FASTEST;
86-
#if defined(__linux__)
87-
const char *zfs_vdev_raidz_impl = "fastest";
88-
#endif
8986

9087
/* Hold all supported implementations */
9188
static size_t raidz_supp_impl_cnt = 0;
@@ -114,7 +111,7 @@ vdev_raidz_math_get_ops(void)
114111
return (&vdev_raidz_scalar_impl);
115112

116113
raidz_impl_ops_t *ops = NULL;
117-
const uint32_t impl = RAIDZ_IMPL_READ(zfs_vdev_raidz_impl_setting);
114+
const uint32_t impl = RAIDZ_IMPL_READ(zfs_vdev_raidz_impl);
118115

119116
switch (impl) {
120117
case IMPL_FASTEST:
@@ -543,7 +540,7 @@ vdev_raidz_math_init(void)
543540
#endif
544541

545542
/* Finish initialization */
546-
atomic_swap_32(&zfs_vdev_raidz_impl_setting, user_sel_impl);
543+
atomic_swap_32(&zfs_vdev_raidz_impl, user_sel_impl);
547544
raidz_math_initialized = B_TRUE;
548545
}
549546

@@ -582,7 +579,7 @@ static const struct {
582579
* If we are called before init(), user preference will be saved in
583580
* user_sel_impl, and applied in later init() call. This occurs when module
584581
* parameter is specified on module load. Otherwise, directly update
585-
* zfs_vdev_raidz_impl_setting.
582+
* zfs_vdev_raidz_impl.
586583
*
587584
* @val Name of raidz implementation to use
588585
* @param Unused.
@@ -628,12 +625,9 @@ vdev_raidz_impl_set(const char *val)
628625

629626
if (err == 0) {
630627
if (raidz_math_initialized)
631-
atomic_swap_32(&zfs_vdev_raidz_impl_setting, impl);
628+
atomic_swap_32(&zfs_vdev_raidz_impl, impl);
632629
else
633630
atomic_swap_32(&user_sel_impl, impl);
634-
#if defined(__linux__)
635-
zfs_vdev_raidz_impl = raidz_supp_impl[i]->name;
636-
#endif
637631
}
638632

639633
return (err);
@@ -646,7 +640,7 @@ vdev_raidz_impl_get(char *buffer, size_t size)
646640
{
647641
int i, cnt = 0;
648642
char *fmt;
649-
const uint32_t impl = RAIDZ_IMPL_READ(zfs_vdev_raidz_impl_setting);
643+
const uint32_t impl = RAIDZ_IMPL_READ(zfs_vdev_raidz_impl);
650644

651645
ASSERT(raidz_math_initialized);
652646

@@ -668,3 +662,21 @@ vdev_raidz_impl_get(char *buffer, size_t size)
668662
}
669663

670664
#endif
665+
666+
#if defined(_KERNEL) && defined(__linux__)
667+
static int
668+
zfs_vdev_raidz_impl_set(const char *val, zfs_kernel_param_t *kp)
669+
{
670+
return (vdev_raidz_impl_set(val));
671+
}
672+
673+
static int
674+
zfs_vdev_raidz_impl_get(char *buffer, zfs_kernel_param_t *kp)
675+
{
676+
return (vdev_raidz_impl_get(buffer, PAGE_SIZE));
677+
}
678+
679+
module_param_call(zfs_vdev_raidz_impl, zfs_vdev_raidz_impl_set,
680+
zfs_vdev_raidz_impl_get, NULL, 0644);
681+
MODULE_PARM_DESC(zfs_vdev_raidz_impl, "Select raidz implementation.");
682+
#endif

0 commit comments

Comments
 (0)