From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com
Subject: [Qemu-devel] [PATCH v2 04/18] block: non-raw protocols never cache
Date: Thu, 26 Jan 2012 18:22:35 +0100 [thread overview]
Message-ID: <1327598569-5199-5-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1327598569-5199-1-git-send-email-pbonzini@redhat.com>
Non-raw protocols never cache their data. Make this visible by setting
BDRV_O_NOCACHE in the open_flags. It will be used to prohibit block sizes
smaller than the backend's block size.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
block/curl.c | 1 +
block/iscsi.c | 2 ++
block/nbd.c | 1 +
block/rbd.c | 1 +
block/sheepdog.c | 1 +
block/vdi.c | 1 +
6 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/block/curl.c b/block/curl.c
index e9102e3..e7243dd 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -409,6 +409,7 @@ static int curl_open(BlockDriverState *bs, const char *filename, int flags)
curl_multi_setopt( s->multi, CURLMOPT_SOCKETFUNCTION, curl_sock_cb );
curl_multi_do(s);
+ bs->open_flags |= BDRV_O_NOCACHE;
return 0;
out:
diff --git a/block/iscsi.c b/block/iscsi.c
index bd3ca11..55f52c4 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -578,6 +578,8 @@ static int iscsi_open(BlockDriverState *bs, const char *filename, int flags)
return -EINVAL;
}
+ bs->open_flags |= BDRV_O_NOCACHE;
+
iscsi_url = iscsi_parse_full_url(iscsi, filename);
if (iscsi_url == NULL) {
error_report("Failed to parse URL : %s %s", filename,
diff --git a/block/nbd.c b/block/nbd.c
index 161b299..ca2ccca 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -317,6 +317,7 @@ static int nbd_open(BlockDriverState *bs, const char* filename, int flags)
*/
result = nbd_establish_connection(bs);
+ bs->open_flags |= BDRV_O_NOCACHE;
return result;
}
diff --git a/block/rbd.c b/block/rbd.c
index 46a8579..e6c8f15 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -494,6 +494,7 @@ static int qemu_rbd_open(BlockDriverState *bs, const char *filename, int flags)
}
bs->read_only = (s->snap != NULL);
+ bs->open_flags |= BDRV_O_NOCACHE;
s->event_reader_pos = 0;
r = qemu_pipe(s->fds);
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 9416400..accee00 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1047,6 +1047,7 @@ static int sd_open(BlockDriverState *bs, const char *filename, int flags)
s->min_dirty_data_idx = UINT32_MAX;
s->max_dirty_data_idx = 0;
+ bs->open_flags |= BDRV_O_NOCACHE;
bs->total_sectors = s->inode.vdi_size / SECTOR_SIZE;
strncpy(s->name, vdi, sizeof(s->name));
qemu_co_mutex_init(&s->lock);
diff --git a/block/vdi.c b/block/vdi.c
index 6a0011f..fde612f 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -441,6 +441,7 @@ static int vdi_open(BlockDriverState *bs, int flags)
goto fail;
}
+ bs->open_flags |= BDRV_O_NOCACHE;
bs->total_sectors = header.disk_size / SECTOR_SIZE;
s->block_size = header.block_size;
--
1.7.7.6
next prev parent reply other threads:[~2012-01-26 17:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-26 17:22 [Qemu-devel] [PATCH v2 00/18] Support mismatched host and guest logical block sizes Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 01/18] block: do not rely on open_flags for bdrv_is_snapshot Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 02/18] block: store actual flags in bs->open_flags Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 03/18] block: pass protocol flags up to the format Paolo Bonzini
2012-01-26 17:22 ` Paolo Bonzini [this message]
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 05/18] block: remove enable_write_cache Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 06/18] block: move flag bits together Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 07/18] raw: remove the aligned_buf Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 08/18] block: rename buffer_alignment to guest_block_size Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 09/18] block: add host_block_size Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 10/18] raw: probe host_block_size Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 11/18] iscsi: save host block size Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 12/18] block: allow waiting only for overlapping writes Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 13/18] block: allow waiting at arbitrary granularity Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 14/18] block: protect against "torn reads" for guest_block_size > host_block_size Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 15/18] block: align and serialize I/O when guest_block_size < host_block_size Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 16/18] block: default physical block size to host block size Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 17/18] block: default min_io_size to host block size when doing rmw Paolo Bonzini
2012-01-26 17:22 ` [Qemu-devel] [PATCH v2 18/18] qemu-io: add blocksize argument to open Paolo Bonzini
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=1327598569-5199-5-git-send-email-pbonzini@redhat.com \
--to=pbonzini@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).