]> Git Repo - qemu.git/commitdiff
sheepdog: reload only header in a case of live snapshot
authorHitoshi Mitake <[email protected]>
Fri, 6 Jun 2014 04:35:12 +0000 (13:35 +0900)
committerStefan Hajnoczi <[email protected]>
Fri, 6 Jun 2014 12:54:43 +0000 (14:54 +0200)
sheepdog driver doesn't need to read data_vdi_id[] when a live snapshot is
created.

Cc: Kevin Wolf <[email protected]>
Cc: Stefan Hajnoczi <[email protected]>
Cc: Liu Yuan <[email protected]>
Cc: MORITA Kazutaka <[email protected]>
Signed-off-by: Hitoshi Mitake <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
block/sheepdog.c

index 5f7e025b6144a3163e1eacfaebdbfc9646f70cc3..1fa19399f0e83fde30e30964cc8142bce7878af9 100644 (file)
@@ -200,6 +200,8 @@ typedef struct SheepdogInode {
     uint32_t data_vdi_id[MAX_DATA_OBJS];
 } SheepdogInode;
 
+#define SD_INODE_HEADER_SIZE offsetof(SheepdogInode, data_vdi_id)
+
 /*
  * 64 bit FNV-1a non-zero initial basis
  */
@@ -1287,7 +1289,7 @@ static int reload_inode(BDRVSheepdogState *s, uint32_t snapid, const char *tag)
         return -EIO;
     }
 
-    inode = g_malloc(sizeof(s->inode));
+    inode = g_malloc(SD_INODE_HEADER_SIZE);
 
     ret = find_vdi_name(s, s->name, snapid, tag, &vid, false, &local_err);
     if (ret) {
@@ -1297,13 +1299,14 @@ static int reload_inode(BDRVSheepdogState *s, uint32_t snapid, const char *tag)
     }
 
     ret = read_object(fd, s->aio_context, (char *)inode, vid_to_vdi_oid(vid),
-                      s->inode.nr_copies, sizeof(*inode), 0, s->cache_flags);
+                      s->inode.nr_copies, SD_INODE_HEADER_SIZE, 0,
+                      s->cache_flags);
     if (ret < 0) {
         goto out;
     }
 
     if (inode->vdi_id != s->inode.vdi_id) {
-        memcpy(&s->inode, inode, sizeof(s->inode));
+        memcpy(&s->inode, inode, SD_INODE_HEADER_SIZE);
     }
 
 out:
This page took 0.023375 seconds and 4 git commands to generate.