- 28 11月, 2013 8 次提交
-
-
由 Peter Lieven 提交于
this patch does 2 things: a) only do additional call outs if BDRV_BLOCK_ZERO is not already set. b) use the newly introduced bdrv_unallocated_blocks_are_zero() to return the zero state of an unallocated block. the used callout to bdrv_has_zero_init() is only valid right after bdrv_create. Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPeter Lieven <pl@kamp.de> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
由 Peter Lieven 提交于
this patch adds a call to completely zero out a block device. the operation is sped up by checking the block status and only writing zeroes to the device if they currently do not return zeroes. optionally the zero writing can be sped up by setting the flag BDRV_REQ_MAY_UNMAP to emulate the zero write by unmapping if the driver supports it. Signed-off-by: NPeter Lieven <pl@kamp.de> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
由 Peter Lieven 提交于
Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPeter Lieven <pl@kamp.de> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
由 Peter Lieven 提交于
Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPeter Lieven <pl@kamp.de> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
由 Peter Lieven 提交于
This adds 2 wrappers to read the unallocated_blocks_are_zero and can_write_zeroes_with_unmap info from the BDI. The wrappers are required to check for the existence of a backing_hd and if the devices are opened with the correct flags. Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPeter Lieven <pl@kamp.de> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
由 Peter Lieven 提交于
Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPeter Lieven <pl@kamp.de> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
由 Peter Lieven 提交于
Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPeter Lieven <pl@kamp.de> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
由 Peter Lieven 提交于
Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPeter Lieven <pl@kamp.de> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
- 15 11月, 2013 1 次提交
-
-
由 Kevin Wolf 提交于
If an explicit driver option is present, but doesn't specify a valid driver, then bdrv_open() should fail instead of probing the format. Signed-off-by: NKevin Wolf <kwolf@redhat.com> Reviewed-by: NJeff Cody <jcody@redhat.com> Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
-
- 14 11月, 2013 1 次提交
-
-
由 Fam Zheng 提交于
If backing file doesn't exist, the error message is confusing and misleading: $ qemu /tmp/a.qcow2 qemu: could not open disk image /tmp/a.qcow2: Could not open file: No such file or directory But... $ ls /tmp/a.qcow2 /tmp/a.qcow2 $ qemu-img info /tmp/a.qcow2 image: /tmp/a.qcow2 file format: qcow2 virtual size: 8.0G (8589934592 bytes) disk size: 196K cluster_size: 65536 backing file: /tmp/b.qcow2 Because... $ ls /tmp/b.qcow2 ls: cannot access /tmp/b.qcow2: No such file or directory This is not intuitive. It's better to have the missing file's name in the error message. With this patch: $ qemu-io -c 'read 0 512' /tmp/a.qcow2 qemu-io: can't open device /tmp/a.qcow2: Could not open backing file: Could not open '/stor/vm/arch.raw': No such file or directory no file open, try 'help open' Which is a little bit better. Signed-off-by: NFam Zheng <famz@redhat.com> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
- 08 11月, 2013 1 次提交
-
-
由 Fam Zheng 提交于
Since b94a2610, bdrv_getlength() is omitted when probing image. VMDK monolithicFlat is broken by that because a file < 512 bytes can't be read with its total_sectors truncated to 0. This patch round up the size to BDRV_SECTOR_SIZE, when a image size is not sector aligned. Signed-off-by: NFam Zheng <famz@redhat.com> Reviewed-by: NBenoit Canet <benoit@irqsave.net> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
- 07 11月, 2013 1 次提交
-
-
由 Max Reitz 提交于
error_setg_errno() may overwrite errno; therefore, its value should be read before calling that function and not afterwards. Signed-off-by: NMax Reitz <mreitz@redhat.com> Reviewed-by: NEric Blake <eblake@redhat.com> Reviewed-by: NBenoit Canet <benoit@irqsave.net> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
- 29 10月, 2013 3 次提交
-
-
由 Kevin Wolf 提交于
The block layer generally keeps the size of an image cached in bs->total_sectors so that it doesn't have to perform expensive operations to get the size whenever it needs it. This doesn't work however when using a backend that can change its size without qemu being aware of it, i.e. passthrough of removable media like CD-ROMs or floppy disks. For this reason, the caching is disabled when a removable device is used. It is obvious that checking whether the _guest_ device has removable media isn't the right thing to do when we want to know whether the size of the host backend can change. To make things worse, non-top-level BlockDriverStates never have any device attached, which makes qemu assume they are removable, so drv->bdrv_getlength() is always called on the protocol layer. In the case of raw-posix, this causes unnecessary lseek() system calls, which turned out to be rather expensive. This patch completely changes the logic and disables bs->total_sectors caching only for certain block driver types, for which a size change is expected: host_cdrom and host_floppy on POSIX, host_device on win32; also the raw format in case it sits on top of one of these protocols, but in the common case the nested bdrv_getlength() call on the protocol driver will use the cache again and avoid an expensive drv->bdrv_getlength() call. Signed-off-by: NKevin Wolf <kwolf@redhat.com> Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
-
由 Thibaut LAURENT 提交于
Since commit 0ebd24e0, bdrv_open_common will throw an error when trying to open a file read-only with the BDRV_O_COPY_ON_READ flag set. Although BDRV_O_RDWR is unset for the backing files, BDRV_O_COPY_ON_READ is still passed on if copy-on-read was requested for the drive. Let's unset this flag too before opening the backing file, or bdrv_open_common will fail. Signed-off-by: NThibaut LAURENT <thibaut.laurent@gmail.com> Reviewed-by: NBenoit Canet <benoit@irqsave.net> Reviewed-by: NMax Reitz <mreitz@redhat.com> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
由 Max Reitz 提交于
bdrv_open_backing_file() tries to copy the backing file name using pstrcpy directly after calling bdrv_open() to open the backing file without checking whether that was actually successful. If it was not, ps->backing_hd->file will probably be NULL and qemu will crash. Fix this by moving pstrcpy after checking whether bdrv_open() succeeded. Signed-off-by: NMax Reitz <mreitz@redhat.com> Reviewed-by: NBenoit Canet <benoit@irqsave.net> Reviewed-by: Amos Kong <kongjianjun@gmail.com> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
- 11 10月, 2013 5 次提交
-
-
由 Kevin Wolf 提交于
If a read-only device is configured with copy-on-read=on, the old code only prints a warning and automatically disables copy on read. Make it a real error for blockdev-add. Signed-off-by: NKevin Wolf <kwolf@redhat.com> Reviewed-by: NMax Reitz <mreitz@redhat.com> Reviewed-by: NEric Blake <eblake@redhat.com>
-
由 Kevin Wolf 提交于
The main intent of this patch is to consolidate the whitelist checks to a single point in the code instead of spreading it everywhere. This adds a nicer error message for read-only whitelisting, too, in places where it was still missing. The patch also contains a bonus bug fix: By finding the format first in bdrv_open() and then independently checking against the whitelist only later, we avoid the case that use of a non-whitelisted format results in probing rather than an error message. Previously, this could happen when using the driver=... option. Signed-off-by: NKevin Wolf <kwolf@redhat.com> Reviewed-by: NFam Zheng <famz@redhat.com>
-
由 Benoît Canet 提交于
This field is used by blkverify to disable external snapshots creation. It will also be used by block filters like quorum to disable external snapshot creation. Signed-off-by: NBenoit Canet <benoit@irqsave.net> Reviewed-by: NMax Reitz <mreitz@redhat.com> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
由 Peter Lieven 提交于
if a raw device like an iscsi target or host device is used the current implementation makes a second call out to get the block status of bs->file. Signed-off-by: NPeter Lieven <pl@kamp.de> Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
由 Max Reitz 提交于
Add a function for retrieving an ImageInfoSpecific object from a block driver. Signed-off-by: NMax Reitz <mreitz@redhat.com> Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
- 07 10月, 2013 1 次提交
-
-
由 Dunrong Huang 提交于
The content filename point to may be erased by qemu_opts_absorb_qdict() in raw_open_common() in drv->bdrv_file_open() So it's better to use bs->filename. Signed-off-by: NDunrong Huang <riegamaths@gmail.com> Reviewed-by: NMax Reitz <mreitz@redhat.com> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
- 02 10月, 2013 1 次提交
-
-
由 Dunrong Huang 提交于
The content filename point to will be erased by qemu_opts_absorb_qdict() in raw_open_common() in drv->bdrv_file_open() So it's better to use bs->filename. Signed-off-by: NDunrong Huang <riegamaths@gmail.com> Reviewed-by: NMax Reitz <mreitz@redhat.com> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
- 26 9月, 2013 1 次提交
-
-
由 Fam Zheng 提交于
Signed-off-by: NFam Zheng <famz@redhat.com> Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
- 25 9月, 2013 5 次提交
-
-
由 Benoît Canet 提交于
Signed-off-by: NBenoit Canet <benoit@irqsave.net> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
由 Benoît Canet 提交于
Some drivers will have driver specifics options but no filename. This new bool allow the block layer to treat them correctly. The .bdrv_needs_filename is set in drivers not having .bdrv_parse_filename and not having .bdrv_open. The first exception to this rule will be the quorum driver. Signed-off-by: NBenoit Canet <benoit@irqsave.net> Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
由 Peter Lieven 提交于
Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPeter Lieven <pl@kamp.de> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
由 Peter Lieven 提交于
if the call is invoked through bdrv_is_allocated the caller might expect *pnum = 0 on error. however, a new implementation of bdrv_get_block_status might only return a negative exit value on error while keeping *pnum untouched. Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPeter Lieven <pl@kamp.de> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
由 Fam Zheng 提交于
Providing backing.file.filename doesn't override backing file as expected: $ x86_64-softmmu/qemu-system-x86_64 -drive \ file=/tmp/child.qcow2,backing.file.filename=/tmp/fake.qcow2 qemu-system-x86_64: -drive \ file=/tmp/child.qcow2,backing.file.filename=/tmp/fake.qcow2: could not open disk image /tmp/child.qcow2: Can't specify 'file' and 'filename' options at the same time With $ qemu-img info /tmp/child.qcow2 image: /tmp/child.qcow2 file format: qcow2 virtual size: 1.0G (1073741824 bytes) disk size: 196K cluster_size: 65536 backing file: /tmp/fake.qcow2 This fixes it by calling bdrv_get_full_backing_filename only if backing.file.filename is not provided. Also save the backing file name to bs->backing_file so the information is correct with HMP "info block". Signed-off-by: NFam Zheng <famz@redhat.com> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
- 21 9月, 2013 1 次提交
-
-
由 Fam Zheng 提交于
To read the last sector that is not aligned to sector boundary, current code for growable backends, since commit 893a8f62 "block: Produce zeros when protocols reading beyond end of file", drops the data and directly returns zeroes. That is incorrect. Signed-off-by: NFam Zheng <famz@redhat.com> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
- 12 9月, 2013 5 次提交
-
-
由 Max Reitz 提交于
Add an Error ** parameter to bdrv_create and its associated functions to allow more specific error messages. Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Max Reitz 提交于
Add an Error ** parameter to bdrv_open, bdrv_file_open and associated functions to allow more specific error messages. Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Max Reitz 提交于
Add an Error ** parameter to BlockDriver.bdrv_create to allow more specific error messages. Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Max Reitz 提交于
Add an Error ** parameter to BlockDriver.bdrv_open and BlockDriver.bdrv_file_open to allow more specific error messages. Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Max Reitz 提交于
This patch adds the "amend" option to qemu-img which allows changing image options on existing image files. It also adds the generic bdrv implementation which is basically just a wrapper for the image format specific function. Signed-off-by: NMax Reitz <mreitz@redhat.com> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
- 06 9月, 2013 6 次提交
-
-
由 Paolo Bonzini 提交于
Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
由 Paolo Bonzini 提交于
Protocols return raw data, so you can assume the offsets to pass through unchanged. Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
由 Paolo Bonzini 提交于
If the sectors are unallocated and we are past the end of the backing file, they will read as zero. Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
由 Paolo Bonzini 提交于
Alternatively, this could use a "discard zeroes data" flag returned by bdrv_get_info. Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
由 Paolo Bonzini 提交于
Define the return value of get_block_status. Bits 0, 1, 2 and 9-62 are valid; bit 63 (the sign bit) is reserved for errors. Bits 3-8 are left for future extensions. The return code is compatible with the old is_allocated API: if a driver only returns 0 or 1 (aka BDRV_BLOCK_DATA) like is_allocated used to, clients of is_allocated will not have any change in behavior. Still, we will return more precise information in the next patches and the new definition of bdrv_is_allocated is already prepared for this. Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-
由 Paolo Bonzini 提交于
For now, bdrv_get_block_status is just another name for bdrv_is_allocated. The next patches will add more flags. This also touches all block drivers with a mostly mechanical rename. The sole exception is cow; because it calls cow_co_is_allocated from the read code, we keep that function and make cow_co_get_block_status a wrapper. Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com> Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
-