- 11 7月, 2017 24 次提交
-
-
由 Daniel P. Berrange 提交于
Instead of requiring separate input/output buffers for encrypting data, change qcow2_encrypt_sectors() to assume use of a single buffer, encrypting in place. The current callers all used the same buffer for input/output already. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com> Message-id: 20170623162419.26068-11-berrange@redhat.com Reviewed-by: NAlberto Garcia <berto@igalia.com> Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Daniel P. Berrange 提交于
This converts the qcow driver to make use of the QCryptoBlock APIs for encrypting image content. This is only wired up to permit use of the legacy QCow encryption format. Users who wish to have the strong LUKS format should switch to qcow2 instead. With this change it is now required to use the QCryptoSecret object for providing passwords, instead of the current block password APIs / interactive prompting. $QEMU \ -object secret,id=sec0,file=/home/berrange/encrypted.pw \ -drive file=/home/berrange/encrypted.qcow,encrypt.format=aes,\ encrypt.key-secret=sec0 Though note that running QEMU system emulators with the AES encryption is no longer supported, so while the above syntax is valid, QEMU will refuse to actually run the VM in this particular example. Likewise when creating images with the legacy AES-CBC format qemu-img create -f qcow \ --object secret,id=sec0,file=/home/berrange/encrypted.pw \ -o encrypt.format=aes,encrypt.key-secret=sec0 \ /home/berrange/encrypted.qcow 64M Reviewed-by: NMax Reitz <mreitz@redhat.com> Reviewed-by: NAlberto Garcia <berto@igalia.com> Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NDaniel P. Berrange <berrange@redhat.com> Message-id: 20170623162419.26068-10-berrange@redhat.com Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Daniel P. Berrange 提交于
Instead of requiring separate input/output buffers for encrypting data, change encrypt_sectors() to assume use of a single buffer, encrypting in place. One current caller uses the same buffer for input/output already and the other two callers are easily converted to do so. Reviewed-by: NAlberto Garcia <berto@igalia.com> Reviewed-by: NEric Blake <eblake@redhat.com> Reviewed-by: NMax Reitz <mreitz@redhat.com> Reviewed-by: NKevin Wolf <kwolf@redhat.com> Signed-off-by: NDaniel P. Berrange <berrange@redhat.com> Message-id: 20170623162419.26068-9-berrange@redhat.com Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Daniel P. Berrange 提交于
Historically the qcow & qcow2 image formats supported a property "encryption=on" to enable their built-in AES encryption. We'll soon be supporting LUKS for qcow2, so need a more general purpose way to enable encryption, with a choice of formats. This introduces an "encrypt.format" option, which will later be joined by a number of other "encrypt.XXX" options. The use of a "encrypt." prefix instead of "encrypt-" is done to facilitate mapping to a nested QAPI schema at later date. e.g. the preferred syntax is now qemu-img create -f qcow2 -o encrypt.format=aes demo.qcow2 Signed-off-by: NDaniel P. Berrange <berrange@redhat.com> Message-id: 20170623162419.26068-8-berrange@redhat.com Reviewed-by: NAlberto Garcia <berto@igalia.com> Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Daniel P. Berrange 提交于
Test 048 is designed to verify data preservation during an image resize. The qcow (v1) format impl has never supported resize so always fails. Reviewed-by: NMax Reitz <mreitz@redhat.com> Reviewed-by: NAlberto Garcia <berto@igalia.com> Signed-off-by: NDaniel P. Berrange <berrange@redhat.com> Message-id: 20170623162419.26068-7-berrange@redhat.com Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Daniel P. Berrange 提交于
Test 042 is designed to verify operation with zero sized images. Such images are not supported with qcow (v1), so this test has always failed. Reviewed-by: NMax Reitz <mreitz@redhat.com> Reviewed-by: NAlberto Garcia <berto@igalia.com> Signed-off-by: NDaniel P. Berrange <berrange@redhat.com> Message-id: 20170623162419.26068-6-berrange@redhat.com Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Daniel P. Berrange 提交于
The qcow driver refuses to open images which are less than 2 bytes in size, but will happily create such images. Add a check in the create path to avoid this discrepancy. Reviewed-by: NMax Reitz <mreitz@redhat.com> Reviewed-by: NAlberto Garcia <berto@igalia.com> Reviewed-by: NEric Blake <eblake@redhat.com> Signed-off-by: NDaniel P. Berrange <berrange@redhat.com> Message-id: 20170623162419.26068-5-berrange@redhat.com Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Daniel P. Berrange 提交于
Document that use of guest virtual sector numbers as the basis for the initialization vectors is a potential weakness, when combined with internal snapshots or multiple images using the same passphrase. This fixes the formatting of the itemized list too. Reviewed-by: NMax Reitz <mreitz@redhat.com> Reviewed-by: NAlberto Garcia <berto@igalia.com> Signed-off-by: NDaniel P. Berrange <berrange@redhat.com> Message-id: 20170623162419.26068-4-berrange@redhat.com Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Daniel P. Berrange 提交于
When integrating the crypto support with qcow/qcow2, we don't want to use the bare LUKS option names "hash-alg", "key-secret", etc. We need to namespace them to match the nested QAPI schema. e.g. "encrypt.hash-alg", "encrypt.key-secret" so that they don't clash with any general qcow options at a later date. Reviewed-by: NEric Blake <eblake@redhat.com> Reviewed-by: NMax Reitz <mreitz@redhat.com> Reviewed-by: NAlberto Garcia <berto@igalia.com> Signed-off-by: NDaniel P. Berrange <berrange@redhat.com> Message-id: 20170623162419.26068-3-berrange@redhat.com Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Daniel P. Berrange 提交于
The block/crypto.c defines a set of QemuOpts that provide parameters for encryption. This will also be needed by the qcow/qcow2 integration, so expose the relevant pieces in a new block/crypto.h header. Some helper methods taking QemuOpts are changed to take QDict to simplify usage in other places. Reviewed-by: NMax Reitz <mreitz@redhat.com> Reviewed-by: NEric Blake <eblake@redhat.com> Reviewed-by: NAlberto Garcia <berto@igalia.com> Signed-off-by: NDaniel P. Berrange <berrange@redhat.com> Message-id: 20170623162419.26068-2-berrange@redhat.com Signed-off-by: NMax Reitz <mreitz@redhat.com>
-
由 Peter Maydell 提交于
VFIO fixes 2017-07-10 - Don't iterate over non-realized devices (Alex Williamson) - Add PCIe capability version fixup (Alex Williamson) # gpg: Signature made Mon 10 Jul 2017 20:06:11 BST # gpg: using RSA key 0x239B9B6E3BB08B22 # gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" # gpg: aka "Alex Williamson <alex@shazbot.org>" # gpg: aka "Alex Williamson <alwillia@redhat.com>" # gpg: aka "Alex Williamson <alex.l.williamson@gmail.com>" # Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B 8A90 239B 9B6E 3BB0 8B22 * remotes/awilliam/tags/vfio-updates-20170710.0: vfio/pci: Fixup v0 PCIe capabilities vfio: Test realized when using VFIOGroup.device_list iterator Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
-
由 Paolo Bonzini 提交于
While ARM could present the xenpv machine, it does not and trying to enable it breaks compilation. Revert to the previous test which only looked at $target_name, not $cpu. Fixes: 3b6b7550Reported-by: NAlex Bennée <alex.bennee@linaro.org> Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com> Message-id: 20170711100049.20513-1-pbonzini@redhat.com Reviewed-by: NPeter Maydell <peter.maydell@linaro.org> Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
-
由 Peter Maydell 提交于
Migration pull 2017-07-10 # gpg: Signature made Mon 10 Jul 2017 18:04:57 BST # gpg: using RSA key 0x0516331EBC5BFDE7 # gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A 9FA9 0516 331E BC5B FDE7 * remotes/dgilbert/tags/pull-migration-20170710a: migration: Make compression_threads use save/load_setup/cleanup() migration: Convert ram to use new load_setup()/load_cleanup() migration: Create load_setup()/cleanup() methods migration: Rename cleanup() to save_cleanup() migration: Rename save_live_setup() to save_setup() doc: update TYPE_MIGRATION documents doc: add item for "-M enforce-config-section" vl: move global property, migrate init earlier migration: fix handling for --only-migratable Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
-
由 Juan Quintela 提交于
Once there, be consistent and use compress_thread_{save,load}_{setup,cleanup}. Signed-off-by: NJuan Quintela <quintela@redhat.com> Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20170628095228.4661-6-quintela@redhat.com> Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
-
由 Juan Quintela 提交于
Once there, I rename ram_migration_cleanup() to ram_save_cleanup(). Notice that this is the first pass, and I only passed XBZRLE to the new scheme. Moved decoded_buf to inside XBZRLE struct. As a bonus, I don't have to export xbzrle functions from ram.c. Signed-off-by: NJuan Quintela <quintela@redhat.com> Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com> -- loaded_data pointer was needed because called can change it (dave) spell loaded correctly in comment (dave) Message-Id: <20170628095228.4661-5-quintela@redhat.com> Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
-
由 Juan Quintela 提交于
We need to do things at load time and at cleanup time. Signed-off-by: NJuan Quintela <quintela@redhat.com> -- Move the printing of the error message so we can print the device giving the error. Add call to postcopy stuff Message-Id: <20170628095228.4661-4-quintela@redhat.com> Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
-
由 Juan Quintela 提交于
We need a cleanup for loads, so we rename here to be consistent. Signed-off-by: NJuan Quintela <quintela@redhat.com> Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com> -- Rename htab_cleanup to htap_save_cleanup as dave suggestion Message-Id: <20170628095228.4661-3-quintela@redhat.com> Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
-
由 Juan Quintela 提交于
We are going to use it now for more than save live regions. Once there rename qemu_savevm_state_begin() to qemu_savevm_state_setup(). Signed-off-by: NJuan Quintela <quintela@redhat.com> Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20170628095228.4661-2-quintela@redhat.com> Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
-
由 Peter Xu 提交于
[Peter collected Eduardo's patch comment and formatted into patch] Suggested-by: NEduardo Habkost <ehabkost@redhat.com> Signed-off-by: NPeter Xu <peterx@redhat.com> Message-Id: <1499242883-2184-5-git-send-email-peterx@redhat.com> Reviewed-by: NEduardo Habkost <ehabkost@redhat.com> Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
-
由 Peter Xu 提交于
It's never documented, and now we have one more parameter for it (which obsoletes this one). Document it properly. Suggested-by: NEduardo Habkost <ehabkost@redhat.com> Signed-off-by: NPeter Xu <peterx@redhat.com> Message-Id: <1499396048-21657-1-git-send-email-peterx@redhat.com> Reviewed-by: NGreg Kurz <groug@kaod.org> Reviewed-by: NEduardo Habkost <ehabkost@redhat.com> Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com> Removed 'Although now' commit message as per Eduardo's review
-
由 Peter Xu 提交于
Currently drive_init_func() may call migrate_get_current() while the migrate object is still not ready yet at that time. Move the migration object init earlier, along with the global properties, right after acceleration init. This fixes a breakage for iotest 055, which caused an assertion failure. Reported-by: NMax Reitz <mreitz@redhat.com> Reported-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: NEduardo Habkost <ehabkost@redhat.com> Tested-by: NQingFeng Hao <haoqf@linux.vnet.ibm.com> Fixes: 3df663 ("migration: move only_migratable to MigrationState") Signed-off-by: NPeter Xu <peterx@redhat.com> Message-Id: <1499242883-2184-3-git-send-email-peterx@redhat.com> Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
-
由 Peter Xu 提交于
MigrateState object is not ready at that time, so we'll get an assertion. Use qemu_global_option() instead. Reported-by: NEduardo Habkost <ehabkost@redhat.com> Suggested-by: NEduardo Habkost <ehabkost@redhat.com> Reviewed-by: NEduardo Habkost <ehabkost@redhat.com> Reviewed-by: NJuan Quintela <quintela@redhat.com> Fixes: 3df663e5 ("migration: move only_migratable to MigrationState") Signed-off-by: NPeter Xu <peterx@redhat.com> Message-Id: <1499242883-2184-2-git-send-email-peterx@redhat.com> Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
-
由 Alex Williamson 提交于
Intel 82599 VFs report a PCIe capability version of 0, which is invalid. The earliest version of the PCIe spec used version 1. This causes Windows to fail startup on the device and it will be disabled with error code 10. Our choices are either to drop the PCIe cap on such devices, which has the side effect of likely preventing the guest from discovering any extended capabilities, or performing a fixup to update the capability to the earliest valid version. This implements the latter. Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
-
由 Alex Williamson 提交于
VFIOGroup.device_list is effectively our reference tracking mechanism such that we can teardown a group when all of the device references are removed. However, we also use this list from our machine reset handler for processing resets that affect multiple devices. Generally device removals are fully processed (exitfn + finalize) when this reset handler is invoked, however if the removal is triggered via another reset handler (piix4_reset->acpi_pcihp_reset) then the device exitfn may run, but not finalize. In this case we hit asserts when we start trying to access PCI helpers since much of the PCI state of the device is released. To resolve this, add a pointer to the Object DeviceState in our common base-device and skip non-realized devices as we iterate. Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
-
- 10 7月, 2017 16 次提交
-
-
由 Peter Maydell 提交于
nbd patches for 2017-07-10 - Eric Blake: MAINTAINERS: Promote NBD to supported, with new maintainer - Vladimir Sementsov-Ogievskiy: [00/10] nbd refactoring part 2 # gpg: Signature made Mon 10 Jul 2017 15:59:18 BST # gpg: using RSA key 0xA7A16B4A2527436A # gpg: Good signature from "Eric Blake <eblake@redhat.com>" # gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" # gpg: aka "[jpeg image of size 6874]" # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A * remotes/ericb/tags/pull-nbd-2017-07-10-v2: nbd: use generic trace subsystem instead of TRACE macro nbd: refactor tracing nbd/server: rename clientflags var in nbd_negotiate_options nbd/server: fix TRACE in nbd_negotiate_send_rep_len nbd/client: refactor TRACE of NBD_MAGIC nbd/common: nbd_tls_handshake: remove extra TRACE nbd/server: add errp to nbd_send_reply() nbd/server: use errp instead of LOG nbd/server: refactor nbd_negotiate nbd/server: nbd_negotiate: return 1 on NBD_OPT_ABORT MAINTAINERS: Promote NBD to supported, with new maintainer Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
-
Let NBD use the trace mechanisms already present in qemu. Now you can use the -trace optino of qemu, or the -T/--trace option of qemu-img, qemu-io, and qemu-nbd, to select nbd traces. For qemu, the QMP commands trace-event-{get,set}-state can also toggle tracing on the fly. Example: qemu-nbd --trace 'nbd_*' <image file> # enables all nbd traces Recompilation with CFLAGS=-DDEBUG_NBD is no more needed, furthermore, DEBUG_NBD macro is removed from the code. Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20170707152918.23086-11-vsementsov@virtuozzo.com> [eblake: minor tweaks to a couple of traces] Signed-off-by: NEric Blake <eblake@redhat.com>
-
Reorganize traces: move, reword, add information, drop extra ones. Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20170707152918.23086-10-vsementsov@virtuozzo.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
Rename 'clientflags' to just 'option'. This variable has nothing to do with flags, but is a single integer representing the option requested by the client. Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20170707152918.23086-9-vsementsov@virtuozzo.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
Fix wrong order of TRACE arguments. Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20170707152918.23086-8-vsementsov@virtuozzo.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
We are going to switch from TRACE macro to trace points, this TRACE complicates things, this patch simplifies it. Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20170707152918.23086-7-vsementsov@virtuozzo.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
Error is propagated to the caller, TRACE is not needed. Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: NEric Blake <eblake@redhat.com> Message-Id: <20170707152918.23086-6-vsementsov@virtuozzo.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: NEric Blake <eblake@redhat.com> Message-Id: <20170707152918.23086-5-vsementsov@virtuozzo.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
Move to modern errp scheme from just LOGging errors. Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20170707152918.23086-4-vsementsov@virtuozzo.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
Combine two successive "if (oldStyle) {...} else {...}" into one. Block "if (client->tlscreds)" under "if (oldStyle)" is unreachable, as we have "oldStyle = client->exp != NULL && !client->tlscreds;". So, delete this block. Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20170707152918.23086-3-vsementsov@virtuozzo.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
Separate the case when a client sends NBD_OPT_ABORT from all other errors. It will be needed for the following patch, where errors will be reported. This particular case is not actually an error - it honestly follows the NBD protocol. Therefore it should not be reported like an error. Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: NEric Blake <eblake@redhat.com> Message-Id: <20170707152918.23086-2-vsementsov@virtuozzo.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
We are promising more than just odd fixes, and Paolo is hoping to offload the pull requests to me. Also, enough of NBD is related to the block layer that it is worth including qemu-block on patches. While at it, include blockdev-nbd.c and qemu-nbd.texi in the set of maintained files. Signed-off-by: NEric Blake <eblake@redhat.com> Message-Id: <20170707182151.29872-1-eblake@redhat.com> Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
-
由 Peter Maydell 提交于
Block layer patches # gpg: Signature made Mon 10 Jul 2017 12:26:44 BST # gpg: using RSA key 0x7F09B272C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: (40 commits) block: Make bdrv_is_allocated_above() byte-based block: Minimize raw use of bds->total_sectors block: Make bdrv_is_allocated() byte-based backup: Switch backup_run() to byte-based backup: Switch backup_do_cow() to byte-based backup: Switch block_backup.h to byte-based backup: Switch BackupBlockJob to byte-based block: Drop unused bdrv_round_sectors_to_clusters() mirror: Switch mirror_iteration() to byte-based mirror: Switch mirror_do_read() to byte-based mirror: Switch mirror_cow_align() to byte-based mirror: Update signature of mirror_clip_sectors() mirror: Switch mirror_do_zero_or_discard() to byte-based mirror: Switch MirrorBlockJob to byte-based commit: Switch commit_run() to byte-based commit: Switch commit_populate() to byte-based stream: Switch stream_run() to byte-based stream: Drop reached_end for stream_complete() stream: Switch stream_populate() to byte-based trace: Show blockjob actions via bytes, not sectors ... Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
-
由 Eric Blake 提交于
We are gradually moving away from sector-based interfaces, towards byte-based. In the common case, allocation is unlikely to ever use values that are not naturally sector-aligned, but it is possible that byte-based values will let us be more precise about allocation at the end of an unaligned file that can do byte-based access. Changing the signature of the function to use int64_t *pnum ensures that the compiler enforces that all callers are updated. For now, the io.c layer still assert()s that all callers are sector-aligned, but that can be relaxed when a later patch implements byte-based block status. Therefore, for the most part this patch is just the addition of scaling at the callers followed by inverse scaling at bdrv_is_allocated(). But some code, particularly stream_run(), gets a lot simpler because it no longer has to mess with sectors. Leave comments where we can further simplify by switching to byte-based iterations, once later patches eliminate the need for sector-aligned operations. For ease of review, bdrv_is_allocated() was tackled separately. Signed-off-by: NEric Blake <eblake@redhat.com> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
由 Eric Blake 提交于
bdrv_is_allocated_above() was relying on intermediate->total_sectors, which is a field that can have stale contents depending on the value of intermediate->has_variable_length. An audit shows that we are safe (we were first calling through bdrv_co_get_block_status() which in turn calls bdrv_nb_sectors() and therefore just refreshed the current length), but it's nicer to favor our accessor functions to avoid having to repeat such an audit, even if it means refresh_total_sectors() is called more frequently. Suggested-by: NJohn Snow <jsnow@redhat.com> Signed-off-by: NEric Blake <eblake@redhat.com> Reviewed-by: NManos Pitsidianakis <el13635@mail.ntua.gr> Reviewed-by: NJeff Cody <jcody@redhat.com> Reviewed-by: NJohn Snow <jsnow@redhat.com> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-
由 Eric Blake 提交于
We are gradually moving away from sector-based interfaces, towards byte-based. In the common case, allocation is unlikely to ever use values that are not naturally sector-aligned, but it is possible that byte-based values will let us be more precise about allocation at the end of an unaligned file that can do byte-based access. Changing the signature of the function to use int64_t *pnum ensures that the compiler enforces that all callers are updated. For now, the io.c layer still assert()s that all callers are sector-aligned on input and that *pnum is sector-aligned on return to the caller, but that can be relaxed when a later patch implements byte-based block status. Therefore, this code adds usages like DIV_ROUND_UP(,BDRV_SECTOR_SIZE) to callers that still want aligned values, where the call might reasonbly give non-aligned results in the future; on the other hand, no rounding is needed for callers that should just continue to work with byte alignment. For the most part this patch is just the addition of scaling at the callers followed by inverse scaling at bdrv_is_allocated(). But some code, particularly bdrv_commit(), gets a lot simpler because it no longer has to mess with sectors; also, it is now possible to pass NULL if the caller does not care how much of the image is allocated beyond the initial offset. Leave comments where we can further simplify once a later patch eliminates the need for sector-aligned requests through bdrv_is_allocated(). For ease of review, bdrv_is_allocated_above() will be tackled separately. Signed-off-by: NEric Blake <eblake@redhat.com> Signed-off-by: NKevin Wolf <kwolf@redhat.com>
-