From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaRc3-00040i-5k for qemu-devel@nongnu.org; Tue, 13 Dec 2011 07:37:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RaRc1-0004GX-Sh for qemu-devel@nongnu.org; Tue, 13 Dec 2011 07:37:39 -0500 Received: from mail-yx0-f173.google.com ([209.85.213.173]:36775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaRc1-0004GM-Ou for qemu-devel@nongnu.org; Tue, 13 Dec 2011 07:37:37 -0500 Received: by yenm6 with SMTP id m6so6316748yen.4 for ; Tue, 13 Dec 2011 04:37:37 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 13 Dec 2011 13:37:07 +0100 Message-Id: <1323779840-4235-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1323779840-4235-1-git-send-email-pbonzini@redhat.com> References: <1323779840-4235-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 04/17] block: non-raw protocols never cache List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 --- 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