History | View | Annotate | Download (44.8 kB)
qemu-io: add write -z option for bdrv_co_write_zeroes
Extend the qemu-io write command with the -z option to callbdrv_co_write_zeroes(). Exposing the zero write interface from qemu-ioallows us to write tests that exercise this new block layer interface....
Merge remote-tracking branch 'kwolf/for-anthony' into staging
qemu-io: end aio help text sentences with periods
Signed-off-by: Laszlo Ersek <lersek@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
block: replace unchecked strdup/malloc/calloc with glib
Most of the codebase as been converted to use glib memory allocationfunctions. There are still a few instances of malloc/calloc in theblock layer and qemu-io. Replace them, especially since they do not...
block: bdrv_aio_* do not return NULL
Initially done with the following semantic patch:
rule1 expression E;statement S;@@ E =( bdrv_aio_readv | bdrv_aio_writev | bdrv_aio_flush | bdrv_aio_discard | bdrv_aio_ioctl) (...);(- if (E == NULL) { ... }...
rule1
block: convert qemu_aio_flush() calls to bdrv_drain_all()
Many places in QEMU call qemu_aio_flush() to complete all pendingasynchronous I/O. Most of these places actually want to drain all blockrequests but there is no block layer API to do so.
This patch introduces the bdrv_drain_all() API to wait for requests...
fix spelling in main directory
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
qemu-io: Fix multiwrite_f error handling
Without this fix, some qiovs can be leaked if an error occurs. Also a semicolonat the end of the command line would make the code walk beyond the end of argv.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-io: Handle create_iovec errors
Callers of create_iovec() didn't check for failure and continued withuninitialised data in error cases. This patch adds checks to each call.
qemu-io: delete bs instead of leaking it
Using bdrv_close() is not enough to free a BlockDriverState. Since weexplicitly create it with bdrv_new(), use bdrv_delete() to close anddelete it.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
fix memory leak in aio_write_f
Haven't released memory of 'ctx' before return.
Signed-off-by: Alex Jia <ajia@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Remove blanks before \n in output strings
Those blanks violate the coding conventions, seescripts/checkpatch.pl.
Blanks missing after colons in the changed lines were added.
This patch does not try to fix tabs, long lines and otherproblems in the changed lines, therefore checkpatch.pl reports...
qemu-io: remove unnecessary assignment
Remove an unnecessary assignment, spotted by clang analyzer:/src/qemu/qemu-io.c:995:9: warning: Value stored to 'offset' is never read offset += reqs[i].qiov->size;
Acked-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-io: Fix if scoping bug
Fix a bug caused by lack of braces in if statement
Lack of braces means that if(count & 0x1ff) is never reached
Signed-off-by: Devin Nakamura <devin122@gmail.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-io: Fix formatting
Replaced tabs with spaces, 8 space indentations with 4 spaceindentation, and other fixes to better adhere to CODING_STYLE
block: clarify the meaning of BDRV_O_NOCACHE
Change BDRV_O_NOCACHE to only imply bypassing the host OS file cache,but no writeback semantics. All existing callers are changed to alsospecify BDRV_O_CACHE_WB to give them writeback semantics.
Signed-off-by: Christoph Hellwig <hch@lst.de>...
qemu-io: Fix discard command
qemu-io passed bytes where it's supposed to pass sectors, so discard requestswere off.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
qemu-io: fix a memory leak
Fix a memory leak, reported by cppcheck:[/src/qemu/qemu-io.c:1135]: (error) Memory leak: ctx
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Remove NULL checks for bdrv_new return value
It's an indirect call to qemu_malloc, which never returns an error.
qemu-io: Add discard command
discard [-Cq] off len -- discards a number of bytes at a specifiedoffset
discards a range of bytes from the given offset
Example: 'discard 512 1k' - discards 1 kilobyte from 512 bytes into the file
Discards a segment of the currently open file....
qemu-io: Fix typo in help texts
qemu-io: New command map
The new map command in qemu-io lists all allocated/unallocated areas in animage file.
use qemu_blockalign consistently
Use qemu_blockalign for all allocations in the block layer. This allowsincreasing the required alignment, which is need to support O_DIRECT ondevices with large block sizes.
qemu-io: Make alloc output useful when nb_sectors=1
There is no indication whether or not the sector is allocated whennb_sectors=1:
sector allocated at offset 64 KiB
This message is produced whether or not the sector is allocated.
Simply use the same message as the plural case, I don't think the...
fix variable type in qemu-io.c
The variable len can get a negative return value from cvtnum,which we check for, but which is impossible with the currentunsigned variable type. Currently the if(len < 0) check ispointless. This patch fixes that.
Signed-off-by: Joel Schopp <jschopp@austin.ibm.com>...
qemu-io: Fix error messages
The truncate and getlength commands passed a negative error number to strerror.They also happen to be the two functions that are lacking a newline at the endof their error message.
qemu-io: Add multiwrite command
The new multiwrite commands allows to use qemu-io for testingbdrv_aio_multiwrite.
Fix %lld or %llx printf format use
Replace calls of old bdrv_open
What is known today as bdrv_open2 becomes the new bdrv_open. All remainingcallers of the old function are converted to the new one. In some places theyeven know the right format, so they should have used bdrv_open2 from the...
block: get rid of the BDRV_O_FILE flag
BDRV_O_FILE is only used to communicate between bdrv_file_open and bdrv_open.It affects two things: first bdrv_open only searches for protocols usingfind_protocol instead of all image formats and host drivers. We can easily...
qemu-io: fix aio help texts
Fix a few typos in the help texts for the various aio commands.
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
qemu-io: Fix return value handling of bdrv_open
bdrv_open may return -errno so we have to checkif the return value is '< 0', not '== -1'.
Signed-off-by: Ryota Ozaki <ozaki.ryota@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
block: kill BDRV_O_CREAT
The BDRV_O_CREAT option is unused inside qemu and partially duplicatesthe bdrv_create method. Remove it, and the -C option to qemu-io whichisn't used in qemu-iotests anyway.
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Clean-up a little bit the RW related bits of BDRV_O_FLAGS. BDRV_O_RDONLY gone (and so is BDRV_O_ACCESS). Default value for bdrv_flags (0/zero) is READ-ONLY. Need to explicitly request READ-WRITE.
Instead of using the field 'readonly' of the BlockDriverState struct for passing the request,...
qemu-io: suppress a warning with gcc 4.0.2
qemu-io: Fix memory leak
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-io: add 'const'
Fix OpenBSD build of qemu-io
GCC 3.3.5 generates warnings for static forward declarations of data, sorearrange code to use static forward declarations of functions instead.
Use <getopt.h> for optind instead of local definition.
qemu-io: Improve portability (win32 now supported).
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
raw-posix: add Linux native AIO support
Now that do have a nicer interface to work against we can add Linux nativeAIO support. It's an extremly thing layer just setting up an iocb forthe io_submit system call in the submission path, and registering an...
Fix Sparse warnings: "Using plain integer as NULL pointer"
qemu-io: Rework alloc command
The alloc command in qemu-io is mostly useless currently. Instead of doing asingle call to bdrv_is_allocated, we must call bdrv_is_allocated in a loopuntil we have found out for each requested sector if it is allocated or not...
qemu-io: reject invalid pattern
Replace the use of atoi which is used for pattern parsing currently withstrtol. Atoi won't parse sedecimal pattern values (it always returns 0),but qemu-iotests use such pattern values. Also reject every patternthat is not a unsigned char as we pass the pattern to memset which...
qemu-io: Implement bdrv_load_vmstate/bdrv_save_vmstate
The load_vmstate and save_vmstate functions are implemented as avariation of the normal read/write operation, enabled by the -b option.This is the same mechanism as is used to switch from read/write to...
qemu-io: use BDRV_O_FILE to implement the growable open option
Instead of doing our own check for protocols which fails because raw isn'tformally a protocol but special cased in find_protocol specify the BDRV_O_FILEoption to use the same code as bdrv_file_open does....
qemu-io: small cleanups for the aio code
Address a couple of review comments from Kevin.
Signed-off-by: Christoph Hellwig <hch@lst.de>
qemu-io: better input validation for vector-based commands
Fix up a couple of issues with validating the input of the variouslength arguments for the vectored I/O commands:
- do the alignment check on each length instead the always 0 count argument - use a long long varibale for the cvtnum return value so that we can check...
qemu-io: add flag to mark files growable
Add a -g flag to the open command and the main qemu-io command line toallow opening a file growable. This is only allowed for protocols,mirroring the limitation exposed through bdrv_file_open.
qemu-io: fix memory leak
qemu-io leaks the request buffer whenever the read or write function isn'texecuted completely down the "normal" code path.
[hch: also fix the aio and vectored variants the same way]
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
Fix dump output in qemu-io.
The dump output was not nicely formatted for byteslarger than 0x7f, because signed values expanded tosizeof(int) bytes. So for example 0xab did not printas "ab", but as "ffffffab".
I also cleaned the function prototype, which avoids...
qemu-io: Fix spelling in help message.
excerciser -> exerciser
qemu-io: add aio read/write/flush commands
Add commands to exercise asynchronous reads/writes and to flush alloutstanding aio commands. Commands to exercise aio cancellations willfollow in a separate patch.
Workaround compiler warnings at -O1
Signed-off-by: Paul Brook <paul@codesourcery.com>
qemu-io: Optionally verify only part of read data
There are reasonable test cases where a read must span areas that are notuniformly filled with one pattern but contains several parts. This makes -Puseless for them currently.
Introducing additional options which determine the part of the read data that...
qemu-io: Verify read data by patterns (Kevin Wolf)
This patch adds a -P option to read and readv which allows to compare the readdata to a given pattern. This can be used to verify data written by write -P.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
qemu-io: Fix handling of bdrv_is_allocated() return value (Kevin Wolf)
bdrv_is_allocated() returns a boolean which indicates if the offset isallocated, not 0 on success and everything else is an error.
a couple of qemu-io fixes (Christoph Hellwig)
Fix two stupid bugs that I forgot to push out:
- qiov->size already is in bytes, no need to shift it - actually use the supplied patter in the writev command
Add files not included in previous commit.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6995 c046a42c-6fe2-441c-8c8c-71466251a162