]> xenbits.xensource.com Git - people/dstodden/blktap.git/log
people/dstodden/blktap.git
13 years agouse fallocate when possible for allocating vhd blocks xcp/volatile/ext4
Jake Wires [Tue, 31 May 2011 23:07:03 +0000 (16:07 -0700)]
use fallocate when possible for allocating vhd blocks

[Forward port from xc/master abb20c8]
Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoXC-4323: fdatasync when extending files
Jake Wires [Thu, 2 Dec 2010 01:04:10 +0000 (17:04 -0800)]
XC-4323: fdatasync when extending files

[Forward port from xc/master 4267f57]
Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agovhd: Link to libiconv, where needed/wanted. xcp/next
Daniel Stodden [Tue, 30 Aug 2011 04:28:55 +0000 (05:28 +0100)]
vhd: Link to libiconv, where needed/wanted.

Adds --with-libiconv. Helps with a proper uclibc build.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoac/vhd: Make libvhdio conditionally only.
Daniel Stodden [Mon, 29 Aug 2011 03:02:59 +0000 (04:02 +0100)]
ac/vhd: Make libvhdio conditionally only.

Current part/ is not well portable because of the the
Linux header dependencies. But it's optional anyway.
New ENABLE_VHDIO also replaces ENABLE_SHARED, used for
vhdio only.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoac/vhd: Make vhd/lib/tests conditionally only.
Daniel Stodden [Mon, 29 Aug 2011 02:54:59 +0000 (03:54 +0100)]
ac/vhd: Make vhd/lib/tests conditionally only.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoLink vhd-index against libuuid, explicitly.
Daniel Stodden [Thu, 25 Aug 2011 07:58:20 +0000 (08:58 +0100)]
Link vhd-index against libuuid, explicitly.

The implicit dependency through libvhd.la
won't work on Debian sid/gcc-4.6.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agolibvhdio: Build only a shared library.
Daniel Stodden [Mon, 15 Aug 2011 07:40:57 +0000 (00:40 -0700)]
libvhdio: Build only a shared library.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agotap-ctl-spawn: Fall back to tapdisk in $(builddir).
Daniel Stodden [Sun, 31 Jul 2011 23:17:11 +0000 (16:17 -0700)]
tap-ctl-spawn: Fall back to tapdisk in $(builddir).

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agotap-ctl-spawn: Move sbin/tapdisk2 to libexec/tapdisk.
Daniel Stodden [Sun, 31 Jul 2011 22:16:05 +0000 (15:16 -0700)]
tap-ctl-spawn: Move sbin/tapdisk2 to libexec/tapdisk.

With some cleanup:

 - Allow overrides with TAPDISK, or TAPDISK2.
 - If TAPDISK/TAPDISK2 is set, require that to succeed.
 - Return errno on failure.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoac: Add autogen.sh, version 20090301
Daniel Stodden [Wed, 27 Jul 2011 23:39:44 +0000 (23:39 +0000)]
ac: Add autogen.sh, version 20090301

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoautotools: Build blktap with automake/autoconf.
Daniel Stodden [Sun, 31 Jul 2011 02:20:06 +0000 (19:20 -0700)]
autotools: Build blktap with automake/autoconf.

 - XCP source: Remove mk/ subtree.
 - Use autoconf/automake.
 - Use libtool, solving our library build troubles.
 - Need a version. Make that blktap-2.0.90 for now.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoAdd missing headers
Daniel Stodden [Sun, 28 Aug 2011 05:35:19 +0000 (05:35 +0000)]
Add missing headers

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agovhd: Don't rely on resolved_path = NULL feature in realpath().
Daniel Stodden [Mon, 29 Aug 2011 01:21:24 +0000 (02:21 +0100)]
vhd: Don't rely on resolved_path = NULL feature in realpath().

A resolved_path arg of NULL implies a malloc of just enough space,
standardized since POSIX.1-2008. Not portable to uClibc, failing by a
__nonnull(2) attribute.

Fix with PATH_MAX sized stack buffers, and strdup()s where needed.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoFix strict aliasing / pointer casts for rhel/gcc-4.1.2.
Daniel Stodden [Thu, 4 Aug 2011 01:33:28 +0000 (18:33 -0700)]
Fix strict aliasing / pointer casts for rhel/gcc-4.1.2.

 - Mostly posix_memalign. Gcc won't appreciate char buffer out vars
   recasted to void.

 - Mostly fixed with void pointers. That's fine, because most of our
   memalign usage are sector-aligned opaque buffers anyway.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agovhd: More gcc fortification complaints.
Daniel Stodden [Thu, 25 Aug 2011 07:36:41 +0000 (08:36 +0100)]
vhd: More gcc fortification complaints.

This time adding a couple hypothetical error conditions.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoRework gcc fortification catches, failing -Wunused.
Daniel Stodden [Fri, 29 Jul 2011 23:10:09 +0000 (16:10 -0700)]
Rework gcc fortification catches, failing -Wunused.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agovhd: Remove unused vhd_block_vector_read_allocated.
Daniel Stodden [Fri, 29 Jul 2011 23:09:19 +0000 (16:09 -0700)]
vhd: Remove unused vhd_block_vector_read_allocated.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agovhd: remove HD_TYPE_STR definition from vhd.h
Daniel Stodden [Fri, 29 Jul 2011 23:08:40 +0000 (16:08 -0700)]
vhd: remove HD_TYPE_STR definition from vhd.h

Only used in vhd-util-read, so inlined there for now.
Might go extern again if that's ever a problem.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoio-optimize: Inline type var in __print_iocb.
Daniel Stodden [Thu, 25 Aug 2011 08:01:00 +0000 (09:01 +0100)]
io-optimize: Inline type var in __print_iocb.

Unused if DBG() is void producing, a warning under gcc-4.6.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoio-optimize: #undef unused code if !DEBUG/TEST
Daniel Stodden [Fri, 29 Jul 2011 23:53:31 +0000 (16:53 -0700)]
io-optimize: #undef unused code if !DEBUG/TEST

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoqueue: Restore orphaned setup/destroy callbacks in td_tio_rwio.
Daniel Stodden [Sat, 30 Jul 2011 00:02:16 +0000 (17:02 -0700)]
queue: Restore orphaned setup/destroy callbacks in td_tio_rwio.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoRemove unused variables/labels.
Daniel Stodden [Fri, 29 Jul 2011 23:06:32 +0000 (16:06 -0700)]
Remove unused variables/labels.

Up to a clean build with -O2 -Wall -Werror.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoMove relative-path out of include/
Daniel Stodden [Sun, 31 Jul 2011 01:44:54 +0000 (18:44 -0700)]
Move relative-path out of include/

Only used in libvhd.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoMove partition.h out of include/
Daniel Stodden [Sun, 31 Jul 2011 01:51:22 +0000 (18:51 -0700)]
Move partition.h out of include/

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoMove lvm-util.h to lvm/
Daniel Stodden [Sun, 31 Jul 2011 01:51:05 +0000 (18:51 -0700)]
Move lvm-util.h to lvm/

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agopart: Mark vhdpartx executable
Daniel Stodden [Thu, 28 Jul 2011 01:15:09 +0000 (18:15 -0700)]
part: Mark vhdpartx executable

13 years agovhd: Move atomicio.h out of include/
Daniel Stodden [Thu, 28 Jul 2011 10:33:13 +0000 (03:33 -0700)]
vhd: Move atomicio.h out of include/

Note that vhd-update doesn't need atomicio.h.
And vhd/lib Source is cloned, so should be headers.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agovhd: Fix broken error rollback in vhd_index_update_bat.
Daniel Stodden [Thu, 28 Jul 2011 02:08:29 +0000 (19:08 -0700)]
vhd: Fix broken error rollback in vhd_index_update_bat.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agovhd: Fix err return in vhd_journal_write_entry
Daniel Stodden [Thu, 28 Jul 2011 00:29:12 +0000 (17:29 -0700)]
vhd: Fix err return in vhd_journal_write_entry

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agotest-snapshot: Fix void return value.
Daniel Stodden [Sat, 30 Jul 2011 00:44:41 +0000 (17:44 -0700)]
test-snapshot: Fix void return value.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agolvm/vhd: 64-bit build fixes.
Daniel Stodden [Thu, 28 Jul 2011 02:07:25 +0000 (19:07 -0700)]
lvm/vhd: 64-bit build fixes.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agopart: Build with -fPIC
Daniel Stodden [Sat, 23 Jul 2011 20:16:37 +0000 (13:16 -0700)]
part: Build with -fPIC

libvhd.o wants to link partition.o

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoAdd .gitignore.
Daniel Stodden [Tue, 19 Jul 2011 22:13:15 +0000 (15:13 -0700)]
Add .gitignore.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agovhd: move from linux asm/types.h to inttypes.h
Daniel Stodden [Tue, 19 Jul 2011 07:33:04 +0000 (00:33 -0700)]
vhd: move from linux asm/types.h to inttypes.h

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoFix 64-bit build.
Daniel Stodden [Tue, 19 Jul 2011 07:12:15 +0000 (00:12 -0700)]
Fix 64-bit build.

Mainly a matter of
 - Fixing printf formats.
 - Strip duplicate case statements in vhdio (foo vs foo64).
 - Some downcasts for integers turned long now.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoEA-1001: Break remaining XCP kernel build dependency. master
Daniel Stodden [Wed, 13 Jul 2011 21:17:45 +0000 (14:17 -0700)]
EA-1001: Break remaining XCP kernel build dependency.

Partial revert of 569:9f795e737459 (EA-1001: Build VBD ring macros
from kernel, not xen headers). Dropping KBUILD dependencies after
resorting to a private copy of the linux headers.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoEA-1001: Use a standalone copy of linux/blktap.h
Daniel Stodden [Wed, 13 Jul 2011 21:17:00 +0000 (14:17 -0700)]
EA-1001: Use a standalone copy of linux/blktap.h

Done with most of the BLKIF ring macros.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agocontrol: Fix devname use after free.
Daniel Stodden [Wed, 13 Jul 2011 21:03:47 +0000 (14:03 -0700)]
control: Fix devname use after free.

Rare error path only.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agocontrol: Fix tap_cli_stats_usage.
Daniel Stodden [Wed, 13 Jul 2011 21:03:19 +0000 (14:03 -0700)]
control: Fix tap_cli_stats_usage.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agovbd: Fixed broken rollback after open_vdi failure.
Daniel Stodden [Wed, 13 Jul 2011 20:56:37 +0000 (13:56 -0700)]
vbd: Fixed broken rollback after open_vdi failure.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agocontrol: Fix borked td create shutdown path.
Daniel Stodden [Wed, 13 Jul 2011 20:53:51 +0000 (13:53 -0700)]
control: Fix borked td create shutdown path.

Aiee, don't free the VBD when failing VDI open.

But free the name (we require it to be NULL on entry), so
tap-ctl-create can cleanly detach on rollback path.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoPR-1053: Fix a potential crasher in tapdisk_image_open_parent.
Daniel Stodden [Wed, 13 Jul 2011 20:53:28 +0000 (13:53 -0700)]
PR-1053: Fix a potential crasher in tapdisk_image_open_parent.

Bail out on cases not TD_NO_PARENT, such as -ENOENT.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoVHD: Improve misleading result code from failing vhd_parent_locator_get.
Daniel Stodden [Wed, 13 Jul 2011 20:51:37 +0000 (13:51 -0700)]
VHD: Improve misleading result code from failing vhd_parent_locator_get.

Presently always comes back with -EINVAL, due to a final
vhd_parent_locator_read failing. Fix returns -EINVAL when without
candidates altogether, and the last vhd_find_parent results
otherwise. Such as -ENOENT.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agopart: Fix CFLAGS.
Daniel Stodden [Tue, 28 Jun 2011 01:09:26 +0000 (18:09 -0700)]
part: Fix CFLAGS.

Don't override Rules.mk's CFLAGS (+, not =). Also, -O0 is for
single-stepping. If there's a problem, let's figure it out.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agomake: Remove tapdisk-disktype.o dupe from TAP-OBJS.
Daniel Stodden [Tue, 28 Jun 2011 01:08:58 +0000 (18:08 -0700)]
make: Remove tapdisk-disktype.o dupe from TAP-OBJS.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agocontrol: Fix tap_ctl_create rv after failing tap_ctl_spawn.
Daniel Stodden [Tue, 28 Jun 2011 01:08:57 +0000 (18:08 -0700)]
control: Fix tap_ctl_create rv after failing tap_ctl_spawn.

This typically applies on broken installations. Borked dev builds,
systems missing a feature or library, or missing a tapdisk2 binary
altogether.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoCA-61156: control: Anticipate tap-ctl-spawn racing a bugtool killall -USR1.
Daniel Stodden [Tue, 28 Jun 2011 01:08:57 +0000 (18:08 -0700)]
CA-61156: control: Anticipate tap-ctl-spawn racing a bugtool killall -USR1.

There's a race between tapdisk's sigaction init and xen-bugtool
shooting debug signals under RT stress. If killed by something as
innocuous as USR1, then just retry the fork().

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoMake blktap portable to Ubuntu
Mike McClurg [Tue, 7 Jun 2011 18:35:30 +0000 (19:35 +0100)]
Make blktap portable to Ubuntu

These are changes mostly required by gcc 4.5, with the exception of the change
to Config.mk, which inserts some make variables that we expect to be inserted
by the spec file. The rest of the changes are including missing headers,
initialising a variable and providing a mode when opening a file.

Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
13 years agoPR-1129: Add a manpage draft.
Daniel Stodden [Fri, 3 Jun 2011 08:20:11 +0000 (01:20 -0700)]
PR-1129: Add a manpage draft.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoPR-1129: minor rate limiter updates.
Daniel Stodden [Fri, 3 Jun 2011 08:20:11 +0000 (01:20 -0700)]
PR-1129: minor rate limiter updates.

 - Debug code + more error verbosity.
 - Support full paths for socket naming.
 - Correct inverted decimal/binary suffixes (ouch!).

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoMAR-125: Rate-limit VHD driver errors.
Daniel Stodden [Mon, 23 May 2011 02:23:47 +0000 (19:23 -0700)]
MAR-125: Rate-limit VHD driver errors.

Hooking into driver->ratelimit, sharing log rates with the VBD level
failures.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoMAR-125: Drop common VBD error message dups + use rate limits.
Daniel Stodden [Mon, 23 May 2011 02:23:46 +0000 (19:23 -0700)]
MAR-125: Drop common VBD error message dups + use rate limits.

 - Log only the first treq failure, driving vreq->error. Later treqs
   don't contribute to vreq status, so need not be logged either.

 - Ratelimit vreq failures (tlog_drv_error)

 - Store previous errors in vreq->prev_error upon retry. If the
   condition doesn't change during retry, drop the message.

 - Final timeout should be ERR, not LOG_INFO message.

Aims to significantly reduce retry log spam on borked SRs, hopefully
without losing critical information.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoMAR-125: Add driver log rate limits.
Daniel Stodden [Mon, 23 May 2011 02:23:46 +0000 (19:23 -0700)]
MAR-125: Add driver log rate limits.

Allocates one td-loglimit instance per driver instance. Present burst
size is 16 messages, over an interval of 90 seconds. To be shared by
both driver code and the VBD.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
13 years agoMAR-125: Support log rate limiting.
Daniel Stodden [Mon, 23 May 2011 02:23:45 +0000 (19:23 -0700)]
MAR-125: Support log rate limiting.

Much like Linux's ratelimit. Allow for message bursts of some size,
count messages as they pass. Drop messages once the burst size was
exceeded within a given interval. Next interval resets the count.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-57842: Fix deMorgan-esque glitch in the retry logic.
Daniel Stodden [Wed, 4 May 2011 21:25:06 +0000 (14:25 -0700)]
CA-57842: Fix deMorgan-esque glitch in the retry logic.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoXOP-38: (lcache) Detect out-of-space conditions before write() does.
Daniel Stodden [Sat, 16 Apr 2011 00:56:11 +0000 (17:56 -0700)]
XOP-38: (lcache) Detect out-of-space conditions before write() does.

Test free space in the caching SR before attempting to store our
reads. VHD block allocation writes on Ext3 have the nasty property of
blocking excessively after running out of space. We therefore
enable/disable ourselves at a 1/s granularity, querying free space
through statfs beforehand.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-51905: Preserve vbd->flags.
Daniel Stodden [Sat, 16 Apr 2011 00:31:02 +0000 (17:31 -0700)]
CA-51905: Preserve vbd->flags.

Ugh, more fallout after 608:1feb6ca365ef.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agox-chain: zero regex pointers to avoid regfree()'ing garbage
Andrei Lifchits [Thu, 31 Mar 2011 18:29:02 +0000 (19:29 +0100)]
x-chain: zero regex pointers to avoid regfree()'ing garbage

14 years agoCA-53968: Fix build.
Daniel Stodden [Mon, 14 Mar 2011 22:41:30 +0000 (15:41 -0700)]
CA-53968: Fix build.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-53968: Fix crasher after 592:a4ef44e898ac (Move blktap ring ...).
Daniel Stodden [Mon, 14 Mar 2011 21:44:57 +0000 (14:44 -0700)]
CA-53968: Fix crasher after 592:a4ef44e898ac (Move blktap ring ...).

VHD debug code, dumping unallocated requests, observing a null vreq.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-51905: Partially revert 590:df25c3e1f79f (Shorten tapdisk_vbd_open_vdi ...)
Daniel Stodden [Tue, 8 Mar 2011 08:52:02 +0000 (00:52 -0800)]
CA-51905: Partially revert 590:df25c3e1f79f (Shorten tapdisk_vbd_open_vdi ...)

Breaking resume on 'secondary' nodes. Won't get rid of that before SM
moves to chain declarations.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-52368: truncate VHD files on reset-on-boot
Andrei Lifchits [Wed, 23 Feb 2011 18:32:33 +0000 (18:32 +0000)]
CA-52368: truncate VHD files on reset-on-boot

14 years agoCA-51988/XC-3264: Don't (re-)issue requests while paused.
Jake Wires [Tue, 22 Feb 2011 01:30:06 +0000 (17:30 -0800)]
CA-51988/XC-3264: Don't (re-)issue requests while paused.

Picks missing quiesced-state related bits only from XC blktap.git
32923215. Issue was then duplicated through 595:8651e424a229
(vbd_recheck_state), hence the second hunk.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
From 3292321524cc5797bd0e01b9d36e71ed4a54cbbf Mon Sep 17 00:00:00 2001
Date: Tue, 10 Aug 2010 16:41:38 -0700
* don't issue requests while paused
* don't timeout requests while paused
* ensure progress on resume
Signed-off-by: Jake Wires <Jake.Wires@citrix.com>
---
 drivers/tapdisk-vbd.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

14 years agoPR-1053: llcache - local leaf caching drivers.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: llcache - local leaf caching drivers.

Add PR-1053 compliant local leaf caching support, in toplevel filter
drivers. Since data paths are very different (local or shared storage
writes, in the non-persistent vs. mirrored or shared storage write in
the persistent case), this adds two new driver types:

 - llp: Local Leaf, Persistent
 - lle: Local Leaf, Non-persistent ('ephemeral')

Both work by driving an aggregated vhd image, internally.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1053: Loop cache writes as vreqs, not treqs.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: Loop cache writes as vreqs, not treqs.

Looping treqs on the toplevel image is prone to error and doesn't
retry. It cannot be properly scheduled, therefore may starve normal
VBD taps. Queue vreqs instead.

Related change:

* The 'phase' request state is now gone, dfa state now driven by
  callback separation.

* Failing req alloc now stalls the queue (-EBUSY) instead of dropping
  a cache entry.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1053: Remove nonfunctional debug routine.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: Remove nonfunctional debug routine.

14 years agoPR-1053: Sort out buffer init.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: Sort out buffer init.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1053: Shorten names.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: Shorten names.

 - Align with later llcache (local leaf) driver types.
 - s/local_cache/lcache/, matching public names.
 - s/lreq/req/, aligning with other drivers.
 - s/get/alloc/, s/put/free, lacking refcounts.
 - shorten some field names, unlikely to cause clashing.
 - prefix TD_, where appropriate.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1053: Remove td_queue_write.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: Remove td_queue_write.

14 years agoPR-1053: Make td_queue_read/write optional.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: Make td_queue_read/write optional.

Saves some extra code in drivers and ensures common error indication.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1053: Add remus block driver.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: Add remus block driver.

Mainly needed to fill a disktype hole, but could use some updates too.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoMake treq.vreq explicit.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
Make treq.vreq explicit.

Used to be vreq.private, but only has a single user. Note that
completion callbacks rather use vreq->token to attach issuer state.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1053: Further reduce tapdisk-stream.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: Further reduce tapdisk-stream.

Drop the pipe end and custom event. Reissue requests right after prior
completion instead.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1053: Iterate VBD runs between schedules.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: Iterate VBD runs between schedules.

Request queues are only processed once per iteration, once after
select. Presently, request completion goes last, after after new I/O.

As a consequence, vreq completion in filter drivers cannot easily
drive new requests without some pipe loop hooked into the event loop.

Fixed by iterating VBD runs. Iteration stops once all VBDs stop
indicating progress.

Iteration runs a dedicated vbd_recheck_state, because normal
vbd_check_state contains which should not be iterated (most notably
-EBUSY failures).

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1053: Fix tapdisk-stream.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: Fix tapdisk-stream.

Was dropped by the vreq patch, because the VBD change broke
compilation. Essentially acts as a tap, but in a somewhat improperly
(now) because it emulates a blkif ring to do so.

Fixed with a major rewrite. The tool got somewhat out of fashion, but
is a good API exercise:

 * New code now queues vreqs instead of fake blkif reqs.
 * Won't get rid of the loopback event fd yet.

The latter is because new requests are only processed per iteration,
after select fired. As a consequence, vreq completion cannot just
queue new requests, because they won't get run before the next
external event fires. This will affect VBD I/O queued by filter
drivers, too.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1053: Eliminate the vreq->status.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: Eliminate the vreq->status.

Used to be a blkif-style status code. Obsolete, since tapdisk-blktap
only deals with vreq->error codes anyway.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1053: Move the blktap ring out of tapdisk-vbd.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: Move the blktap ring out of tapdisk-vbd.

About to potentially put multiple users on top of a single VBD.
Motivation:

 - Enable more than one external taps, such as blktap + blkif/gntdev.

 - Let filter drivers issue true VBD I/O, cleanly.

So make the local blktap device ring only one of them
(tapdisk-blktap).

Usage:

 - Entry is tapdisk_vbd_queue_request. Callers are fully responsible
   for vreq memory preallocation and some vreq init.

 - Exit is through a completion callback. Callbacks come in
   bursts. Final callback gets annotated, so kicking external pads
   stays efficient.

This changes a couple details about VBD-requests:

 - Break out blkif-style segment formats. Replaced with a struct
   td_iovec, essentially in uio.h's struct iovec spirit: a base+len
   vector, but in sectors, not bytes.

   Segment merges are up to the caller. This reverts cset 3a9bcd90c.

 - Treqs now link back to const vreqs. Presently only to get treqs
   'name'd for debugging, because ring 'ids' don't make sense anymore
   internally.

 - Moves related typedefs into tapdisk.h

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1129: Add x-chain: pseudo target type.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1129: Add x-chain: pseudo target type.

Adds a new cli driver type, syntaxed 'x-chain:/path'. Doesn't target a
driver, but opens <path> and parses a list of "<type>:<images>
<flags>\n" entries.

Drops most of the present vbd_open code, replaced with a couple
primitives in tapdisk_image:

  - tapdisk_image_open - single image.
  - tapdisk_image_open_parents -- append parent chain as per get_parent_id.
  - tapdisk_image_open_chain -- the normal vbd entry.
  - tapdisk_image_validate_chain -- dito.

The x-chain target will create the head of the vbd image chain
precisely as described in its input file, followed by a final call to
tapdisk_image_open_parents and validation.

Apart from sharing tapdev parent nodes as presently done with the
local caching drivers.

VHD-index mode currently dropped. Other legacy tap-ctl args should
keep working.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1248: Shorten the tapdisk_vbd_open_vdi control path.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1248: Shorten the tapdisk_vbd_open_vdi control path.

We used to have to pipe all additional driver activations through
tapdisk_vbd_open_vdi, back then mainly for blktap1 compat. This can be
done in the control callback now. Reduces the amount of flagging
involved, and simplifies passing additional parameters to drivers.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1129: Rate limiting intro.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1129: Rate limiting intro.

Simple I/O rate limiting intro. Bridging resource utilization across a
group of independent tapdisks.

Comprising:

 - block-valve: Top-level filter issuing bandwith requests, deferring
   I/O to acknowldgement. Usage: valve:/path/to/sock/un

 - td-rated: Stand alone bridge process, listing to bandwidth
   requests, typically from valve:/ instances. Includes a plugin
   interface for various rate limiting algorithms.

Algorithms (yet slightly experimental):

 - "Token Bucket". A classic, with some trivial modifications to
   promote batching.

 - "Meminfo". Watching /proc/meminfo for pagecache congestion.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1129: Enforce masked state.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1129: Enforce masked state.

Masking timeout events only skips timeval calculation, but doesn't
prevent them from anyway as they expired. Enforce masked state right
around the callback. For timeouts, this means the event will keep
ticking at the interval given.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1129: Fix main loop timeout bug.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1129: Fix main loop timeout bug.

Calls to scheduler_check_fd_events return prematurely, failing to mark
a timeout pending, iff nfds is 0.

This leads to a condition where the deadline never gets reset, so the
next calculated timeout tv will be {0, 0} and we're left spinning in
select()s.

Fixed by separating fd and timeout checks.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoStrip image_t.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
Strip image_t.

There is td_disk_info_t for drivers, so remove the glue.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1053: Leave parent sharing + rdonly modes to the child.
Daniel Stodden [Tue, 15 Feb 2011 09:37:45 +0000 (01:37 -0800)]
PR-1053: Leave parent sharing + rdonly modes to the child.

Comes somewhat natural. Simplifies image open code. Will allow future
drivers to override RDONLY mode on the shared storage leaf node.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoRemove td_image.private.
Daniel Stodden [Tue, 15 Feb 2011 09:37:44 +0000 (01:37 -0800)]
Remove td_image.private.

Not needed on the datapath because of the vreq->vbd map. (Meaning that
ultimately driver and image could event be merged (again), if vbd
image lists get ever out of fashion.)

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoAllow for holes in tapdisk_disk_types.
Daniel Stodden [Tue, 15 Feb 2011 09:37:44 +0000 (01:37 -0800)]
Allow for holes in tapdisk_disk_types.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoMake disk names const where needed.
Daniel Stodden [Tue, 15 Feb 2011 09:37:44 +0000 (01:37 -0800)]
Make disk names const where needed.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoAdd a containerof().
Daniel Stodden [Tue, 15 Feb 2011 09:37:44 +0000 (01:37 -0800)]
Add a containerof().

Cowardly sneaked into list.h.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoAdd some useful gccisms.
Daniel Stodden [Tue, 15 Feb 2011 09:37:44 +0000 (01:37 -0800)]
Add some useful gccisms.

This are all named after the linux/compiler.h ones, not to get
uneccessarily creative.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-46079: Remove the image reopen hack (2)
Daniel Stodden [Tue, 15 Feb 2011 09:37:44 +0000 (01:37 -0800)]
CA-46079: Remove the image reopen hack (2)

Stray code.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-29373: Don't retry when there's no point, batched.
Jake Wires [Tue, 15 Feb 2011 09:37:44 +0000 (01:37 -0800)]
CA-29373: Don't retry when there's no point, batched.

Date: Thu, 1 Jul 2010 11:33:47 -0700
[PATCH 68/79] don't retry when there's no point
[PATCH 69/79] fix handling early failures

Signed-off-by: Jake Wires <jake.wires@citrix.com>
Acked-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-51534: fix vhd-util "destroy data" for preallocated-BAT VHDs
Andrei Lifchits [Sat, 12 Feb 2011 16:22:04 +0000 (16:22 +0000)]
CA-51534: fix vhd-util "destroy data" for preallocated-BAT VHDs

14 years agoEA-1001: Rework such that rpmbuild of the source rpm works without defining 'kernel_v...
Jonathan Ludlam [Tue, 8 Feb 2011 16:00:54 +0000 (16:00 +0000)]
EA-1001: Rework such that rpmbuild of the source rpm works without defining 'kernel_version'. This can still be overridden if required.

14 years agoCA-10471: Fix macro typos.
Daniel Stodden [Fri, 28 Jan 2011 00:33:15 +0000 (16:33 -0800)]
CA-10471: Fix macro typos.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-10471: Forward R/O flags to blktap.
Daniel Stodden [Thu, 27 Jan 2011 21:36:54 +0000 (13:36 -0800)]
CA-10471: Forward R/O flags to blktap.

Switch to newer blktap_device_info params:

 * Call a new ioctl command.

 * On legacy kernels, fall back to the old entry

 * Set flags for disk R/O-mode.

 * Set physical_sector_size (512, still).

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-10471: add option to mount tapdisks read-only
Jake Wires [Wed, 26 Jan 2011 22:28:43 +0000 (14:28 -0800)]
CA-10471: add option to mount tapdisks read-only

From 6ee06eff2f182097579a486f74899dc77a1955a9 Mon Sep 17 00:00:00 2001
Date: Wed, 1 Sep 2010 14:08:33 -0700

Signed-off-by: Jake Wires <jake.wires@citrix.com>
14 years agoEA-1001: Install tap-ctl.h in blktap include directory
Gianni Tedesco [Mon, 24 Jan 2011 15:58:24 +0000 (15:58 +0000)]
EA-1001: Install tap-ctl.h in blktap include directory

14 years agoEA-1001: Remove system libaio special build case.
Daniel Stodden [Tue, 18 Jan 2011 19:53:23 +0000 (11:53 -0800)]
EA-1001: Remove system libaio special build case.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoEA-1001: Use tapif_user ring header space with newer kernels.
Daniel Stodden [Tue, 18 Jan 2011 19:53:23 +0000 (11:53 -0800)]
EA-1001: Use tapif_user ring header space with newer kernels.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Acked-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoEA-1001: Build VBD ring macros from kernel, not xen headers.
Daniel Stodden [Tue, 18 Jan 2011 19:53:23 +0000 (11:53 -0800)]
EA-1001: Build VBD ring macros from kernel, not xen headers.

Includes linux/blktap.h, not xen/io/blkif.h. Make therefore wants a
KBUILD argument to find the kernel headers.

Fallout:

 * Presently comes with loads of ugly blkif_t/ypedefs and defines to
   reduce noise under drivers/. Will go away with later VBD patches.

 * BLKTAP_RING_SIZE isn't constant anymore (due to _SC_PAGE_SIZE).
   Substituted with a MAX_REQUESTS defined to a fixed 32U. More
   flexible queue size dimensions are clearly a field for future work.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>