|
|
1bdc94 |
From c757f534ae34ad858e0d706e0fb893ef5f3aeb28 Mon Sep 17 00:00:00 2001
|
|
|
1bdc94 |
From: Max Reitz <mreitz@redhat.com>
|
|
|
1bdc94 |
Date: Mon, 18 Jun 2018 16:12:06 +0200
|
|
|
1bdc94 |
Subject: [PATCH 30/54] block: Add BDRV_REQ_WRITE_UNCHANGED flag
|
|
|
1bdc94 |
|
|
|
1bdc94 |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
|
1bdc94 |
Message-id: <20180618161212.14444-5-mreitz@redhat.com>
|
|
|
1bdc94 |
Patchwork-id: 80764
|
|
|
1bdc94 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 04/10] block: Add BDRV_REQ_WRITE_UNCHANGED flag
|
|
|
1bdc94 |
Bugzilla: 1518738
|
|
|
1bdc94 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
1bdc94 |
|
|
|
1bdc94 |
This flag signifies that a write request will not change the visible
|
|
|
1bdc94 |
disk content. With this flag set, it is sufficient to have the
|
|
|
1bdc94 |
BLK_PERM_WRITE_UNCHANGED permission instead of BLK_PERM_WRITE.
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
1bdc94 |
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
1bdc94 |
Reviewed-by: Alberto Garcia <berto@igalia.com>
|
|
|
1bdc94 |
Message-id: 20180421132929.21610-4-mreitz@redhat.com
|
|
|
1bdc94 |
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
1bdc94 |
(cherry picked from commit c6035964f8316b504060618d05b5dd434f18595b)
|
|
|
1bdc94 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
1bdc94 |
---
|
|
|
1bdc94 |
block/io.c | 6 +++++-
|
|
|
1bdc94 |
include/block/block.h | 6 +++++-
|
|
|
1bdc94 |
2 files changed, 10 insertions(+), 2 deletions(-)
|
|
|
1bdc94 |
|
|
|
1bdc94 |
diff --git a/block/io.c b/block/io.c
|
|
|
1bdc94 |
index bd9a19a..134b2a4 100644
|
|
|
1bdc94 |
--- a/block/io.c
|
|
|
1bdc94 |
+++ b/block/io.c
|
|
|
1bdc94 |
@@ -1501,7 +1501,11 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child,
|
|
|
1bdc94 |
assert(!waited || !req->serialising);
|
|
|
1bdc94 |
assert(req->overlap_offset <= offset);
|
|
|
1bdc94 |
assert(offset + bytes <= req->overlap_offset + req->overlap_bytes);
|
|
|
1bdc94 |
- assert(child->perm & BLK_PERM_WRITE);
|
|
|
1bdc94 |
+ if (flags & BDRV_REQ_WRITE_UNCHANGED) {
|
|
|
1bdc94 |
+ assert(child->perm & (BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE));
|
|
|
1bdc94 |
+ } else {
|
|
|
1bdc94 |
+ assert(child->perm & BLK_PERM_WRITE);
|
|
|
1bdc94 |
+ }
|
|
|
1bdc94 |
assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE);
|
|
|
1bdc94 |
|
|
|
1bdc94 |
ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req);
|
|
|
1bdc94 |
diff --git a/include/block/block.h b/include/block/block.h
|
|
|
1bdc94 |
index 397b5e8..3894edd 100644
|
|
|
1bdc94 |
--- a/include/block/block.h
|
|
|
1bdc94 |
+++ b/include/block/block.h
|
|
|
1bdc94 |
@@ -54,8 +54,12 @@ typedef enum {
|
|
|
1bdc94 |
BDRV_REQ_FUA = 0x10,
|
|
|
1bdc94 |
BDRV_REQ_WRITE_COMPRESSED = 0x20,
|
|
|
1bdc94 |
|
|
|
1bdc94 |
+ /* Signifies that this write request will not change the visible disk
|
|
|
1bdc94 |
+ * content. */
|
|
|
1bdc94 |
+ BDRV_REQ_WRITE_UNCHANGED = 0x40,
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
/* Mask of valid flags */
|
|
|
1bdc94 |
- BDRV_REQ_MASK = 0x3f,
|
|
|
1bdc94 |
+ BDRV_REQ_MASK = 0x7f,
|
|
|
1bdc94 |
} BdrvRequestFlags;
|
|
|
1bdc94 |
|
|
|
1bdc94 |
typedef struct BlockSizes {
|
|
|
1bdc94 |
--
|
|
|
1bdc94 |
1.8.3.1
|
|
|
1bdc94 |
|