From: "Marc Bevand" <m.bevand@gmail.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Vegard Nossum <vegard.nossum@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Remove dead-code (else-block) from block-qcow.c
Date: Tue, 3 Jun 2008 12:55:24 -0700 [thread overview]
Message-ID: <aaccfcb60806031255q3ed2e38evad6fc9b08ac4cf37@mail.gmail.com> (raw)
In-Reply-To: <484577E3.9020705@codemonkey.ws>
[-- Attachment #1: Type: text/plain, Size: 350 bytes --]
On Tue, Jun 3, 2008 at 9:57 AM, Anthony Liguori <anthony@codemonkey.ws> wrote:
>
> Please send the patch as an attachment or inlined.
Here it is. (I originally wanted to inline it but I am currently stuck
with MUAs that cannot be configured to NOT wrap text lines.)
To answer Vegard's question, It's gmane that corrupted my email.
--
Marc Bevand
[-- Attachment #2: qemu-remove-dead-code.patch --]
[-- Type: application/octet-stream, Size: 3204 bytes --]
[PATCH] Remove dead-code (else-block) from block-qcow.c
"if (allocate == 1)" is always true because the value of "allocate" is
checked a few lines above.
Patch made against SVN's rev 4622.
Signed-off-by: Marc Bevand <m.bevand <at> gmail.com>
Index: block-qcow.c
===================================================================
--- block-qcow.c (revision 4622)
+++ block-qcow.c (working copy)
@@ -339,33 +339,28 @@
return -1;
} else {
cluster_offset = bdrv_getlength(s->hd);
- if (allocate == 1) {
- /* round to cluster size */
- cluster_offset = (cluster_offset + s->cluster_size - 1) &
- ~(s->cluster_size - 1);
- bdrv_truncate(s->hd, cluster_offset + s->cluster_size);
- /* if encrypted, we must initialize the cluster
- content which won't be written */
- if (s->crypt_method &&
- (n_end - n_start) < s->cluster_sectors) {
- uint64_t start_sect;
- start_sect = (offset & ~(s->cluster_size - 1)) >> 9;
- memset(s->cluster_data + 512, 0x00, 512);
- for(i = 0; i < s->cluster_sectors; i++) {
- if (i < n_start || i >= n_end) {
- encrypt_sectors(s, start_sect + i,
- s->cluster_data,
- s->cluster_data + 512, 1, 1,
- &s->aes_encrypt_key);
- if (bdrv_pwrite(s->hd, cluster_offset + i * 512,
- s->cluster_data, 512) != 512)
- return -1;
- }
+ /* round to cluster size */
+ cluster_offset = (cluster_offset + s->cluster_size - 1) &
+ ~(s->cluster_size - 1);
+ bdrv_truncate(s->hd, cluster_offset + s->cluster_size);
+ /* if encrypted, we must initialize the cluster
+ content which won't be written */
+ if (s->crypt_method &&
+ (n_end - n_start) < s->cluster_sectors) {
+ uint64_t start_sect;
+ start_sect = (offset & ~(s->cluster_size - 1)) >> 9;
+ memset(s->cluster_data + 512, 0x00, 512);
+ for(i = 0; i < s->cluster_sectors; i++) {
+ if (i < n_start || i >= n_end) {
+ encrypt_sectors(s, start_sect + i,
+ s->cluster_data,
+ s->cluster_data + 512, 1, 1,
+ &s->aes_encrypt_key);
+ if (bdrv_pwrite(s->hd, cluster_offset + i * 512,
+ s->cluster_data, 512) != 512)
+ return -1;
}
}
- } else {
- cluster_offset |= QCOW_OFLAG_COMPRESSED |
- (uint64_t)compressed_size << (63 - s->cluster_bits);
}
}
/* update L2 table */
next prev parent reply other threads:[~2008-06-03 19:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-03 5:49 [Qemu-devel] [PATCH] Remove dead-code (else-block) from block-qcow.c Marc Bevand
2008-06-03 13:22 ` Vegard Nossum
2008-06-05 22:51 ` [Qemu-devel] Off-topic (mailman bug) Marc Bevand
2008-06-03 16:57 ` [Qemu-devel] [PATCH] Remove dead-code (else-block) from block-qcow.c Anthony Liguori
2008-06-03 19:55 ` Marc Bevand [this message]
2008-06-03 20:15 ` Anthony Liguori
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=aaccfcb60806031255q3ed2e38evad6fc9b08ac4cf37@mail.gmail.com \
--to=m.bevand@gmail.com \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
--cc=vegard.nossum@gmail.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).