summaryrefslogtreecommitdiffstats
path: root/buffered_file.c
Commit message (Collapse)AuthorAgeFilesLines
* buffered_file: buffered_put_buffer() don't need to set last_errorJuan Quintela2012-10-171-2/+0
| | | | | | | | Callers on savevm.c:qemu_fflush() will set it. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* migration: make migrate_fd_wait_for_unfreeze() return errorsJuan Quintela2012-10-171-2/+6
| | | | | | | | Adjust all callers Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* buffered_file: make buffered_flush return the error codeJuan Quintela2012-10-171-9/+26
| | | | | | Or the amount of data written if there is no error. Adjust all callers. Signed-off-by: Juan Quintela <quintela@redhat.com>
* buffered_file: callers of buffered_flush() already check for errorsJuan Quintela2012-10-171-7/+0
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* buffered_file: We can access directly to bandwidth_limitJuan Quintela2012-10-171-3/+2
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* buffered_file: unfold migrate_fd_closeJuan Quintela2012-10-171-5/+2
| | | | | | We only used it once, just remove the callback indirection. Signed-off-by: Juan Quintela <quintela@redhat.com>
* buffered_file: unfold migrate_fd_wait_for_unfreezeJuan Quintela2012-10-171-4/+1
| | | | | | We only used it once, just remove the callback indirection. Signed-off-by: Juan Quintela <quintela@redhat.com>
* buffered_file: unfold migrate_fd_put_readyJuan Quintela2012-10-171-4/+1
| | | | | | | | We only use it once, just remove the callback indirection. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* buffered_file: unfold migrate_fd_put_bufferJuan Quintela2012-10-171-5/+2
| | | | | | | | We only used it once, just remove the callback indirection Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* buffered_file: opaque is MigrationStateJuan Quintela2012-10-171-3/+3
| | | | | | | | | It always have that type, just change it. We will remove buffered file later on the migration thread series. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* buffered_file: rename opaque to migration_stateJuan Quintela2012-10-171-6/+6
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* BufferedFile: append, then flushPaolo Bonzini2012-10-171-39/+11
| | | | | | | | | | | Simplify the logic for pushing data from the buffer to the output pipe/socket. This also matches more closely what will be the operation of the migration thread. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
* buffered_file: g_realloc() can't failJuan Quintela2012-10-171-9/+1
| | | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
* prepare for future GPLv2+ relicensingPaolo Bonzini2012-01-131-0/+2
| | | | | | | | | All files under GPLv2 will get GPLv2+ changes starting tomorrow. event_notifier.c and exec-obsolete.h were only ever touched by Red Hat employees and can be relicensed now. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: use qemu_file_get_error() return value when possibleJuan Quintela2011-10-201-9/+14
| | | | Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: rename qemu_file_has_error to qemu_file_get_errorJuan Quintela2011-10-201-7/+7
| | | | | | | Now the function returned errno, so it is better the new name. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: change has_error to contain errno valuesJuan Quintela2011-10-201-2/+2
| | | | | | We normally already have an errno value. When not, abuse EIO. Signed-off-by: Juan Quintela <quintela@redhat.com>
* buffered_file: reuse QEMUFile has_error fieldJuan Quintela2011-10-201-9/+8
| | | | | | | | | Instead of having two has_error fields in QEMUFile & QEMUBufferedFile, reuse the 1st one. Notice that the one in buffered_file is only set after a file operation. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
* buffered_file: Use right "opaque"Juan Quintela2011-10-201-1/+1
| | | | | | | | | buffered_close 's' variable is of type QEMUFileBuffered, and wait_for_unfreeze() expect to receive a MigrationState, that 'coincidentaly' is s->opaque. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: If there is one error, it makes no sense to continueJuan Quintela2011-10-201-3/+9
| | | | | | Once there, add a comment about what each error mean. Signed-off-by: Juan Quintela <quintela@redhat.com>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-4/+4
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Remove unused sysemu.h include directivesBlue Swirl2011-04-151-1/+0
| | | | | | | Remove unused sysemu.h include directives to speed up build with the following patches. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* change all rt_clock references to use millisecond resolution accessorsPaolo Bonzini2011-03-211-3/+3
| | | | | | | | | | | | | | | This was done with: sed -i '/get_clock\>.*rt_clock/s/get_clock\>/get_clock_ms/' \ $(git grep -l 'get_clock\>.*rt_clock' ) sed -i '/new_timer\>.*rt_clock/s/new_timer\>/new_timer_ms/' \ $(git grep -l 'new_timer\>.*rt_clock' ) after checking that get_clock and new_timer never occur twice on the same line. There were no missed occurrences; however, even if there had been, they would have been caught by the compiler. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* migration: allow rate > 4gMichael S. Tsirkin2010-12-021-3/+6
| | | | | | | | I'd like to disable bandwidth limit or make it very high, Use int64_t all over to make values >= 4g work. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Jason Wang <jasowang@redhat.com>
* set proper migration status on ->write error (v5)Marcelo Tosatti2010-08-191-1/+3
| | | | | | | | | | | | | If ->write fails, declare migration status as MIG_STATE_ERROR. Also, in buffered_file.c, ->close the object in case of an error. Fixes "migrate -d "exec:dd of=file", where dd fails to open file. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* QEMUFileBuffered: indicate that we're ready when the underlying file is readyAvi Kivity2010-08-191-0/+8
| | | | | | | | | | | | | | | | | | | QEMUFileBuffered stops writing when the underlying QEMUFile is not ready, and tells its producer so. However, when the underlying QEMUFile becomes ready, it neglects to pass that information along, resulting in stoppage of all data until the next tick (a tenths of a second). Usually this doesn't matter, because most QEMUFiles used with QEMUFileBuffered are almost always ready, but in the case of exec: migration this is not true, due to the small pipe buffers used to connect to the target process. The result is very slow migration. Fix by detecting the readiness notification and propagating it. The detection is a little ugly since QEMUFile overloads put_buffer() to send it, but that's the suject for a different patch. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Do not use dprintfmalc2010-02-071-18/+18
| | | | | | | | | dprintf is already claimed by POSIX[1], and on at least one system is implemented as a macro [1] http://www.opengroup.org/onlinepubs/9699919799/functions/dprintf.html Signed-off-by: malc <av1474@comtv.ru>
* Block live migrationlirans@il.ibm.com2009-11-171-1/+9
| | | | | | | | | | | | | | | | | | | This patch introduces block migration called during live migration. Block are being copied to the destination in an async way. First the code will transfer the whole disk and then transfer all dirty blocks accumulted during the migration. Still need to improve transition from the iterative phase of migration to the end phase. For now transition will take place when all blocks transfered once, all the dirty blocks will be transfered during the end phase (guest is suspended). Changes from v4: - Global variabels moved to a global state structure allocated dynamically. - Minor coding style issues. - Poll block.c for tracking of dirty blocks instead of manage it here. Signed-off-by: Liran Schour <lirans@il.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix compilation warnings when DEBUG_BUFFERED_FILE is definedPierre Riteau2009-09-091-6/+6
| | | | | | | gcc 4.3.2 throws warnings when DEBUG_BUFFERED_FILE is defined, because we are using the wrong format specifiers to print size_t/ssize_t values. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix most warnings (errors with -Werror) when debugging is enabledBlue Swirl2009-07-201-2/+2
| | | | | | | I used the following command to enable debugging: perl -p -i -e 's/^\/\/#define DEBUG/#define DEBUG/g' * */* */*/* Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* introduce set_rate_limit function for QEMUFileGlauber Costa2009-05-221-1/+15
| | | | | | | This patch converts the current callers of qemu_fopen_ops(). Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* toplevel: remove error handling from qemu_malloc() callers (Avi Kivity)aliguori2009-02-051-2/+0
| | | | | | | | Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6531 c046a42c-6fe2-441c-8c8c-71466251a162
* Remove unnecessary trailing newlinesblueswir12008-12-131-1/+0
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6000 c046a42c-6fe2-441c-8c8c-71466251a162
* Introduce a buffered file wrapper for QEMUFilealiguori2008-10-131-0/+250
This patch introduces a buffered QEMUFile wrapper. This allows QEMUFile's to be rate limited. It also makes it easier to implement a QEMUFile that is asynchronous since the current QEMUFile API requires that all reads and writes be synchronous. The only real non-obvious part of the API is the "frozen" concept. If the backend returns EAGAIN, the QEMUFile is said to be "frozen". This means no additional output will be sent to the backend until the file is unfrozen. qemu_file_put_notify can be used to unfreeze a frozen file. A synchronous interface is also provided to wait for an unfreeze event. This is used during the final part of live migration when the VM is no longer running. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5475 c046a42c-6fe2-441c-8c8c-71466251a162
OpenPOWER on IntegriCloud