diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-06-13 18:17:32 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-06-13 18:17:32 +0100 |
commit | d1bf88e56f46c75d472dc60c02bbbc7b474519f9 (patch) | |
tree | f773f3c6540d6e9ad94ee83b0a8b45843f77fe42 /nbd/server.c | |
parent | 650a379d505bf558bcb41124bc6c951a76cbc113 (diff) | |
parent | 611ae1d71647c58b23dc2c116a946884ce30abf8 (diff) |
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-06-13' into staging
nbd patches for 2019-06-13
- add 'qemu-nbd --pid-file'
- NBD-related iotest improvements
- NBD code refactoring in preparation for reconnect
# gpg: Signature made Thu 13 Jun 2019 16:37:58 BST
# gpg: using RSA key A7A16B4A2527436A
# 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
* remotes/ericb/tags/pull-nbd-2019-06-13:
block/nbd: merge NBDClientSession struct back to BDRVNBDState
block/nbd: merge nbd-client.* to nbd.c
block/nbd-client: drop stale logout
nbd/server: Nicer spelling of max BLOCK_STATUS reply length
iotests: Let 233 run concurrently
iotests: Use qemu-nbd's --pid-file
qemu-nbd: Do not close stderr
iotests.py: Add qemu_nbd_early_pipe()
qemu-nbd: Add --pid-file option
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'nbd/server.c')
-rw-r--r-- | nbd/server.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/nbd/server.c b/nbd/server.c index aeca3893fe..10faedcfc5 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -21,15 +21,18 @@ #include "qapi/error.h" #include "trace.h" #include "nbd-internal.h" +#include "qemu/units.h" #define NBD_META_ID_BASE_ALLOCATION 0 #define NBD_META_ID_DIRTY_BITMAP 1 -/* NBD_MAX_BITMAP_EXTENTS: 1 mb of extents data. An empirical +/* + * NBD_MAX_BLOCK_STATUS_EXTENTS: 1 MiB of extents data. An empirical * constant. If an increase is needed, note that the NBD protocol * recommends no larger than 32 mb, so that the client won't consider - * the reply as a denial of service attack. */ -#define NBD_MAX_BITMAP_EXTENTS (0x100000 / 8) + * the reply as a denial of service attack. + */ +#define NBD_MAX_BLOCK_STATUS_EXTENTS (1 * MiB / 8) static int system_errno_to_nbd_errno(int err) { @@ -1960,7 +1963,7 @@ static int nbd_co_send_block_status(NBDClient *client, uint64_t handle, Error **errp) { int ret; - unsigned int nb_extents = dont_fragment ? 1 : NBD_MAX_BITMAP_EXTENTS; + unsigned int nb_extents = dont_fragment ? 1 : NBD_MAX_BLOCK_STATUS_EXTENTS; NBDExtent *extents = g_new(NBDExtent, nb_extents); uint64_t final_length = length; @@ -2045,7 +2048,7 @@ static int nbd_co_send_bitmap(NBDClient *client, uint64_t handle, uint32_t context_id, Error **errp) { int ret; - unsigned int nb_extents = dont_fragment ? 1 : NBD_MAX_BITMAP_EXTENTS; + unsigned int nb_extents = dont_fragment ? 1 : NBD_MAX_BLOCK_STATUS_EXTENTS; NBDExtent *extents = g_new(NBDExtent, nb_extents); uint64_t final_length = length; |