Skip to content

Commit 6c82951

Browse files
authored
FreeBSD: remove support for FreeBSD < 13.0-RELEASE (#16372)
This includes the last 12.x release (now EOL) and 13.0 development versions (<1300139). Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Reviewed-by: Tony Hutter <[email protected]>
1 parent e9f51eb commit 6c82951

27 files changed

+86
-857
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ For more details see the NOTICE, LICENSE and COPYRIGHT files; `UCRL-CODE-235197`
3232

3333
# Supported Kernels
3434
* The `META` file contains the officially recognized supported Linux kernel versions.
35-
* Supported FreeBSD versions are any supported branches and releases starting from 12.4-RELEASE.
35+
* Supported FreeBSD versions are any supported branches and releases starting from 13.0-RELEASE.

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

-42
Original file line numberDiff line numberDiff line change
@@ -28,48 +28,6 @@
2828
#ifndef _SYS_CCOMPAT_H
2929
#define _SYS_CCOMPAT_H
3030

31-
#if __FreeBSD_version < 1300051
32-
#define vm_page_valid(m) (m)->valid = VM_PAGE_BITS_ALL
33-
#define vm_page_do_sunbusy(m)
34-
#define vm_page_none_valid(m) ((m)->valid == 0)
35-
#else
36-
#define vm_page_do_sunbusy(m) vm_page_sunbusy(m)
37-
#endif
38-
39-
#if __FreeBSD_version < 1300074
40-
#define VOP_UNLOCK1(x) VOP_UNLOCK(x, 0)
41-
#else
42-
#define VOP_UNLOCK1(x) VOP_UNLOCK(x)
43-
#endif
44-
45-
#if __FreeBSD_version < 1300064
46-
#define VN_IS_DOOMED(vp) ((vp)->v_iflag & VI_DOOMED)
47-
#endif
48-
49-
#if __FreeBSD_version < 1300068
50-
#define VFS_VOP_VECTOR_REGISTER(x)
51-
#endif
52-
53-
#if __FreeBSD_version >= 1300076
54-
#define getnewvnode_reserve_() getnewvnode_reserve()
55-
#else
56-
#define getnewvnode_reserve_() getnewvnode_reserve(1)
57-
#endif
58-
59-
#if __FreeBSD_version < 1300102
60-
#define ASSERT_VOP_IN_SEQC(zp)
61-
#define MNTK_FPLOOKUP 0
62-
#define vn_seqc_write_begin(vp)
63-
#define vn_seqc_write_end(vp)
64-
65-
#ifndef VFS_SMR_DECLARE
66-
#define VFS_SMR_DECLARE
67-
#endif
68-
#ifndef VFS_SMR_ZONE_SET
69-
#define VFS_SMR_ZONE_SET(zone)
70-
#endif
71-
#endif
72-
7331
struct hlist_node {
7432
struct hlist_node *next, **pprev;
7533
};

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

-6
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,4 @@ int secpolicy_xvattr(vnode_t *vp, xvattr_t *xvap, uid_t owner, cred_t *cr,
7070
vtype_t vtype);
7171
int secpolicy_smb(cred_t *cr);
7272

73-
74-
#if __FreeBSD_version >= 1300005
75-
#define spl_priv_check_cred(a, b) priv_check_cred((a), (b))
76-
#else
77-
#define spl_priv_check_cred(a, b) priv_check_cred((a), (b), 0)
78-
#endif
7973
#endif /* _OPENSOLARIS_SYS_POLICY_H_ */

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

-3
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ do_thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg,
8888
thread_lock(td);
8989
sched_prio(td, pri);
9090
sched_add(td, SRQ_BORING);
91-
#if __FreeBSD_version < 1300068
92-
thread_unlock(td);
93-
#endif
9491
}
9592
return (td);
9693
}

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
#define _OPENSOLARIS_SYS_RANDOM_H_
3131

3232
#include_next <sys/random.h>
33-
#if __FreeBSD_version >= 1300108
3433
#include <sys/prng.h>
35-
#endif
3634

3735
static inline int
3836
random_get_bytes(uint8_t *p, size_t s)
@@ -51,7 +49,7 @@ random_get_pseudo_bytes(uint8_t *p, size_t s)
5149
static inline uint32_t
5250
random_in_range(uint32_t range)
5351
{
54-
#if defined(_KERNEL) && __FreeBSD_version >= 1300108
52+
#if defined(_KERNEL)
5553
return (prng32_bounded(range));
5654
#else
5755
uint32_t r;

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

-16
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,6 @@ void zfs_vmobject_assert_wlocked(vm_object_t object);
4141
void zfs_vmobject_wlock(vm_object_t object);
4242
void zfs_vmobject_wunlock(vm_object_t object);
4343

44-
#if __FreeBSD_version >= 1300081
45-
#define zfs_vmobject_assert_wlocked_12(x)
46-
#define zfs_vmobject_wlock_12(x)
47-
#define zfs_vmobject_wunlock_12(x)
48-
#else
49-
#define zfs_vmobject_assert_wlocked_12(x) \
50-
zfs_vmobject_assert_wlocked((x))
51-
#define zfs_vmobject_wlock_12(x) \
52-
zfs_vmobject_wlock(x)
53-
#define zfs_vmobject_wunlock_12(x) \
54-
zfs_vmobject_wunlock(x)
55-
#define vm_page_grab_unlocked(obj, idx, flags) \
56-
vm_page_grab((obj), (idx), (flags))
57-
#define vm_page_grab_valid_unlocked(m, obj, idx, flags) \
58-
vm_page_grab_valid((m), (obj), (idx), (flags))
59-
#endif
6044
static inline caddr_t
6145
zfs_map_page(vm_page_t pp, struct sf_buf **sfp)
6246
{

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,13 @@ vn_is_readonly(vnode_t *vp)
9595
static __inline void
9696
vn_flush_cached_data(vnode_t *vp, boolean_t sync)
9797
{
98-
#if __FreeBSD_version > 1300054
9998
if (vm_object_mightbedirty(vp->v_object)) {
100-
#else
101-
if (vp->v_object->flags & OBJ_MIGHTBEDIRTY) {
102-
#endif
10399
int flags = sync ? OBJPC_SYNC : 0;
104100
vn_lock(vp, LK_SHARED | LK_RETRY);
105101
zfs_vmobject_wlock(vp->v_object);
106102
vm_object_page_clean(vp->v_object, 0, 0, flags);
107103
zfs_vmobject_wunlock(vp->v_object);
108-
VOP_UNLOCK1(vp);
104+
VOP_UNLOCK(vp);
109105
}
110106
}
111107
#endif

include/os/freebsd/zfs/sys/zfs_vfsops_os.h

-77
Original file line numberDiff line numberDiff line change
@@ -27,40 +27,21 @@
2727
#ifndef _SYS_FS_ZFS_VFSOPS_H
2828
#define _SYS_FS_ZFS_VFSOPS_H
2929

30-
#if __FreeBSD_version >= 1300125
31-
#define TEARDOWN_RMS
32-
#endif
33-
34-
#if __FreeBSD_version >= 1300109
35-
#define TEARDOWN_INACTIVE_RMS
36-
#endif
37-
3830
#include <sys/dataset_kstats.h>
3931
#include <sys/list.h>
4032
#include <sys/vfs.h>
4133
#include <sys/zil.h>
4234
#include <sys/sa.h>
4335
#include <sys/rrwlock.h>
44-
#ifdef TEARDOWN_INACTIVE_RMS
4536
#include <sys/rmlock.h>
46-
#endif
4737
#include <sys/zfs_ioctl.h>
4838

4939
#ifdef __cplusplus
5040
extern "C" {
5141
#endif
5242

53-
#ifdef TEARDOWN_RMS
5443
typedef struct rmslock zfs_teardown_lock_t;
55-
#else
56-
#define zfs_teardown_lock_t rrmlock_t
57-
#endif
58-
59-
#ifdef TEARDOWN_INACTIVE_RMS
6044
typedef struct rmslock zfs_teardown_inactive_lock_t;
61-
#else
62-
#define zfs_teardown_inactive_lock_t krwlock_t
63-
#endif
6445

6546
typedef struct zfsvfs zfsvfs_t;
6647
struct znode;
@@ -120,7 +101,6 @@ struct zfsvfs {
120101
struct task z_unlinked_drain_task;
121102
};
122103

123-
#ifdef TEARDOWN_RMS
124104
#define ZFS_TEARDOWN_INIT(zfsvfs) \
125105
rms_init(&(zfsvfs)->z_teardown_lock, "zfs teardown")
126106

@@ -150,39 +130,7 @@ struct zfsvfs {
150130

151131
#define ZFS_TEARDOWN_HELD(zfsvfs) \
152132
rms_owned_any(&(zfsvfs)->z_teardown_lock)
153-
#else
154-
#define ZFS_TEARDOWN_INIT(zfsvfs) \
155-
rrm_init(&(zfsvfs)->z_teardown_lock, B_FALSE)
156-
157-
#define ZFS_TEARDOWN_DESTROY(zfsvfs) \
158-
rrm_destroy(&(zfsvfs)->z_teardown_lock)
159-
160-
#define ZFS_TEARDOWN_ENTER_READ(zfsvfs, tag) \
161-
rrm_enter_read(&(zfsvfs)->z_teardown_lock, tag);
162-
163-
#define ZFS_TEARDOWN_EXIT_READ(zfsvfs, tag) \
164-
rrm_exit(&(zfsvfs)->z_teardown_lock, tag)
165-
166-
#define ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, tag) \
167-
rrm_enter(&(zfsvfs)->z_teardown_lock, RW_WRITER, tag)
168-
169-
#define ZFS_TEARDOWN_EXIT_WRITE(zfsvfs) \
170-
rrm_exit(&(zfsvfs)->z_teardown_lock, tag)
171-
172-
#define ZFS_TEARDOWN_EXIT(zfsvfs, tag) \
173-
rrm_exit(&(zfsvfs)->z_teardown_lock, tag)
174-
175-
#define ZFS_TEARDOWN_READ_HELD(zfsvfs) \
176-
RRM_READ_HELD(&(zfsvfs)->z_teardown_lock)
177-
178-
#define ZFS_TEARDOWN_WRITE_HELD(zfsvfs) \
179-
RRM_WRITE_HELD(&(zfsvfs)->z_teardown_lock)
180-
181-
#define ZFS_TEARDOWN_HELD(zfsvfs) \
182-
RRM_LOCK_HELD(&(zfsvfs)->z_teardown_lock)
183-
#endif
184133

185-
#ifdef TEARDOWN_INACTIVE_RMS
186134
#define ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \
187135
rms_init(&(zfsvfs)->z_teardown_inactive_lock, "zfs teardown inactive")
188136

@@ -206,31 +154,6 @@ struct zfsvfs {
206154

207155
#define ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs) \
208156
rms_wowned(&(zfsvfs)->z_teardown_inactive_lock)
209-
#else
210-
#define ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \
211-
rw_init(&(zfsvfs)->z_teardown_inactive_lock, NULL, RW_DEFAULT, NULL)
212-
213-
#define ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs) \
214-
rw_destroy(&(zfsvfs)->z_teardown_inactive_lock)
215-
216-
#define ZFS_TEARDOWN_INACTIVE_TRY_ENTER_READ(zfsvfs) \
217-
rw_tryenter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER)
218-
219-
#define ZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs) \
220-
rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER)
221-
222-
#define ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs) \
223-
rw_exit(&(zfsvfs)->z_teardown_inactive_lock)
224-
225-
#define ZFS_TEARDOWN_INACTIVE_ENTER_WRITE(zfsvfs) \
226-
rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_WRITER)
227-
228-
#define ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs) \
229-
rw_exit(&(zfsvfs)->z_teardown_inactive_lock)
230-
231-
#define ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs) \
232-
RW_WRITE_HELD(&(zfsvfs)->z_teardown_inactive_lock)
233-
#endif
234157

235158
#define ZSB_XATTR 0x0001 /* Enable user xattrs */
236159
/*

module/os/freebsd/spl/spl_kmem.c

-8
Original file line numberDiff line numberDiff line change
@@ -240,22 +240,14 @@ void
240240
kmem_cache_reap_soon(kmem_cache_t *cache)
241241
{
242242
#ifndef KMEM_DEBUG
243-
#if __FreeBSD_version >= 1300043
244243
uma_zone_reclaim(cache->kc_zone, UMA_RECLAIM_DRAIN);
245-
#else
246-
zone_drain(cache->kc_zone);
247-
#endif
248244
#endif
249245
}
250246

251247
void
252248
kmem_reap(void)
253249
{
254-
#if __FreeBSD_version >= 1300043
255250
uma_reclaim(UMA_RECLAIM_TRIM);
256-
#else
257-
uma_reclaim();
258-
#endif
259251
}
260252
#else
261253
void

0 commit comments

Comments
 (0)