Commit Graph
82 Commits
Author SHA1 Message Date
Keir Fraser 121068a2ce blktap: portability cleanup
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2008-07-14 10:03:09 +01:00
Keir Fraser 962649c369 blktap: cleanup
Make functions w/o a prototype static and remove redundant
declaration of xs_fire_next_watch().

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2008-07-11 15:36:40 +01:00
Keir Fraser 1d36727c99 tapdisk: in case O_DIRECT fails, retry again with o_flags but
O_DIRECT, instead of fixed value O_RD_WR | O_LARGEFILE

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-07-11 12:43:33 +01:00
Keir Fraser 5109f87cee Blktapctrl compatibility layer
I originally had just changed the NEWINTF ioctl to send over 48-bits
of information, which works on 64-bit but not on 32-bit (since the arg
is an unsigned long).  Additionally, the previous changes would break
an older userland against a new kernel.  For that reason, introduce a
new ioctl (NEWINTF_EXT) that fixes both of these problems.  This is
the dom0 userland side.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-07-09 10:41:49 +01:00
Keir Fraser 04465fbeb9 blktap: Fall back to libcrypto if libgcrypt is not installed.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-06-30 11:39:10 +01:00
Keir Fraser 53a29c4ca7 blktap: link against libgcrypt rather than libcrypto
tapdisk, part of blktap, links against libcrypto. tapdisk includes
GPLv2 (tapaio.c) and other licensed code (block-qcow.c). The license
of OpenSSL is considered incompatible with the GPL by many
people. This patch changes them to link against libgcrypt, which is
LGPL.

Signed-off-by: Bastian Blank <waldi@debian.org>
2008-06-30 10:00:53 +01:00
Keir Fraser 4fe815abd1 blktap: Extend userland busid to 32 bits
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-06-27 16:08:56 +01:00
Keir Fraser c8af9ce961 tapdisk: Fix qcow2 for images > 2 GB
Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-06-27 14:03:52 +01:00
Keir Fraser defe5e9a30 blktap: Automatically start tapdisk-ioemu on demand
When a domain wants to use a tap:ioemu disk but has no device model,
start a tapdisk-ioemu instance as provider. Also, move the creation
and removal of communication pipes to xend so that qemu-dm doesn't
need the unwanted SIGHUP handler anymore.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-04-23 16:57:23 +01:00
Keir Fraser 8318d7d63d Revert 17499:451ae3b8e5c8
Breaks HVM guest creation (bugzilla #1221).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-04-23 13:30:24 +01:00
Keir Fraser 3b64ad17ca blktap: Automatically start tapdisk-ioemu on demand
When a domain wants to use a tap:ioemu disk but has no device model,
start a tapdisk-ioemu instance as provider. Also, move the creation
and removal of communication pipes to xend so that qemu-dm doesn't
need the unwanted SIGHUP handler anymore.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-04-22 14:39:33 +01:00
Keir Fraser bd095de691 tools: Use PATH_MAX for pathname char arrays.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-04-04 14:49:37 +01:00
Keir Fraser b4f95a5c93 tapdisk: Fix L1 table endianess of qcow images
Fix tapdisk to use big endian L1 tables as used by qemu/ioemu. Old
tapdisk images with native endianess are automagically converted to
big endian when the image file is opened for the first time.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-03-27 17:13:37 +00:00
Keir Fraser 6fef410021 blktap: Fix BSD build failure.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2008-03-19 16:19:10 +00:00
Keir Fraser f9aa19ee3a tapaio build fix
With some combinations of compiler flags (no optimization, -Werror),
the compiler may complain that the function doesn't have a return
statement (even if the function actually just never returns), reported
as bug 1128. This adds a dummy return statement.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-03-19 14:12:12 +00:00
Keir Fraser 45b676a245 Use ioemu block drivers through blktap.
Add support for a tap:ioemu pseudo driver. Devices using this driver
won't use tapdisk (containing the code duplication) any more, but will
connect to the qemu-dm of the domain. In this way no working
configuration should be broken right now as you can still choose to
use the tapdisk drivers.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-03-18 10:58:47 +00:00
Keir Fraser 2dfb6b6e90 Clean up blktap Makefiles.
Signed-off-by: Bastian Blank <waldi@debian.org>
2008-03-17 10:57:59 +00:00
Keir Fraser a226d0f1bb blktapctrl: Fix a potential device minor number leak.
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2008-03-03 11:08:10 +00:00
Keir Fraser 912ede3b1a blktap: Fix unused warnings in block-qcow2.c with -D_FORTIFY_SOURCE=2.
Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-02-28 13:19:38 +00:00
Keir Fraser c3d370d254 blktap: Remove some code duplication
With my qcow2 patch to blktap I contributed a bit to the mess, so here
an attempt to clean up and remove at least some of the code
duplication in the functions dealing with aio operations.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-02-25 09:12:20 +00:00
Keir Fraser 219c37ca95 blktap: qcow2 image format support
This patch adds support for the qcow2 image format to blktap. It
consists mostly of qemu code, adapted to the blktap interfaces.
Snapshots and compressed images are supported.

The qcow2 driver may be used by either specifying tap:qcow2 or by
using tap:qcow which will detect that you have a version 2 image and
will call the qcow2 driver.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-02-21 10:30:57 +00:00
Keir Fraser 67bfbd67d1 libxenctrl headers should not pollute macro namespace with
mb/rmb/wmb. Instead add a xen_ prefix. Modify Xen's public headers to
expect the prefixed names instead of bare mb/rmb/wmb, but gate this
expectation on a bump of __XEN_INTERFACE_VERSION__.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-02-12 11:37:45 +00:00
Keir Fraser ad44c013ec Define CFLAGS and LDFLAGS for libxenctrl.
Signed-off-by: Bastian Blank <waldi@debian.org>
2008-01-27 12:57:14 +00:00
Keir Fraser be5fbf9a7f Move generation of public header hierarchy into the tools.
This patch merges the two versions of public header generation
currently used in the build into one.

Signed-off-by: Bastian Blank <waldi@debian.org>
2008-01-26 10:38:44 +00:00
Keir Fraser bc4a5b7bf5 blktap: Clean up makefile and linked libs.
Signed-off-by: Bastian Blank <waldi@debian.org>
2008-01-26 10:17:33 +00:00
Keir Fraser 93e3de7b94 Add SBINDIR. Use it always.
Signed-off-by: Bastian Blank <waldi@debian.org>
2008-01-22 14:35:02 +00:00
Keir Fraser d2477385df tools: LDFLAGS in link lines
LDFLAGS is not honoured by a couple of link lines in tools/*, but
should be.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2008-01-17 15:17:22 +00:00
Keir Fraser 6aef553b66 blktap: factor out linux specific code
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2008-01-15 14:17:22 +00:00
Keir Fraser fa7a56b7fa tapaio check return value from read()
In tools/blktap/drivers/tapaio.c there is a call to read(2) whose
return value is not checked.  The attached patch attempts to do
something vaguely sensible in cases of error.

Fully comprehensive error handling in this area would be quite tough
to introduce now but at least with this change when things go wrong
you stand a chance of getting some information about what happened.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2007-12-27 12:28:58 +00:00
Keir Fraser 363a648846 blktap: cleanups for *BSD.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2007-12-05 09:59:23 +00:00
Keir Fraser 8ddc7e13ab blktap: remove unused headers.
Attached patch removes unused linux specific headers
and makes bswap.h ready for BSD support.

This is first step for BSD support in blktap. More to come.
No functional change.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2007-12-04 10:48:28 +00:00
kfraser@localhost.localdomain c1d183f3dd blktap: Fix double-free in tapdisk cleanup.
Signed-off-by: Ben Guthro <bguthro@virtualiron.com>
Signed-off-by: Josh Nicholas <jnicholas@virtualiron.com>
2007-08-30 16:29:10 +01:00
kfraser@localhost.localdomain 4eb73854d7 Fix file descriptor leak in blktapctrl
The blktapctrl process is responsible for spawning individual tapdisk
processes. It does this using the 'system' method, but unfortunately
none of its file descriptors have the close-on-exec flag set. The
parent blktapctl process opens a couple of unix domain sockets
per-tapdisk it spawns. So the first tapdisk get 2 FDs leaked to it,
the second gets 4 FDs leaked to it, the 3rd gets 6 and so on. The use
of 'system' also unneccessarily invokes the shell.

Replace system with fork/execvp, and explicitly close all file handles
up to _SC_OPEN_MAX.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-08-01 09:04:20 +01:00
Keir Fraser 43aa5ed8c0 Specify -fno-strict-aliasing in root build config file.
Fixes correctness issues with xenstored and gcc-4.2.

Original patch by Charles Coffing <ccoffing@novell.com>

Signed-off-by: Keir Fraser <keir@xensource.com>
2007-07-07 10:31:15 +01:00
kfraser@localhost.localdomain bdb957f876 blktap: Add fallback code to blktap for missing poll-on-aio support.
blktap requires a xen specific kernel AIO ABI which has been vetoed by
upstream in favour of another approach. Rather than include this ABI,
Fedora has been carrying a patch which makes tap:aio use a thread to
poll for aio events and notify the main thread via a pipe.

The upstream approach of allowing io_getevents() poll normal file
descriptors via epoll is still progressing:
 http://lkml.org/lkml/2007/1/3/16

but when that does make it upstream, blktap will require significant
re-working to use that approach.

In the meantime, here's a patch which uses the poll-in-a-thread
approach only if AIO poll support isn't available. It also hides the
details behind a simple abstraction and makes both tap:aio and
tap:qcow use it.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2007-06-19 16:32:28 +01:00
kfraser@localhost.localdomain ff2fc71eda tools: warn_unused_result build fixes.
Note that some of the existing error checking for asprintf was wrong
for Linux.  asprintf in glibc returns -1 on error, but leaves the
pointer uninitialized.  Only the BSDs zero out the pointer on error.

Also, while fixing these warnings I saw several error paths that were
incorrect.  This patch minimally fixes the warn_unused_result; more
complete error path cleanup will be a later patch.

Signed-off-by:  Charles Coffing <ccoffing@novell.com>
2007-06-12 11:38:31 +01:00
Ian Campbell fe4fa7d7f7 Remove a few stray references to the sparse tree.
The only non-obvious change here is in tools/xenfb/Makefile. This now picks up
the headers it requires via the copy in tools/libxc.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
2007-06-04 12:47:53 +01:00
kfraser@localhost.localdomain ecc82ca3e6 blktap: Fix compile errors
When compiling the various blktap drivers with warnings cranked up, I
get errors that return values are not checked.

Signed-off-by: Charles Coffing <ccoffing@novell.com>
2007-05-24 14:07:40 +01:00
kfraser@localhost.localdomain 541b4e900d blktap: Add one more error reason statement to blktapctrl
blktapctrl already prints out exits reasons for all goto's to
open_failed except of not finding a device number for blktap0
This patch adds just that message so the user will get more info than
just "Unable to start blktapctrl"
Common source of this issue is that blktap is missing/failed to
load/...

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
2007-05-24 10:50:07 +01:00
kfraser@localhost.localdomain 5ea167dcd7 blktap: Fix qcow max_aio_reqs calculation.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-05-03 19:25:47 +01:00
Brendan Cully 5d93b6f183 Put blktap character device back into /dev/xen.
Changeset 14895:800aa9f5cec9 accidentally moved it into /var/run/tap
along with the control FIFOs.
Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
2007-05-02 09:42:43 -07:00
kfraser@localhost.localdomain 03023435b5 blktap: Segments can span multiple clusters with tap:qcow.
In blktap's qcow we need split up read/write requests if the requests
span multiple clusters. However, with our MAX_AIO_REQUESTS define we
assume that there is only ever a single aio request per tapdisk
request and under heavy i/o we can run out of room causing us to
cancel requests.

Dynamically allocate (based on cluster_bits) the various io request
queues the driver maintains.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2007-04-26 11:29:41 +01:00
Jake Wires 34cb794701 [TAPDISK] Move tapdisk control files from /dev/xen to /var/run/tap
Signed-off-by: Jake Wires <jwires@xensource.com>
2007-04-23 17:15:38 -07:00
Jake Wires c4f51da19f [TAPDISK] Use incremental cookies and fix blktapctrl::test_path parameter typo.
Signed-off-by: Jake Wires <jwires@xensource.com>
2007-04-23 15:37:53 -07:00
Jake Wires 9a549acc99 [TAPDISK] Fix qcow initialization bug.
fd_end was being incorrectly initialized upon open, leading to data corruption.

Signed-off-by: Jake Wires <jwires@xensource.com>
2007-04-10 11:40:43 -07:00
Keir Fraser f5db79b294 blktap: Fix qcow2raw.
qcow2raw would hang the conversion just short of 100%, because the
final write queue was never being submitted.  If a blktap drivers read
synchronously, then "submit_events" and "complete" variables are
checked before getting set, so the fact that reads have finished is
not noticed, so the final write queue was never submitted.

Note that I have also removed the variables write_complete and
read_complete.  They were unused, and they were also not set correctly
in the synchronous case.

Signed-off-by: Charles Coffing <ccoffing@novell.com>
2007-03-31 12:24:55 +01:00
Jake Wires 31e57af5d6 [TAPDISK] unlock sector on error case
Signed-off-by: Jake Wires <jwires@xensource.com>
2007-03-16 15:23:26 -07:00
Jake Wires a3d17a18e5 [TAPDISK] honor read-only attributes when creating tap-based VBDs
Signed-off-by: Jake Wires <jwires@xensource.com>
2007-02-23 17:26:07 -08:00
Jake Wires 99a8295b96 [TAPDISK] handle error case when opening VDIs 2007-02-23 09:40:32 -08:00
Jake Wires 11e8d023ca [TAPDISK] minor changes to tapdisk and plugins
* open all parent images read-only
* expose parent image names to tapdisk (needed for locking api)
Signed-off-by: Jake Wires <jwires@xensource.com>
2007-02-22 21:32:17 -08:00