All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: yuchenlin <npes87184@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 3/3] dmg: don't skip zero chunk
Date: Wed, 2 Jan 2019 12:40:26 +0000	[thread overview]
Message-ID: <20190102124026.GL24009@stefanha-x1.localdomain> (raw)
In-Reply-To: <20181223025939.15775-4-npes87184@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1807 bytes --]

On Sun, Dec 23, 2018 at 10:59:39AM +0800, yuchenlin wrote:
> The dmg file has many tables which describe: "start from sector XXX to
> sector XXX, the compression method is XXX and where the compressed data
> resides on".
> 
> Each sector in the expanded file should be covered by a table. The table
> will describe the offset of compressed data (or raw depends on the type)
> in the dmg.
> 
> For example:
> 
> [-----------The expanded file------------]
> [---bzip table ---]/* zeros */[---zlib---]
>     ^
>     | if we want to read this sector.
> 
> we will find bzip table which contains this sector, and get the
> compressed data offset, read it from dmg, uncompress it, finally write to
> expanded file.
> 
> If we skip zero chunk (table), some sector cannot find the table which
> will cause search_chunk() return s->n_chunks, dmg_read_chunk() return -1
> and finally causing dmg_co_preadv() return EIO.
> 
> See:
> 
> [-----------The expanded file------------]
> [---bzip table ---]/* zeros */[---zlib---]
>                     ^
>                     | if we want to read this sector.
> 
> Oops, we cannot find the table contains it...
> 
> In the original implementation, we don't have zero table. When we try to
> read sector inside the zero chunk. We will get EIO, and skip reading.
> 
> After this patch, we treat zero chunk the same as ignore chunk, it will
> directly write zero and avoid some sector may not find the table.
> 
> After this patch:
> 
> [-----------The expanded file------------]
> [---bzip table ---][--zeros--][---zlib---]
> 
> Signed-off-by: yuchenlin <npes87184@gmail.com>
> ---
>  block/dmg.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  parent reply	other threads:[~2019-01-02 12:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-23  2:59 [Qemu-devel] [PATCH v2 0/3] dmg: fixing reading in dmg yuchenlin
2018-12-23  2:59 ` [Qemu-devel] [PATCH v2 1/3] dmg: fix binary search yuchenlin
2018-12-24 15:27   ` Julio Faracco
2019-01-02 11:49   ` Stefan Hajnoczi
2019-01-02 12:20     ` 林育辰
2019-01-03 10:09       ` Stefan Hajnoczi
2019-01-03 11:40         ` Yu-Chen Lin
2018-12-23  2:59 ` [Qemu-devel] [PATCH v2 2/3] dmg: use enumeration type instead of hard coding number yuchenlin
2018-12-24 15:28   ` Julio Faracco
2019-01-02 11:49   ` Stefan Hajnoczi
2018-12-23  2:59 ` [Qemu-devel] [PATCH v2 3/3] dmg: don't skip zero chunk yuchenlin
2018-12-24 15:28   ` Julio Faracco
2019-01-02 12:40   ` Stefan Hajnoczi [this message]
2018-12-24 15:26 ` [Qemu-devel] [Qemu-block] [PATCH v2 0/3] dmg: fixing reading in dmg Julio Faracco

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=20190102124026.GL24009@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=npes87184@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.