block: return errors from bdrv_register_buf()

Registering an I/O buffer is only a performance optimization hint but it
is still necessary to return errors when it fails.

Later patches will need to detect errors when registering buffers but an
immediate advantage is that error_report() calls are no longer needed in
block driver .bdrv_register_buf() functions.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20221013185908.1297568-8-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2022-10-13 14:59:02 -04:00
parent e8b6535533
commit f4ec04bae9
7 changed files with 52 additions and 18 deletions

View file

@ -433,8 +433,11 @@ struct BlockDriver {
* that it can do IOMMU mapping with VFIO etc., in order to get better
* performance. In the case of VFIO drivers, this callback is used to do
* DMA mapping for hot buffers.
*
* Returns: true on success, false on failure
*/
void (*bdrv_register_buf)(BlockDriverState *bs, void *host, size_t size);
bool (*bdrv_register_buf)(BlockDriverState *bs, void *host, size_t size,
Error **errp);
void (*bdrv_unregister_buf)(BlockDriverState *bs, void *host, size_t size);
/*