All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Fam Zheng <famz@redhat.com>
Subject: [Qemu-devel] [PATCH 3/9] block: Add BDRV_REQ_WRITE_UNCHANGED flag
Date: Mon, 16 Apr 2018 18:58:43 +0200	[thread overview]
Message-ID: <20180416165849.28864-4-mreitz@redhat.com> (raw)
In-Reply-To: <20180416165849.28864-1-mreitz@redhat.com>

This flag signifies that a write request will not change the visible
disk content.  With this flag set, it is sufficient to have the
BLK_PERM_WRITE_UNCHANGED permission instead of BLK_PERM_WRITE.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 include/block/block.h | 6 +++++-
 block/io.c            | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/block/block.h b/include/block/block.h
index 397b5e8d44..3894edda9d 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -54,8 +54,12 @@ typedef enum {
     BDRV_REQ_FUA                = 0x10,
     BDRV_REQ_WRITE_COMPRESSED   = 0x20,
 
+    /* Signifies that this write request will not change the visible disk
+     * content. */
+    BDRV_REQ_WRITE_UNCHANGED    = 0x40,
+
     /* Mask of valid flags */
-    BDRV_REQ_MASK               = 0x3f,
+    BDRV_REQ_MASK               = 0x7f,
 } BdrvRequestFlags;
 
 typedef struct BlockSizes {
diff --git a/block/io.c b/block/io.c
index bd9a19a9c4..134b2a498f 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1501,7 +1501,11 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child,
     assert(!waited || !req->serialising);
     assert(req->overlap_offset <= offset);
     assert(offset + bytes <= req->overlap_offset + req->overlap_bytes);
-    assert(child->perm & BLK_PERM_WRITE);
+    if (flags & BDRV_REQ_WRITE_UNCHANGED) {
+        assert(child->perm & (BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE));
+    } else {
+        assert(child->perm & BLK_PERM_WRITE);
+    }
     assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE);
 
     ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req);
-- 
2.14.3

  parent reply	other threads:[~2018-04-16 16:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16 16:58 [Qemu-devel] [PATCH 0/9] block: Add COR filter driver Max Reitz
2018-04-16 16:58 ` [Qemu-devel] [PATCH 1/9] " Max Reitz
2018-04-20  8:31   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-04-20 13:21     ` Max Reitz
2018-04-16 16:58 ` [Qemu-devel] [PATCH 2/9] block: BLK_PERM_WRITE includes ..._UNCHANGED Max Reitz
2018-04-20  8:32   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-04-20 12:04   ` Alberto Garcia
2018-04-20 13:22     ` Max Reitz
2018-04-16 16:58 ` Max Reitz [this message]
2018-04-20  8:33   ` [Qemu-devel] [PATCH 3/9] block: Add BDRV_REQ_WRITE_UNCHANGED flag Stefan Hajnoczi
2018-04-20 12:06   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-04-16 16:58 ` [Qemu-devel] [PATCH 4/9] block: Set BDRV_REQ_WRITE_UNCHANGED for COR writes Max Reitz
2018-04-20  8:33   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-04-20 12:06   ` Alberto Garcia
2018-04-16 16:58 ` [Qemu-devel] [PATCH 5/9] block/quorum: Support BDRV_REQ_WRITE_UNCHANGED Max Reitz
2018-04-20  8:44   ` Stefan Hajnoczi
2018-04-20 12:09   ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2018-04-16 16:58 ` [Qemu-devel] [PATCH 6/9] block: Support BDRV_REQ_WRITE_UNCHANGED in filters Max Reitz
2018-04-20  8:35   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-04-20 12:19   ` Alberto Garcia
2018-04-16 16:58 ` [Qemu-devel] [PATCH 7/9] iotests: Clean up wrap image in 197 Max Reitz
2018-04-20  8:38   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-04-20 12:20   ` Alberto Garcia
2018-04-16 16:58 ` [Qemu-devel] [PATCH 8/9] iotests: Copy 197 for COR filter driver Max Reitz
2018-04-20  8:38   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-04-16 16:58 ` [Qemu-devel] [PATCH 9/9] iotests: Add test for COR across nodes Max Reitz
2018-04-20  8:43   ` Stefan Hajnoczi
2018-04-20 13:22     ` Max Reitz
2018-04-20  7:49 ` [Qemu-devel] [PATCH 0/9] block: Add COR filter driver Stefan Hajnoczi

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=20180416165849.28864-4-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 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.