From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
qemu-block@nongnu.org
Subject: [Qemu-devel] [PATCH RFC 1/3] block: Introduce BDRV_O_UNSAFE_READ
Date: Tue, 14 Mar 2017 10:39:31 +0800 [thread overview]
Message-ID: <20170314023933.12118-2-famz@redhat.com> (raw)
In-Reply-To: <20170314023933.12118-1-famz@redhat.com>
This flag clears out the "consistent read" permission that blk_new_open
requests.
Signed-off-by: Fam Zheng <famz@redhat.com>
---
block/block-backend.c | 2 +-
include/block/block.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/block-backend.c b/block/block-backend.c
index 5742c09..99428ee 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -197,7 +197,7 @@ BlockBackend *blk_new_open(const char *filename, const char *reference,
* caller of blk_new_open() doesn't make use of the permissions, but they
* shouldn't hurt either. We can still share everything here because the
* guest devices will add their own blockers if they can't share. */
- perm = BLK_PERM_CONSISTENT_READ;
+ perm = flags & BDRV_O_UNSAFE_READ ? 0 : BLK_PERM_CONSISTENT_READ;
if (flags & BDRV_O_RDWR) {
perm |= BLK_PERM_WRITE;
}
diff --git a/include/block/block.h b/include/block/block.h
index 5149260..d43b563 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -98,6 +98,7 @@ typedef struct HDGeometry {
select an appropriate protocol driver,
ignoring the format layer */
#define BDRV_O_NO_IO 0x10000 /* don't initialize for I/O */
+#define BDRV_O_UNSAFE_READ 0x20000 /* don't require consistent read */
#define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_NO_FLUSH)
--
2.9.3
next prev parent reply other threads:[~2017-03-14 2:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-14 2:39 [Qemu-devel] [PATCH RFC 0/3] block: Backdoor to skip image locking in qemu-io/qemu-img Fam Zheng
2017-03-14 2:39 ` Fam Zheng [this message]
2017-04-18 13:15 ` [Qemu-devel] [PATCH RFC 1/3] block: Introduce BDRV_O_UNSAFE_READ Eric Blake
2017-03-14 2:39 ` [Qemu-devel] [PATCH RFC 2/3] qemu-img: Add --unsafe-read option to subcommands Fam Zheng
2017-04-18 13:20 ` Eric Blake
2017-04-20 3:27 ` Fam Zheng
2017-03-14 2:39 ` [Qemu-devel] [PATCH RFC 3/3] qemu-io: Add --unsafe-read option Fam Zheng
2017-04-18 13:27 ` Eric Blake
2017-04-20 3:29 ` Fam Zheng
2017-04-14 1:14 ` [Qemu-devel] [Qemu-block] [PATCH RFC 0/3] block: Backdoor to skip image locking in qemu-io/qemu-img John Snow
2017-04-14 2:25 ` Fam Zheng
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=20170314023933.12118-2-famz@redhat.com \
--to=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.