Commit Graph

15 Commits

Author SHA1 Message Date
aliguori f1b2f712a4 more BlockDriver C99 initializers (Christoph Hellwig)
Looks like the two bdrv_raw instances were missed last time.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7018 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-07 18:23:51 +00:00
aliguori 3060cd14c2 Fix find_device_type() to correctly identify floppy disk devices; (Luca Tettamanti)
they are reported as DRIVE_REMOVABLE by win32.

Signed-off-by: Luca Tettamanti <kronos.it@gmail.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7010 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-07 01:24:53 +00:00
blueswir1 b9e82a5946 Fix some win32 compile warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6984 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-05 18:03:31 +00:00
aliguori 9c39be47db Remove dead AIO code for win32
AFAIK, it's never been enabled and hasn't even compiled in ages.  Remove the
code to avoid confusion.  If someone ever decides to fix it, they can get at
the old version in RCS history.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6958 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-29 20:54:17 +00:00
aliguori 537a1d4bb0 Fix regression introduced by r6824
The changes introduced by r6824 broke a subtle, and admittedly obscure, aspect
of the block API.  While bdrv_{pread,pwrite} return the number of bytes read
or written upon success, bdrv_{read,write} returns a zero upon success.

When using bdrv_pread for bdrv_read, special care must be taken to handle this
case.

This fixes certain guest images (notably linux-0.2 provided on the qemu
website).

Reported-by: malc <av1474@comtv.ru>
Reported-by: Herve Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6828 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-13 03:12:03 +00:00
aliguori eda578e559 Drop internal bdrv_pread()/bdrv_pwrite() APIs (Avi Kivity)
Now that scsi generic no longer uses bdrv_pread() and bdrv_pwrite(), we can
drop the corresponding internal APIs, which overlap bdrv_read()/bdrv_write()
and, being byte oriented, are unnatural for a block device.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6824 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-12 19:57:16 +00:00
aliguori 49dc768d4c Fix windows build and clean up use of <windows.h>
We want to globally define WIN_LEAN_AND_MEAN and WINVER to particular values so
let's do it in OS_CFLAGS.

Then, we can pepper in windows.h includes where using #includes that require it.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6783 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-08 16:26:59 +00:00
aurel32 e60f469ca8 Use C99 initializers for BlockDriver methods
Consistently use the C99 named initializer format for the BlockDriver
methods to make the method table more readable and more easily
extensible.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6768 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-07 22:00:29 +00:00
aliguori 9f7965c7e9 Expand cache= option and use write-through caching by default
This patch changes the cache= option to accept none, writeback, or writethough
to control the host page cache behavior.  By default, writethrough caching is
now used which internally is implemented by using O_DSYNC to open the disk
images.  When using -snapshot, writeback is used by default since data integrity
it not at all an issue.

cache=none has the same behavior as cache=off previously.  The later syntax is
still supported by now deprecated.  I also cleaned up the O_DIRECT
implementation to avoid many of the #ifdefs.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5485 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-14 14:42:54 +00:00
aliguori a76bab4952 Refactor AIO to allow multiple AIO implementations
This patch refactors the AIO layer to allow multiple AIO implementations.  It's
only possible because of the recent signalfd() patch.  

Right now, the AIO infrastructure is pretty specific to the block raw backend.
For other block devices to implement AIO, the qemu_aio_wait function must
support registration.  This patch introduces a new function,
qemu_aio_set_fd_handler, which can be used to register a file descriptor to be
called back.  qemu_aio_wait() now polls a set of file descriptors registered
with this function until one becomes readable or writable.

This patch should allow the implementation of alternative AIO backends (via a
thread pool or linux-aio) and AIO backends in non-traditional block devices
(like NBD).

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5297 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-22 19:17:18 +00:00
aliguori 2acf5af04d block-raw is not a protocol
The protocol_name "file" was added to the block driver when async IO was
introduced.  This can be used to select that a file is treated as a raw
device instead of probing for the type.  However, protocols are not subject
to path interpretation which cases qcow2 images with raw base images to not
function is the path was specified relatively.

The fix is simply to remove the protocol_name from the raw block driver.  The
proper way to force the use of a raw block format is to use the format= option
with -drive.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5233 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-16 13:21:58 +00:00
aliguori 03ff3ca30f Use common objects for qemu-img and qemu-nbd
Right now, we sprinkle #if defined(QEMU_IMG) && defined(QEMU_NBD) all over the
code.  It's ugly and causes us to have to build multiple object files for
linking against qemu and the tools.

This patch introduces a new file, qemu-tool.c which contains enough for
qemu-img, qemu-nbd, and QEMU to all share the same objects.

This also required getting qemu-nbd to be a bit more Windows friendly.  I also
changed the Windows block-raw to use normal IO instead of overlapping IO since
we don't actually do AIO yet on Windows.  I changed the various #if 0's to
 #if WIN32_AIO to make it easier for someone to eventually fix AIO on Windows.

After this patch, there are no longer any #ifdef's related to qemu-img and
qemu-nbd.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5226 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-15 15:51:35 +00:00
aliguori baf35cb902 Use signalfd() to work around signal/select race
This patch introduces signalfd() to work around the signal/select race in
checking for AIO completions.  For platforms that don't support signalfd(), we
emulate it with threads.

There was a long discussion about this approach.  I don't believe there are any
fundamental problems with this approach and I believe eliminating the use of
signals is a good thing.

I've tested Windows and Linux using Windows and Linux guests.  I've also checked
for disk IO performance regressions.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5187 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-10 15:45:19 +00:00
balrog 33f002714b Add "cache" parameter to "-drive" (Laurent Vivier).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3848 c046a42c-6fe2-441c-8c8c-71466251a162
2007-12-24 14:33:24 +00:00
ths 223d4670a0 Split block-raw.c into block-raw-posix.c and block-raw-win32.c, by
Anthony Liguori.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3814 c046a42c-6fe2-441c-8c8c-71466251a162
2007-12-15 17:28:36 +00:00