From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 04/17] block: non-raw protocols never cache
Date: Tue, 13 Dec 2011 13:37:07 +0100 [thread overview]
Message-ID: <1323779840-4235-5-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1323779840-4235-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 handle block sizes
smaller than the backend's block size.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
block/curl.c | 1 +
block/iscsi.c | 1 +
block/nbd.c | 1 +
block/rbd.c | 1 +
block/sheepdog.c | 1 +
block/vdi.c | 1 +
6 files changed, 6 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 938c568..4e6cf7a 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -474,6 +474,7 @@ static int iscsi_open(BlockDriverState *bs, const char *filename, int flags)
return -EINVAL;
}
+ bs->open_flags |= BDRV_O_NOCACHE;
memset(iscsilun, 0, sizeof(IscsiLun));
/* Should really append the KVM name after the ':' here */
diff --git a/block/nbd.c b/block/nbd.c
index 882b2dc..d944ee7 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -176,6 +176,7 @@ static int nbd_open(BlockDriverState *bs, const char* filename, int flags)
*/
result = nbd_establish_connection(bs);
+ bs->open_flags |= BDRV_O_NOCACHE;
qemu_co_mutex_init(&s->lock);
return result;
}
diff --git a/block/rbd.c b/block/rbd.c
index 312584a..d20955f 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -492,6 +492,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 aa9707f..3ea2872 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1248,6 +1248,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 31cdfab..dfae347 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.1
next prev parent reply other threads:[~2011-12-13 12:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-13 12:37 [Qemu-devel] [PATCH 00/17] Support mismatched host and guest logical block sizes Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 01/17] block: do not rely on open_flags for bdrv_is_snapshot Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 02/17] block: store actual flags in bs->open_flags Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 03/17] block: pass protocol flags up to the format Paolo Bonzini
2011-12-15 4:10 ` Zhi Yong Wu
2011-12-13 12:37 ` Paolo Bonzini [this message]
2011-12-13 12:37 ` [Qemu-devel] [PATCH 05/17] block: remove enable_write_cache Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 06/17] block: move flag bits together Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 07/17] raw: remove the aligned_buf Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 08/17] block: rename buffer_alignment to guest_block_size Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 09/17] block: add host_block_size Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 10/17] raw: probe host_block_size Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 11/17] iscsi: save host block size Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 12/17] block: allow waiting only for overlapping writes Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 13/17] block: allow waiting at arbitrary granularity Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 14/17] block: protect against "torn reads" for guest_block_size > host_block_size Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 15/17] block: align and serialize I/O when guest_block_size < host_block_size Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 16/17] block: default physical block size to host block size Paolo Bonzini
2011-12-13 12:37 ` [Qemu-devel] [PATCH 17/17] qemu-io: add blocksize argument to open Paolo Bonzini
2011-12-14 11:13 ` [Qemu-devel] [PATCH 00/17] Support mismatched host and guest logical block sizes Kevin Wolf
2011-12-14 11:47 ` Paolo Bonzini
2011-12-14 12:05 ` Kevin Wolf
2011-12-14 12:40 ` Paolo Bonzini
2011-12-21 16:55 ` Christoph Hellwig
2011-12-21 17:00 ` 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=1323779840-4235-5-git-send-email-pbonzini@redhat.com \
--to=pbonzini@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).