]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Increase default zcmd allocation to 256K
authorMichael Niewöhner <c0d3z3r0@users.noreply.github.com>
Tue, 30 Jul 2019 16:59:38 +0000 (18:59 +0200)
committerMatthew Ahrens <mahrens@delphix.com>
Tue, 30 Jul 2019 16:59:38 +0000 (09:59 -0700)
When creating hundreds of clones (for example using containers with
LXD) cloning slows down as the number of clones increases over time.
The reason for this is that the fetching of the clone information
using a small zcmd buffer requires two ioctl calls, one to determine
the size and a second to return the data. However, this requires
gathering the data twice, once to determine the size and again to
populate the zcmd buffer to return it to userspace.
These are expensive ioctl() calls, so instead, make the default buffer
size much larger: 256K.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Closes #9084

lib/libzfs/libzfs_util.c

index 9dcbb9b608cded365bce6180a44c12e5ba089176..27d630d4f51f1f7e113a3f3b0a033f783b05886b 100644 (file)
@@ -1140,7 +1140,7 @@ int
 zcmd_alloc_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, size_t len)
 {
        if (len == 0)
-               len = 16 * 1024;
+               len = 256 * 1024;
        zc->zc_nvlist_dst_size = len;
        zc->zc_nvlist_dst =
            (uint64_t)(uintptr_t)zfs_alloc(hdl, zc->zc_nvlist_dst_size);