History | View | Annotate | Download (24.3 kB)
Use error_is_set() only when necessary
error_is_set(&var) is the same as var != NULL, but it takeswhole-program analysis to figure that out. Unnecessarily hard foroptimizers, static checkers, and human readers. Dumb it down toobvious.
Gets rid of several dozen Coverity false positives....
rbd: switch from pipe to QEMUBH completion notification
rbd callbacks are called from non-QEMU threads. Up until now a pipe wasused to signal completion back to the QEMU iothread.
The pipe writer code handles EAGAIN using select(2). The select(2) API...
qemu-option: Remove qemu_opts_create_nofail
This is a boiler-plate _nofail variant of qemu_opts_create. Remove anduse error_abort in call sites.
null/0 arguments needs to be added for the id and fail_if_exists fieldsin affected callsites due to argument inconsistency between the normal and...
rbd: avoid qemu_rbd_snap_list() memory leaks
When there are no snapshots qemu_rbd_snap_list() returns 0 and thesnapshot table pointer is NULL. Don't forget to free the snaps bufferwe allocated for librbd rbd_snap_list().
When the function succeeds don't forget to free the snaps buffer after...
block: introduce BlockDriver.bdrv_needs_filename to enable some drivers.
Some drivers will have driver specifics options but no filename.This new bool allow the block layer to treat them correctly.
The .bdrv_needs_filename is set in drivers not having .bdrv_parse_filename and...
bdrv: Use "Error" for creating images
Add an Error ** parameter to BlockDriver.bdrv_create to allow morespecific error messages.
Signed-off-by: Max Reitz <mreitz@redhat.com>
snapshot: distinguish id and name in snapshot delete
Snapshot creation actually already distinguish id and name since it takea structured parameter *sn, but delete can't. Later an accurate deleteis needed in qmp_transaction abort and blockdev-snapshot-delete-sync,...
bdrv: Use "Error" for opening images
Add an Error ** parameter to BlockDriver.bdrv_open andBlockDriver.bdrv_file_open to allow more specific error messages.
block/rbd: drop qemu_rbd_aio_flush_cb()
.io_flush() is no longer called so drop qemu_rbd_aio_flush_cb().qemu_aio_count is unused now so drop it too.
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....
block: change default of .has_zero_init to 0
.has_zero_init defaults to 1 for all formats and protocols.
this is a dangerous default since this means that allnew added drivers need to manually overwrite it to 0 ifthey do not ensure that a device is zero initialized...
rbd: Fix use after free in rbd_open()
Commit a9ccedc3 frees the QemuOpts for the driver-specific optionsimmediately, even though it still needs the filename string that iscontained there. This doesn't work. Move the deletion of the QemuOpts tothe end of the function where its content isn't needed any more....
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>
rbd: Use bdrv_open options instead of filename
This is only to convert the internal interface that is used for passingthe "filename" to be parsed, but converting to actual fine grainedoptions is left for another day, as it doesn't look trivial.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
rbd: add an asynchronous flush
The existing bdrv_co_flush_to_disk implementation uses rbd_flush(),which is sychronous and causes the main qemu thread to block until itis complete. This results in unresponsiveness and extra latency forthe guest.
Fix this by using an asynchronous version of flush. This was added to...
rbd: fix compile error
Commit 787e4a85 [block: Add options QDict to bdrv_file_open() prototypes] didn'tupdate rbd.c accordingly.
Cc: Kevin Wolf <kwolf@redhat.com>Cc: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Liu Yuan <tailai.ly@taobao.com>Reviewed-by: Stefan Weil <sw@weilnetz.de>...
misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: move include files to include/block/
rbd: Fix race between aio completition and aio cancel
This one fixes a race which qemu had also in iscsi block driverbetween cancellation and io completition.
qemu_rbd_aio_cancel was not synchronously waiting for the end ofthe command.
To archieve this it introduces a new status flag which uses...
use int64_t for return values from rbd instead of int
rbd / rados tends to return pretty often length of writesor discarded blocks. These values might be bigger than int.
The steps to reproduce are:
mkfs.xfs -f a whole device bigger than int in bytes. mkfs.xfs sends...
aio: rename AIOPool to AIOCBInfo
Now that AIOPool no longer keeps a freelist, it isn't really a "pool" anymore. Rename it to AIOCBInfo and make it const since it no longerneeds to be modified.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: do not parse BDRV_O_CACHE_WB in block drivers
Block drivers should ignore BDRV_O_CACHE_WB in .bdrv_open flags,and in the bs->open_flags.
This patch removes the code, leaving the behaviour behind as ifBDRV_O_CACHE_WB was set.
Signed-off-by: Jeff Cody <jcody@redhat.com>...
Merge remote-tracking branch 'mjt/mjt-iov2' into staging
rbd: hook up cache options
Writeback caching was added in Ceph 0.46, and writethrough will be in0.47. These are controlled by general config options, so there's noneed to check for librbd version.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
allow qemu_iovec_from_buffer() to specify offset from which to start copying
Similar to qemu_iovec_memset(QEMUIOVector *qiov, size_t offset, int c, size_t bytes);the new prototype is: qemu_iovec_from_buf(QEMUIOVector *qiov, size_t offset,...
change qemu_iovec_to_buf() to match other to,from_buf functions
It now allows specifying offset within qiov to start from andamount of bytes to copy. Actual implementation is just a callto iov_to_buf().
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
rbd: add discard support
Change the write flag to an operation type in RBDAIOCB, and make thebuffer optional since discard doesn't use it.
Discard is first included in librbd 0.1.2 (which is in Ceph 0.46).If librbd is too old, leave out qemu_rbd_aio_discard entirely,...
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>
rbd: wire up snapshot removal and rollback functionality
Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
prepare for future GPLv2+ relicensing
All files under GPLv2 will get GPLv2+ changes starting tomorrow.event_notifier.c and exec-obsolete.h were only ever touched by Red Hatemployees and can be relicensed now.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
block: qemu_aio_get does not return NULL
Initially done with the following semantic patch:
rule1 expression E;statement S;@@ E = qemu_aio_get (...);(- if (E == NULL) { ... } |- if (E) { <... S ...> })
rule1
which however missed occurrences in linux-aio.c and posix-aio-compat.c....
rbd: always set out parameter in qemu_rbd_snap_list
The caller expects psn_tab to be NULL when there are no snapshots oran error occurs. This results in calling g_free on an invalid address.
Reported-by: Oliver Francke <Oliver@filoo.de>Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>...
block: Rename bdrv_co_flush to bdrv_co_flush_to_disk
There are two different types of flush that you can do: Flushing one level upto the OS (i.e. writing data to the host page cache) or flushing it all the waydown to the disk. The existing functions flush to the disk, reflect this in the...
block: change flush to co_flush
Since coroutine operation is now mandatory, convert all bdrv_flushimplementations to coroutines. For qcow2, this means taking the lock.Other implementations are simpler and just forward bdrv_flush to theunderlying protocol, so they can avoid the lock....
rbd: allow escaping in config string
The config string is variously delimited by =, @, and /, depending on thefield. Allow these characters to be escaped by preceeding them with \.
Signed-off-by: Sage Weil <sage@newdream.net>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
rbd: ignore failures when reading from default conf location
If we are reading from the default config location, ignore any failures.It is perfectly legal for the user to specify exactly the options they needand to not rely on any config file.
Signed-off-by: Sage Weil <sage@newdream.net>...
rbd: update comment heading
Properly document the configuration string syntax and semantics. Remove(out of date) details about the librbd implementation.
rbd: call flush, if available
librbd recently added async writeback and flush support. If the newrbd_flush() call is available, call it.
rbd: clean up, fix style
No assignment in condition. Remove duplicate ret > 0 check.
Signed-off-by: Sage Weil <sage@newdream.net>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
rbd: fix leak in qemu_rbd_open failure paths
Fix leak of s->snap in failure path. Simplify error paths for the wholefunction.
Reported-by: Stefan Hajnoczi <stefanha@gmail.com>Signed-off-by: Sage Weil <sage@newdream.net>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>...
rbd: allow client id to be specified in config string
Allow the client id to be specified in the config string via 'id=' so thatusers can control who they authenticate as. Currently they are stuck withthe default ('admin'). This is necessary for anyone using authentication...
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>
block/rbd: Remove unused local variable
Variable 'snap' is assigned a value that is never used.Remove snap and the related code.
Cc: Christian Brunner <chb@muc.de>Cc: Josh Durgin <josh.durgin@dreamhost.com>Cc: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Weil <weil@mail.berlios.de>...
rbd: allow configuration of rados from the rbd filename
The new format is rbd:pool/image[@snapshot][:option1=value1[:option2=value2...]]Each option is used to configure rados, and may be any Ceph option, or "conf".The "conf" option specifies a Ceph configuration file to read....
rbd: check return values when scheduling aio
If scheduling fails, the number of outstanding I/Os must be correct,or there will be a hang when waiting for everything to be flushed.
Reviewed-by: Christian Brunner <chb@muc.de>Reported-by: Stefan Hajnoczi <stefanha@gmail.com>...
rbd: Add bdrv_truncate implementation
Reviewed-by: Christian Brunner <chb@muc.de>Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
rbd: use the higher level librbd instead of just librados
librbd stacks on top of librados to provide accessto rbd images.
Using librbd simplifies the qemu code, and allowsqemu to use new versions of the rbd formatwith few (if any) changes.
Reviewed-by: Christian Brunner <chb@muc.de>...
ceph/rbd block driver for qemu-kvm
RBD is an block driver for the distributed file system Ceph(http://ceph.newdream.net/). This driver uses librados (which is partof the Ceph server) for direct access to the Ceph object store and isrunning entirely in userspace (Yehuda also wrote a driver for the...