From: Hitoshi Mitake <mitake.hitoshi@gmail.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
sheepdog@lists.wpkg.org, mitake.hitoshi@gmail.com,
Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>,
Stefan Hajnoczi <stefanha@redhat.com>,
Liu Yuan <namei.unix@gmail.com>,
MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Subject: [Qemu-devel] [PATCH 2/2] sheepdog: reload only header in a case of live snapshot
Date: Tue, 3 Jun 2014 00:06:50 +0900 [thread overview]
Message-ID: <1401721610-12920-3-git-send-email-mitake.hitoshi@gmail.com> (raw)
In-Reply-To: <1401721610-12920-1-git-send-email-mitake.hitoshi@gmail.com>
sheepdog dirver doesn't need to read data_vdi_id[] when a live
snapshot is created.
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Liu Yuan <namei.unix@gmail.com>
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
---
block/sheepdog.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 8266382..06c4180 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -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
*/
@@ -1275,7 +1277,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);
if (ret) {
@@ -1283,13 +1285,14 @@ static int reload_inode(BDRVSheepdogState *s, uint32_t snapid, const char *tag)
}
ret = read_object(fd, (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:
--
1.9.1
next prev parent reply other threads:[~2014-06-02 15:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-02 15:06 [Qemu-devel] [PATCH 0/2] bugfixes of sheepdog driver for a case of live snapshot Hitoshi Mitake
2014-06-02 15:06 ` [Qemu-devel] [PATCH 1/2] sheepdog: fix vdi object update after " Hitoshi Mitake
2014-06-02 15:06 ` Hitoshi Mitake [this message]
2014-06-02 15:48 ` [Qemu-devel] [PATCH 2/2] sheepdog: reload only header in a case of " Eric Blake
2014-06-03 1:08 ` Hitoshi Mitake
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=1401721610-12920-3-git-send-email-mitake.hitoshi@gmail.com \
--to=mitake.hitoshi@gmail.com \
--cc=kwolf@redhat.com \
--cc=mitake.hitoshi@lab.ntt.co.jp \
--cc=morita.kazutaka@lab.ntt.co.jp \
--cc=namei.unix@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=sheepdog@lists.wpkg.org \
--cc=stefanha@redhat.com \
/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).