diff options
author | Max Reitz <mreitz@redhat.com> | 2018-04-21 15:29:26 +0200 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2018-05-15 16:15:21 +0200 |
commit | 228345bf5db8bc97d1c64f062e138d389065d1ab (patch) | |
tree | 2ea40af2c6c2f01aec2265e702bbcf4cf60d10d6 /block/copy-on-read.c | |
parent | 1b1a920b713af6af795d49d0e3d2a8a65020bf82 (diff) |
block: Support BDRV_REQ_WRITE_UNCHANGED in filters
Update the rest of the filter drivers to support
BDRV_REQ_WRITE_UNCHANGED. They already forward write request flags to
their children, so we just have to announce support for it.
This patch does not cover the replication driver because that currently
does not support flags at all, and because it just grabs the WRITE
permission for its children when it can, so we should be fine just
submitting the incoming WRITE_UNCHANGED requests as normal writes.
It also does not cover format drivers for similar reasons. They all use
bdrv_format_default_perms() as their .bdrv_child_perm() implementation
so they just always grab the WRITE permission for their file children
whenever possible. In addition, it often would be difficult to
ascertain whether incoming unchanging writes end up as unchanging writes
in their files. So we just leave them as normal potentially changing
writes.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Message-id: 20180421132929.21610-7-mreitz@redhat.com
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/copy-on-read.c')
-rw-r--r-- | block/copy-on-read.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/block/copy-on-read.c b/block/copy-on-read.c index 823ec751c4..6a97208888 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -33,11 +33,13 @@ static int cor_open(BlockDriverState *bs, QDict *options, int flags, return -EINVAL; } - bs->supported_write_flags = BDRV_REQ_FUA & - bs->file->bs->supported_write_flags; + bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED | + (BDRV_REQ_FUA & + bs->file->bs->supported_write_flags); - bs->supported_zero_flags = (BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) & - bs->file->bs->supported_zero_flags; + bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED | + ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) & + bs->file->bs->supported_zero_flags); return 0; } |