qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, jsnow@redhat.com,
	qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 03/20] file-posix: Switch to .bdrv_co_block_status()
Date: Fri, 22 Sep 2017 13:54:59 +0800	[thread overview]
Message-ID: <20170922055459.GG1397@lemon.lan> (raw)
In-Reply-To: <0c239541-da93-33d0-1c0e-88e29de89e2c@redhat.com>

On Wed, 09/20 08:47, Eric Blake wrote:
> On 09/20/2017 04:57 AM, Fam Zheng wrote:
> > On Thu, 09/14 09:40, Eric Blake wrote:
> >> We are gradually moving away from sector-based interfaces, towards
> >> byte-based.  Update the file protocol driver accordingly.  In mapping
> >> mode, note that the entire file is reported as allocated, so we can
> >> take a shortcut and skip lseek().
> >>
> >> Signed-off-by: Eric Blake <eblake@redhat.com>
> >>
> 
> >>
> >> -    ret = find_allocation(bs, start, &data, &hole);
> >> +    if (!mapping) {
> >> +        *pnum = bytes;
> >> +        *file = bs;
> >> +        return BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID |
> >> +            (offset & BDRV_BLOCK_OFFSET_MASK);
> >> +    }
> > 
> > I may be missing something, because the last time I tried to understand the
> > rationale behind "mapping" was already some time ago: shouldn't we still
> > distinguish hole and data? What will omitting BDRV_BLOCK_ZERO help?
> 
> Hmm, the commit message is slightly off (in part, because I switched the
> sense of the bool flag between series revisions, but did not properly
> update the commit text to match).  In mapping mode, we want to return as
> much information as possible (the client is something like 'qemu-img
> map'), including where the holes lie.  But when we are NOT in mapping
> mode, we care more about learning which portions of the file are
> described in the current layer of the backing chain, rather than
> delegating to another layer, regardless of whether the read will see
> data or zeroes.  By the time we are at the POSIX file protocol layer, we
> know that every byte in the file system/block device has a 1:1 mapping
> to the bytes that the guest will read (we do not delegate to any backing
> file), so we can simply report the entire remainder of the file as
> allocated without worrying about holes.

Thanks, it would be good if this explanation can be added to the comment of
"mapping" parameter, so it's easy to understand the actual intention in the
future.

> 
> Here's where the mapping flag was added and semantics documented (in
> series 3; whereas the current email is series 4):
> https://lists.gnu.org/archive/html/qemu-devel/2017-09/msg03542.html
> 
> So what I really need to do is fix the commit message to read:
> 
> In mapping mode, we must report as much information as possible about
> where holes can be found; but when we don't care about mapping, the user
> is more interested in how much of the guest view will come from the
> current layer rather than delegating to some other BDS, and we can take
> the shortcut that all of the remainder of the file fits that
> description, and therefore take a shortcut and skip lseek() for a larger
> *pnum result.
> 
> (the same comment probably applies to several other patches in the series)
> 

Fam

  reply	other threads:[~2017-09-22  5:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14 14:40 [Qemu-devel] [PATCH v3 00/20] add byte-based block_status driver callbacks Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 01/20] block: Add .bdrv_co_block_status() callback Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 02/20] block: Switch passthrough drivers to .bdrv_co_block_status() Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 03/20] file-posix: Switch " Eric Blake
2017-09-20  9:57   ` Fam Zheng
2017-09-20 13:47     ` Eric Blake
2017-09-22  5:54       ` Fam Zheng [this message]
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 04/20] gluster: " Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 05/20] iscsi: Switch cluster_sectors to byte-based Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 06/20] iscsi: Switch iscsi_allocmap_update() " Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 07/20] iscsi: Switch to .bdrv_co_block_status() Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 08/20] null: " Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 09/20] parallels: " Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 10/20] qcow: " Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 11/20] qcow2: " Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 12/20] qed: " Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 13/20] raw: " Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 14/20] sheepdog: " Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 15/20] vdi: Avoid bitrot of debugging code Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 16/20] vdi: Switch to .bdrv_co_block_status() Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 17/20] vmdk: " Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 18/20] vpc: " Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 19/20] vvfat: " Eric Blake
2017-09-14 14:40 ` [Qemu-devel] [PATCH v3 20/20] block: Drop unused .bdrv_co_get_block_status() Eric Blake

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=20170922055459.GG1397@lemon.lan \
    --to=famz@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@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).