History | View | Annotate | Download (18.7 kB)
block/nbd: drop nbd_have_request()
.io_flush() is no longer called so drop nbd_have_request(). We cannotdrop in_flight since it is still used by other block/nbd.c code.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
aio: drop io_flush argument
The .io_flush() handler no longer exists and has no users. Drop theio_flush argument to aio_set_fd_handler() and related functions.
The AioFlushEventNotifierHandler and AioFlushHandler typedefs are nolonger used and are dropped too....
nbd: strip braces from literal IPv6 address in URI
Otherwise they would get passed to getaddrinfo and fail with:address resolution failed for [::1]:1234: Name or service not known
(Broken by commit v1.4.0-736-gf17c90b)
Signed-off-by: Ján Tomko <jtomko@redhat.com>...
remove double semicolons
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Merge remote-tracking branch 'kwolf/for-anthony' into staging
block: Remove filename parameter from .bdrv_file_open()
It is unused now in all block drivers.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
nbd: set TCP_NODELAY
Disable the Nagle algorithm to reduce latency. Note this means we mustalso use TCP_CORK when sending header followed by payload to avoidfragmenting lots of little packets. The previous patch took care ofthat.
Suggested-by: Nick Thomas <nick@bytemark.co.uk>...
nbd: use TCP_CORK in nbd_co_send_request()
Use TCP_CORK to defer packet transmission until both the header and thepayload have been written.
Suggested-by: Nick Thomas <nick@bytemark.co.uk>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
nbd: unlock mutex in nbd_co_send_request() error path
Cc: qemu-stable@nongnu.orgSigned-off-by: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()
The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets.Rename to qemu_set_nonblock() just like qemu_set_cloexec().
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
nbd: Accept -drive options for the network connection
The existing parsers for the file name now parse everything into thebdrv_open() options QDict. Instead of using these parsers, you can nowdirectly specify the options on the command line, like this:...
block: Introduce .bdrv_parse_filename callback
If a driver needs structured data and not just a string, it can providea .bdrv_parse_filename callback now that parses the command line stringinto separate options. Keeping this separate from .bdrv_open_filename...
nbd: Use default port if only host is specified
The URL method already takes care to apply the default port when none isspecfied. Directly specifying driver-specific options required the portnumber until now. Allow leaving it out and apply the default....
nbd: Check against invalid option combinations
A file name may only specified if no host or socket path is specified.The latter two may not appear at the same time either.
block: Add options QDict to bdrv_file_open() prototypes
The new parameter is unused yet.
nbd: Keep hostname and port separate
The NBD block supports an URL syntax, for which a URL parser returnsseparate hostname and port fields. It also supports the traditional qemusyntax encoded in a filename. Until now, after parsing the URL to geteach piece of information, a new string is built to be fed to socket...
misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: move include files to include/block/
nbd: accept URIs
The URI syntax is consistent with the Gluster syntax. Export namesare specified in the path, preceded by one or more (otherwise unused)slashes.
nbd: accept relative path to Unix socket
Adding the "is_unix" member now will simplify the parsing of NBD URIs.
cleanup qemu_co_sendv(), qemu_co_recvv() and friends
The same as for non-coroutine versions in previouspatches: rename arguments to be more obvious, changetype of arguments from int to size_t where appropriate,and use common code for send and receive paths (with...
nbd: Fix uninitialised use of s->sock
s->sock is assigned only afterwards, so we're really registering anaio_fd_handler for file descriptor 0 here. Not exactly what we intended.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
aio: remove process_queue callback and qemu_aio_process_queue
Both unused after the previous patch.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
nbd: consistently check for <0 or >=0
This prepares for the following patch, which changes -1 return valuesto negative errno.
nbd: consistently return negative errno values
In the next patch we need to look at the return code of nbd_wr_sync.To avoid percolating the socket_error() ugliness all around, let'shandle errors by returning negative errno values.
nbd: do not block in nbd_wr_sync if no data at all is available
Right now, nbd_wr_sync will hang if no data at all is available on thesocket and the other side is not going to provide any. Relax this bymaking it loop only for writes or partial reads. This fixes a race...
nbd: avoid out of bounds access to recv_coroutine array
This can happen with a buggy or malicious server.
Reported-by: Michael Tokarev <mjt@tls.msk.ru>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
nbd: switch to asynchronous operation
nbd: split requests
qemu-nbd has a limit of slightly less than 1M per request. Workaround this in the nbd block driver.
nbd: allow multiple in-flight requests
Allow sending up to 16 requests, and drive the replies to the coroutinethat did the request. The code is written to be exactly the same asbefore this patch when MAX_NBD_REQUESTS == 1 (modulo the extra mutexand state)....
nbd: add support for NBD_CMD_FLAG_FUA
nbd: add support for NBD_CMD_FLUSH
nbd: add support for NBD_CMD_TRIM
fix typo: delete redundant semicolon
Double semicolons should be single.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
block: take lock around bdrv_read implementations
This does the first part of the conversion to coroutines, bywrapping bdrv_read implementations to take the mutex.
Drivers that implement bdrv_read rather than bdrv_co_readv canthen benefit from asynchronous operation (at least if the underlying...
block: take lock around bdrv_write implementations
This does the first part of the conversion to coroutines, bywrapping bdrv_write implementations to take the mutex.
Drivers that implement bdrv_write rather than bdrv_co_writev canthen benefit from asynchronous operation (at least if the underlying...
block: add a CoMutex to synchronous read drivers
The big conversion of bdrv_read/write to coroutines caused the twohomonymous callbacks in BlockDriver to become reentrant. It goeslike this:
1) bdrv_read is now called in a coroutine, and calls bdrv_read or...
nbd: support feature negotiation
nbd supports writing flags in bytes 24...27 of the header,and uses that for the read-only flag. Add support for itin qemu-nbd.
nbd: Clean up use of block_int.h
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
NBD: Avoid leaking a couple of strings when the NBD device is closed
Signed-off-by: Nick Thomas <nick@bytemark.co.uk>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
NBD device: Separate out parsing configuration and opening sockets.
We also change the way the file parameter is parsed so IPv6 IPaddresses can be used, e.g.: "drive=nbd:[::1]:5000"
nbd: correctly manage default port
block/nbd.c: use default port number when none is specifiedqemu-nbd.c: use IANA-assigned port number: 10809
Signed-off-by: Laurent Vivier <laurent@vivier.eu>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
nbd: Introduce NBD named exports.
This patch allows to connect Qemu using NBD protocol to an nbd-serverusing named exports.
For instance, if on the host "isoserver", in /etc/nbd-server/config, you have:
[generic][debian-500-ppc-netinst] exportname = /ISO/debian-500-powerpc-netinst.iso...
block: Open the underlying image file in generic code
Format drivers shouldn't need to bother with things like file names, but ratherjust get an open BlockDriverState for the underlying protocol. This patchintroduces this behaviour for bdrv_open implementation. For protocols which...
block: kill BDRV_O_CREAT
The BDRV_O_CREAT option is unused inside qemu and partially duplicatesthe bdrv_create method. Remove it, and the -C option to qemu-io whichisn't used in qemu-iotests anyway.
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Move block drivers into their own directory