Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Notable upstream pull request merges:
 #15511 92dc4ad Consider `dnode_t` allocations in dbuf cache size accounting
 #15514 22c8c33 Use abd_zero_off() where applicable
 #15515 5a3bffa ZIO: Optimize zio_flush()
 #15527 cd67bc0 freebsd: remove __FBSDID macro use

Obtained from:	OpenZFS
OpenZFS commit: a94860a
  • Loading branch information
mmatuska committed Nov 21, 2023
2 parents bbde5c0 + a94860a commit a2b560c
Show file tree
Hide file tree
Showing 39 changed files with 136 additions and 155 deletions.
20 changes: 11 additions & 9 deletions sys/contrib/openzfs/cmd/dbufstat.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import re

bhdr = ["pool", "objset", "object", "level", "blkid", "offset", "dbsize"]
bxhdr = ["pool", "objset", "object", "level", "blkid", "offset", "dbsize",
"meta", "state", "dbholds", "dbc", "list", "atype", "flags",
"usize", "meta", "state", "dbholds", "dbc", "list", "atype", "flags",
"count", "asize", "access", "mru", "gmru", "mfu", "gmfu", "l2",
"l2_dattr", "l2_asize", "l2_comp", "aholds", "dtype", "btype",
"data_bs", "meta_bs", "bsize", "lvls", "dholds", "blocks", "dsize"]
Expand All @@ -47,17 +47,17 @@ dhdr = ["pool", "objset", "object", "dtype", "cached"]
dxhdr = ["pool", "objset", "object", "dtype", "btype", "data_bs", "meta_bs",
"bsize", "lvls", "dholds", "blocks", "dsize", "cached", "direct",
"indirect", "bonus", "spill"]
dincompat = ["level", "blkid", "offset", "dbsize", "meta", "state", "dbholds",
"dbc", "list", "atype", "flags", "count", "asize", "access",
"mru", "gmru", "mfu", "gmfu", "l2", "l2_dattr", "l2_asize",
"l2_comp", "aholds"]
dincompat = ["level", "blkid", "offset", "dbsize", "usize", "meta", "state",
"dbholds", "dbc", "list", "atype", "flags", "count", "asize",
"access", "mru", "gmru", "mfu", "gmfu", "l2", "l2_dattr",
"l2_asize", "l2_comp", "aholds"]

thdr = ["pool", "objset", "dtype", "cached"]
txhdr = ["pool", "objset", "dtype", "cached", "direct", "indirect",
"bonus", "spill"]
tincompat = ["object", "level", "blkid", "offset", "dbsize", "meta", "state",
"dbc", "dbholds", "list", "atype", "flags", "count", "asize",
"access", "mru", "gmru", "mfu", "gmfu", "l2", "l2_dattr",
tincompat = ["object", "level", "blkid", "offset", "dbsize", "usize", "meta",
"state", "dbc", "dbholds", "list", "atype", "flags", "count",
"asize", "access", "mru", "gmru", "mfu", "gmfu", "l2", "l2_dattr",
"l2_asize", "l2_comp", "aholds", "btype", "data_bs", "meta_bs",
"bsize", "lvls", "dholds", "blocks", "dsize"]

Expand All @@ -70,6 +70,7 @@ cols = {
"blkid": [8, -1, "block number of buffer"],
"offset": [12, 1024, "offset in object of buffer"],
"dbsize": [7, 1024, "size of buffer"],
"usize": [7, 1024, "size of attached user data"],
"meta": [4, -1, "is this buffer metadata?"],
"state": [5, -1, "state of buffer (read, cached, etc)"],
"dbholds": [7, 1000, "number of holds on buffer"],
Expand Down Expand Up @@ -399,6 +400,7 @@ def update_dict(d, k, line, labels):
key = line[labels[k]]

dbsize = int(line[labels['dbsize']])
usize = int(line[labels['usize']])
blkid = int(line[labels['blkid']])
level = int(line[labels['level']])

Expand All @@ -416,7 +418,7 @@ def update_dict(d, k, line, labels):
d[pool][objset][key]['indirect'] = 0
d[pool][objset][key]['spill'] = 0

d[pool][objset][key]['cached'] += dbsize
d[pool][objset][key]['cached'] += dbsize + usize

if blkid == -1:
d[pool][objset][key]['bonus'] += dbsize
Expand Down
13 changes: 13 additions & 0 deletions sys/contrib/openzfs/include/sys/dmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,9 @@ typedef struct dmu_buf_user {
*/
taskq_ent_t dbu_tqent;

/* Size of user data, for inclusion in dbuf_cache accounting. */
uint64_t dbu_size;

/*
* This instance's eviction function pointers.
*
Expand Down Expand Up @@ -733,6 +736,16 @@ void *dmu_buf_replace_user(dmu_buf_t *db,
*/
void *dmu_buf_remove_user(dmu_buf_t *db, dmu_buf_user_t *user);

/*
* User data size accounting. This can be used to artifically inflate the size
* of the dbuf during cache accounting, so that dbuf_evict_thread evicts enough
* to satisfy memory reclaim requests. It's not used for anything else, and
* defaults to 0.
*/
uint64_t dmu_buf_user_size(dmu_buf_t *db);
void dmu_buf_add_user_size(dmu_buf_t *db, uint64_t nadd);
void dmu_buf_sub_user_size(dmu_buf_t *db, uint64_t nsub);

/*
* Returns the user data (dmu_buf_user_t *) associated with this dbuf.
*/
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/lib/libshare/os/freebsd/nfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
* Copyright (c) 2020, 2022 by Delphix. All rights reserved.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/param.h>
#include <sys/vfs.h>

Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/lib/libspl/os/freebsd/mnttab.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
* functions.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/param.h>
#include <sys/mount.h>
#include <sys/mntent.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/lib/libzfs/os/freebsd/libzfs_zmount.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
* This file implements Solaris compatible zmount() function.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/param.h>
#include <sys/mount.h>
#include <sys/uio.h>
Expand Down
27 changes: 2 additions & 25 deletions sys/contrib/openzfs/lib/libzutil/os/linux/zutil_setproctitle.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,6 @@ spt_min(size_t a, size_t b)
return ((a < b) ? a : b);
}

/*
* For discussion on the portability of the various methods, see
* https://lists.freebsd.org/pipermail/freebsd-stable/2008-June/043136.html
*/
static int
spt_clearenv(void)
{
char **tmp;

tmp = malloc(sizeof (*tmp));
if (tmp == NULL)
return (errno);

tmp[0] = NULL;
environ = tmp;

return (0);
}

static int
spt_copyenv(int envc, char *envp[])
{
Expand All @@ -124,12 +105,7 @@ spt_copyenv(int envc, char *envp[])
return (errno);
memcpy(envcopy, envp, envsize);

error = spt_clearenv();
if (error) {
environ = envp;
free(envcopy);
return (error);
}
environ = NULL;

for (i = 0; envcopy[i]; i++) {
eq = strchr(envcopy[i], '=');
Expand All @@ -142,6 +118,7 @@ spt_copyenv(int envc, char *envp[])
*eq = '=';

if (error) {
clearenv();
environ = envp;
free(envcopy);
return (error);
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/param.h>
#include <sys/lock.h>
#include <sys/mutex.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_dtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/queue.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_kmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/byteorder.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
* [2] https://illumos.org/man/9f/kstat_create
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/kernel.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/jail.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/priv.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_procfs_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
*
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/list.h>
#include <sys/mutex.h>
#include <sys/procfs_list.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_sunddi.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/jail.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/kernel.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_taskq.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/kmem.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/kernel.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/counter.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_zlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
*
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/kmem.h>
#include <sys/kmem_cache.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/spl/spl_zone.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/kernel.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/zfs/crypto_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
* Portions of this file are derived from sys/geom/eli/g_eli_hmac.c
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/errno.h>

Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/zfs/dmu_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
*
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/dmu.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/zfs/kmod_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
*
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/param.h>
#include <sys/buf.h>
#include <sys/cmn_err.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/zfs/sysctl_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
*
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
Expand Down
2 changes: 1 addition & 1 deletion sys/contrib/openzfs/module/os/freebsd/zfs/vdev_label_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ vdev_label_write_pad2(vdev_t *vd, const char *buf, size_t size)
ASSERT3U(spa_config_held(spa, SCL_ALL, RW_WRITER), ==, SCL_ALL);

pad2 = abd_alloc_for_io(VDEV_PAD_SIZE, B_TRUE);
abd_zero(pad2, VDEV_PAD_SIZE);
abd_copy_from_buf(pad2, buf, size);
abd_zero_off(pad2, size, VDEV_PAD_SIZE - size);

retry:
zio = zio_root(spa, NULL, NULL, flags);
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/zfs/zfs_file_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
*
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/dmu.h>
#include <sys/dmu_impl.h>
#include <sys/dmu_recv.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ioctl_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
*
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/param.h>
#include <sys/conf.h>
Expand Down
3 changes: 0 additions & 3 deletions sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ioctl_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
*
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/nvpair.h>
Expand Down
Loading

0 comments on commit a2b560c

Please sign in to comment.