diff options
author | Jiri Kosina <jkosina@suse.cz> | 2012-04-08 23:48:52 +0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-04-08 23:48:52 +0400 |
commit | e75d660672ddd11704b7f0fdb8ff21968587b266 (patch) | |
tree | ccb9c107744c10b553c0373e450bee3971d16c00 /drivers/virtio/virtio_balloon.c | |
parent | 61282f37927143e45b03153f3e7b48d6b702147a (diff) | |
parent | 0034102808e0dbbf3a2394b82b1bb40b5778de9e (diff) | |
download | linux-e75d660672ddd11704b7f0fdb8ff21968587b266.tar.xz |
Merge branch 'master' into for-next
Merge with latest Linus' tree, as I have incoming patches
that fix code that is newer than current HEAD of for-next.
Conflicts:
drivers/net/ethernet/realtek/r8169.c
Diffstat (limited to 'drivers/virtio/virtio_balloon.c')
-rw-r--r-- | drivers/virtio/virtio_balloon.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 95aeedf198f8..05f0a80818a2 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -367,42 +367,40 @@ static void __devexit virtballoon_remove(struct virtio_device *vdev) #ifdef CONFIG_PM static int virtballoon_freeze(struct virtio_device *vdev) { + struct virtio_balloon *vb = vdev->priv; + /* * The kthread is already frozen by the PM core before this * function is called. */ + while (vb->num_pages) + leak_balloon(vb, vb->num_pages); + update_balloon_size(vb); + /* Ensure we don't get any more requests from the host */ vdev->config->reset(vdev); vdev->config->del_vqs(vdev); return 0; } -static int virtballoon_thaw(struct virtio_device *vdev) -{ - return init_vqs(vdev->priv); -} - -static int virtballoon_restore(struct virtio_device *vdev) +static int restore_common(struct virtio_device *vdev) { struct virtio_balloon *vb = vdev->priv; - struct page *page, *page2; + int ret; - /* We're starting from a clean slate */ - vb->num_pages = 0; + ret = init_vqs(vdev->priv); + if (ret) + return ret; - /* - * If a request wasn't complete at the time of freezing, this - * could have been set. - */ - vb->need_stats_update = 0; + fill_balloon(vb, towards_target(vb)); + update_balloon_size(vb); + return 0; +} - /* We don't have these pages in the balloon anymore! */ - list_for_each_entry_safe(page, page2, &vb->pages, lru) { - list_del(&page->lru); - totalram_pages++; - } - return init_vqs(vdev->priv); +static int virtballoon_restore(struct virtio_device *vdev) +{ + return restore_common(vdev); } #endif @@ -423,7 +421,6 @@ static struct virtio_driver virtio_balloon_driver = { #ifdef CONFIG_PM .freeze = virtballoon_freeze, .restore = virtballoon_restore, - .thaw = virtballoon_thaw, #endif }; |