mirror_zfs/lib/libzfs
Rob Norris 3e7e19e028 pool_iter_refresh: don't refresh pools twice
In "all pools" mode, pool_iter_refresh() will call zpool_iter(), which
will call zpool_refresh_stats() before calling add_pool(). If we already
have the pool, this is a different handle, so we just release it and
return. Back in pool_iter_refresh(), we then call zpool_stats_refresh()
again for our handle on the same pool.

All together, this means we're doing two ZFS_IOC_POOL_STATS calls into
the kernel for every pool in the system. This isn't wrong, but it does
double the pressure on global locks.

Instead, we add a new function zpool_refresh_stats_from_handle() that
simply copies the pool config and state from one handle to another, and
use it to update our handle before we release it in add_pool(), so we
only have one call per pool per interval.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #17807
2025-10-21 09:50:43 -07:00
..
os libzfs: ensure all ioctl calls go through lzc_ioctl_fd() 2025-05-21 09:23:23 -07:00
.gitignore Clean up lib dependencies 2020-07-10 14:26:00 -07:00
libzfs_changelist.c SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
libzfs_config.c pool_iter_refresh: don't refresh pools twice 2025-10-21 09:50:43 -07:00
libzfs_crypto.c everywhere: misc unnecessary var init/update 2025-07-22 15:23:58 -07:00
libzfs_dataset.c Relax special_small_blocks restrictions 2025-07-02 11:11:37 -07:00
libzfs_diff.c Prefer VERIFY0(n) over VERIFY(n == 0) 2025-08-07 11:40:59 -07:00
libzfs_impl.h SPDX: license tags: CDDL-1.0 2025-03-13 17:56:27 -07:00
libzfs_import.c Prefer VERIFY0(n) over VERIFY(n == 0) 2025-08-07 11:40:59 -07:00
libzfs_iter.c Sort the blocking snapshots list #12751 (#17264) 2025-05-01 17:40:23 -07:00
libzfs_mount.c Prefer VERIFY0(n) over VERIFY(n == 0) 2025-08-07 11:40:59 -07:00
libzfs_pool.c Detect a slow raidz child during reads 2025-09-10 15:31:30 -07:00
libzfs_sendrecv.c Prefer VERIFY0P(n) over VERIFY(n == NULL) 2025-08-07 11:41:37 -07:00
libzfs_status.c Add no-upgrade featureflag 2025-07-09 14:01:59 -07:00
libzfs_util.c Detect a slow raidz child during reads 2025-09-10 15:31:30 -07:00
libzfs.abi pool_iter_refresh: don't refresh pools twice 2025-10-21 09:50:43 -07:00
libzfs.pc.in Spruce up pkg-config files for libzfs/libzfs_core 2020-09-04 11:11:18 -07:00
libzfs.suppr Library ABI tracking with abigail 2020-11-17 09:18:52 -08:00
Makefile.am Bump SONAME of libzfs and libzpool 2024-10-06 14:49:33 -07:00
THIRDPARTYLICENSE.openssl Fix typos in lib/ 2019-09-02 17:53:27 -07:00
THIRDPARTYLICENSE.openssl.descrip Encryption patch follow-up 2017-10-11 16:54:48 -04:00