summaryrefslogtreecommitdiff
path: root/block/rbd.c
AgeCommit message (Collapse)AuthorFilesLines
2012-11-21use int64_t for return values from rbd instead of intStefan Priebe1-2/+2
rbd / rados tends to return pretty often length of writes or 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 a discard. Important is that you use scsi-hd and set discard_granularity=512. Otherwise rbd disabled discard support. Signed-off-by: Stefan Priebe <s.priebe@profihost.ag> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-11-14aio: rename AIOPool to AIOCBInfoStefan Hajnoczi1-2/+2
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 longer needs to be modified. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-09-24block: do not parse BDRV_O_CACHE_WB in block driversJeff Cody1-6/+0
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 if BDRV_O_CACHE_WB was set. Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-07-09Merge remote-tracking branch 'mjt/mjt-iov2' into stagingAnthony Liguori1-2/+2
* mjt/mjt-iov2: rewrite iov_send_recv() and move it to iov.c cleanup qemu_co_sendv(), qemu_co_recvv() and friends export iov_send_recv() and use it in iov_send() and iov_recv() rename qemu_sendv to iov_send, change proto and move declarations to iov.h change qemu_iovec_to_buf() to match other to,from_buf functions consolidate qemu_iovec_copy() and qemu_iovec_concat() and make them consistent allow qemu_iovec_from_buffer() to specify offset from which to start copying consolidate qemu_iovec_memset{,_skip}() into single function and use existing iov_memset() rewrite iov_* functions change iov_* function prototypes to be more appropriate virtio-serial-bus: use correct lengths in control_out() message Conflicts: tests/Makefile Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-06-15rbd: hook up cache optionsJosh Durgin1-0/+19
Writeback caching was added in Ceph 0.46, and writethrough will be in 0.47. These are controlled by general config options, so there's no need to check for librbd version. Signed-off-by: Josh Durgin <josh.durgin@inktank.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-06-11change qemu_iovec_to_buf() to match other to,from_buf functionsMichael Tokarev1-1/+1
It now allows specifying offset within qiov to start from and amount of bytes to copy. Actual implementation is just a call to iov_to_buf(). Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-06-11allow qemu_iovec_from_buffer() to specify offset from which to start copyingMichael Tokarev1-1/+1
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, const void *buf, size_t bytes); The processing starts at offset bytes within qiov. This way, we may copy a bounce buffer directly to a middle of qiov. This is exactly the same function as iov_from_buf() from iov.c, so use the existing implementation and rename it to qemu_iovec_from_buf() to be shorter and to match the utility function. As with utility implementation, we now assert that the offset is inside actual iovec. Nothing changed for current callers, because `offset' parameter is new. While at it, stop using "bounce-qiov" in block/qcow2.c and copy decrypted data directly from cluster_data instead of recreating a temp qiov for doing that. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-05-02rbd: add discard supportJosh Durgin1-16/+73
Change the write flag to an operation type in RBDAIOCB, and make the buffer 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, so the old behavior is preserved. Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-19aio: remove process_queue callback and qemu_aio_process_queuePaolo Bonzini1-3/+2
Both unused after the previous patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-01-26rbd: wire up snapshot removal and rollback functionalityGregory Farnum1-0/+22
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>
2012-01-13prepare for future GPLv2+ relicensingPaolo Bonzini1-0/+2
All files under GPLv2 will get GPLv2+ changes starting tomorrow. event_notifier.c and exec-obsolete.h were only ever touched by Red Hat employees and can be relicensed now. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-15rbd: always set out parameter in qemu_rbd_snap_listJosh Durgin1-1/+2
The caller expects psn_tab to be NULL when there are no snapshots or an 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> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15block: qemu_aio_get does not return NULLPaolo Bonzini1-3/+0
Initially done with the following semantic patch: @ rule1 @ expression E; statement S; @@ E = qemu_aio_get (...); ( - if (E == NULL) { ... } | - if (E) { <... S ...> } ) which however missed occurrences in linux-aio.c and posix-aio-compat.c. Those were done by hand. The change in vdi_aio_setup's caller was also done by hand. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-11block: Rename bdrv_co_flush to bdrv_co_flush_to_diskKevin Wolf1-5/+5
There are two different types of flush that you can do: Flushing one level up to the OS (i.e. writing data to the host page cache) or flushing it all the way down to the disk. The existing functions flush to the disk, reflect this in the function name. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-21block: change flush to co_flushPaolo Bonzini1-2/+2
Since coroutine operation is now mandatory, convert all bdrv_flush implementations to coroutines. For qcow2, this means taking the lock. Other implementations are simpler and just forward bdrv_flush to the underlying protocol, so they can avoid the lock. The bdrv_flush callback is then unused and can be eliminated. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-20rbd: allow escaping in config stringSage Weil1-2/+27
The config string is variously delimited by =, @, and /, depending on the field. 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>
2011-09-20rbd: call flush, if availableSage Weil1-0/+12
librbd recently added async writeback and flush support. If the new rbd_flush() call is available, call it. Signed-off-by: Sage Weil <sage@newdream.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-20rbd: update comment headingSage Weil1-15/+13
Properly document the configuration string syntax and semantics. Remove (out of date) details about the librbd implementation. Signed-off-by: Sage Weil <sage@newdream.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-20rbd: ignore failures when reading from default conf locationSage Weil1-10/+4
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 need and to not rely on any config file. Signed-off-by: Sage Weil <sage@newdream.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-09-12rbd: fix leak in qemu_rbd_open failure pathsSage Weil1-15/+13
Fix leak of s->snap in failure path. Simplify error paths for the whole function. Reported-by: Stefan Hajnoczi <stefanha@gmail.com> 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>
2011-09-12rbd: clean up, fix styleSage Weil1-9/+8
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>
2011-09-12rbd: allow client id to be specified in config stringSage Weil1-8/+44
Allow the client id to be specified in the config string via 'id=' so that users can control who they authenticate as. Currently they are stuck with the default ('admin'). This is necessary for anyone using authentication in their environment. 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>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-13/+13
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-06-14block/rbd: Remove unused local variableStefan Weil1-4/+0
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> Reviewed-by: Josh Durgin <josh.durgin@dreamhost.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08rbd: Add bdrv_truncate implementationJosh Durgin1-0/+14
Reviewed-by: Christian Brunner <chb@muc.de> Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08rbd: check return values when scheduling aioJosh Durgin1-4/+20
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> Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08rbd: allow configuration of rados from the rbd filenameJosh Durgin1-17/+102
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. This allows rbd volumes from more than one Ceph cluster to be used by specifying different monitor addresses, as well as having different logging levels or locations for different volumes. Reviewed-by: Christian Brunner <chb@muc.de> Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-06-08rbd: use the higher level librbd instead of just libradosJosh Durgin1-577/+218
librbd stacks on top of librados to provide access to rbd images. Using librbd simplifies the qemu code, and allows qemu to use new versions of the rbd format with few (if any) changes. Reviewed-by: Christian Brunner <chb@muc.de> Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com> Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-12-14ceph/rbd block driver for qemu-kvmChristian Brunner1-0/+1059
RBD is an block driver for the distributed file system Ceph (http://ceph.newdream.net/). This driver uses librados (which is part of the Ceph server) for direct access to the Ceph object store and is running entirely in userspace (Yehuda also wrote a driver for the linux kernel, that can be used to access rbd volumes as a block device). Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Christian Brunner <chb@muc.de> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>