qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 04/18] block: non-raw protocols never cache


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH v2 04/18] block: non-raw protocols never cache
Date: Thu, 26 Jan 2012 18:22:35 +0100

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 <address@hidden>
---
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]