public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: mingo@elte.hu, kvm@vger.kernel.org, penberg@kernel.org,
	asias.hejun@gmail.com, gorcunov@gmail.com,
	chaitanyakulkarni15@gmail.com, ashwini.kulkarni@gmail.com
Subject: Re: [PATCH v1 1/3] kvm tools: Close the disk images after the guest shuts down
Date: Wed, 18 May 2011 13:31:47 +0300	[thread overview]
Message-ID: <1305714707.12150.74.camel@sasha> (raw)
In-Reply-To: <1305713837-18889-1-git-send-email-prasadjoshi124@gmail.com>

On Wed, 2011-05-18 at 11:17 +0100, Prasad Joshi wrote:
> Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
> ---
>  tools/kvm/kvm-run.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/kvm/kvm-run.c b/tools/kvm/kvm-run.c
> index ba8e5ce..ef180e4 100644
> --- a/tools/kvm/kvm-run.c
> +++ b/tools/kvm/kvm-run.c
> @@ -46,6 +46,7 @@
>  #define MAX_DISK_IMAGES		4
>  
>  static struct kvm *kvm;
> +static struct disk_image *image_disks[MAX_DISK_IMAGES];

You already have image_filename[] which holds image filenames, and
image_count which tells you how many images are loaded.

>  static struct kvm_cpu *kvm_cpus[KVM_NR_CPUS];
>  static __thread struct kvm_cpu *current_kvm_cpu;
>  
> @@ -504,6 +505,7 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
>  				die("unable to load disk image %s", image_filename[i]);
>  
>  			virtio_blk__init(kvm, disk);
> +			image_disks[i] = disk;
>  		}
>  	}
>  	free(hi);
> @@ -583,6 +585,11 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
>  			exit_code	= 1;
>  	}
>  
> +	for (i = 0; i < MAX_DISK_IMAGES; i++) {
> +		if (image_disks[i])
> +			disk_image__close(image_disks[i]);
> +	}
> +
>  	kvm__delete(kvm);
>  
>  	if (!exit_code)


-- 

Sasha.


  parent reply	other threads:[~2011-05-18 10:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-18 10:17 [PATCH v1 1/3] kvm tools: Close the disk images after the guest shuts down Prasad Joshi
2011-05-18 10:17 ` [PATCH v1 2/3] kvm tools: Release memoty allocated during virtio block initialization Prasad Joshi
2011-05-18 10:25   ` Pekka Enberg
2011-05-18 11:11   ` Ingo Molnar
2011-05-18 10:17 ` [PATCH v1 3/3] kvm tools: Add QCOW level2 caching support Prasad Joshi
2011-05-18 10:27   ` Pekka Enberg
2011-05-18 10:41     ` Prasad Joshi
2011-05-18 11:18       ` Pekka Enberg
2011-05-18 11:10     ` Ingo Molnar
2011-05-18 11:27   ` Sasha Levin
2011-05-18 10:31 ` Sasha Levin [this message]
2011-05-18 10:36   ` [PATCH v1 1/3] kvm tools: Close the disk images after the guest shuts down Prasad Joshi
2011-05-18 11:15 ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1305714707.12150.74.camel@sasha \
    --to=levinsasha928@gmail.com \
    --cc=ashwini.kulkarni@gmail.com \
    --cc=asias.hejun@gmail.com \
    --cc=chaitanyakulkarni15@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.org \
    --cc=prasadjoshi124@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox