qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Subject: [Qemu-devel] [patch 4/5] Add flag to indicate external users to block device
Date: Wed, 26 Jan 2011 12:12:34 -0200	[thread overview]
Message-ID: <20110126141348.319412154@redhat.com> (raw)
In-Reply-To: 20110126141230.637895847@redhat.com

[-- Attachment #1: 03-driveinfo-inuse --]
[-- Type: text/plain, Size: 1673 bytes --]

Certain operations such as drive_del or resize cannot be performed
while external users (eg. block migration) reference the block device.

Add a flag to indicate that.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: qemu/block.c
===================================================================
--- qemu.orig/block.c
+++ qemu/block.c
@@ -2770,6 +2770,17 @@ int64_t bdrv_get_dirty_count(BlockDriver
     return bs->dirty_count;
 }
 
+void bdrv_set_in_use(BlockDriverState *bs, int in_use)
+{
+    assert(bs->in_use != in_use);
+    bs->in_use = in_use;
+}
+
+int bdrv_in_use(BlockDriverState *bs)
+{
+    return bs->in_use;
+}
+
 int bdrv_img_create(const char *filename, const char *fmt,
                     const char *base_filename, const char *base_fmt,
                     char *options, uint64_t img_size, int flags)
Index: qemu/block_int.h
===================================================================
--- qemu.orig/block_int.h
+++ qemu/block_int.h
@@ -199,6 +199,7 @@ struct BlockDriverState {
     char device_name[32];
     unsigned long *dirty_bitmap;
     int64_t dirty_count;
+    int in_use; /* users other than guest access, eg. block migration */
     QTAILQ_ENTRY(BlockDriverState) list;
     void *private;
 };
Index: qemu/block.h
===================================================================
--- qemu.orig/block.h
+++ qemu/block.h
@@ -240,6 +240,8 @@ void bdrv_reset_dirty(BlockDriverState *
                       int nr_sectors);
 int64_t bdrv_get_dirty_count(BlockDriverState *bs);
 
+void bdrv_set_in_use(BlockDriverState *bs, int in_use);
+int bdrv_in_use(BlockDriverState *bs);
 
 typedef enum {
     BLKDBG_L1_UPDATE,

  parent reply	other threads:[~2011-01-26 14:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-26 14:12 [Qemu-devel] [patch 0/5] block migration interaction fixes Marcelo Tosatti
2011-01-26 14:12 ` [Qemu-devel] [patch 1/5] block-migration: actually disable dirty tracking on cleanup Marcelo Tosatti
2011-01-26 14:12 ` [Qemu-devel] [patch 2/5] blockdev: add refcount to DriveInfo Marcelo Tosatti
2011-01-26 14:12 ` [Qemu-devel] [patch 3/5] block-migration: add reference to target DriveInfo Marcelo Tosatti
2011-01-26 14:12 ` Marcelo Tosatti [this message]
2011-01-26 14:12 ` [Qemu-devel] [patch 5/5] block: enable in_use flag Marcelo Tosatti
2011-02-07 11:27 ` [Qemu-devel] Re: [patch 0/5] block migration interaction fixes Kevin Wolf

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=20110126141348.319412154@redhat.com \
    --to=mtosatti@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).