From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: jcody@redhat.com, qemu-block@nongnu.org
Subject: [Qemu-devel] [PATCH 1/2] sheepdog: cleanup repeated expression
Date: Tue, 22 May 2018 22:10:55 +0200 [thread overview]
Message-ID: <20180522201056.1442-2-pbonzini@redhat.com> (raw)
In-Reply-To: <20180522201056.1442-1-pbonzini@redhat.com>
The expression "SD_INODE_SIZE - sizeof(inode.data_vdi_id)" already has a macro
defined for the same value (though with a nicer definition using offsetof).
Replace it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
block/sheepdog.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 4237132419..23cf5a8430 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -2337,7 +2337,7 @@ static int sd_truncate(BlockDriverState *bs, int64_t offset,
}
/* we don't need to update entire object */
- datalen = SD_INODE_SIZE - sizeof(s->inode.data_vdi_id);
+ datalen = SD_INODE_HEADER_SIZE;
s->inode.vdi_size = offset;
ret = write_object(fd, s->bs, (char *)&s->inode,
vid_to_vdi_oid(s->inode.vdi_id), s->inode.nr_copies,
@@ -2705,7 +2705,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
*/
strncpy(s->inode.tag, sn_info->name, sizeof(s->inode.tag));
/* we don't need to update entire object */
- datalen = SD_INODE_SIZE - sizeof(s->inode.data_vdi_id);
+ datalen = SD_INODE_HEADER_SIZE;
inode = g_malloc(datalen);
/* refresh inode. */
@@ -2991,7 +2991,7 @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
/* we don't need to read entire object */
ret = read_object(fd, s->bs, (char *)&inode,
vid_to_vdi_oid(vid),
- 0, SD_INODE_SIZE - sizeof(inode.data_vdi_id), 0,
+ 0, SD_INODE_HEADER_SIZE, 0,
s->cache_flags);
if (ret) {
--
2.17.0
next prev parent reply other threads:[~2018-05-22 20:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-22 20:10 [Qemu-devel] [PATCH 0/2] sheepdog: remove huge BSS object Paolo Bonzini
2018-05-22 20:10 ` Paolo Bonzini [this message]
2018-05-22 20:25 ` [Qemu-devel] [PATCH 1/2] sheepdog: cleanup repeated expression Philippe Mathieu-Daudé
2018-05-23 2:12 ` Fam Zheng
2018-05-23 15:30 ` Jeff Cody
2018-05-22 20:10 ` [Qemu-devel] [PATCH 2/2] sheepdog: remove huge BSS object Paolo Bonzini
2018-05-22 20:26 ` Philippe Mathieu-Daudé
2018-05-23 1:43 ` Fam Zheng
2018-05-23 17:25 ` Philippe Mathieu-Daudé
-- strict thread matches above, loose matches on Subject: below --
2018-05-23 16:07 [Qemu-devel] [PATCH v2 0/2] " Paolo Bonzini
2018-05-23 16:07 ` [Qemu-devel] [PATCH 1/2] sheepdog: cleanup repeated expression 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=20180522201056.1442-2-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=jcody@redhat.com \
--cc=qemu-block@nongnu.org \
--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).