Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Notable upstream pull request merges:
 #15366 c3773de ZIL: Cleanup sync and commit handling
 #15409 dbe839a zvol: Cleanup set property
 #15409 60387fa zvol: Implement zvol threading as a Property
 #15409 9ccdb8b zvol: fix delayed update to block device ro entry
 #15448 05a7348 RAIDZ: Use cache blocking during parity math
 #15452 514d661 Tune zio buffer caches and their alignments
 #15456 799e09f Unify arc_prune_async() code
 #15465 763ca47 Fix block cloning between unencrypted and encrypted
                 datasets

To make the module version better comparable, the module version number
now includes the commit count since last tag.

Obtained from:	OpenZFS
OpenZFS commit:	41e55b4
  • Loading branch information
mmatuska committed Nov 1, 2023
2 parents 0c5cd04 + 41e55b4 commit f8b1db8
Show file tree
Hide file tree
Showing 33 changed files with 449 additions and 439 deletions.
10 changes: 10 additions & 0 deletions sys/contrib/openzfs/cmd/zpool/compatibility.d/grub2
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Features which are supported by GRUB2
allocation_classes
async_destroy
block_cloning
bookmarks
device_rebuild
embedded_data
empty_bpobj
enabled_txg
Expand All @@ -9,6 +12,13 @@ filesystem_limits
hole_birth
large_blocks
livelist
log_spacemap
lz4_compress
obsolete_counts
project_quota
resilver_defer
spacemap_histogram
spacemap_v2
userobj_accounting
zilsaxattr
zpool_checkpoint
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ typedef struct zfid_long {
#define SHORT_FID_LEN (sizeof (zfid_short_t) - sizeof (uint16_t))
#define LONG_FID_LEN (sizeof (zfid_long_t) - sizeof (uint16_t))

extern uint_t zfs_fsyncer_key;
extern int zfs_super_owner;
extern int zfs_bclone_enabled;

Expand Down
2 changes: 1 addition & 1 deletion sys/contrib/openzfs/include/os/linux/zfs/sys/zpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extern const struct file_operations zpl_file_operations;
extern const struct file_operations zpl_dir_file_operations;

/* zpl_super.c */
extern void zpl_prune_sb(int64_t nr_to_scan, void *arg);
extern void zpl_prune_sb(uint64_t nr_to_scan, void *arg);

extern const struct super_operations zpl_super_operations;
extern const struct export_operations zpl_export_operations;
Expand Down
6 changes: 3 additions & 3 deletions sys/contrib/openzfs/include/sys/abd.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ int abd_cmp_buf_off(abd_t *, const void *, size_t, size_t);
void abd_zero_off(abd_t *, size_t, size_t);
void abd_verify(abd_t *);

void abd_raidz_gen_iterate(abd_t **cabds, abd_t *dabd,
ssize_t csize, ssize_t dsize, const unsigned parity,
void abd_raidz_gen_iterate(abd_t **cabds, abd_t *dabd, size_t off,
size_t csize, size_t dsize, const unsigned parity,
void (*func_raidz_gen)(void **, const void *, size_t, size_t));
void abd_raidz_rec_iterate(abd_t **cabds, abd_t **tabds,
ssize_t tsize, const unsigned parity,
size_t tsize, const unsigned parity,
void (*func_raidz_rec)(void **t, const size_t tsize, void **c,
const unsigned *mul),
const unsigned *mul);
Expand Down
2 changes: 1 addition & 1 deletion sys/contrib/openzfs/include/sys/arc.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ typedef struct arc_prune arc_prune_t;
typedef void arc_read_done_func_t(zio_t *zio, const zbookmark_phys_t *zb,
const blkptr_t *bp, arc_buf_t *buf, void *priv);
typedef void arc_write_done_func_t(zio_t *zio, arc_buf_t *buf, void *priv);
typedef void arc_prune_func_t(int64_t bytes, void *priv);
typedef void arc_prune_func_t(uint64_t bytes, void *priv);

/* Shared module parameters */
extern uint_t zfs_arc_average_blocksize;
Expand Down
1 change: 0 additions & 1 deletion sys/contrib/openzfs/include/sys/arc_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,6 @@ extern void arc_wait_for_eviction(uint64_t, boolean_t);

extern void arc_lowmem_init(void);
extern void arc_lowmem_fini(void);
extern void arc_prune_async(uint64_t);
extern int arc_memory_throttle(spa_t *spa, uint64_t reserve, uint64_t txg);
extern uint64_t arc_free_memory(void);
extern int64_t arc_available_memory(void);
Expand Down
1 change: 1 addition & 0 deletions sys/contrib/openzfs/include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ typedef enum {
ZFS_PROP_REDACT_SNAPS,
ZFS_PROP_SNAPSHOTS_CHANGED,
ZFS_PROP_PREFETCH,
ZFS_PROP_VOLTHREADING,
ZFS_NUM_PROPS
} zfs_prop_t;

Expand Down
1 change: 0 additions & 1 deletion sys/contrib/openzfs/include/sys/zfs_ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,6 @@ typedef struct zfsdev_state {
extern void *zfsdev_get_state(minor_t minor, enum zfsdev_state_type which);
extern int zfsdev_getminor(zfs_file_t *fp, minor_t *minorp);

extern uint_t zfs_fsyncer_key;
extern uint_t zfs_allow_log_key;

#endif /* _KERNEL */
Expand Down
2 changes: 1 addition & 1 deletion sys/contrib/openzfs/include/sys/zfs_znode.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ extern void zfs_log_rename_whiteout(zilog_t *zilog, dmu_tx_t *tx,
uint64_t txtype, znode_t *sdzp, const char *sname, znode_t *tdzp,
const char *dname, znode_t *szp, znode_t *wzp);
extern void zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype,
znode_t *zp, offset_t off, ssize_t len, int ioflag,
znode_t *zp, offset_t off, ssize_t len, boolean_t commit,
zil_callback_t callback, void *callback_data);
extern void zfs_log_truncate(zilog_t *zilog, dmu_tx_t *tx, int txtype,
znode_t *zp, uint64_t off, uint64_t len);
Expand Down
5 changes: 3 additions & 2 deletions sys/contrib/openzfs/include/sys/zvol.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ extern int zvol_get_stats(objset_t *, nvlist_t *);
extern boolean_t zvol_is_zvol(const char *);
extern void zvol_create_cb(objset_t *, void *, cred_t *, dmu_tx_t *);
extern int zvol_set_volsize(const char *, uint64_t);
extern int zvol_set_snapdev(const char *, zprop_source_t, uint64_t);
extern int zvol_set_volmode(const char *, zprop_source_t, uint64_t);
extern int zvol_set_volthreading(const char *, boolean_t);
extern int zvol_set_common(const char *, zfs_prop_t, zprop_source_t, uint64_t);
extern int zvol_set_ro(const char *, boolean_t);
extern zvol_state_handle_t *zvol_suspend(const char *);
extern int zvol_resume(zvol_state_handle_t *);
extern void *zvol_tag(zvol_state_handle_t *);
Expand Down
5 changes: 3 additions & 2 deletions sys/contrib/openzfs/include/sys/zvol_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ typedef struct zvol_state {
atomic_t zv_suspend_ref; /* refcount for suspend */
krwlock_t zv_suspend_lock; /* suspend lock */
struct zvol_state_os *zv_zso; /* private platform state */
boolean_t zv_threading; /* volthreading property */
} zvol_state_t;


Expand All @@ -81,9 +82,9 @@ void zvol_remove_minors_impl(const char *name);
void zvol_last_close(zvol_state_t *zv);
void zvol_insert(zvol_state_t *zv);
void zvol_log_truncate(zvol_state_t *zv, dmu_tx_t *tx, uint64_t off,
uint64_t len, boolean_t sync);
uint64_t len);
void zvol_log_write(zvol_state_t *zv, dmu_tx_t *tx, uint64_t offset,
uint64_t size, int sync);
uint64_t size, boolean_t commit);
int zvol_get_data(void *arg, uint64_t arg2, lr_write_t *lr, char *buf,
struct lwb *lwb, zio_t *zio);
int zvol_init_impl(void);
Expand Down
18 changes: 18 additions & 0 deletions sys/contrib/openzfs/lib/libshare/os/linux/nfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@


static boolean_t nfs_available(void);
static boolean_t exports_available(void);

typedef int (*nfs_shareopt_callback_t)(const char *opt, const char *value,
void *cookie);
Expand Down Expand Up @@ -539,6 +540,8 @@ nfs_commit_shares(void)
static void
nfs_truncate_shares(void)
{
if (!exports_available())
return;
nfs_reset_shares(ZFS_EXPORTS_LOCK, ZFS_EXPORTS_FILE);
}

Expand Down Expand Up @@ -566,3 +569,18 @@ nfs_available(void)

return (avail == 1);
}

static boolean_t
exports_available(void)
{
static int avail;

if (!avail) {
if (access(ZFS_EXPORTS_DIR, F_OK) != 0)
avail = -1;
else
avail = 1;
}

return (avail == 1);
}
3 changes: 2 additions & 1 deletion sys/contrib/openzfs/lib/libzfs/libzfs.abi
Original file line number Diff line number Diff line change
Expand Up @@ -1868,7 +1868,8 @@
<enumerator name='ZFS_PROP_REDACT_SNAPS' value='94'/>
<enumerator name='ZFS_PROP_SNAPSHOTS_CHANGED' value='95'/>
<enumerator name='ZFS_PROP_PREFETCH' value='96'/>
<enumerator name='ZFS_NUM_PROPS' value='97'/>
<enumerator name='ZFS_PROP_VOLTHREADING' value='97'/>
<enumerator name='ZFS_NUM_PROPS' value='98'/>
</enum-decl>
<typedef-decl name='zfs_prop_t' type-id='4b000d60' id='58603c44'/>
<enum-decl name='zprop_source_t' naming-typedef-id='a2256d42' id='5903f80e'>
Expand Down
12 changes: 12 additions & 0 deletions sys/contrib/openzfs/man/man7/zfsprops.7
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,18 @@ are equivalent to the
and
.Sy noexec
mount options.
.It Sy volthreading Ns = Ns Sy on Ns | Ns Sy off
Controls internal zvol threading.
The value
.Sy off
disables zvol threading, and zvol relies on application threads.
The default value is
.Sy on ,
which enables threading within a zvol.
Please note that this property will be overridden by
.Sy zvol_request_sync
module parameter.
This property is only applicable to Linux.
.It Sy filesystem_limit Ns = Ns Ar count Ns | Ns Sy none
Limits the number of filesystems and volumes that can exist under this point in
the dataset tree.
Expand Down
62 changes: 0 additions & 62 deletions sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@
#include <sys/vm.h>
#include <sys/vmmeter.h>

#if __FreeBSD_version >= 1300139
static struct sx arc_vnlru_lock;
static struct vnode *arc_vnlru_marker;
#endif

extern struct vfsops zfs_vfsops;

uint_t zfs_arc_free_target = 0;
Expand Down Expand Up @@ -131,53 +126,6 @@ arc_default_max(uint64_t min, uint64_t allmem)
return (MAX(allmem * 5 / 8, size));
}

/*
* Helper function for arc_prune_async() it is responsible for safely
* handling the execution of a registered arc_prune_func_t.
*/
static void
arc_prune_task(void *arg)
{
uint64_t nr_scan = (uintptr_t)arg;

#ifndef __ILP32__
if (nr_scan > INT_MAX)
nr_scan = INT_MAX;
#endif

#if __FreeBSD_version >= 1300139
sx_xlock(&arc_vnlru_lock);
vnlru_free_vfsops(nr_scan, &zfs_vfsops, arc_vnlru_marker);
sx_xunlock(&arc_vnlru_lock);
#else
vnlru_free(nr_scan, &zfs_vfsops);
#endif
}

/*
* Notify registered consumers they must drop holds on a portion of the ARC
* buffered they reference. This provides a mechanism to ensure the ARC can
* honor the metadata limit and reclaim otherwise pinned ARC buffers. This
* is analogous to dnlc_reduce_cache() but more generic.
*
* This operation is performed asynchronously so it may be safely called
* in the context of the arc_reclaim_thread(). A reference is taken here
* for each registered arc_prune_t and the arc_prune_task() is responsible
* for releasing it once the registered arc_prune_func_t has completed.
*/
void
arc_prune_async(uint64_t adjust)
{

#ifndef __LP64__
if (adjust > UINTPTR_MAX)
adjust = UINTPTR_MAX;
#endif
taskq_dispatch(arc_prune_taskq, arc_prune_task,
(void *)(intptr_t)adjust, TQ_SLEEP);
ARCSTAT_BUMP(arcstat_prune);
}

uint64_t
arc_all_memory(void)
{
Expand Down Expand Up @@ -228,23 +176,13 @@ arc_lowmem_init(void)
{
arc_event_lowmem = EVENTHANDLER_REGISTER(vm_lowmem, arc_lowmem, NULL,
EVENTHANDLER_PRI_FIRST);
#if __FreeBSD_version >= 1300139
arc_vnlru_marker = vnlru_alloc_marker();
sx_init(&arc_vnlru_lock, "arc vnlru lock");
#endif
}

void
arc_lowmem_fini(void)
{
if (arc_event_lowmem != NULL)
EVENTHANDLER_DEREGISTER(vm_lowmem, arc_event_lowmem);
#if __FreeBSD_version >= 1300139
if (arc_vnlru_marker != NULL) {
vnlru_free_marker(arc_vnlru_marker);
sx_destroy(&arc_vnlru_lock);
}
#endif
}

void
Expand Down
32 changes: 32 additions & 0 deletions sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,26 @@ zfs_vnodes_adjust_back(void)
#endif
}

#if __FreeBSD_version >= 1300139
static struct sx zfs_vnlru_lock;
static struct vnode *zfs_vnlru_marker;
#endif
static arc_prune_t *zfs_prune;

static void
zfs_prune_task(uint64_t nr_to_scan, void *arg __unused)
{
if (nr_to_scan > INT_MAX)
nr_to_scan = INT_MAX;
#if __FreeBSD_version >= 1300139
sx_xlock(&zfs_vnlru_lock);
vnlru_free_vfsops(nr_to_scan, &zfs_vfsops, zfs_vnlru_marker);
sx_xunlock(&zfs_vnlru_lock);
#else
vnlru_free(nr_to_scan, &zfs_vfsops);
#endif
}

void
zfs_init(void)
{
Expand All @@ -2100,11 +2120,23 @@ zfs_init(void)
dmu_objset_register_type(DMU_OST_ZFS, zpl_get_file_info);

zfsvfs_taskq = taskq_create("zfsvfs", 1, minclsyspri, 0, 0, 0);

#if __FreeBSD_version >= 1300139
zfs_vnlru_marker = vnlru_alloc_marker();
sx_init(&zfs_vnlru_lock, "zfs vnlru lock");
#endif
zfs_prune = arc_add_prune_callback(zfs_prune_task, NULL);
}

void
zfs_fini(void)
{
arc_remove_prune_callback(zfs_prune);
#if __FreeBSD_version >= 1300139
vnlru_free_marker(zfs_vnlru_marker);
sx_destroy(&zfs_vnlru_lock);
#endif

taskq_destroy(zfsvfs_taskq);
zfsctl_fini();
zfs_znode_fini();
Expand Down
21 changes: 15 additions & 6 deletions sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,15 @@ zfs_open(vnode_t **vpp, int flag, cred_t *cr)
return (SET_ERROR(EPERM));
}

/* Keep a count of the synchronous opens in the znode */
if (flag & O_SYNC)
atomic_inc_32(&zp->z_sync_cnt);
/*
* Keep a count of the synchronous opens in the znode. On first
* synchronous open we must convert all previous async transactions
* into sync to keep correct ordering.
*/
if (flag & O_SYNC) {
if (atomic_inc_32_nv(&zp->z_sync_cnt) == 1)
zil_async_to_sync(zfsvfs->z_log, zp->z_id);
}

zfs_exit(zfsvfs, FTAG);
return (0);
Expand Down Expand Up @@ -4201,6 +4207,10 @@ zfs_putpages(struct vnode *vp, vm_page_t *ma, size_t len, int flags,
}
zfs_vmobject_wunlock(object);

boolean_t commit = (flags & (zfs_vm_pagerput_sync |
zfs_vm_pagerput_inval)) != 0 ||
zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS;

if (ncount == 0)
goto out;

Expand Down Expand Up @@ -4253,7 +4263,7 @@ zfs_putpages(struct vnode *vp, vm_page_t *ma, size_t len, int flags,
* but that would make the locking messier
*/
zfs_log_write(zfsvfs->z_log, tx, TX_WRITE, zp, off,
len, 0, NULL, NULL);
len, commit, NULL, NULL);

zfs_vmobject_wlock(object);
for (i = 0; i < ncount; i++) {
Expand All @@ -4268,8 +4278,7 @@ zfs_putpages(struct vnode *vp, vm_page_t *ma, size_t len, int flags,

out:
zfs_rangelock_exit(lr);
if ((flags & (zfs_vm_pagerput_sync | zfs_vm_pagerput_inval)) != 0 ||
zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
if (commit)
zil_commit(zfsvfs->z_log, zp->z_id);

dataset_kstats_update_write_kstats(&zfsvfs->z_kstat, len);
Expand Down
Loading

0 comments on commit f8b1db8

Please sign in to comment.