]> xenbits.xensource.com Git - people/dstodden/blktap.git/log
people/dstodden/blktap.git
13 years agouse fallocate when possible for allocating vhd blocks xcp/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 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>
14 years agoEA-1001: Disable block-log.
Daniel Stodden [Tue, 18 Jan 2011 19:53:23 +0000 (11:53 -0800)]
EA-1001: Disable block-log.

Based on guest blkif ring definitions. Won't build before we can link
against xen-tools again.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoEA-1001: Nuke tapdisk1.
Daniel Stodden [Tue, 18 Jan 2011 19:53:23 +0000 (11:53 -0800)]
EA-1001: Nuke tapdisk1.

Including tapdisk-ipc.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-41427: Don't log errors to logfiles.
Daniel Stodden [Thu, 4 Nov 2010 23:34:36 +0000 (16:34 -0700)]
CA-41427: Don't log errors to logfiles.

Prevents flooding /var/log under non-transient error conditions.

Signed-off-by: Daneil Stodden <daniel.stodden@citrix.com>
14 years agoCA-44322: Remove AIO threading code.
Daniel Stodden [Thu, 14 Oct 2010 10:23:23 +0000 (03:23 -0700)]
CA-44322: Remove AIO threading code.

Reverts 557:68e1b3249623 and later. Kernel side improved since
linux-2.6.32.pq.hg 269:6ddf9e468ff8.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.comm>
14 years agoUpdate the RPM spec file buildrequires line
Jonathan Ludlam [Mon, 18 Oct 2010 14:06:05 +0000 (15:06 +0100)]
Update the RPM spec file buildrequires line

14 years agoCA-45498: Update RPM license header.
Daniel Stodden [Fri, 15 Oct 2010 20:45:08 +0000 (13:45 -0700)]
CA-45498: Update RPM license header.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-45498: Remove proprietary objects patch altogether.
Daniel Stodden [Fri, 15 Oct 2010 08:26:45 +0000 (01:26 -0700)]
CA-45498: Remove proprietary objects patch altogether.

Mainly to remove a warning regarding the empty diff during SRPM build.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCP-1840: Count ENOSPC redirects.
Daniel Stodden [Fri, 15 Oct 2010 01:17:31 +0000 (18:17 -0700)]
CP-1840: Count ENOSPC redirects.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-46696; CA-44322: Save 7968k per tapdisk.
Daniel Stodden [Thu, 14 Oct 2010 10:23:23 +0000 (03:23 -0700)]
CA-46696; CA-44322: Save 7968k per tapdisk.

Linux/x86 default thread stack size is 8M. That's more than needed.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-44425: add the "kill data" option to vhd-util-modify (required for reset-on-boot)
Andrei Lifchits [Mon, 4 Oct 2010 13:52:45 +0000 (14:52 +0100)]
CA-44425: add the "kill data" option to vhd-util-modify (required for reset-on-boot)

14 years agoCA-44322: Restrict I/O request merging on filesystems.
Daniel Stodden [Thu, 30 Sep 2010 21:01:47 +0000 (14:01 -0700)]
CA-44322: Restrict I/O request merging on filesystems.

Ensure that every single iocb can be issued with only the memory
reserves held in kernel space. Main resource prone to congestion are
bio structs.

For I/O continguous in physical storage, such as bare LUN mappings, a
single bio will hold up to 256 pages. To accomodate block mappings on
file systems, we reserve a more than 1 bio, but cannot submit iocbs of
arbitrary length without risking to stall once the reserve is
exhausted.

Limits the iocb size on ext. Assumes 4k blocks for now.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-44322: Add an I/O-submit thread.
Daniel Stodden [Thu, 30 Sep 2010 21:01:45 +0000 (14:01 -0700)]
CA-44322: Add an I/O-submit thread.

Slightly annoying to add threads to core blktap code, but necessary to
avoid potential starvation when dom0 gets under memory
pressure. Blktap can guarantee io_submit makes progress by keeping
memory reserves, but not enough to guarantee that it's
non-blocking. To refill the reserves, we want completion of in-flight
I/O the main even loop.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.comm>
14 years agoCA-46079: Recover the image storage type.
Daniel Stodden [Thu, 30 Sep 2010 21:01:40 +0000 (14:01 -0700)]
CA-46079: Recover the image storage type.

Used to be a message parameter passed in at open time, then down
through the VBD and images up to the driver. Replaced by stat() and
statfs().

The vbd->storage isn't really applicable with cross-SR VHD chains
became more popular, so removed. We keep the driver->storage, but only
for verbosity. Drivers with type-dependent code call
tapdisk_storage_type() during td_open() are encouraged to store the
result here.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-46079: Remove the VHDoLVM snapshot rename/reactivation support hacks.
Daniel Stodden [Thu, 30 Sep 2010 21:01:38 +0000 (14:01 -0700)]
CA-46079: Remove the VHDoLVM snapshot rename/reactivation support hacks.

Removed:
 - Switch from raw LV-* to sparse VHD-* leaves, dealing with renames.
 - The lvchange call to move the DM node to the new metadata.

Both rather handled by SM.

Signed-off-by: Daniel Stoddden <daniel.stodden@citrix.com>
14 years agoCA-46079: Remove the image reopen hack.
Daniel Stodden [Thu, 30 Sep 2010 21:01:35 +0000 (14:01 -0700)]
CA-46079: Remove the image reopen hack.

Used to reopen the image chain on the first request, thereby detecting
guest activation after migration. Obsolete since tapdisk is
spawned/resumed after VM stop/copy now.

Signed-off-by: Daniel Stoddden <daniel.stodden@citrix.com>
14 years agoCA-46079: Remove the blktap-1 control daemon.
Daniel Stodden [Thu, 30 Sep 2010 21:01:33 +0000 (14:01 -0700)]
CA-46079: Remove the blktap-1 control daemon.

Got in the way of shifting some definitions around.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-45316: Fix misleading VHD preallocation error.
Daniel Stodden [Wed, 29 Sep 2010 09:59:20 +0000 (02:59 -0700)]
CA-45316: Fix misleading VHD preallocation error.

Short writes are normally due to ENOSPC or EOD, so don't EIO. Then
save offset/count and report the actual errno for future generations.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-44974: Preserve the active connection list when freeing.
Daniel Stodden [Wed, 15 Sep 2010 00:32:35 +0000 (17:32 -0700)]
CA-44974: Preserve the active connection list when freeing.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1053: Fix bounce buffer allocation size.
Daniel Stodden [Thu, 9 Sep 2010 09:05:37 +0000 (02:05 -0700)]
PR-1053: Fix bounce buffer allocation size.

Anticipate significantly less than 2816 requests in flight.

Times 11 * 4k buffer space, this was worth 121MB memory, mlocked.

Since segment treqs are merged, use ring size with some extra headroom
for splits.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCP-1840: Avoid potential response msg loss.
Daniel Stodden [Thu, 9 Sep 2010 09:05:17 +0000 (02:05 -0700)]
CP-1840: Avoid potential response msg loss.

The write-message/close-connection path wouldn't even try a response
message xmit since. Note this case matters when IPC broke, normal I/O
will drain.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-44974: Make tap_ctl_close idempotent.
Daniel Stodden [Thu, 9 Sep 2010 09:05:17 +0000 (02:05 -0700)]
CA-44974: Make tap_ctl_close idempotent.

Avoid potential freelist/conn vector corruption due to
double-frees. Upgrade the WARN_ON() to a panic(), the present drain
loop doesn't want to be asked after disconnect.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCP-1840: Fix buffer xmit error return path in blktap-control.
Daniel Stodden [Thu, 9 Sep 2010 09:05:16 +0000 (02:05 -0700)]
CP-1840: Fix buffer xmit error return path in blktap-control.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoPR-1053: Simplify bounce buffer memcpy.
Daniel Stodden [Tue, 7 Sep 2010 11:47:23 +0000 (04:47 -0700)]
PR-1053: Simplify bounce buffer memcpy.

14 years agoPR-1053: Demalloc the data path.
Daniel Stodden [Tue, 7 Sep 2010 11:47:23 +0000 (04:47 -0700)]
PR-1053: Demalloc the data path.

14 years agoCA-44958: Sync lreq release with outstanding I/O.
Daniel Stodden [Tue, 7 Sep 2010 11:47:22 +0000 (04:47 -0700)]
CA-44958: Sync lreq release with outstanding I/O.

The writeback code doesn't check for partial I/O completion. Fixed
with a common treq.cb and a variable lreq->phase to read/write state.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCA-44675: Fix parent cache corruption due to I/O crosstalk.
Daniel Stodden [Tue, 7 Sep 2010 02:42:26 +0000 (19:42 -0700)]
CA-44675: Fix parent cache corruption due to I/O crosstalk.

Previous patch requeued completing ring I/O buffers.

An interesting question is why this succeeds without a proper tapdisk
crash. The only sane explanation I can come up with is that the common
path manages to queue AIOs before our response hits the kernel so
unmap goes after GUP page translation. Which sounds not too
improbable, the target leaf vhd bitmap was likely still hot at this
point.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
14 years agoCP-1760: Fix potential infinite loop condition in tap-ctl.
Daniel Stodden [Fri, 3 Sep 2010 19:38:50 +0000 (12:38 -0700)]
CP-1760: Fix potential infinite loop condition in tap-ctl.

Yet another sign check error.

14 years agoCP-1705: bug fix for local read caching
Andrei Lifchits [Wed, 1 Sep 2010 14:26:44 +0000 (15:26 +0100)]
CP-1705: bug fix for local read caching

14 years agoCP-1840: Hush tap-ctl stats calls.
Daniel Stodden [Wed, 1 Sep 2010 00:27:34 +0000 (17:27 -0700)]
CP-1840: Hush tap-ctl stats calls.

Also, not allowing client reentries is fatally wrong.