mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
migration/multifd: Add mapped-ram support to fd: URI
If we receive a file descriptor that points to a regular file, there's nothing stopping us from doing multifd migration with mapped-ram to that file. Enable the fd: URI to work with multifd + mapped-ram. Note that the fds passed into multifd are duplicated because we want to avoid cross-thread effects when doing cleanup (i.e. close(fd)). The original fd doesn't need to be duplicated because monitor_get_fd() transfers ownership to the caller. Signed-off-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Peter Xu <peterx@redhat.com> Link: https://lore.kernel.org/r/20240229153017.2221-23-farosas@suse.de Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
a49d15a38d
commit
decdc76772
5 changed files with 63 additions and 5 deletions
|
@ -11,6 +11,7 @@
|
|||
#include "qemu/error-report.h"
|
||||
#include "qapi/error.h"
|
||||
#include "channel.h"
|
||||
#include "fd.h"
|
||||
#include "file.h"
|
||||
#include "migration.h"
|
||||
#include "io/channel-file.h"
|
||||
|
@ -53,15 +54,20 @@ bool file_send_channel_create(gpointer opaque, Error **errp)
|
|||
{
|
||||
QIOChannelFile *ioc;
|
||||
int flags = O_WRONLY;
|
||||
bool ret = true;
|
||||
bool ret = false;
|
||||
int fd = fd_args_get_fd();
|
||||
|
||||
ioc = qio_channel_file_new_path(outgoing_args.fname, flags, 0, errp);
|
||||
if (!ioc) {
|
||||
ret = false;
|
||||
goto out;
|
||||
if (fd && fd != -1) {
|
||||
ioc = qio_channel_file_new_fd(dup(fd));
|
||||
} else {
|
||||
ioc = qio_channel_file_new_path(outgoing_args.fname, flags, 0, errp);
|
||||
if (!ioc) {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
multifd_channel_connect(opaque, QIO_CHANNEL(ioc));
|
||||
ret = true;
|
||||
|
||||
out:
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue