qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 64ebf5: qemu-io: Don't die on second open


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 64ebf5: qemu-io: Don't die on second open
Date: Mon, 10 Jul 2017 06:54:41 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 64ebf556486af39024cc9e7a8c88303a7b37c465
      
https://github.com/qemu/qemu/commit/64ebf556486af39024cc9e7a8c88303a7b37c465
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M qemu-io.c
    M tests/qemu-iotests/060.out
    M tests/qemu-iotests/114.out
    M tests/qemu-iotests/153.out

  Log Message:
  -----------
  qemu-io: Don't die on second open

Most callback commands in qemu-io return 0 to keep the interpreter
loop running, or 1 to quit immediately.  However, open_f() just
passed through the return value of openfile(), which has different
semantics of returning 0 if a file was opened, or 1 on any failure.

As a result of mixing the return semantics, we are forcing the
qemu-io interpreter to exit early on any failures, which is rather
annoying when some of the failures are obviously trying to give
the user a hint of how to proceed (if we didn't then kill qemu-io
out from under the user's feet):

$ qemu-io
qemu-io> open foo
qemu-io> open foo
file open already, try 'help close'
$ echo $?
0

In general, we WANT openfile() to report failures, since it is the
function used in the form 'qemu-io -c "$something" no_such_file'
for performing one or more -c options on a single file, and it is
not worth attempting $something if the file itself cannot be opened.
So the solution is to fix open_f() to always return 0 (when we are
in interactive mode, even failure to open should not end the
session), and save the return value of openfile() for command line
use in main().

Note, however, that we do have some qemu-iotests that do 'qemu-io
-c "open file" -c "$something"'; such tests will now proceed to
attempt $something whether or not the open succeeded, the same way
as if the two commands had been attempted in interactive mode.  As
such, the expected output for those tests has to be modified.  But it
also means that it is now possible to use -c close and have a single
qemu-io command line operate on more than one file even without
using interactive mode.  Although the '-c open' action is a subtle
change in behavior, remember that qemu-io is for debugging purposes,
so as long as it serves the needs of qemu-iotests while still being
reasonable for interactive use, it should not be a problem that we
are changing tests to the new behavior.

This has been awkward since at least as far back as commit
e3aff4f, in 2009.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 81c219ac6ce0d6182e35f3976f2caa4cefcaf9f0
      
https://github.com/qemu/qemu/commit/81c219ac6ce0d6182e35f3976f2caa4cefcaf9f0
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/io.c
    M tests/qemu-iotests/177
    M tests/qemu-iotests/177.out

  Log Message:
  -----------
  block: Guarantee that *file is set on bdrv_get_block_status()

We document that *file is valid if the return is not an error and
includes BDRV_BLOCK_OFFSET_VALID, but forgot to obey this contract
when a driver (such as blkdebug) lacks a callback.  Messed up in
commit 67a0fd2 (v2.6), when we added the file parameter.

Enhance qemu-iotest 177 to cover this, using a sequence that would
print garbage or even SEGV, because it was dererefencing through
uninitialized memory.  [The resulting test output shows that we
have less-than-ideal block status from the blkdebug driver, but
that's a separate fix coming up soon.]

Setting *file on all paths that return BDRV_BLOCK_OFFSET_VALID is
enough to fix the crash, but we can go one step further: always
setting *file, even on error, means that a broken caller that
blindly dereferences file without checking for error is now more
likely to get a reliable SEGV instead of randomly acting on garbage,
making it easier to diagnose such buggy callers.  Adding an
assertion that file is set where expected doesn't hurt either.

CC: address@hidden
Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: d5254033daf524fb2eee862eb8377b9ddc81000a
      
https://github.com/qemu/qemu/commit/d5254033daf524fb2eee862eb8377b9ddc81000a
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/commit.c
    M block/mirror.c
    M block/raw-format.c
    M block/vpc.c
    M include/block/block.h

  Log Message:
  -----------
  block: Simplify use of BDRV_BLOCK_RAW

The lone caller that cares about a return of BDRV_BLOCK_RAW
(namely, io.c:bdrv_co_get_block_status) completely replaces the
return value, so there is no point in passing BDRV_BLOCK_DATA.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 544daf6679cef4c0fac8b4a07deef305021a22c1
      
https://github.com/qemu/qemu/commit/544daf6679cef4c0fac8b4a07deef305021a22c1
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/blkdebug.c
    M tests/qemu-iotests/177.out

  Log Message:
  -----------
  blkdebug: Support .bdrv_co_get_block_status

Without a passthrough status of BDRV_BLOCK_RAW, anything wrapped by
blkdebug appears 100% allocated as data.  Better is treating it the
same as the underlying file being wrapped.

Update iotest 177 for the new expected output.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 139921aaa77c435104308ad53b631a00c3b65ae8
      
https://github.com/qemu/qemu/commit/139921aaa77c435104308ad53b631a00c3b65ae8
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  vvfat: fix qemu-img map and qemu-img convert

- bs->total_sectors is the number of sectors of the whole disk
- s->sector_count is the number of sectors of the FAT partition

This fixes the following assert in qemu-img map:
qemu-img.c:2641: get_block_status: Assertion `nb_sectors' failed.

This also fixes an infinite loop in qemu-img convert.

Fixes: 4480e0f924a42e1db8b8cfcac4d0634dd1bb27a0
Fixes: https://bugs.launchpad.net/qemu/+bug/1599539
Cc: address@hidden
Signed-off-by: Hervé Poussineau <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: d6a7e54ed3c53ab05e364fdf863becebb90a7111
      
https://github.com/qemu/qemu/commit/d6a7e54ed3c53ab05e364fdf863becebb90a7111
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  vvfat: replace tabs by 8 spaces

This was a complete mess. On 2299 indented lines:
- 1329 were with spaces only
- 617 with tabulations only
- 353 with spaces and tabulations

Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 5f5b29dfce9676d9d013376800c65af773d8bd9c
      
https://github.com/qemu/qemu/commit/5f5b29dfce9676d9d013376800c65af773d8bd9c
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  vvfat: fix typos

Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: ad05b31857b8f21c5ea89ba3e470a58c288f1c36
      
https://github.com/qemu/qemu/commit/ad05b31857b8f21c5ea89ba3e470a58c288f1c36
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  vvfat: rename useless enumeration values

MODE_FAKED and MODE_RENAMED are not and were never used.

Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 4dc705dc7e96704df6ae3ba22fc3a3f0d0db7608
      
https://github.com/qemu/qemu/commit/4dc705dc7e96704df6ae3ba22fc3a3f0d0db7608
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  vvfat: introduce offset_to_bootsector, offset_to_fat and offset_to_root_dir

- offset_to_bootsector is the number of sectors up to FAT bootsector
- offset_to_fat is the number of sectors up to first File Allocation Table
- offset_to_root_dir is the number of sectors up to root directory sector

Replace first_sectors_number - 1 by offset_to_bootsector.
Replace first_sectors_number by offset_to_fat.
Replace faked_sectors by offset_to_rootdir.

Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 92e28d82209b0ff49db801e9a56a400cc1f44967
      
https://github.com/qemu/qemu/commit/92e28d82209b0ff49db801e9a56a400cc1f44967
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  vvfat: fix field names in FAT12/FAT16 and FAT32 boot sectors

Specification: "FAT: General overview of on-disk format" v1.03, pages 11-13
Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: f82d92bb028a1d674bab4ccc7e6cde6c04956230
      
https://github.com/qemu/qemu/commit/f82d92bb028a1d674bab4ccc7e6cde6c04956230
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  vvfat: always create . and .. entries at first and in that order

readdir() doesn't always return . and .. entries at first and in that order.
This leads to not creating them at first in the directory, which raises some
errors on file system checking utilities like MS-DOS Scandisk.

Specification: "FAT: General overview of on-disk format" v1.03, page 25

Fixes: https://bugs.launchpad.net/qemu/+bug/1599539
Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 09ec4119fb5a48f6783c23e275e698d977a11ca9
      
https://github.com/qemu/qemu/commit/09ec4119fb5a48f6783c23e275e698d977a11ca9
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  vvfat: correctly create long names for non-ASCII filenames

Assume that input filename is encoded as UTF-8, so correctly create UTF-16 
encoding.

Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 0c36111f57ec2188f679e7fa810291b7386bdca1
      
https://github.com/qemu/qemu/commit/0c36111f57ec2188f679e7fa810291b7386bdca1
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  vvfat: correctly create base short names for non-ASCII filenames

More specifically, create short name from filename and change blacklist of
invalid chars to whitelist of valid chars.

Windows 9x also now correctly see long file names of filenames containing a 
space,
but Scandisk still complains about mismatch between SFN and LFN.

[kwolf: Build fix for this intermediate patch (it included declarations
 for variables that are only used in the next patch) ]

Specification: "FAT: General overview of on-disk format" v1.03, pages 30-31
Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 339cebcc019da9f0e9aa53ca0dac852853abc7f6
      
https://github.com/qemu/qemu/commit/339cebcc019da9f0e9aa53ca0dac852853abc7f6
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  vvfat: correctly generate numeric-tail of short file names

More specifically:
- try without numeric-tail only if LFN didn't have invalid short chars
- start at ~1 (instead of ~0)
- handle case if numeric tail is more than one char (ie > 10)

Windows 9x Scandisk doesn't see anymore mismatches between short file names and
long file names for non-ASCII filenames.

Specification: "FAT: General overview of on-disk format" v1.03, page 31
Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 6817efea3a0d1bf87be815970cdb014c5a64b628
      
https://github.com/qemu/qemu/commit/6817efea3a0d1bf87be815970cdb014c5a64b628
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  vvfat: limit number of entries in root directory in FAT12/FAT16

FAT12/FAT16 root directory is two sectors in size, which allows only 512 
directory entries.
Prevent QEMU startup if too much files exist, instead of overflowing root 
directory.

Also introduce variable root_entries, which will be required for FAT32.

Fixes: https://bugs.launchpad.net/qemu/+bug/1599539/comments/4
Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 78f002c901a89bebbf7337c1797e3d9e8249309c
      
https://github.com/qemu/qemu/commit/78f002c901a89bebbf7337c1797e3d9e8249309c
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  vvfat: handle KANJI lead byte 0xe5

Specification: "FAT: General overview of on-disk format" v1.03, page 23
Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 8b544293ef855b41ea91d7bc361d5340e7fda902
      
https://github.com/qemu/qemu/commit/8b544293ef855b41ea91d7bc361d5340e7fda902
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  vvfat: change OEM name to 'MSWIN4.1'

According to specification:
"'MSWIN4.1' is the recommanded setting, because it is the setting least likely
to cause compatibility problems. If you want to put something else in here,
that is your option, but the result may be that some FAT drivers might not
recognize the volume."

Specification: "FAT: General overview of on-disk format" v1.03, page 9
Signed-off-by: Hervé Poussineau <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 6b4df5483333fc6ad950aadba8194f04ff450197
      
https://github.com/qemu/qemu/commit/6b4df5483333fc6ad950aadba8194f04ff450197
  Author: Daniel P. Berrange <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: drop -e and -6 options from the 'create' & 'convert' commands

The '-e' and '-6' options to the 'create' & 'convert' commands were
"deprecated" in favour of the more generic '-o' option many years ago:

  commit eec77d9e712bd4157a4e1c0b5a9249d168add738
  Author: Jes Sorensen <address@hidden>
  Date:   Tue Dec 7 17:44:34 2010 +0100

    qemu-img: Deprecate obsolete -6 and -e options

Except this was never actually a deprecation, which would imply giving
the user a warning while the functionality continues to work for a
number of releases before eventual removal. Instead the options were
immediately turned into an error + exit. Given that the functionality
is already broken, there's no point in keeping these psuedo-deprecation
messages around any longer.

Signed-off-by: Daniel P. Berrange <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: c616f16e0c9a2d0b2f13785d37ca0f18d54d571f
      
https://github.com/qemu/qemu/commit/c616f16e0c9a2d0b2f13785d37ca0f18d54d571f
  Author: Thomas Huth <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M blockdev.c
    M qemu-options.hx

  Log Message:
  -----------
  blockdev: Print a warning for legacy drive options that belong to -device

We likely do not want to carry these legacy -drive options along forever.
Let's emit a deprecation warning for the -drive options that have a
replacement with the -device option, so that the (hopefully few) remaining
users are aware of this and can adapt their scripts / behaviour accordingly.

Signed-off-by: Thomas Huth <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: f3e4ce4af336f2ea306fa0f40ec1a5149864ca8c
      
https://github.com/qemu/qemu/commit/f3e4ce4af336f2ea306fa0f40ec1a5149864ca8c
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/backup.c
    M block/commit.c
    M block/mirror.c
    M block/stream.c
    M include/qemu/ratelimit.h

  Log Message:
  -----------
  blockjob: Track job ratelimits via bytes, not sectors

The user interface specifies job rate limits in bytes/second.
It's pointless to have our internal representation track things
in sectors/second, particularly since we want to move away from
sector-based interfaces.

Fix up a doc typo found while verifying that the ratelimit
code handles the scaling difference.

Repetition of expressions like 'n * BDRV_SECTOR_SIZE' will be
cleaned up later when functions are converted to iterate over
images by bytes rather than by sectors.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 5cb1a49e01db12a38790c982aafde94977f7b0ee
      
https://github.com/qemu/qemu/commit/5cb1a49e01db12a38790c982aafde94977f7b0ee
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/backup.c
    M block/commit.c
    M block/mirror.c
    M block/stream.c
    M block/trace-events

  Log Message:
  -----------
  trace: Show blockjob actions via bytes, not sectors

Upcoming patches are going to switch to byte-based interfaces
instead of sector-based.  Even worse, trace_backup_do_cow_enter()
had a weird mix of cluster and sector indices.

The trace interface is low enough that there are no stability
guarantees, and therefore nothing wrong with changing our units,
even in cases like trace_backup_do_cow_skip() where we are not
changing the trace output.  So make the tracing uniformly use
bytes.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 8493211c02bbc74d1ae051422f90bbfd20debb5e
      
https://github.com/qemu/qemu/commit/8493211c02bbc74d1ae051422f90bbfd20debb5e
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/stream.c

  Log Message:
  -----------
  stream: Switch stream_populate() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Start by converting an
internal function (no semantic change).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 158c6492571c82c5632070c7ccee36b3dffd3ca9
      
https://github.com/qemu/qemu/commit/158c6492571c82c5632070c7ccee36b3dffd3ca9
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/stream.c

  Log Message:
  -----------
  stream: Drop reached_end for stream_complete()

stream_complete() skips the work of rewriting the backing file if
the job was cancelled, if data->reached_end is false, or if there
was an error detected (non-zero data->ret) during the streaming.
But note that in stream_run(), data->reached_end is only set if the
loop ran to completion, and data->ret is only 0 in two cases:
either the loop ran to completion (possibly by cancellation, but
stream_complete checks for that), or we took an early goto out
because there is no bs->backing.  Thus, we can preserve the same
semantics without the use of reached_end, by merely checking for
bs->backing (and logically, if there was no backing file, streaming
is a no-op, so there is no backing file to rewrite).

Suggested-by: Kevin Wolf <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: d535435f4a3968a897803d38bf1642f3b644979a
      
https://github.com/qemu/qemu/commit/d535435f4a3968a897803d38bf1642f3b644979a
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/stream.c

  Log Message:
  -----------
  stream: Switch stream_run() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Change the internal
loop iteration of streaming to track by bytes instead of sectors
(although we are still guaranteed that we iterate by steps that
are sector-aligned).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: d8a9858408bcc57a3f4934c5082dd4dddebae583
      
https://github.com/qemu/qemu/commit/d8a9858408bcc57a3f4934c5082dd4dddebae583
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/commit.c

  Log Message:
  -----------
  commit: Switch commit_populate() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Start by converting an
internal function (no semantic change).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 317a6676a279bf71c881992387f75e16e009259c
      
https://github.com/qemu/qemu/commit/317a6676a279bf71c881992387f75e16e009259c
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/commit.c

  Log Message:
  -----------
  commit: Switch commit_run() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Change the internal
loop iteration of committing to track by bytes instead of sectors
(although we are still guaranteed that we iterate by steps that
are sector-aligned).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: b436982f04fb33bb29fcdea190bd1fdc97dc65ef
      
https://github.com/qemu/qemu/commit/b436982f04fb33bb29fcdea190bd1fdc97dc65ef
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/mirror.c

  Log Message:
  -----------
  mirror: Switch MirrorBlockJob to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Continue by converting an
internal structure (no semantic change), and all references to the
buffer size.

Add an assertion that our use of s->granularity >> BDRV_SECTOR_BITS
(necessary for interaction with sector-based dirty bitmaps, until
a later patch converts those to be byte-based) does not suffer from
truncation problems.

[checkpatch has a false positive on use of MIN() in this patch]

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: e6f2419389a841260e0323ae72751ab489ec6dcc
      
https://github.com/qemu/qemu/commit/e6f2419389a841260e0323ae72751ab489ec6dcc
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/mirror.c

  Log Message:
  -----------
  mirror: Switch mirror_do_zero_or_discard() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Convert another internal
function (no semantic change).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 931e52607fbecb40543b298d7ee8740d0e4af3ef
      
https://github.com/qemu/qemu/commit/931e52607fbecb40543b298d7ee8740d0e4af3ef
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/mirror.c

  Log Message:
  -----------
  mirror: Update signature of mirror_clip_sectors()

Rather than having a void function that modifies its input
in-place as the output, change the signature to reduce a layer
of indirection and return the result.

Suggested-by: John Snow <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 782d97efec66d743f87f28f1d040cdfacc380b1e
      
https://github.com/qemu/qemu/commit/782d97efec66d743f87f28f1d040cdfacc380b1e
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/mirror.c

  Log Message:
  -----------
  mirror: Switch mirror_cow_align() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Convert another internal
function (no semantic change), and add mirror_clip_bytes() as a
counterpart to mirror_clip_sectors().  Some of the conversion is
a bit tricky, requiring temporaries to convert between units; it
will be cleared up in a following patch.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: ae4cc8777b456ab87ca1f02b98b006ec0c96335e
      
https://github.com/qemu/qemu/commit/ae4cc8777b456ab87ca1f02b98b006ec0c96335e
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/mirror.c

  Log Message:
  -----------
  mirror: Switch mirror_do_read() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Convert another internal
function, preserving all existing semantics, and adding one more
assertion that things are still sector-aligned (so that conversions
to sectors in mirror_read_complete don't need to round).

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: fb2ef7919bd7b125a2ff6cb70689a7ab93b9d05a
      
https://github.com/qemu/qemu/commit/fb2ef7919bd7b125a2ff6cb70689a7ab93b9d05a
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/mirror.c

  Log Message:
  -----------
  mirror: Switch mirror_iteration() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Change the internal
loop iteration of mirroring to track by bytes instead of sectors
(although we are still guaranteed that we iterate by steps that
are both sector-aligned and multiples of the granularity).  Drop
the now-unused mirror_clip_sectors().

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: e8a81e9cadd0ec0e2cf3f564ae73809b0d8780da
      
https://github.com/qemu/qemu/commit/e8a81e9cadd0ec0e2cf3f564ae73809b0d8780da
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/io.c
    M include/block/block.h

  Log Message:
  -----------
  block: Drop unused bdrv_round_sectors_to_clusters()

Now that the last user [mirror_iteration()] has converted to using
bytes, we no longer need a function to round sectors to clusters.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: cf79cdf662aad365b53fc955f45fd47d9883c8df
      
https://github.com/qemu/qemu/commit/cf79cdf662aad365b53fc955f45fd47d9883c8df
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/backup.c

  Log Message:
  -----------
  backup: Switch BackupBlockJob to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Continue by converting an
internal structure (no semantic change), and all references to
tracking progress.  Drop a redundant local variable bytes_per_cluster.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: f6ac207893a661a6c32819c43a2ab2789b40d12f
      
https://github.com/qemu/qemu/commit/f6ac207893a661a6c32819c43a2ab2789b40d12f
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/backup.c
    M block/replication.c
    M include/block/block_backup.h

  Log Message:
  -----------
  backup: Switch block_backup.h to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Continue by converting
the public interface to backup jobs (no semantic change), including
a change to CowRequest to track by bytes instead of cluster indices.

Note that this does not change the difference between the public
interface (starting point, and size of the subsequent range) and
the internal interface (starting and end points).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Xie Changlong <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 03f5d60bbf264ea68e50db2a7b2383a8da5122d2
      
https://github.com/qemu/qemu/commit/03f5d60bbf264ea68e50db2a7b2383a8da5122d2
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/backup.c

  Log Message:
  -----------
  backup: Switch backup_do_cow() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Convert another internal
function (no semantic change).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 6f8e35e2414433a56b4bd548b87b8ac2aedecb77
      
https://github.com/qemu/qemu/commit/6f8e35e2414433a56b4bd548b87b8ac2aedecb77
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/backup.c

  Log Message:
  -----------
  backup: Switch backup_run() to byte-based

We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based.  Change the internal
loop iteration of backups to track by bytes instead of sectors
(although we are still guaranteed that we iterate by steps that
are cluster-aligned).

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: d6a644bbfef81bb6c7ab11656ad71e326f75ac77
      
https://github.com/qemu/qemu/commit/d6a644bbfef81bb6c7ab11656ad71e326f75ac77
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/backup.c
    M block/commit.c
    M block/io.c
    M block/stream.c
    M block/vvfat.c
    M include/block/block.h
    M migration/block.c
    M qemu-img.c
    M qemu-io-cmds.c

  Log Message:
  -----------
  block: Make bdrv_is_allocated() byte-based

We are gradually moving away from sector-based interfaces, towards
byte-based.  In the common case, allocation is unlikely to ever use
values that are not naturally sector-aligned, but it is possible
that byte-based values will let us be more precise about allocation
at the end of an unaligned file that can do byte-based access.

Changing the signature of the function to use int64_t *pnum ensures
that the compiler enforces that all callers are updated.  For now,
the io.c layer still assert()s that all callers are sector-aligned
on input and that *pnum is sector-aligned on return to the caller,
but that can be relaxed when a later patch implements byte-based
block status.  Therefore, this code adds usages like
DIV_ROUND_UP(,BDRV_SECTOR_SIZE) to callers that still want aligned
values, where the call might reasonbly give non-aligned results
in the future; on the other hand, no rounding is needed for callers
that should just continue to work with byte alignment.

For the most part this patch is just the addition of scaling at the
callers followed by inverse scaling at bdrv_is_allocated().  But
some code, particularly bdrv_commit(), gets a lot simpler because it
no longer has to mess with sectors; also, it is now possible to pass
NULL if the caller does not care how much of the image is allocated
beyond the initial offset.  Leave comments where we can further
simplify once a later patch eliminates the need for sector-aligned
requests through bdrv_is_allocated().

For ease of review, bdrv_is_allocated_above() will be tackled
separately.

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: c00716beb30ba996bd6fdfd5f41bb07e4414144f
      
https://github.com/qemu/qemu/commit/c00716beb30ba996bd6fdfd5f41bb07e4414144f
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/io.c

  Log Message:
  -----------
  block: Minimize raw use of bds->total_sectors

bdrv_is_allocated_above() was relying on intermediate->total_sectors,
which is a field that can have stale contents depending on the value
of intermediate->has_variable_length.  An audit shows that we are safe
(we were first calling through bdrv_co_get_block_status() which in
turn calls bdrv_nb_sectors() and therefore just refreshed the current
length), but it's nicer to favor our accessor functions to avoid having
to repeat such an audit, even if it means refresh_total_sectors() is
called more frequently.

Suggested-by: John Snow <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Manos Pitsidianakis <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 51b0a488882328f8f02519bb47ca7e0e7fbe12ff
      
https://github.com/qemu/qemu/commit/51b0a488882328f8f02519bb47ca7e0e7fbe12ff
  Author: Eric Blake <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/commit.c
    M block/io.c
    M block/mirror.c
    M block/replication.c
    M block/stream.c
    M include/block/block.h
    M qemu-img.c

  Log Message:
  -----------
  block: Make bdrv_is_allocated_above() byte-based

We are gradually moving away from sector-based interfaces, towards
byte-based.  In the common case, allocation is unlikely to ever use
values that are not naturally sector-aligned, but it is possible
that byte-based values will let us be more precise about allocation
at the end of an unaligned file that can do byte-based access.

Changing the signature of the function to use int64_t *pnum ensures
that the compiler enforces that all callers are updated.  For now,
the io.c layer still assert()s that all callers are sector-aligned,
but that can be relaxed when a later patch implements byte-based
block status.  Therefore, for the most part this patch is just the
addition of scaling at the callers followed by inverse scaling at
bdrv_is_allocated().  But some code, particularly stream_run(),
gets a lot simpler because it no longer has to mess with sectors.
Leave comments where we can further simplify by switching to
byte-based iterations, once later patches eliminate the need for
sector-aligned operations.

For ease of review, bdrv_is_allocated() was tackled separately.

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 94c56652b9079cfb9d560a6dde7ecb15eb9ef9c7
      
https://github.com/qemu/qemu/commit/94c56652b9079cfb9d560a6dde7ecb15eb9ef9c7
  Author: Peter Maydell <address@hidden>
  Date:   2017-07-10 (Mon, 10 Jul 2017)

  Changed paths:
    M block/backup.c
    M block/blkdebug.c
    M block/commit.c
    M block/io.c
    M block/mirror.c
    M block/raw-format.c
    M block/replication.c
    M block/stream.c
    M block/trace-events
    M block/vpc.c
    M block/vvfat.c
    M blockdev.c
    M include/block/block.h
    M include/block/block_backup.h
    M include/qemu/ratelimit.h
    M migration/block.c
    M qemu-img.c
    M qemu-io-cmds.c
    M qemu-io.c
    M qemu-options.hx
    M tests/qemu-iotests/060.out
    M tests/qemu-iotests/114.out
    M tests/qemu-iotests/153.out
    M tests/qemu-iotests/177
    M tests/qemu-iotests/177.out

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Mon 10 Jul 2017 12:26:44 BST
# gpg:                using RSA key 0x7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <address@hidden>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream: (40 commits)
  block: Make bdrv_is_allocated_above() byte-based
  block: Minimize raw use of bds->total_sectors
  block: Make bdrv_is_allocated() byte-based
  backup: Switch backup_run() to byte-based
  backup: Switch backup_do_cow() to byte-based
  backup: Switch block_backup.h to byte-based
  backup: Switch BackupBlockJob to byte-based
  block: Drop unused bdrv_round_sectors_to_clusters()
  mirror: Switch mirror_iteration() to byte-based
  mirror: Switch mirror_do_read() to byte-based
  mirror: Switch mirror_cow_align() to byte-based
  mirror: Update signature of mirror_clip_sectors()
  mirror: Switch mirror_do_zero_or_discard() to byte-based
  mirror: Switch MirrorBlockJob to byte-based
  commit: Switch commit_run() to byte-based
  commit: Switch commit_populate() to byte-based
  stream: Switch stream_run() to byte-based
  stream: Drop reached_end for stream_complete()
  stream: Switch stream_populate() to byte-based
  trace: Show blockjob actions via bytes, not sectors
  ...

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/6580476a14ae...94c56652b907

reply via email to

[Prev in Thread] Current Thread [Next in Thread]