diff options
| author | Stefan Hajnoczi <stefanha@redhat.com> | 2025-05-30 11:40:56 -0400 |
|---|---|---|
| committer | Stefan Hajnoczi <stefanha@redhat.com> | 2025-05-30 11:40:56 -0400 |
| commit | 72c58ff8958f6e00ce361d1d568dc21e41c85f45 (patch) | |
| tree | 5be8313900f367b2b9c418c6dc02ab541d700310 /nbd/common.c | |
| parent | d2e9b78162e31b1eaf20f3a4f563da82da56908d (diff) | |
| parent | c49dda7254d43d9e1d4da59c55f02055ba7c4c1b (diff) | |
| download | focaccia-qemu-72c58ff8958f6e00ce361d1d568dc21e41c85f45.tar.gz focaccia-qemu-72c58ff8958f6e00ce361d1d568dc21e41c85f45.zip | |
Merge tag 'pull-nbd-2025-05-29' of https://repo.or.cz/qemu/ericb into staging
NBD patches for 2025-05-29 - Nir Soffer: Allow for larger Unix socket buffers in NBD - Eric Blake: clean up mirror-sparse iotest issues # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAmg42T0ACgkQp6FrSiUn # Q2r5nwgAg4ftfPBnynqL54dQ6rPKPOwW3n4Ei26EsC86OcFIGEGuCK6UGBH4bH6d # BgyjNWY/6/t90vnXcBGVFmxrugHGh3TwOpAY08TqW0LGmpJiwX5wZTk3cVbcwXat # ME8oYeOQwLwqboFthlgnXsUuQrKtXrkY27154ztH354x4bi5AmHi//Or4+EdFf8L # /cCmS7uHPiHV9l1+U1hV4i1UQ+3rWHIOcfn/sKeEwPfrlyEW+2fxWUjl7qyf/Mqz # EwCtkjz4WsFTxYyQPN6r3NyoEIZDRK27srubVhat6Fk9gOnR5Rh2MCntyxUpXmo5 # 4xD3QkVbXVRhXv6n6rjmA/Q3bvZ1oQ== # =yjPj # -----END PGP SIGNATURE----- # gpg: Signature made Thu 29 May 2025 18:01:33 EDT # gpg: using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A # gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full] # gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full] # gpg: aka "[jpeg image of size 6874]" [full] # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A * tag 'pull-nbd-2025-05-29' of https://repo.or.cz/qemu/ericb: iotests: Filter out ZFS in several tests iotests: Improve mirror-sparse on ext4 and xfs iotests: Use disk_usage in more places nbd: Set unix socket send buffer on Linux nbd: Set unix socket send buffer on macOS io: Add helper for setting socket send buffer size Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'nbd/common.c')
| -rw-r--r-- | nbd/common.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/nbd/common.c b/nbd/common.c index 589a748cfe..2a133a66c3 100644 --- a/nbd/common.c +++ b/nbd/common.c @@ -18,6 +18,9 @@ #include "qemu/osdep.h" #include "trace.h" +#include "io/channel-socket.h" +#include "qapi/error.h" +#include "qemu/units.h" #include "nbd-internal.h" /* Discard length bytes from channel. Return -errno on failure and 0 on @@ -264,3 +267,26 @@ const char *nbd_mode_lookup(NBDMode mode) return "<unknown>"; } } + +/* + * Testing shows that 2m send buffer is optimal. Changing the receive buffer + * size has no effect on performance. + * On Linux we need to increase net.core.wmem_max to make this effective. + */ +#if defined(__APPLE__) || defined(__linux__) +#define UNIX_STREAM_SOCKET_SEND_BUFFER_SIZE (2 * MiB) +#endif + +void nbd_set_socket_send_buffer(QIOChannelSocket *sioc) +{ +#ifdef UNIX_STREAM_SOCKET_SEND_BUFFER_SIZE + if (sioc->localAddr.ss_family == AF_UNIX) { + size_t size = UNIX_STREAM_SOCKET_SEND_BUFFER_SIZE; + Error *errp = NULL; + + if (qio_channel_socket_set_send_buffer(sioc, size, &errp) < 0) { + warn_report_err(errp); + } + } +#endif /* UNIX_STREAM_SOCKET_SEND_BUFFER_SIZE */ +} |